/* ============================================================
   kakvam.site — портал. Дизайн-система.
   Шрифты: Rubik (UI/заголовки/текст) + JetBrains Mono (акценты).
   ============================================================ */

:root {
  /* Бренд (переопределяется тви­ком --brand) */
  --brand: #6d4cf2;
  --brand-ink: #ffffff;

  /* Цветовое кодирование категорий */
  --c-tool:    #2f74e0;   /* Инструменты */
  --c-game:    #f0762f;   /* Игры и поделки */
  --c-article: #1f9d57;   /* Статьи */
  --c-ai:      #c23ad6;   /* ИИ */

  /* Светлая тема */
  --bg:        #f3f3f7;
  --bg-grid:   rgba(109,76,242,.05);
  --surface:   #ffffff;
  --surface-2: #f7f7fb;
  --border:    #e7e7ef;
  --border-2:  #d9d9e6;
  --text:      #1b1a22;
  --text-2:    #565466;
  --text-3:    #8d8b9d;
  --shadow-sm: 0 1px 2px rgba(24,22,40,.05), 0 1px 3px rgba(24,22,40,.04);
  --shadow-md: 0 2px 6px rgba(24,22,40,.06), 0 8px 24px rgba(24,22,40,.07);
  --shadow-lg: 0 8px 24px rgba(24,22,40,.10), 0 24px 56px rgba(24,22,40,.12);

  /* Геометрия */
  --r-sm: 10px;
  --r:    14px;
  --r-lg: 22px;
  --maxw: 1180px;
  --gut:  clamp(16px, 4vw, 40px);

  /* Шрифты */
  --font-ui: "Rubik", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  --density: 1;   /* масштаб плотности */
}

[data-theme="dark"] {
  --brand-ink: #ffffff;
  --c-tool:    #5b9bff;
  --c-game:    #ff9a55;
  --c-article: #41c47e;
  --c-ai:      #df6cf0;

  --bg:        #131218;
  --bg-grid:   rgba(140,110,255,.06);
  --surface:   #1c1b24;
  --surface-2: #232230;
  --border:    #2f2d3b;
  --border-2:  #3b3949;
  --text:      #f1f0f7;
  --text-2:    #b1afc2;
  --text-3:    #7b7990;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 2px 8px rgba(0,0,0,.35), 0 12px 30px rgba(0,0,0,.4);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.45), 0 28px 64px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-image:
    radial-gradient(var(--bg-grid) 1px, transparent 1px);
  background-size: 26px 26px;
  background-position: -13px -13px;
  transition: background-color .25s, color .25s;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

::selection { background: color-mix(in oklab, var(--brand) 28%, transparent); }

/* ---------- Тонкая полоса прокрутки ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }

/* ============================================================
   Контейнеры
   ============================================================ */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gut); }
.section { margin-top: clamp(40px, 6vw, 72px); }

/* ============================================================
   Шапка / навигация
   ============================================================ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--bg) 80%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: 12px var(--gut);
  display: flex; align-items: center; gap: 20px;
}

/* Логотип */
.logo { display: flex; align-items: center; gap: 11px; flex-shrink: 0; }
.logo__mark {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--brand), color-mix(in oklab, var(--brand) 55%, #3aa0ff));
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,.25);
}
.logo__mark svg { width: 22px; height: 22px; }
.logo__txt { line-height: 1.1; display: flex; flex-direction: column; }
.logo__name { display: block; font-weight: 700; font-size: 18px; letter-spacing: -.02em; }
.logo__name b { color: var(--brand); }
.logo__sub {
  display: block; font-family: var(--font-mono); font-size: 10.5px;
  color: var(--text-3); letter-spacing: .01em; white-space: nowrap;
}

