:root {
  color-scheme: light;
  --bg-0: #e8eef2;
  --bg-1: #f3f7f9;
  --ink: #10161c;
  --ink-soft: #3a4652;
  --muted: #6b7885;
  --line: rgba(16, 22, 28, 0.1);
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --button: var(--ink);
  --button-text: #ffffff;
  --status-online: #15803d;
  --status-offline: #b91c1c;
  --shadow: 0 18px 50px rgba(16, 22, 28, 0.08);
  --radius: 22px;
  --font-brand: "Space Grotesk", sans-serif;
  --font-body: "Manrope", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-0);
  color: var(--ink);
  font-family: var(--font-body);
  position: relative;
  overflow-x: hidden;
}

.page-atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 55% at 12% -10%, rgba(45, 212, 191, 0.28), transparent 55%),
    radial-gradient(ellipse 70% 50% at 92% 8%, rgba(56, 189, 248, 0.18), transparent 50%),
    radial-gradient(ellipse 60% 45% at 50% 100%, rgba(15, 118, 110, 0.1), transparent 55%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 45%, #dfe8ee 100%);
}

.page-atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(16, 22, 28, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 22, 28, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 75%);
}

main {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 88px;
}

.hero {
  margin-bottom: 28px;
  animation: rise-in 0.7s var(--ease) both;
}

.hero-compact {
  margin-bottom: 32px;
}

.brand {
  margin: 0;
  font-family: var(--font-brand);
  font-size: clamp(48px, 10vw, 88px);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.04em;
  color: var(--ink);
}

.brand-sm {
  font-size: clamp(36px, 8vw, 56px);
}

.lead {
  max-width: 28rem;
  margin: 16px 0 0;
  color: var(--ink-soft);
  font-size: clamp(16px, 2.4vw, 19px);
  line-height: 1.45;
  font-weight: 500;
}

.search-panel {
  position: sticky;
  top: 12px;
  z-index: 20;
  margin-bottom: 28px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  animation: rise-in 0.7s var(--ease) 0.08s both;
}

.search-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid transparent;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.search-field:focus-within {
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.search-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 2px solid var(--muted);
  border-radius: 50%;
  position: relative;
  opacity: 0.7;
}

.search-icon::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 2px;
  background: var(--muted);
  border-radius: 2px;
  right: -5px;
  bottom: -2px;
  transform: rotate(45deg);
}

.search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
}

.search-input::placeholder {
  color: var(--muted);
}

.search-clear {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: rgba(16, 22, 28, 0.06);
  color: var(--ink-soft);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}

.search-clear:hover {
  background: rgba(16, 22, 28, 0.1);
}