/* Навигация */
.nav { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.nav a {
  padding: 7px 12px; border-radius: 9px;
  font-size: 14px; font-weight: 500; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 7px;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.is-active { color: var(--brand); background: color-mix(in oklab, var(--brand) 10%, transparent); }
.nav__dot { width: 7px; height: 7px; border-radius: 50%; }

.topbar__spacer { flex: 1; }

/* Поиск в шапке */
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 11px; padding: 7px 12px; min-width: 220px;
  box-shadow: var(--shadow-sm);
  color: var(--text-3);
}
.search input {
  border: 0; background: transparent; outline: none; flex: 1;
  font-family: var(--font-ui); font-size: 14px; color: var(--text);
}
.search kbd {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-3);
  border: 1px solid var(--border-2); border-radius: 5px; padding: 1px 5px;
}

/* Кнопка-иконка */
.iconbtn {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); cursor: pointer;
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm); transition: background .15s, color .15s, transform .1s;
}
.iconbtn:hover { color: var(--text); background: var(--surface-2); }
.iconbtn:active { transform: scale(.94); }
.iconbtn svg { width: 18px; height: 18px; }

/* ============================================================
   Кнопки
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: 11px;
  font-family: var(--font-ui); font-size: 14.5px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; transition: transform .1s, box-shadow .15s, background .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--brand); color: var(--brand-ink);
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, var(--shadow-md);
}
.btn--primary:hover { background: color-mix(in oklab, var(--brand) 88%, #000); }
.btn--ghost { background: var(--surface); color: var(--text); border-color: var(--border-2); box-shadow: var(--shadow-sm); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--lg { padding: 14px 24px; font-size: 16px; border-radius: 13px; }
.btn svg { width: 17px; height: 17px; }

/* ============================================================
   Бейджи / теги / чипы
   ============================================================ */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  letter-spacing: .01em; padding: 3px 9px; border-radius: 7px; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.tag__dot { width: 7px; height: 7px; border-radius: 50%; }
.tag--tool    { color: var(--c-tool);    background: color-mix(in oklab, var(--c-tool) 12%, transparent); border-color: color-mix(in oklab, var(--c-tool) 28%, transparent); }
.tag--game    { color: var(--c-game);    background: color-mix(in oklab, var(--c-game) 14%, transparent); border-color: color-mix(in oklab, var(--c-game) 30%, transparent); }
.tag--article { color: var(--c-article); background: color-mix(in oklab, var(--c-article) 14%, transparent); border-color: color-mix(in oklab, var(--c-article) 30%, transparent); }
.tag--ai      { color: var(--c-ai);      background: color-mix(in oklab, var(--c-ai) 14%, transparent); border-color: color-mix(in oklab, var(--c-ai) 30%, transparent); }
.tag--new     { color: var(--brand);     background: color-mix(in oklab, var(--brand) 12%, transparent); border-color: color-mix(in oklab, var(--brand) 30%, transparent); }

/* Фильтр-чипы */
.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chip {
  font-family: var(--font-ui); font-size: 14px; font-weight: 500;
  padding: 9px 15px; border-radius: 10px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); display: inline-flex; align-items: center; gap: 8px;
  transition: all .15s; box-shadow: var(--shadow-sm);
}
.chip:hover { color: var(--text); border-color: var(--border-2); }
.chip__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.chip.is-on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip.is-on .chip__dot { background: currentColor; }
.chip__n { font-family: var(--font-mono); font-size: 12px; opacity: .65; }