.search-meta {
  margin: 10px 4px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.status-line {
  margin: 0 4px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 650;
}

.quick-actions,
.section-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.chip:hover {
  border-color: rgba(15, 118, 110, 0.35);
  background: #fff;
}

.chip.is-active,
.chip-primary {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.chip-action {
  background: rgba(15, 118, 110, 0.08);
  border-color: rgba(15, 118, 110, 0.18);
  color: var(--accent-strong);
}

.chip-action.chip-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.catalog-section + .catalog-section {
  margin-top: 36px;
}

.section-title {
  margin: 0 0 14px;
  font-family: var(--font-brand);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  min-height: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
  transition: transform 0.28s var(--ease), border-color 0.28s var(--ease), box-shadow 0.28s var(--ease);
  animation: rise-in 0.55s var(--ease) both;
}

.card-hit {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.card .actions,
.card .actions a {
  position: relative;
  z-index: 2;
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 118, 110, 0.28);
  box-shadow: var(--shadow);
}

.card-header {
  display: contents;
}

.icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(145deg, #f7fbfc, #e4eef2);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  overflow: hidden;
  color: var(--ink);
}

.icon .icon-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-body {
  min-width: 0;
}

.card h2 {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.card h2 a {
  color: inherit;
  text-decoration: none;
}

.card h2 a:hover {
  color: var(--accent-strong);
}

.username {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.description {
  margin: 8px 0 0;
  color: var(--ink-soft);
  line-height: 1.45;
  font-size: 15px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  align-self: stretch;
  justify-content: space-between;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.7);
  font-family: inherit;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.button:hover {
  border-color: rgba(16, 22, 28, 0.22);
  background: #fff;
}

.button.primary {
  border-color: var(--button);
  background: var(--button);
  color: var(--button-text);
}

.button.primary:hover {
  background: #1a232c;
}

.button.ghost {
  background: transparent;
  border-color: rgba(16, 22, 28, 0.16);
}

.button.ghost:hover {
  background: rgba(255, 255, 255, 0.55);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.status-badge.online {
  color: var(--status-online);
  background: color-mix(in srgb, var(--status-online) 12%, transparent);
}

.status-badge.offline {
  color: var(--status-offline);
  background: color-mix(in srgb, var(--status-offline) 12%, transparent);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.back-link {
  display: inline-flex;
  align-items: center;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.back-link:hover {
  color: var(--ink);
}

.bot-detail {
  display: block;
  padding: 28px;
  animation: rise-in 0.55s var(--ease) both;
}

.bot-detail .card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.bot-detail .icon {
  margin-bottom: 20px;
}

.bot-detail h1 {
  margin: 0;
  font-family: var(--font-brand);
  font-size: clamp(36px, 8vw, 56px);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.bot-detail .description {
  -webkit-line-clamp: unset;
  display: block;
  font-size: 17px;
  margin-top: 14px;
}

.bot-detail .actions {
  margin-top: 28px;
  justify-content: flex-start;
}

.commands {
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.commands li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.commands li:last-child {
  border-bottom: none;
}

.commands-title {
  margin: 32px 0 8px;
  font-family: var(--font-brand);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.loading,
.error-msg,
.empty-msg {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.empty-msg {
  padding: 28px 8px;
}

footer,
.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 56px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

footer a,
.site-footer a {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}

footer a:hover,
.site-footer a:hover {
  color: var(--ink);
}

.guide-main {
  width: min(720px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 88px;
}

.guide-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.guide-step {
  padding: 22px 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
  animation: rise-in 0.55s var(--ease) both;
}

.guide-step h2 {
  margin: 0 0 10px;
  font-family: var(--font-brand);
  font-size: 22px;
  letter-spacing: -0.03em;
}

.guide-step p {
  margin: 0 0 18px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.guide-step code {
  font-size: 0.92em;
  padding: 0.1em 0.35em;
  border-radius: 6px;
  background: rgba(15, 118, 110, 0.1);
}

.guide-note {
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 760px) {
  main {
    width: min(100% - 24px, 560px);
    padding-top: 28px;
  }

  .hero {
    margin-bottom: 28px;
  }

  .brand {
    font-size: clamp(48px, 14vw, 72px);
  }

  .card {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "icon body"
      "side side";
    gap: 14px;
  }

  .icon {
    grid-area: icon;
  }

  .card-body {
    grid-area: body;
  }

  .card-side {
    grid-area: side;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .actions {
    justify-content: flex-start;
  }

  .search-panel {
    top: 8px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg-0: #0c1116;
    --bg-1: #121820;
    --ink: #f3f6f8;
    --ink-soft: #c2ccd4;
    --muted: #8b97a3;
    --line: rgba(243, 246, 248, 0.1);
    --surface: rgba(22, 28, 36, 0.78);
    --surface-solid: #171e27;
    --accent: #2dd4bf;
    --accent-strong: #5eead4;
    --accent-soft: rgba(45, 212, 191, 0.16);
    --button: #f3f6f8;
    --button-text: #10161c;
    --status-online: #4ade80;
    --status-offline: #f87171;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  }

  .page-atmosphere {
    background:
      radial-gradient(ellipse 80% 55% at 10% -8%, rgba(45, 212, 191, 0.16), transparent 55%),
      radial-gradient(ellipse 70% 50% at 95% 5%, rgba(56, 189, 248, 0.1), transparent 50%),
      linear-gradient(180deg, #10161d 0%, #0c1116 100%);
  }

  .search-field {
    background: rgba(12, 17, 22, 0.55);
  }

  .chip {
    background: rgba(255, 255, 255, 0.04);
  }

  .chip-action {
    background: rgba(45, 212, 191, 0.1);
    border-color: rgba(45, 212, 191, 0.22);
    color: var(--accent-strong);
  }

  .icon {
    background: linear-gradient(145deg, #1d2630, #141b23);
  }

  .button {
    background: rgba(255, 255, 255, 0.04);
  }

  .button:hover {
    background: rgba(255, 255, 255, 0.08);
  }
}

/* Telegram Mini App shell leftovers (non SPA path) */
html.tg-app body {
  padding-top: env(safe-area-inset-top);
}

html.tg-app main {
  width: min(100% - 24px, 560px);
  padding: 20px 0 calc(80px + env(safe-area-inset-bottom));
}

html.tg-app .page-atmosphere,
html.tg-app .hero,
html.tg-app .search-panel {
  display: none;
}

html.tg-app header {
  margin-bottom: 24px;
}

html.tg-app h1 {
  font-size: 28px;
  line-height: 1.1;
}

html.tg-app .lead {
  display: none;
}

html.tg-app .catalog-section + .catalog-section {
  margin-top: 28px;
}

html.tg-app .section-title {
  margin-bottom: 10px;
  font-size: 13px;
}

html.tg-app .bot-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

html.tg-app .bot-row {
  display: block;
  min-height: auto;
  padding: 14px 16px;
  border-radius: 16px;
  text-decoration: none;
  color: inherit;
}

html.tg-app .bot-row-main {
  display: flex;
  align-items: center;
  gap: 14px;
}

html.tg-app .bot-row .icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  font-size: 22px;
}

html.tg-app .bot-row-text {
  flex: 1;
  min-width: 0;
}

html.tg-app .bot-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

html.tg-app .bot-row-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

html.tg-app .bot-row .username {
  margin: 2px 0 0;
  font-size: 14px;
}

html.tg-app .bot-row .description {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

html.tg-app .bot-row-chevron {
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}

html.tg-app footer {
  display: none;
}

html.tg-app .back-link {
  display: none;
}

html.tg-app .bot-detail .actions .button.primary {
  display: none;
}

html.tg-app .bot-detail h1 {
  font-size: 28px;
}

html.tg-app .status-badge {
  padding: 4px 8px;
  font-size: 11px;
}