/* Счётчик (просмотры/запуски) */
.stat {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 12.5px; color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.stat svg { width: 15px; height: 15px; opacity: .8; }
.stat-row { display: flex; align-items: center; gap: 16px; }

/* ============================================================
   Превью (CSS-генеративные иконки разделов)
   ============================================================ */
.thumb {
  position: relative; overflow: hidden;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  display: grid; place-items: center;
  border: 1px solid var(--border);
}
.thumb__tint { position: absolute; inset: 0; opacity: .1; }
.thumb__glyph {
  font-family: var(--font-mono); font-weight: 700;
  color: var(--text-3); position: relative; z-index: 1;
}

/* QR-узор */
.m-qr { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; width: 56%; aspect-ratio: 1; }
.m-qr i { background: var(--text); border-radius: 1px; }
.m-qr i.o { background: transparent; }

/* Тетрис-блоки */
.m-tetris { display: grid; grid-template-columns: repeat(4, 12px); grid-auto-rows: 12px; gap: 2px; }
.m-tetris i { border-radius: 2px; }

/* Крестики-нолики */
.m-ttt { display: grid; grid-template-columns: repeat(3, 1fr); width: 58%; aspect-ratio: 1; gap: 3px; }
.m-ttt i { display: grid; place-items: center; font-family: var(--font-mono); font-weight: 700;
  font-size: 15px; border-radius: 4px; background: color-mix(in oklab, var(--c-game) 14%, var(--surface)); }

/* Wordle-плитки */
.m-wordle { display: flex; gap: 4px; }
.m-wordle i { width: 19px; height: 19px; border-radius: 4px; display: grid; place-items: center;
  font-family: var(--font-mono); font-weight: 700; font-size: 11px; color: #fff; }

/* Клавиши */
.m-keys { display: flex; flex-direction: column; gap: 3px; align-items: center; }
.m-keys .row { display: flex; gap: 3px; }
.m-keys b { width: 15px; height: 15px; border-radius: 3px; background: var(--surface);
  border: 1px solid var(--border-2); box-shadow: 0 1.5px 0 var(--border-2); }
.m-keys b.hot { background: var(--brand); border-color: var(--brand); box-shadow: 0 1.5px 0 color-mix(in oklab,var(--brand) 60%, #000); }

/* Терминал / vim */
.m-term { width: 70%; font-family: var(--font-mono); font-size: 12px; line-height: 1.5;
  background: #0e0d14; color: #b6f09a; border-radius: 6px; padding: 9px 11px; text-align: left; }
.m-term .c { color: #7c7a9a; }

/* Чат-пузырь */
.m-chat { width: 60%; }
.m-chat .b { background: var(--brand); color: #fff; border-radius: 12px 12px 12px 3px;
  padding: 7px 11px; font-family: var(--font-mono); font-size: 13px; letter-spacing: 3px; }

/* Абстрактный «плагин» */
.m-shapes { position: relative; width: 54px; height: 54px; }
.m-shapes i { position: absolute; border-radius: 50%; }
.m-shapes i:nth-child(1){ width: 34px; height: 34px; left: 0; top: 6px; background: var(--brand); }
.m-shapes i:nth-child(2){ width: 30px; height: 30px; right: 0; top: 0; background: var(--c-tool); border-radius: 7px; mix-blend-mode: multiply; }
.m-shapes i:nth-child(3){ width: 20px; height: 20px; right: 7px; bottom: 0; background: var(--c-ai); border-radius: 50%; }

/* Строки текста (статья) */
.m-lines { width: 64%; display: flex; flex-direction: column; gap: 6px; }
.m-lines i { height: 5px; border-radius: 3px; background: var(--text-3); opacity: .5; }
.m-lines i:nth-child(1){ width: 80%; background: var(--text-2); opacity: .8; height: 7px; }
.m-lines i:nth-child(4){ width: 55%; }

/* ============================================================
   Карточка каталога (стиль 0 — белая, превью слева)
   ============================================================ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-sm);
  transition: transform .16s cubic-bezier(.3,.7,.4,1), box-shadow .16s, border-color .16s;
  position: relative; overflow: hidden;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-2); }
.card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--cat, var(--brand)); opacity: 0; transition: opacity .16s;
}
.card:hover::before { opacity: 1; }

/* Горизонтальная карточка (превью слева) */
.card--row { display: grid; grid-template-columns: 92px 1fr; gap: 16px; padding: 16px; align-items: center; }
.card--row .thumb { width: 92px; height: 92px; }
.card__body { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.card__head { display: flex; align-items: center; gap: 9px; }
.card__title { font-size: 16.5px; font-weight: 600; letter-spacing: -.01em; line-height: 1.25; }
.card:hover .card__title { color: var(--brand); }
.card__desc {
  font-size: 13.5px; color: var(--text-2); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  text-wrap: pretty;
}
.card__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }

/* Вертикальная карточка (превью сверху) */
.card--tile { display: flex; flex-direction: column; }
.card--tile .thumb { width: 100%; aspect-ratio: 16/10; border-radius: 0; border: 0; border-bottom: 1px solid var(--border); }
.card--tile .card__body { padding: 16px 17px 17px; gap: 7px; }

/* Сетки */
.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 920px){ .grid--3,.grid--4 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 620px){ .grid--2,.grid--3,.grid--4 { grid-template-columns: 1fr; } }

/* ============================================================
   Заголовки секций
   ============================================================ */
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.sec-head__l { display: flex; align-items: center; gap: 13px; }
.sec-kicker { font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.sec-title { font-size: clamp(22px, 3vw, 30px); font-weight: 700; letter-spacing: -.025em; line-height: 1.1; }
.sec-title .em { color: var(--brand); }
.sec-link { font-size: 14px; font-weight: 600; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.sec-link:hover { color: var(--brand); }
.sec-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.sec-icon svg { width: 21px; height: 21px; }

/* ============================================================
   Hero
   ============================================================ */
.hero { padding-top: clamp(36px, 6vw, 64px); }
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-mono); font-size: 13px; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 14px; box-shadow: var(--shadow-sm); margin-bottom: 20px; white-space: nowrap;
}
.hero__eyebrow .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--c-article);
  box-shadow: 0 0 0 0 color-mix(in oklab, var(--c-article) 70%, transparent); animation: pulse 2s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 color-mix(in oklab,var(--c-article) 60%, transparent);} 70%{box-shadow:0 0 0 8px transparent;} 100%{box-shadow:0 0 0 0 transparent;} }
.hero__title { font-size: clamp(34px, 6vw, 58px); font-weight: 700; letter-spacing: -.035em; line-height: 1.04; margin: 0 0 18px; text-wrap: balance; }
.hero__title .em { color: var(--brand); }
.hero__lead { font-size: clamp(16px, 2.2vw, 20px); color: var(--text-2); max-width: 60ch; line-height: 1.5; margin: 0 0 26px; text-wrap: pretty; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* Большой поиск в hero */
.bigsearch {
  display: flex; align-items: center; gap: 12px; max-width: 560px;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 15px;
  padding: 6px 6px 6px 18px; box-shadow: var(--shadow-md); margin-bottom: 22px;
}
.bigsearch svg { width: 21px; height: 21px; color: var(--text-3); flex-shrink: 0; }
.bigsearch input { flex: 1; border: 0; background: transparent; outline: none; font-family: var(--font-ui); font-size: 16px; color: var(--text); }
.bigsearch input::placeholder { color: var(--text-3); }

/* ============================================================
   Флагман (KlavoShooter)
   ============================================================ */
.flagship {
  position: relative; overflow: hidden;
  border-radius: var(--r-lg);
  background:
    radial-gradient(120% 140% at 88% -10%, color-mix(in oklab, var(--brand) 45%, transparent), transparent 60%),
    linear-gradient(135deg, #1a1730, #221a3f 55%, #2a1d4d);
  color: #fff; border: 1px solid color-mix(in oklab, var(--brand) 40%, #000);
  box-shadow: var(--shadow-lg);
}
.flagship__grid {
  position: absolute; inset: 0; opacity: .5;
  background-image: linear-gradient(color-mix(in oklab,var(--brand) 30%, transparent) 1px, transparent 1px),
                    linear-gradient(90deg, color-mix(in oklab,var(--brand) 30%, transparent) 1px, transparent 1px);
  background-size: 34px 34px;
  -webkit-mask-image: radial-gradient(80% 120% at 80% 0%, #000, transparent 70%);
  mask-image: radial-gradient(80% 120% at 80% 0%, #000, transparent 70%);
}
.flagship__inner { position: relative; z-index: 1; display: grid; grid-template-columns: 1.15fr 1fr; gap: 30px; padding: clamp(26px, 4vw, 48px); align-items: center; }
@media (max-width: 860px){ .flagship__inner { grid-template-columns: 1fr; } }
.flagship__badge {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono);
  font-size: 12px; letter-spacing: .04em; text-transform: uppercase;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2);
  padding: 6px 12px; border-radius: 999px; margin-bottom: 18px; backdrop-filter: blur(6px);
}
.flagship__title { font-size: clamp(30px, 4.5vw, 46px); font-weight: 700; letter-spacing: -.03em; line-height: 1.02; margin: 0 0 12px; }
.flagship__title .dom { font-family: var(--font-mono); font-weight: 500; opacity: .6; font-size: .42em; vertical-align: middle; letter-spacing: 0; }
.flagship__lead { font-size: 16.5px; color: rgba(255,255,255,.78); max-width: 46ch; margin: 0 0 22px; line-height: 1.5; text-wrap: pretty; }
.flagship__cta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.flagship .btn--ghost { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.22); box-shadow: none; }
.flagship .btn--ghost:hover { background: rgba(255,255,255,.18); }
.flagship__stats { display: flex; gap: 26px; margin-top: 24px; }
.flagship__stat .n { font-family: var(--font-mono); font-size: 26px; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; }
.flagship__stat .l { font-size: 12.5px; color: rgba(255,255,255,.6); }

/* Демо-сцена клавиатуры во флагмане */
.kbdemo { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.14); border-radius: 16px; padding: 22px; backdrop-filter: blur(8px); }
.kbdemo__line { font-family: var(--font-mono); font-size: 15px; margin-bottom: 16px; color: rgba(255,255,255,.5); }
.kbdemo__line b { color: #fff; }
.kbdemo__line .cursor { display: inline-block; width: 9px; height: 18px; background: var(--c-game); vertical-align: text-bottom; margin-left: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50%{opacity:0;} }
.kbdemo__rows { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.kbdemo__rows .r { display: flex; gap: 6px; }
.kbdemo__rows .k { min-width: 30px; height: 30px; padding: 0 6px; border-radius: 7px; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 12px; color: rgba(255,255,255,.7);
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.kbdemo__rows .k.lit { background: var(--c-game); color: #1a1020; border-color: var(--c-game); box-shadow: 0 2px 0 color-mix(in oklab,var(--c-game) 55%,#000); }
.kbdemo__rows .k.lit2 { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 2px 0 color-mix(in oklab,var(--brand) 55%,#000); }

/* ============================================================
   Лаунчер-плитки (вариант B)
   ============================================================ */
.launch { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
@media (max-width: 920px){ .launch { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 560px){ .launch { grid-template-columns: 1fr; } }
.ltile {
  position: relative; overflow: hidden; border-radius: var(--r);
  padding: 20px; min-height: 168px; color: #fff;
  display: flex; flex-direction: column; justify-content: space-between;
  background: var(--cat); box-shadow: var(--shadow-md);
  transition: transform .16s, box-shadow .16s;
}
.ltile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.ltile__deco { position: absolute; right: -20px; bottom: -20px; width: 120px; height: 120px; opacity: .22; }
.ltile__ic { width: 40px; height: 40px; border-radius: 11px; background: rgba(255,255,255,.18); display: grid; place-items: center; }
.ltile__ic svg { width: 22px; height: 22px; }
.ltile__title { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.ltile__meta { font-family: var(--font-mono); font-size: 12px; opacity: .82; margin-top: 3px; }
.ltile--big { grid-column: span 2; grid-row: span 2; min-height: 352px; }

/* ============================================================
   Хлебные крошки (SEO)
   ============================================================ */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-3); padding: 18px 0 0; }
.crumbs a { color: var(--text-2); }
.crumbs a:hover { color: var(--brand); }
.crumbs .sep { color: var(--text-3); opacity: .6; }
.crumbs .cur { color: var(--text); font-weight: 500; }

/* ============================================================
   Статья
   ============================================================ */
.article { display: grid; grid-template-columns: minmax(0,1fr) 240px; gap: clamp(28px, 5vw, 64px); align-items: start; }
@media (max-width: 900px){ .article { grid-template-columns: 1fr; } }
.prose { max-width: 70ch; }
.prose h1 { font-size: clamp(30px, 5vw, 44px); font-weight: 700; letter-spacing: -.03em; line-height: 1.08; margin: 18px 0 8px; text-wrap: balance; }
.prose .lede { font-size: 19px; color: var(--text-2); line-height: 1.55; margin: 0 0 30px; text-wrap: pretty; }
.prose h2 { font-size: 25px; font-weight: 700; letter-spacing: -.02em; margin: 42px 0 12px; scroll-margin-top: 80px; }
.prose h2::before { content: "# "; font-family: var(--font-mono); color: var(--brand); font-weight: 500; }
.prose h3 { font-size: 19px; font-weight: 600; margin: 28px 0 8px; }
.prose p { font-size: 16.5px; color: var(--text); line-height: 1.7; margin: 0 0 18px; }
.prose a:not(.btn) { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1.5px; text-decoration-color: color-mix(in oklab, var(--brand) 40%, transparent); }
.prose a:not(.btn):hover { text-decoration-color: var(--brand); }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 18px; }
.prose li { font-size: 16.5px; line-height: 1.7; margin-bottom: 7px; }
.prose code { font-family: var(--font-mono); font-size: .88em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }
.prose blockquote { margin: 22px 0; padding: 14px 20px; border-left: 3px solid var(--brand); background: var(--surface-2); border-radius: 0 var(--r-sm) var(--r-sm) 0; color: var(--text-2); font-size: 16.5px; }
.prose .figph { margin: 24px 0; border-radius: var(--r); border: 1px solid var(--border); aspect-ratio: 16/9; }

.article__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin: 0 0 26px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }

/* Оглавление */
.toc { position: sticky; top: 86px; }
.toc__t { font-family: var(--font-mono); font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); margin-bottom: 12px; }
.toc a { display: block; font-size: 14px; color: var(--text-2); padding: 6px 12px; border-left: 2px solid var(--border); margin-left: 1px; transition: all .15s; }
.toc a:hover { color: var(--text); border-color: var(--border-2); }
.toc a.is-active { color: var(--brand); border-color: var(--brand); font-weight: 500; }

/* ============================================================
   Подвал
   ============================================================ */
.footer { margin-top: clamp(56px, 8vw, 96px); border-top: 1px solid var(--border); background: var(--surface); }
.footer__inner { max-width: var(--maxw); margin: 0 auto; padding: 44px var(--gut); display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; }
@media (max-width: 760px){ .footer__inner { grid-template-columns: 1fr 1fr; } }
.footer h4 { font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin: 0 0 14px; }
.footer a { display: block; font-size: 14px; color: var(--text-2); padding: 4px 0; }
.footer a:hover { color: var(--brand); }
.footer__lead { font-size: 14px; color: var(--text-2); max-width: 32ch; margin: 14px 0 0; }
.footer__bottom { border-top: 1px solid var(--border); padding: 18px var(--gut); text-align: center; font-family: var(--font-mono); font-size: 12px; color: var(--text-3); }

/* ============================================================
   Веб-чат виджет
   ============================================================ */
.chatw { position: fixed; right: 20px; bottom: 20px; z-index: 60; }
.chatw__btn {
  width: 56px; height: 56px; border-radius: 18px; border: 0; cursor: pointer;
  background: var(--brand); color: #fff; display: grid; place-items: center;
  box-shadow: var(--shadow-lg); transition: transform .15s;
}
.chatw__btn:hover { transform: translateY(-2px) scale(1.03); }
.chatw__btn svg { width: 26px; height: 26px; }
.chatw__dot { position: absolute; top: -3px; right: -3px; width: 16px; height: 16px; border-radius: 50%; background: var(--c-game); border: 2.5px solid var(--bg); }
.chatw__panel {
  position: absolute; right: 0; bottom: 70px; width: 300px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg); overflow: hidden; transform-origin: bottom right;
  display: none;
}
.chatw.is-open .chatw__panel { display: block; animation: pop .18s cubic-bezier(.3,.7,.4,1); }
@keyframes pop { from{ opacity:0; transform: translateY(8px) scale(.97);} }
.chatw__hd { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--border); }
.chatw__av { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(150deg, var(--brand), var(--c-tool)); display: grid; place-items: center; color: #fff; }
.chatw__av svg { width: 17px; height: 17px; }
.chatw__hd b { font-size: 14px; font-weight: 600; display: block; }
.chatw__hd span { font-family: var(--font-mono); font-size: 11px; color: var(--c-article); }
.chatw__body { padding: 15px; display: flex; flex-direction: column; gap: 10px; max-height: 240px; overflow-y: auto; }
.chatw__msg { font-size: 13.5px; line-height: 1.45; padding: 9px 12px; border-radius: 12px; max-width: 85%; }
.chatw__msg.bot { background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 3px; align-self: flex-start; }
.chatw__msg.me { background: var(--brand); color: #fff; border-bottom-right-radius: 3px; align-self: flex-end; }
.chatw__in { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.chatw__in input { flex: 1; border: 1px solid var(--border); background: var(--surface-2); border-radius: 9px; padding: 8px 11px; font-family: var(--font-ui); font-size: 13.5px; color: var(--text); outline: none; }
.chatw__in button { border: 0; background: var(--brand); color: #fff; border-radius: 9px; width: 36px; cursor: pointer; display: grid; place-items: center; }
.chatw__in button svg { width: 16px; height: 16px; }

/* ============================================================
   Утилиты
   ============================================================ */
.hidden { display: none !important; }
.no-counters .stat-row .stat:not(:first-child){ display:none; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-2); }
.center { text-align: center; }
.maxw-narrow { max-width: 760px; margin-left: auto; margin-right: auto; }

/* ---- Дополнения ---- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.stat[title] { cursor: help; }
/* Оригинальный логотип-wordmark (адаптивный цвет под тему) */
.logo { color: var(--text); }
.logo > svg { height: 30px; width: auto; flex-shrink: 0; }
.logo__sub { align-self: center; }
@media (max-width: 760px){ .topbar .logo__sub { display: none; } }
/* Центрирование контента статьи */
.article { justify-content: center; grid-template-columns: minmax(0, 720px) 220px; }
@media (max-width: 900px){ .article { grid-template-columns: minmax(0, 720px); justify-content: center; } }
/* Реальные картинки и иконки-заглушки в превью */
.thumb__glyph svg { width: 34px; height: 34px; opacity: .85; }
.card--tile .thumb img, .card--row .thumb img { max-width: 100%; max-height: 100%; width: auto; height: auto; }
.card--row .thumb img { border-radius: var(--r-sm); }
.prose img { border-radius: var(--r-sm); margin: 18px 0; }
.prose pre { background: #0e0d14; border-radius: var(--r-sm); padding: 14px 16px; overflow: auto; margin: 18px 0; }
.prose table { border-collapse: collapse; margin: 18px 0; font-size: 14.5px; }
.prose td, .prose th { border: 1px solid var(--border); padding: 7px 10px; }
