/* ============================================================
   Норск — дизайн-система «Scandi-Bento»
   ============================================================ */
@font-face {
  font-family: 'Inter Variable';
  src: url('../assets/Inter-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* --- Светлая тема (по умолчанию) --- */
  --bg: #f3f1ec;
  --bg-2: #ebe8e1;
  --surface: #ffffff;
  --surface-2: #f7f5f1;
  --line: rgba(20, 20, 15, 0.08);
  --text: #21201c;
  --muted: #6b6a63;
  --muted-2: #767268; /* затемнено с #96938a — исходный не проходил WCAG AA (~2.7-3.1:1), этот даёт ~4.8:1 */

  --fjord: #3a6ea5;
  --fjord-2: #2c5580;
  --fjord-soft: color-mix(in srgb, var(--fjord) 14%, transparent);
  --pine: #3f7d5c;
  --pine-soft: color-mix(in srgb, var(--pine) 14%, transparent);
  --terracotta: #c1663c;
  --terracotta-soft: color-mix(in srgb, var(--terracotta) 14%, transparent);
  --terracotta-text: #9c4f28; /* тёмный вариант terracotta для текста на .badge.gold — сам --terracotta даёт только ~3.4:1 на terracotta-soft */

  --good: #3f7d5c;
  --bad: #b3483f;
  --warn: #c9932e;
  --gold: #b8863b;

  /* алиасы обратной совместимости для существующих call-site'ов */
  --brand: var(--fjord);
  --brand-2: var(--fjord-2);
  --brand-soft: var(--fjord-soft);
  --accent: var(--pine);

  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-full: 999px;
  --radius: var(--radius-md);

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;

  --shadow-sm: 0 1px 2px rgba(24, 22, 18, 0.04), 0 4px 12px -4px rgba(24, 22, 18, 0.06);
  --shadow-md: 0 2px 6px -2px rgba(24, 22, 18, 0.06), 0 8px 20px -6px rgba(24, 22, 18, 0.08);
  --shadow: 0 2px 8px -2px rgba(24, 22, 18, 0.08), 0 12px 28px -8px rgba(24, 22, 18, 0.10);
  --shadow-lg: 0 8px 24px -6px rgba(24, 22, 18, 0.10), 0 24px 48px -12px rgba(24, 22, 18, 0.14);
  --shadow-inset: inset 0 1px 0 color-mix(in srgb, #fff 40%, transparent);
  --edge: color-mix(in srgb, var(--line) 72%, transparent);
  --edge-strong: color-mix(in srgb, var(--fjord) 28%, var(--line));

  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-snap: cubic-bezier(.34, 1.15, .64, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dur-fast: .14s;
  --dur-med: .22s;
  --dur-slow: .32s;
  --maxw: 880px;
  --font: 'Inter Variable', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;

  --text-xs: 11px;
  --text-sm: 13px;
  --text-md: 16px;
  --text-base: 15px;
  --text-lg: 17px;
  --text-xl: 22px;
  --text-2xl: clamp(24px, 4.2vw, 30px);

  --tabbar-h: 72px;
  --checkbar-h: 92px;
}

/* --- Тёмная тема: системная (prefers-color-scheme) --- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15161a; --bg-2: #1a1b21; --surface: #1e2026; --surface-2: #25272e;
    --line: color-mix(in srgb, #fff 7%, transparent);
    --text: #ededf0; --muted: #a3a3ad; --muted-2: #8e8e98;
    --fjord: #7fb0e0; --fjord-2: #5a8fc4; --fjord-soft: color-mix(in srgb, var(--fjord) 18%, transparent);
    --pine: #6fae8f; --pine-soft: color-mix(in srgb, var(--pine) 18%, transparent);
    --terracotta: #d98a5f; --terracotta-soft: color-mix(in srgb, var(--terracotta) 18%, transparent); --terracotta-text: #e8a07a;
    --good: #6fae8f; --bad: #e0776d; --warn: #e0b45c; --gold: #d9ab5f;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 4px 14px -4px rgba(0, 0, 0, 0.45);
    --shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.5), 0 16px 32px -10px rgba(0, 0, 0, 0.55);
    --shadow-lg: 0 12px 28px -8px rgba(0, 0, 0, 0.55), 0 28px 56px -14px rgba(0, 0, 0, 0.65);
    --shadow-inset: inset 0 1px 0 color-mix(in srgb, #fff 6%, transparent);
  }
}
/* --- Тёмная тема: ручной переключатель (перекрывает системную) --- */
html[data-theme="dark"] {
  --bg: #15161a; --bg-2: #1a1b21; --surface: #1e2026; --surface-2: #25272e;
  --line: color-mix(in srgb, #fff 7%, transparent);
  --text: #ededf0; --muted: #a3a3ad; --muted-2: #8e8e98;
  --fjord: #7fb0e0; --fjord-2: #5a8fc4; --fjord-soft: color-mix(in srgb, var(--fjord) 18%, transparent);
  --pine: #6fae8f; --pine-soft: color-mix(in srgb, var(--pine) 18%, transparent);
  --terracotta: #d98a5f; --terracotta-soft: color-mix(in srgb, var(--terracotta) 18%, transparent); --terracotta-text: #e8a07a;
  --good: #6fae8f; --bad: #e0776d; --warn: #e0b45c; --gold: #d9ab5f;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 4px 14px -4px rgba(0, 0, 0, 0.45);
  --shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.5), 0 16px 32px -10px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 12px 28px -8px rgba(0, 0, 0, 0.55), 0 28px 56px -14px rgba(0, 0, 0, 0.65);
  --shadow-inset: inset 0 1px 0 color-mix(in srgb, #fff 6%, transparent);
}
html[data-theme="light"] {
  --bg: #f3f1ec; --bg-2: #ebe8e1; --surface: #ffffff; --surface-2: #f7f5f1;
  --line: color-mix(in srgb, #14140f 8%, transparent); --text: #21201c; --muted: #6b6a63; --muted-2: #767268;
  --fjord: #3a6ea5; --fjord-2: #2c5580; --fjord-soft: color-mix(in srgb, var(--fjord) 14%, transparent);
  --pine: #3f7d5c; --pine-soft: color-mix(in srgb, var(--pine) 14%, transparent);
  --terracotta: #c1663c; --terracotta-soft: color-mix(in srgb, var(--terracotta) 14%, transparent); --terracotta-text: #9c4f28;
  --good: #3f7d5c; --bad: #b3483f; --warn: #c9932e; --gold: #b8863b;
  --shadow-sm: 0 1px 2px rgba(24, 22, 18, 0.04), 0 4px 12px -4px rgba(24, 22, 18, 0.06);
  --shadow: 0 2px 8px -2px rgba(24, 22, 18, 0.08), 0 12px 28px -8px rgba(24, 22, 18, 0.10);
  --shadow-lg: 0 8px 24px -6px rgba(24, 22, 18, 0.10), 0 24px 48px -12px rgba(24, 22, 18, 0.14);
  --shadow-inset: inset 0 1px 0 color-mix(in srgb, #fff 40%, transparent);
}

/* ---------- Акцент-пресеты ---------- */
/* fjord — дефолт, отдельного блока не нужно. Остальные переопределяют --fjord/--fjord-2/--fjord-soft
   (основной интерактивный акцент — кнопки, фокус, прогресс) поверх активной темы. Значения намеренно не
   равны токенам --pine/--terracotta 1:1 там, где это создало бы монотонный градиент/бордер (см. .progress,
   .bento-week i.has) — терракота исключение, там совпадение уместно и даёт единый терракотовый акцент.
   Специфичность: [data-accent] < [data-theme][data-accent] < @media(dark){[data-accent]:not([data-theme=light])} —
   так explicit light всегда побеждает системную тёмную, а explicit dark побеждает всегда, вне зависимости от ОС. */
html[data-accent="pine"] { --fjord: #2f6b4a; --fjord-2: #235339; --fjord-soft: color-mix(in srgb, var(--fjord) 14%, transparent); }
html[data-accent="terracotta"] { --fjord: #c1663c; --fjord-2: #a1512c; --fjord-soft: color-mix(in srgb, var(--fjord) 14%, transparent); }
html[data-accent="plum"] { --fjord: #7a4d84; --fjord-2: #603c69; --fjord-soft: color-mix(in srgb, var(--fjord) 14%, transparent); }
html[data-accent="amber"] { --fjord: #a8701f; --fjord-2: #8a5a19; --fjord-soft: color-mix(in srgb, var(--fjord) 14%, transparent); }

html[data-theme="dark"][data-accent="pine"] { --fjord: #5fa17f; --fjord-2: #488367; --fjord-soft: color-mix(in srgb, var(--fjord) 20%, transparent); }
html[data-theme="dark"][data-accent="terracotta"] { --fjord: #d98a5f; --fjord-2: #c07047; --fjord-soft: color-mix(in srgb, var(--fjord) 20%, transparent); }
html[data-theme="dark"][data-accent="plum"] { --fjord: #c48fd0; --fjord-2: #a874b3; --fjord-soft: color-mix(in srgb, var(--fjord) 20%, transparent); }
html[data-theme="dark"][data-accent="amber"] { --fjord: #e0a94a; --fjord-2: #c58f39; --fjord-soft: color-mix(in srgb, var(--fjord) 20%, transparent); }

@media (prefers-color-scheme: dark) {
  html[data-accent="pine"]:not([data-theme="light"]) { --fjord: #5fa17f; --fjord-2: #488367; --fjord-soft: color-mix(in srgb, var(--fjord) 20%, transparent); }
  html[data-accent="terracotta"]:not([data-theme="light"]) { --fjord: #d98a5f; --fjord-2: #c07047; --fjord-soft: color-mix(in srgb, var(--fjord) 20%, transparent); }
  html[data-accent="plum"]:not([data-theme="light"]) { --fjord: #c48fd0; --fjord-2: #a874b3; --fjord-soft: color-mix(in srgb, var(--fjord) 20%, transparent); }
  html[data-accent="amber"]:not([data-theme="light"]) { --fjord: #e0a94a; --fjord-2: #c58f39; --fjord-soft: color-mix(in srgb, var(--fjord) 20%, transparent); }
}

/* ---------- Плотность ---------- */
html[data-density="compact"] {
  --sp-1: 3px; --sp-2: 6px; --sp-3: 9px; --sp-4: 12px; --sp-6: 18px; --sp-8: 24px; --sp-12: 36px;
  --radius-xs: 6px; --radius-sm: 10px; --radius-md: 13px; --radius-lg: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: var(--sp-3);
  z-index: 10000;
  padding: var(--sp-2) var(--sp-4);
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--fjord);
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  left: var(--sp-3);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.52;
  letter-spacing: -0.011em;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
  transition: background-color var(--dur-med) var(--ease-out), color var(--dur-med) var(--ease-out);
}

/* ---------- Иммерсивный фон (фиксированный слой — не обрывается при прокрутке) ---------- */
#bg-fx {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  background: var(--bg);
}
#bg-fx .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(88px);
  opacity: 0.22;
  will-change: transform;
  transform: translate3d(0, 0, 0);
  contain: strict;
}
#bg-fx .blob-a {
  width: min(68vw, 480px);
  height: min(68vw, 480px);
  top: -14%;
  left: -20%;
  background: radial-gradient(circle at 40% 40%, color-mix(in srgb, var(--fjord) 22%, transparent), transparent 68%);
  animation: driftA 32s ease-in-out infinite alternate;
}
#bg-fx .blob-b {
  width: min(54vw, 400px);
  height: min(54vw, 400px);
  bottom: -10%;
  right: -16%;
  background: radial-gradient(circle at 55% 55%, color-mix(in srgb, var(--pine) 20%, transparent), transparent 70%);
  animation: driftB 36s ease-in-out infinite alternate;
}
#bg-fx .blob-c {
  width: min(40vw, 300px);
  height: min(40vw, 300px);
  top: 40%;
  left: 44%;
  background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--terracotta) 16%, transparent), transparent 72%);
  opacity: 0.22;
  animation: driftC 28s ease-in-out infinite alternate;
}
@keyframes driftA {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(6vw, 5vh, 0) scale(1.06); }
}
@keyframes driftB {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-5vw, -4vh, 0) scale(1.05); }
}
@keyframes driftC {
  from { transform: translate3d(-50%, -50%, 0) scale(1); }
  to { transform: translate3d(calc(-50% + 3vw), calc(-50% - 2vh), 0) scale(1.08); }
}
@media (prefers-color-scheme: dark) {
  #bg-fx .blob { opacity: 0.28; filter: blur(96px); }
  #bg-fx .blob-c { opacity: 0.16; }
}
html[data-theme="dark"] #bg-fx .blob { opacity: 0.28; filter: blur(96px); }
html[data-theme="dark"] #bg-fx .blob-c { opacity: 0.16; }
html[data-theme="light"] #bg-fx .blob { opacity: 0.38; filter: blur(88px); }

#app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--sp-5) clamp(var(--sp-4), 4vw, var(--sp-8)) calc(var(--tabbar-h) + var(--sp-5) + env(safe-area-inset-bottom));
  min-height: 100%;
  min-width: 0;
}
.boot-msg {
  margin: 48px auto 0;
  text-align: center;
  color: var(--muted, #96938a);
  font-size: 15px;
}
#app.immersive {
  padding-bottom: calc(var(--checkbar-h) + env(safe-area-inset-bottom));
}
#app.immersive.no-checkbar {
  padding-bottom: calc(var(--sp-6) + env(safe-area-inset-bottom));
}
#app.screen-enter { animation: screenIn var(--dur-slow) var(--ease-out) both; }
@keyframes screenIn {
  from { opacity: 0; transform: translate3d(0, 8px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

/* ---------- Типографика ---------- */
h1, h2, h3 { margin: 0 0 .45em; line-height: 1.18; font-weight: 700; letter-spacing: -0.022em; }
h1 { font-size: var(--text-2xl); }
h2 { font-size: clamp(19px, 3.2vw, 22px); letter-spacing: -0.018em; }
h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.012em; }
p { margin: 0 0 .85em; color: var(--muted); line-height: 1.58; font-size: var(--text-base); }
.small { font-size: var(--text-sm); color: var(--muted); font-weight: 500; line-height: 1.5; }
.tiny { font-size: var(--text-xs); color: var(--muted-2); font-weight: 500; line-height: 1.45; }
.center { text-align: center; }
.nor { color: var(--text); font-weight: 700; letter-spacing: -0.015em; }
.ipa {
  color: var(--fjord-2);
  font-style: normal;
  font-variant: normal;
  font-weight: 500;
  letter-spacing: 0.02em;
  font-feature-settings: "liga" 0;
}
.ru { color: var(--muted); }
.row { display: flex; gap: var(--sp-3); align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: grid; gap: var(--sp-3); }
.hidden, [hidden] { display: none !important; }

/* ---------- Карточки ---------- */
.card {
  background: var(--surface);
  border: none;
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm), var(--shadow-inset);
  transition:
    transform var(--dur-med) var(--ease-out),
    box-shadow var(--dur-med) var(--ease-out);
  will-change: transform;
}
.card.pad-lg { padding: var(--sp-6); }
.card.accent {
  background: linear-gradient(165deg, var(--surface), color-mix(in srgb, var(--fjord-soft) 55%, var(--surface)));
  box-shadow: var(--shadow-sm), 0 0 0 1px color-mix(in srgb, var(--fjord) 12%, transparent);
}
.card-error {
  box-shadow: var(--shadow-sm), inset 0 0 0 1px color-mix(in srgb, var(--bad) 45%, transparent);
}
button.card:hover, .friends-preview-card:hover {
  transform: translate3d(0, -2px, 0);
  box-shadow: var(--shadow-lg), var(--shadow-inset);
}
button.card:active, .friends-preview-card:active {
  transform: translate3d(0, 0, 0) scale(.985);
  box-shadow: var(--shadow-sm);
  transition-duration: var(--dur-fast);
}

/* Интерактивные карточки/строки — теперь настоящие <button> вместо div+role для доступности с клавиатуры.
   Сбрасываем только UA-стили кнопки (шрифт/цвет/выравнивание/курсор) — фон/рамку/паддинг уже задают
   сами классы .card/.bento-tile/.node/.achv-badge, это не трогаем. */
button.card, button.bento-tile, button.node, button.achv-badge, button.row {
  appearance: none; -webkit-appearance: none;
  font: inherit; color: inherit;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
/* .bento-tile/.node уже задают display:flex (сам по себе блочный внешний тип) — не трогаем.
   .card display вообще не задаёт (полагался на блочный <div> по умолчанию) — фиксируем явно для button. */
button.card { display: block; width: 100%; text-align: left; }
button.bento-tile, button.node { text-align: left; }
button.row { display: flex; text-align: left; border: none; background: none; padding: 0; margin: 0; width: 100%; }

/* ---------- Кнопки ---------- */
.btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 18px;
  font-size: var(--text-base);
  font-weight: 700;
  font-family: inherit;
  letter-spacing: -0.01em;
  color: #fff;
  background: linear-gradient(165deg, color-mix(in srgb, var(--fjord) 90%, #fff), var(--fjord-2));
  cursor: pointer;
  transition:
    transform var(--dur-fast) var(--ease-snap),
    box-shadow var(--dur-med) var(--ease-out),
    filter var(--dur-med) var(--ease-out);
  box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--fjord) 45%, transparent);
  will-change: transform;
}
.btn:hover { filter: brightness(1.03); box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--fjord) 50%, transparent); }
.btn:active { transform: scale(.97); box-shadow: 0 2px 8px -2px color-mix(in srgb, var(--fjord) 35%, transparent); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.block { width: 100%; }
.btn.ghost {
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--text);
  border: none;
  box-shadow: inset 0 0 0 1px var(--edge);
}
.btn.ghost:hover { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--edge-strong); }
.btn.subtle {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  border: none;
}
.btn.danger { background: linear-gradient(165deg, #d98a7f, var(--bad)); color: #fff; box-shadow: none; }
.btn.lg { padding: 16px 20px; font-size: 16px; }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: var(--radius-xs); }
.icon { flex: none; display: block; }
.icon-btn {
  appearance: none; cursor: pointer;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--dur-fast) var(--ease-snap),
    box-shadow var(--dur-med) var(--ease-out),
    background var(--dur-med) var(--ease-out);
  will-change: transform;
}
.icon-btn:hover { background: var(--surface); box-shadow: var(--shadow); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.lg { width: 56px; height: 56px; border-radius: var(--radius-lg); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: var(--radius-xs); }
.icon-btn.pulse { animation: speakPulse 2.2s ease-in-out infinite; }
@keyframes speakPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--fjord-soft); }
  50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--fjord) 0%, transparent); }
}

/* ---------- Фокус с клавиатуры ---------- */
/* :focus-visible (а не :focus) — рамка появляется только при навигации с клавиатуры, не от мышиного клика.
   Единый стиль для всех интерактивных элементов дизайн-системы, включая div->button конверсии выше. */
.btn:focus-visible, .icon-btn:focus-visible, .chip:focus-visible, .tab:focus-visible,
.node:focus-visible, .bento-tile:focus-visible, .choice:focus-visible, .opt:focus-visible,
.card:focus-visible, .achv-badge:focus-visible, .row:focus-visible {
  outline: 2px solid var(--fjord);
  outline-offset: 2px;
}

/* ---------- Поля ввода ---------- */
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  background: var(--surface-2);
  border: none;
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  box-shadow: inset 0 0 0 1px var(--edge), var(--shadow-sm);
  transition: box-shadow var(--dur-med) var(--ease-out);
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2396938a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}
.input-select { width: 100%; margin-bottom: 12px; }
input:focus, select:focus, textarea:focus {
  box-shadow: inset 0 0 0 2px var(--fjord), 0 0 0 4px color-mix(in srgb, var(--fjord-soft) 80%, transparent);
}
label.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.range { width: 100%; accent-color: var(--fjord); }

/* ---------- Чипы / бейджи ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--radius-full);
  background: var(--surface-2); border: none;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 75%, transparent);
  font-size: var(--text-sm); color: var(--muted); cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-snap), box-shadow var(--dur-med) var(--ease-out), background var(--dur-med) var(--ease-out);
  will-change: transform;
}
.chip:hover { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fjord) 35%, transparent); background: color-mix(in srgb, var(--fjord-soft) 40%, var(--surface-2)); }
.chip.on { background: var(--fjord-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fjord) 45%, transparent); color: var(--fjord-2); }

/* ---------- Вкладки профиля ---------- */
.tabbar-inline { display: flex; gap: 8px; margin-bottom: 18px; overflow-x: auto; padding-bottom: 2px; }
.tabbar-inline .chip { font-weight: 600; white-space: nowrap; }

/* ---------- Свотчи акцентного цвета ---------- */
.accent-swatches { display: flex; gap: 12px; flex-wrap: wrap; }
.accent-swatch {
  width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent;
  cursor: pointer; transition: transform .15s var(--ease), border-color .15s var(--ease);
  padding: 0;
}
.accent-swatch:hover { transform: scale(1.06); }
.accent-swatch.on { border-color: var(--text); transform: scale(1.1); }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 700;
  background: var(--fjord-soft); color: var(--fjord-2);
}
.badge.gold { background: var(--terracotta-soft); color: var(--terracotta-text); }
.badge.flat { background: var(--surface-2); color: var(--muted); }

/* ---------- Прогресс ---------- */
.progress { height: 10px; background: color-mix(in srgb, var(--surface-2) 85%, var(--muted)); border-radius: var(--radius-full); overflow: hidden; border: none; box-shadow: inset 0 1px 2px color-mix(in srgb, var(--text) 6%, transparent); }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--fjord), color-mix(in srgb, var(--pine) 70%, var(--fjord))); border-radius: var(--radius-full); transition: width .45s var(--ease-out); }
.progress.sm { height: 8px; }

/* ---------- Хедер экрана ---------- */
.app-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  align-items: start;
}
.app-header .title { display: grid; gap: 2px; min-width: 0; }
.app-header .title h1 {
  font-size: var(--text-2xl);
  margin-bottom: 0;
  overflow-wrap: anywhere;
  line-height: 1.15;
}
.app-header .title small { color: var(--muted-2); font-size: var(--text-sm); line-height: 1.4; }
.app-header > .stat-pills,
.app-header > .btn,
.app-header > button {
  justify-self: start;
  max-width: 100%;
}
@media (min-width: 520px) {
  .app-header {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--sp-3);
  }
  .app-header > .stat-pills,
  .app-header > .btn,
  .app-header > button {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }
}
.brandmark { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; }
.brandmark img { width: 34px; height: 34px; border-radius: var(--radius-xs); }

.stat-pills { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: var(--radius-sm); background: var(--surface); border: none; box-shadow: var(--shadow-sm); font-weight: 700; font-size: var(--text-sm); white-space: nowrap; flex-shrink: 0; }
.pill .ico { display: inline-flex; color: var(--fjord); }

/* ---------- Bento-дашборд (Home) ---------- */
.bento {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(var(--sp-3), 2.5vw, var(--sp-4));
  margin-bottom: var(--sp-8);
}
.bento-tile {
  background: var(--surface);
  border: none;
  border-radius: var(--radius-lg);
  padding: clamp(var(--sp-4), 3vw, var(--sp-5));
  box-shadow: var(--shadow-sm), var(--shadow-inset);
  cursor: pointer;
  display: flex; flex-direction: column; gap: var(--sp-2); justify-content: center;
  min-height: 0;
  transition:
    transform var(--dur-med) var(--ease-out),
    box-shadow var(--dur-med) var(--ease-out);
  will-change: transform;
}
.bento-tile:hover { transform: translate3d(0, -3px, 0); box-shadow: var(--shadow-lg), var(--shadow-inset); }
.bento-tile:active { transform: translate3d(0, 0, 0) scale(.985); box-shadow: var(--shadow-sm); transition-duration: var(--dur-fast); }
.bento-continue {
  grid-column: 1 / -1;
  min-height: clamp(132px, 28vw, 168px);
  background:
    radial-gradient(120% 80% at 100% 0%, color-mix(in srgb, var(--fjord) 16%, transparent), transparent 55%),
    linear-gradient(165deg, var(--surface), color-mix(in srgb, var(--fjord-soft) 70%, var(--surface)));
  box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--fjord) 10%, transparent);
  position: relative;
  overflow: hidden;
}
.bento-continue::after {
  content: '';
  position: absolute;
  inset: auto -20% -40% auto;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--pine) 16%, transparent);
  pointer-events: none;
}
.bento-continue .bt-title { font-size: clamp(19px, 4vw, 22px); letter-spacing: -.02em; }
.bento-continue .bt-ico .icon { width: 32px; height: 32px; }
.bento-continue .bt-label { color: var(--fjord-2); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.bento-word { grid-column: 1 / -1; min-height: clamp(100px, 22vw, 124px); }
.bento-progress { grid-column: 1 / -1; min-height: clamp(92px, 20vw, 108px); }
.bento-tile .bt-ico { color: var(--fjord); margin-bottom: 2px; }
.bento-tile .bt-title { font-weight: 700; font-size: var(--text-lg); letter-spacing: -0.018em; }
.bento-tile .bt-sub { color: var(--muted); font-size: var(--text-sm); line-height: 1.45; }
.bento-tile .bt-sub .ipa { font-size: inherit; color: var(--fjord-2); }
.bento-week { display: flex; align-items: flex-end; gap: 5px; height: 44px; margin-top: var(--sp-2); }
.bento-week i { flex: 1; background: color-mix(in srgb, var(--surface-2) 90%, var(--muted)); border-radius: 4px 4px 0 0; min-height: 4px; transition: height var(--dur-med) var(--ease-out); }
.bento-week i.has { background: linear-gradient(180deg, var(--pine), var(--fjord)); }
@media (min-width: 600px) {
  .bento { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4); }
  .bento-continue { grid-column: 1 / 3; grid-row: 1 / 3; min-height: 0; }
  .bento-word { grid-column: 3 / 5; min-height: 0; }
  .bento-progress { grid-column: 3 / 5; min-height: 0; }
}
@media (min-width: 1200px) {
  .bento { gap: var(--sp-5); }
}

/* ---------- Путь обучения (домашний экран) ---------- */
.unit { margin-bottom: 26px; }
.unit-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; min-width: 0; }
.unit-head > * { min-width: 0; }
.unit-head .flex-1, .unit-head h3 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.unit-head .num {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--fjord-soft) 70%, var(--surface));
  color: var(--fjord-2);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fjord) 18%, transparent);
}
.lesson-path { display: grid; gap: var(--sp-3); }
.node {
  display: flex; align-items: center; gap: var(--sp-3);
  background: var(--surface);
  border: none;
  border-radius: var(--radius-lg);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow-sm), var(--shadow-inset);
  cursor: pointer;
  min-width: 0;
  transition:
    transform var(--dur-med) var(--ease-out),
    box-shadow var(--dur-med) var(--ease-out);
  will-change: transform;
}
.node:hover { transform: translate3d(0, -2px, 0); box-shadow: var(--shadow-lg), var(--shadow-inset); }
.node:active { transform: scale(.985); transition-duration: var(--dur-fast); }
.node.locked { opacity: .5; cursor: not-allowed; filter: grayscale(.15); }
.node.locked:hover { transform: none; box-shadow: var(--shadow-sm); }
.node.done { box-shadow: var(--shadow-sm), 0 0 0 1px color-mix(in srgb, var(--fjord) 18%, transparent); }
.node .bubble {
  width: 52px; height: 52px; border-radius: var(--radius-lg); flex: none;
  display: grid; place-items: center; color: var(--fjord);
  background: var(--surface-2);
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 25%, transparent);
}
.node-bubble {
  width: 52px; height: 52px; border-radius: var(--radius-lg); flex: none;
  display: grid; place-items: center; color: var(--fjord);
  background: var(--surface-2);
}
.node.done .bubble { background: linear-gradient(165deg, var(--fjord), var(--fjord-2)); color: #fff; }
.node .meta { display: grid; gap: 4px; flex: 1; min-width: 0; }
.node .meta .t { font-weight: 700; letter-spacing: -0.012em; overflow-wrap: anywhere; }
.node .stars { color: var(--gold); font-size: var(--text-sm); letter-spacing: 2px; flex-shrink: 0; }
.node .go { color: var(--muted-2); display: inline-flex; align-items: center; margin-left: auto; flex-shrink: 0; }

/* ---------- Урок ---------- */
.lesson-top { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-4); flex-wrap: wrap; min-width: 0; }
.lesson-top .progress { flex: 1 1 140px; min-width: 0; }
.lesson-top .btn, .lesson-top .chip, .lesson-top .icon-btn { flex-shrink: 0; }
.lesson-top .intensity-badge { margin-left: auto; flex-shrink: 0; }
.lesson-progress-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--text-sm); font-weight: 700; color: var(--muted);
  min-width: 72px;
}
.lesson-counter { font-variant-numeric: tabular-nums; }
.combo-badge {
  background: linear-gradient(135deg, var(--gold), #e6a23c);
  color: #1a1200;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}
.bento-dual {
  display: grid;
  gap: var(--sp-3);
  grid-template-columns: 1fr;
}
.bento-srs-quick {
  background: linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--fjord-soft) 45%, var(--surface)));
  border: none;
  box-shadow: var(--shadow-sm), 0 0 0 1px color-mix(in srgb, var(--fjord) 14%, transparent);
  text-align: left;
  padding: var(--sp-5);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: transform var(--dur-med) var(--ease-out), box-shadow var(--dur-med) var(--ease-out);
  will-change: transform;
}
.bento-srs-quick:hover { transform: translate3d(0, -2px, 0); box-shadow: var(--shadow-lg); }
.bento-srs-quick:active { transform: scale(.985); transition-duration: var(--dur-fast); }
.bento-srs-quick .bt-title { font-size: clamp(17px, 3.5vw, 20px); }
@media (min-width: 640px) {
  .bento-dual { grid-template-columns: 1.2fr 1fr; }
}
.hearts { display: flex; gap: 3px; }
.hearts .icon-heart { color: var(--muted-2); }
.hearts .heart-full { color: var(--bad); }
.exercise { animation: exerciseIn var(--dur-med) var(--ease-out) both; }
@keyframes exerciseIn {
  from { opacity: 0; transform: translate3d(0, 6px, 0) scale(.992); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}
.prompt-big { font-size: clamp(22px, 5vw, 30px); font-weight: 800; letter-spacing: -0.024em; margin: var(--sp-2) 0 var(--sp-1); line-height: 1.22; }
.prompt-big.md { font-size: clamp(20px, 4.5vw, 24px); }
.prompt-big.lg { font-size: clamp(24px, 5.5vw, 42px); }
.prompt-big.mt-3 { margin-top: var(--sp-3); }
.prompt-big.mb-3 { margin-bottom: var(--sp-3); }
.prompt-big .ipa { font-weight: 500; font-size: 0.72em; letter-spacing: 0.03em; }
.options { display: grid; gap: var(--sp-3); margin-top: var(--sp-2); }
.opt {
  display: flex; align-items: center; gap: var(--sp-3);
  border: none;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: var(--sp-4) var(--sp-5);
  cursor: pointer;
  font-size: var(--text-lg);
  box-shadow: var(--shadow-sm), inset 0 0 0 1.5px color-mix(in srgb, var(--line) 70%, transparent);
  transition:
    transform var(--dur-fast) var(--ease-snap),
    box-shadow var(--dur-med) var(--ease-out),
    background var(--dur-med) var(--ease-out);
  text-align: left;
  will-change: transform;
}
.opt:hover { box-shadow: var(--shadow), inset 0 0 0 1.5px color-mix(in srgb, var(--fjord) 35%, transparent); }
.opt:active { transform: scale(.985); }
.opt.sel { box-shadow: var(--shadow-sm), inset 0 0 0 2px var(--fjord); background: color-mix(in srgb, var(--fjord-soft) 65%, var(--surface)); }
.opt.correct {
  animation: answerPop var(--dur-slow) var(--ease-snap) both;
  box-shadow: var(--shadow-sm), inset 0 0 0 2px var(--good);
  background: color-mix(in srgb, var(--good) 12%, var(--surface));
}
.opt.wrong {
  animation: answerShake .36s var(--ease-out) both;
  box-shadow: var(--shadow-sm), inset 0 0 0 2px var(--bad);
  background: color-mix(in srgb, var(--bad) 10%, var(--surface));
}
@keyframes answerPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.02); }
  100% { transform: scale(1); }
}
@keyframes answerShake {
  0%, 100% { transform: translate3d(0, 0, 0); }
  20% { transform: translate3d(-5px, 0, 0); }
  40% { transform: translate3d(5px, 0, 0); }
  60% { transform: translate3d(-3px, 0, 0); }
  80% { transform: translate3d(3px, 0, 0); }
}
.opt .key {
  width: 26px; height: 26px; border-radius: var(--radius-xs);
  display: grid; place-items: center; font-size: 12px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 80%, transparent);
  color: var(--muted); flex: none;
}

/* Сборка предложения из слов */
.builder { display: grid; gap: var(--sp-4); }
.builder .answer-area { min-height: 62px; border-bottom: 2px dashed color-mix(in srgb, var(--line) 90%, transparent); padding: var(--sp-2) 0; display: flex; flex-wrap: wrap; gap: var(--sp-2); align-content: flex-start; }
.builder .bank { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.token {
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: none;
  box-shadow: var(--shadow-sm), inset 0 0 0 1px color-mix(in srgb, var(--line) 70%, transparent);
  cursor: pointer; font-size: 16px;
  transition: transform var(--dur-fast) var(--ease-snap), opacity var(--dur-med) var(--ease-out), box-shadow var(--dur-med) var(--ease-out);
  will-change: transform;
}
.token:hover { box-shadow: var(--shadow), inset 0 0 0 1px color-mix(in srgb, var(--fjord) 25%, transparent); }
.token:active { transform: scale(.96); }
.token.used { opacity: .28; pointer-events: none; }

/* Совпадение пар */
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.match-cell {
  padding: var(--sp-4); border-radius: var(--radius-sm);
  border: none;
  background: var(--surface);
  box-shadow: var(--shadow-sm), inset 0 0 0 1.5px color-mix(in srgb, var(--line) 70%, transparent);
  cursor: pointer; text-align: center; font-size: 15px;
  transition: transform var(--dur-fast) var(--ease-snap), box-shadow var(--dur-med) var(--ease-out);
  will-change: transform;
}
.match-cell:hover { box-shadow: var(--shadow), inset 0 0 0 1.5px color-mix(in srgb, var(--fjord) 30%, transparent); }
.match-cell:active { transform: scale(.985); }
.match-cell.sel { box-shadow: var(--shadow-sm), inset 0 0 0 2px var(--fjord); background: color-mix(in srgb, var(--fjord-soft) 60%, var(--surface)); }
.match-cell.done { opacity: .35; pointer-events: none; box-shadow: var(--shadow-sm), inset 0 0 0 2px var(--good); }
.match-cell.miss { animation: shake .28s var(--ease-out); }
@keyframes shake {
  0%, 100% { transform: translate3d(0, 0, 0); }
  25% { transform: translate3d(-4px, 0, 0); }
  75% { transform: translate3d(4px, 0, 0); }
}

/* Нижняя плашка проверки */
.checkbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, transparent 0%, color-mix(in srgb, var(--bg) 88%, transparent) 32%, var(--bg) 100%);
  padding: var(--sp-3) clamp(var(--sp-4), 4vw, var(--sp-8)) calc(var(--sp-4) + env(safe-area-inset-bottom));
  border-top: none;
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  z-index: 120;
  pointer-events: none;
}
.checkbar .inner, .checkbar button { pointer-events: auto; }
.checkbar .inner { max-width: var(--maxw); margin: 0 auto; display: grid; gap: 10px; }
.feedback { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.feedback.good { color: var(--good); }
.feedback.bad { color: var(--bad); }
.feedback .sol { font-weight: 500; color: var(--muted); }

/* ---------- Словарь ---------- */
.search { position: relative; margin-bottom: 14px; }
.search input { padding-left: 42px; }
.search .mag { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted-2); }
.word-card { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; }
.word-card .wc-main { flex: 1; min-width: 0; }
.word-card .wc-nor { font-weight: 700; font-size: 17px; }
.word-card .wc-ru { color: var(--muted); font-size: 14px; }
.word-card .wc-ipa { color: var(--fjord-2); font-size: var(--text-sm); letter-spacing: 0.03em; }

/* Словарь — компактные строки */
.dict-list { gap: var(--sp-2); }
.dict-scope { margin-bottom: var(--sp-2); }
.dict-row {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px color-mix(in srgb, var(--line) 68%, transparent);
  transition: box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.dict-row:hover {
  box-shadow: var(--shadow-md), inset 0 0 0 1px color-mix(in srgb, var(--fjord) 14%, var(--line));
}
.dict-row-body { flex: 1; min-width: 0; }
.dict-row-top { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: 2px; }
.dict-nor { font-weight: 700; font-size: var(--text-lg); letter-spacing: -.01em; }
.dict-gloss { color: var(--muted); font-size: var(--text-sm); line-height: 1.35; }
.dict-meta { display: flex; align-items: center; gap: var(--sp-2); margin-top: 4px; flex-wrap: wrap; }
.dict-ipa { color: var(--fjord-2); font-size: var(--text-xs); letter-spacing: 0.03em; }
.dict-unit { font-size: var(--text-xs); color: var(--muted-2); font-weight: 600; }
.dict-cloud { font-size: var(--text-xs); color: var(--muted-2); opacity: .75; flex: none; }
.dict-mastery {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 8px; border-radius: var(--radius-full); flex: none;
}
.dict-mastery.new { background: var(--surface-2); color: var(--muted-2); }
.dict-mastery.learning { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.dict-mastery.known { background: var(--fjord-soft); color: var(--fjord-2); }
.dict-mastery.mastered { background: var(--pine-soft); color: var(--pine); }
.pos-tag {
  font-size: 11px; padding: 2px 7px; border-radius: 6px;
  background: var(--surface-2); color: var(--muted-2);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 75%, transparent);
}

/* ---------- Грамматика ---------- */
.rule { margin-bottom: 14px; }
.rule h3 { display: flex; align-items: center; gap: 8px; }
.rule table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 14px; }
.rule th, .rule td { border: 1px solid color-mix(in srgb, var(--line) 60%, transparent); padding: 8px 10px; text-align: left; }
.rule th { background: var(--surface-2); color: var(--muted); font-weight: 700; }
.example { padding: 10px 12px; border-left: 3px solid var(--fjord); background: var(--fjord-soft); border-radius: 0 10px 10px 0; margin: 8px 0; }
.example .e-nor { font-weight: 700; }
.example .e-ru { color: var(--muted); font-size: 14px; }
.example.tip { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, var(--surface)); }

/* Тултип-перевод по слову */
.tw { all: unset; cursor: pointer; border-bottom: 1.5px dotted var(--fjord); padding-bottom: 1px; }
.tw:hover, .tw:focus-visible { background: var(--fjord-soft); border-radius: 4px; }
.tw-pop {
  position: fixed; z-index: 140; background: var(--surface);
  border: none;
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 10px 12px;
  display: flex; align-items: center; gap: 8px; font-size: 14px; max-width: 220px;
  animation: popIn .15s var(--ease);
}
.tw-pop .tw-pop-ru { font-weight: 700; }
.tw-pop .tw-pop-ipa { color: var(--fjord); font-size: 12px; }
@keyframes popIn { from { opacity: 0; transform: translateY(4px) scale(.96); } to { opacity: 1; transform: none; } }

/* ---------- Видео ---------- */
.video-wrap { position: relative; padding-top: 56.25%; border-radius: var(--radius-sm); overflow: hidden; border: none; box-shadow: var(--shadow-sm); background: #000; }
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-list { display: grid; gap: 12px; }
.video-player-panel { margin-bottom: 24px; }
.video-player-title { margin: 8px 0 6px; font-size: 1.35rem; }
.video-player-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.video-intro { margin-top: 14px; background: var(--fjord-soft); border-color: var(--fjord); }
.video-takeaways { margin-top: 14px; }
.video-takeaways ul { margin: 8px 0 0; padding-left: 1.2em; }
.video-card { text-align: left; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.video-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.video-card.watched { box-shadow: var(--shadow-sm), inset 0 0 0 2px color-mix(in srgb, var(--good) 55%, transparent); opacity: .92; }
.video-card-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.video-custom { margin-bottom: 18px; }
.video-detail .video-back { align-self: flex-start; }
.unit-video-strip h4 { margin-bottom: 8px; }

/* ---------- Онбординг / тест ---------- */
.onb { max-width: 560px; margin: 0 auto; }
.steps { display: flex; gap: 6px; margin-bottom: 22px; }
.steps i { height: 6px; flex: 1; border-radius: 4px; background: var(--surface-2); }
.steps i.on { background: var(--fjord); }
.choice-grid { display: grid; gap: 12px; }
.choice {
  display: flex; align-items: center; gap: var(--sp-4); text-align: left;
  border: none;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  box-shadow: var(--shadow-sm), inset 0 0 0 1.5px color-mix(in srgb, var(--line) 70%, transparent);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-snap), box-shadow var(--dur-med) var(--ease-out);
  will-change: transform;
}
.choice:hover { box-shadow: var(--shadow), inset 0 0 0 1.5px color-mix(in srgb, var(--fjord) 30%, transparent); }
.choice:active { transform: scale(.985); }
.choice.on { box-shadow: var(--shadow-sm), inset 0 0 0 2px var(--fjord); background: color-mix(in srgb, var(--fjord-soft) 60%, var(--surface)); }
.choice .emoji { display: flex; color: var(--fjord); }
.choice .c-meta { display: grid; gap: 2px; }
.choice .c-meta b { font-size: 15px; }

/* ---------- Профиль / настройки ---------- */
.setting-row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4) 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
.setting-row:last-child { border-bottom: 0; }
.setting-row .sr-meta { flex: 1; }
.switch { position: relative; width: 50px; height: 28px; flex: none; }
.switch input { display: none; }
.switch .track {
  position: absolute; inset: 0; border-radius: var(--radius-full);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 80%, transparent);
  transition: background var(--dur-med) var(--ease-out), box-shadow var(--dur-med) var(--ease-out);
}
.switch input:checked + .track { background: var(--fjord); box-shadow: none; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform var(--dur-med) var(--ease-out); box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch input:checked + .track + .knob { transform: translateX(22px); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 96px), 1fr)); gap: var(--sp-2); }
.stat-box {
  background: var(--surface); border: none;
  border-radius: var(--radius-sm); padding: var(--sp-4); text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-fast) var(--ease-snap), box-shadow var(--dur-med) var(--ease-out);
  will-change: transform;
}
.stat-box:hover { box-shadow: var(--shadow); }
.stat-box:active { transform: scale(.97); }
.stat-box-ico { display: flex; justify-content: center; color: var(--fjord); margin-bottom: 4px; }
.stat-box .v { font-size: 24px; font-weight: 800; }
.stat-box .l { font-size: 12px; color: var(--muted-2); }

/* ---------- ИИ-тьютор ---------- */
.ai-chat { display: grid; gap: 12px; }
.msg { padding: 12px 14px; border-radius: var(--radius-sm); max-width: 92%; line-height: 1.5; font-size: 15px; white-space: pre-wrap; border: none; }
.msg.user { background: color-mix(in srgb, var(--fjord-soft) 75%, var(--surface)); box-shadow: var(--shadow-sm), 0 0 0 1px color-mix(in srgb, var(--fjord) 18%, transparent); justify-self: end; }
.msg.ai { background: var(--surface-2); box-shadow: var(--shadow-sm); justify-self: start; }
.msg.ai .ru { color: var(--muted); }
.msg.ai .nor, .msg.ai .tw { color: var(--fjord-2); }

/* ---------- Подписка ---------- */
.plan-grid {
  display: grid;
  gap: var(--sp-3);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  align-items: stretch;
}
.plan-card {
  position: relative; border: none;
  background: var(--surface); border-radius: var(--radius-lg); padding: var(--sp-4);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-sm), inset 0 0 0 1.5px color-mix(in srgb, var(--line) 70%, transparent);
  transition: transform var(--dur-fast) var(--ease-snap), box-shadow var(--dur-med) var(--ease-out);
}
.plan-card.current { box-shadow: var(--shadow-sm), inset 0 0 0 2px var(--fjord); background: color-mix(in srgb, var(--fjord-soft) 55%, var(--surface)); }
.plan-card.popular { box-shadow: var(--shadow), inset 0 0 0 2px color-mix(in srgb, var(--terracotta) 45%, transparent); }
.plan-badge {
  position: absolute; top: -10px; right: 14px;
  background: var(--terracotta); color: #fff; font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: var(--radius-full);
}
.plan-card .pc-name { font-weight: 800; font-size: 16px; margin-bottom: 4px; }
.plan-launch-note {
  font-size: 12px;
  color: var(--terracotta);
  font-weight: 600;
  margin: 0 0 var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--terracotta) 12%, var(--surface));
}
.plan-card .pc-price-block { margin-bottom: 6px; }
.plan-card .pc-price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}
.plan-card .pc-price-old {
  color: var(--muted-2);
  font-size: 12px;
  text-decoration: line-through;
}
.plan-card .pc-price-sale {
  color: var(--fjord);
  font-weight: 800;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}
.plan-card .pc-discount-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--terracotta);
  border-radius: 4px;
  padding: 2px 6px;
  margin-bottom: 4px;
}
.plan-card .pc-price { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.plan-card .pc-demo { color: var(--muted-2); font-size: 11px; margin-bottom: 10px; }
.plan-card ul { margin: 0 0 12px; padding-left: 18px; color: var(--muted); font-size: 13px; flex: 1; }
.plan-card li { margin-bottom: 4px; }
.plan-card.yearly { margin-top: var(--sp-3); }
.plan-card.plan-yearly { box-shadow: var(--shadow-sm), inset 0 0 0 1.5px dashed color-mix(in srgb, var(--fjord) 45%, transparent); }
.plan-card.plan-family { box-shadow: var(--shadow-sm), inset 0 0 0 1.5px dashed color-mix(in srgb, var(--gold) 50%, transparent); }
.plan-card .pc-icon { color: var(--fjord); margin-bottom: var(--sp-1); }
.trial-banner {
  padding: var(--sp-4); border-radius: var(--radius-sm);
  background: var(--fjord-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fjord) 35%, transparent);
  margin-bottom: var(--sp-3);
}
.trial-banner h3 { margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.trial-banner p { margin-bottom: var(--sp-3); }
.subscription-section .section-title { margin-bottom: var(--sp-3); }
.quota-row { margin-top: var(--sp-2); }
.quota-bar { height: 8px; background: var(--surface-2); border-radius: var(--radius-full); overflow: hidden; border: none; box-shadow: inset 0 1px 2px color-mix(in srgb, var(--text) 6%, transparent); margin-top: 6px; }
.quota-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--fjord), var(--fjord-2)); transition: width .3s var(--ease), background-color .3s var(--ease); }
.quota-bar.warn > i { background: var(--warn); }
.quota-bar.exhausted > i { background: var(--bad); }

/* ---------- Офлайн-индикатор ---------- */
.offline-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 70;
  padding: calc(6px + env(safe-area-inset-top)) 12px 6px;
  text-align: center; font-size: 12px; font-weight: 700;
  color: #fff; background: color-mix(in srgb, var(--bad) 88%, #000);
  box-shadow: 0 2px 12px color-mix(in srgb, var(--bad) 40%, transparent);
  animation: offlineIn var(--dur-med) var(--ease-snap) both;
}
@keyframes offlineIn {
  from { opacity: 0; transform: translate3d(0, -100%, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}
body.is-offline #app {
  padding-top: calc(28px + env(safe-area-inset-top));
}

/* ---------- Тосты / прочее ---------- */
.toast {
  position: fixed; left: 50%;
  bottom: calc(var(--tabbar-h) + var(--sp-4) + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 12px 18px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  font-weight: 700; z-index: 130; animation: toastIn var(--dur-med) var(--ease-snap) both;
  max-width: min(92vw, 420px);
  pointer-events: none;
}
@keyframes toastIn {
  from { opacity: 0; transform: translate3d(-50%, 8px, 0) scale(.96); }
  to { opacity: 1; transform: translate3d(-50%, 0, 0) scale(1); }
}
body.has-checkbar .toast {
  bottom: calc(var(--checkbar-h) + var(--sp-3) + env(safe-area-inset-bottom));
}
.empty { text-align: center; padding: 40px 20px; color: var(--muted-2); }
.empty .big { display: flex; justify-content: center; margin-bottom: 8px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.link { color: var(--fjord); cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ---------- Профиль: hero / кольцо / достижения / друзья ---------- */
.profile-hero {
  display: flex; align-items: center; gap: 16px; margin-bottom: 18px;
  flex-wrap: wrap;
}
.profile-hero .avatar {
  width: 64px; height: 64px; border-radius: var(--radius-lg); flex: none;
  display: grid; place-items: center; font-size: 26px; font-weight: 800;
  background: linear-gradient(145deg, var(--fjord-soft), var(--pine-soft));
  border: none;
  box-shadow: var(--shadow-sm), 0 0 0 1px color-mix(in srgb, var(--fjord) 22%, transparent);
  color: var(--fjord-2);
}
.profile-hero .ph-meta { flex: 1; min-width: 0; }
.profile-hero .ph-name { font-size: 19px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 2px; }
.profile-hero .ph-tagline { color: var(--muted); font-size: 13px; }
.profile-hero .ph-rings { display: flex; gap: 10px; flex: none; }

@media (max-width: 520px) {
  .profile-hero .ph-rings { width: 100%; justify-content: center; margin-top: 4px; }
  .profile-hero .ph-meta { flex-basis: calc(100% - 80px); }
}

.ring {
  position: relative; flex: none; border-radius: 50%;
  background: conic-gradient(var(--fjord) calc(var(--pct, 0) * 3.6deg), var(--surface-2) 0deg);
  transition: --pct 1s var(--ease);
}
@property --pct {
  syntax: '<number>';
  inherits: true;
  initial-value: 0;
}
.ring::before { content: ''; position: absolute; inset: 8px; border-radius: 50%; background: var(--surface); }
.ring .ring-label {
  position: absolute; inset: 8px; z-index: 1; border-radius: 50%;
  display: grid; place-items: center; text-align: center; line-height: 1.15;
}
.ring .ring-label b { display: block; font-size: 15px; }
.ring .ring-label span { display: block; font-size: 10px; color: var(--muted-2); }

.achv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.achv-badge {
  text-align: center; padding: 12px 8px; border-radius: var(--radius-lg);
  background: var(--surface); border: none; box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-snap), box-shadow var(--dur-med) var(--ease-out);
}
.achv-badge:hover { box-shadow: var(--shadow); }
.achv-badge:active { transform: scale(.96); }
.achv-badge .achv-ico { display: flex; justify-content: center; color: var(--fjord); margin-bottom: 4px; }
.achv-badge .achv-title { font-size: 11px; font-weight: 700; }
.achv-badge .achv-sub { font-size: 10px; color: var(--muted-2); margin-top: 2px; }
.achv-badge.unlocked { box-shadow: var(--shadow-sm), 0 0 0 1px color-mix(in srgb, var(--fjord) 20%, transparent); background: color-mix(in srgb, var(--fjord-soft) 50%, var(--surface)); }
.achv-badge.locked { opacity: .4; filter: grayscale(1); }
.achv-badge.locked .achv-ico { color: var(--muted-2); }

.friends-preview-card { cursor: pointer; }
.avatar-stack { display: flex; }
.avatar-mini {
  width: 30px; height: 30px; border-radius: var(--radius-xs); margin-left: -8px;
  display: grid; place-items: center; font-size: 12px; font-weight: 800;
  background: var(--surface-2); border: 2px solid var(--surface); color: var(--text);
}
.avatar-stack .avatar-mini:first-child { margin-left: 0; }

.leader-row {
  display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-lg); background: var(--surface);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-2);
}
.leader-row.me { background: color-mix(in srgb, var(--fjord-soft) 55%, var(--surface)); box-shadow: var(--shadow-sm), 0 0 0 1px color-mix(in srgb, var(--fjord) 12%, transparent); }
.leader-row .lr-rank { width: 22px; text-align: center; font-weight: 800; color: var(--muted-2); flex: none; }
.leader-row .lr-name { flex: 1; min-width: 0; font-weight: 700; }
.leader-row .lr-stats { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); flex: none; }

/* ---------- Стаггер-анимация для списков ---------- */
.stagger > * { animation: itemIn var(--dur-med) var(--ease-out) both; }
@keyframes itemIn {
  from { opacity: 0; transform: translate3d(0, 6px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 24ms; }
.stagger > *:nth-child(3) { animation-delay: 48ms; }
.stagger > *:nth-child(4) { animation-delay: 72ms; }
.stagger > *:nth-child(5) { animation-delay: 96ms; }
.stagger > *:nth-child(6) { animation-delay: 120ms; }
.stagger > *:nth-child(7) { animation-delay: 144ms; }
.stagger > *:nth-child(8) { animation-delay: 168ms; }
.stagger > *:nth-child(n+9) { animation-delay: 192ms; }

/* ---------- Единая микро-интерактивность ---------- */
.chip:active { transform: scale(.96); }
.tab:active { transform: scale(.96); }

/* ---------- Таб-бар ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center; gap: 4px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  border-top: none;
  box-shadow: 0 -8px 32px -12px color-mix(in srgb, var(--text) 12%, transparent);
  padding: 8px clamp(8px, 2vw, 16px) calc(8px + env(safe-area-inset-bottom));
  z-index: 100;
  max-width: 100vw;
}
.tabbar .tab {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  color: var(--muted-2); font-family: inherit;
  display: grid; place-items: center; gap: 2px;
  padding: 6px 14px; border-radius: var(--radius-sm); min-width: 64px;
  transition: color var(--dur-med) var(--ease-out), background var(--dur-med) var(--ease-out), transform var(--dur-fast) var(--ease-snap);
  will-change: transform;
}
.tabbar .tab .tab-txt { font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.01em; }
.tabbar .tab.on { color: var(--fjord); background: color-mix(in srgb, var(--fjord-soft) 75%, transparent); }
.tabbar .tab.on .tab-ico { animation: tabPop .28s var(--ease-snap); }
@keyframes tabPop {
  0% { transform: scale3d(1, 1, 1); }
  45% { transform: scale3d(1.12, 1.12, 1); }
  100% { transform: scale3d(1, 1, 1); }
}

/* ---------- Адаптив ---------- */
@media (min-width: 600px) {
  .choice-grid { grid-template-columns: 1fr 1fr; }
  .video-list { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 720px) {
  .tabbar { left: 50%; transform: translateX(-50%); width: auto; border-radius: 18px 18px 0 0; }
  .match-grid { grid-template-columns: 1fr 1fr 1fr 1fr; }
}
@media (min-width: 900px) {
  :root { --maxw: 1080px; }
  .achv-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .video-list { grid-template-columns: 1fr 1fr 1fr; }
  .onb { max-width: 640px; }
}
@media (min-width: 1200px) {
  :root { --maxw: 1180px; }
}
@media (min-width: 1440px) {
  :root { --maxw: 1240px; }
  #app { padding-top: var(--sp-8); }
}
@media (max-width: 380px) {
  .tabbar .tab { min-width: 56px; padding: 6px 8px; }
  .stat-pills .pill { padding: 6px 8px; }
  #app { padding-left: var(--sp-3); padding-right: var(--sp-3); }
  .bento-tile { padding: var(--sp-4); }
  .card { padding: var(--sp-4); }
  .prompt-big { font-size: clamp(20px, 6vw, 26px); }
}
@media (max-width: 320px) {
  .tabbar .tab .tab-txt { display: none; }
  .tabbar .tab { min-width: 48px; padding: 8px 10px; }
  .bento { gap: var(--sp-2); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .icon-btn.pulse { animation: none !important; }
  #bg-fx .blob { opacity: 0.25; }
}

/* ---------- Crash screen ---------- */
.crash-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: min(70vh, 600px); padding: 24px 16px; text-align: center;
}
.crash-screen > svg, .crash-screen > .ico { color: var(--bad); margin-bottom: 12px; }
.crash-card { max-width: 420px; width: 100%; }
.crash-card h1 { font-size: 1.35rem; margin-bottom: 8px; }
.crash-msg { color: var(--bad); margin: 10px 0; word-break: break-word; }
.crash-details { text-align: left; margin-top: 12px; }
.crash-details pre {
  margin-top: 8px; padding: 10px; border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: 11px; overflow: auto; max-height: 160px;
}

/* ============================================================
   Home polish · utilities · glass
   ============================================================ */
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.mt-3 { margin-top: var(--sp-3); }
.muted { color: var(--muted-2); }
.flex-1 { flex: 1; min-width: 0; }
.go { color: var(--muted-2); display: inline-flex; align-items: center; }

.section-title {
  font-size: var(--text-lg);
  font-weight: 800;
  letter-spacing: -.02em;
  margin: var(--sp-6) 0 var(--sp-3);
  color: var(--text);
}

.level-group {
  border: none;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.level-group-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  color: inherit;
}
.level-group-head h3 { font-size: var(--text-base); font-weight: 800; }
.level-group-head .level-progress { display: block; color: var(--muted); font-size: var(--text-sm); margin-top: 2px; }
.level-group-body { padding: 0 var(--sp-3) var(--sp-4); }
.level-group-body .unit { margin-bottom: var(--sp-4); }
.level-group-body .unit:last-child { margin-bottom: 0; }

.home-hero {
  display: grid;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
  min-width: 0;
}
.home-hero > * { min-width: 0; }
.home-hero .hero-plan {
  background: var(--surface);
  border: none;
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  box-shadow: var(--shadow-sm);
}
.home-hero .hero-plan-head {
  display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3);
}
.home-hero .hero-plan-head h3 { margin: 0; font-size: var(--text-lg); }
.home-hero .plan-step {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; text-align: left;
  padding: var(--sp-3);
  border-radius: var(--radius-sm);
  border: none;
  background: var(--surface-2);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px color-mix(in srgb, var(--line) 65%, transparent);
  transition: transform var(--dur-fast) var(--ease-snap), box-shadow var(--dur-med) var(--ease-out);
  will-change: transform;
}
.home-hero .plan-step:hover { box-shadow: var(--shadow), inset 0 0 0 1px color-mix(in srgb, var(--fjord) 28%, transparent); transform: translate3d(0, -1px, 0); }
.home-hero .plan-step.primary {
  background: linear-gradient(165deg, var(--surface), color-mix(in srgb, var(--fjord-soft) 80%, var(--surface)) 180%);
  box-shadow: var(--shadow-sm), inset 0 0 0 1.5px color-mix(in srgb, var(--fjord) 22%, transparent);
}
.home-hero .plan-step .ps-meta { flex: 1; min-width: 0; }
.home-hero .plan-step .ps-meta b { display: block; font-size: var(--text-base); }
.home-hero .plan-steps { display: grid; gap: var(--sp-2); }

.bento-compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: var(--sp-4);
}
.bento-compact .bento-word,
.bento-compact .bento-progress {
  grid-column: auto;
  min-height: 96px;
}
@media (max-width: 480px) {
  .bento-compact { grid-template-columns: 1fr; }
}

.card.glass {
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

details.insights {
  margin-bottom: var(--sp-4);
  border: none;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
details.insights > summary {
  list-style: none;
  cursor: pointer;
  padding: var(--sp-4);
  font-weight: 700;
  display: flex; align-items: center; gap: var(--sp-2);
}
details.insights > summary::-webkit-details-marker { display: none; }
details.insights > summary::after {
  content: '▾';
  margin-left: auto;
  color: var(--muted-2);
  transition: transform .2s var(--ease);
}
details.insights[open] > summary::after { transform: rotate(180deg); }
details.insights .insights-body {
  padding: 0 var(--sp-4) var(--sp-4);
  display: grid; gap: var(--sp-3);
  border-top: 1px solid color-mix(in srgb, var(--line) 65%, transparent);
}

.card-row-link {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; text-align: left;
}
.card-row-link .cr-icon { color: var(--fjord); flex: none; }
.card-row-link .cr-body { flex: 1; min-width: 0; }
.card-row-link .cr-body h3 { margin: 0 0 2px; font-size: var(--text-base); }
.card-row-link .cr-body p { margin: 0; font-size: var(--text-sm); color: var(--muted); }

.promo-card {
  margin-bottom: var(--sp-3);
  box-shadow: var(--shadow-sm), var(--shadow-inset), 0 0 0 1px color-mix(in srgb, var(--fjord) 16%, transparent);
  background: linear-gradient(165deg, var(--surface), color-mix(in srgb, var(--fjord-soft) 45%, var(--surface)));
}

.feedback-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); width: 100%; }

@media (min-width: 720px) {
  .home-hero { grid-template-columns: 1.15fr 1fr; align-items: stretch; }
  .home-hero .bento-continue { min-height: 100%; margin: 0; }
  .home-hero .bento-dual { min-height: 100%; }
}

/* ============================================================
   Profile · Practice · Onboarding · Grammar · Dictionary
   ============================================================ */
.section-card { margin-bottom: var(--sp-4); }
.section-card > h3 { margin-bottom: var(--sp-3); }

.page-footer {
  margin-top: var(--sp-6);
  text-align: center;
  color: var(--muted-2);
  font-size: var(--text-xs);
}

.install-banner {
  position: fixed;
  bottom: calc(var(--tabbar-h) + var(--sp-3) + env(safe-area-inset-bottom, 0px));
  left: clamp(var(--sp-3), 3vw, var(--sp-4));
  right: clamp(var(--sp-3), 3vw, var(--sp-4));
  z-index: 110;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
}
.install-banner span { flex: 1; }
@media (min-width: 720px) {
  .install-banner { left: 50%; transform: translateX(-50%); max-width: 480px; right: auto; }
}

.profile-stat-grid { margin-bottom: var(--sp-4); }

.checkpoint-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-2) var(--sp-3);
  border: none;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 70%, transparent);
}

.rubric-row { display: flex; align-items: center; gap: var(--sp-2); }
.rubric-row .rubric-label { min-width: 78px; font-size: var(--text-sm); color: var(--muted); }
.rubric-row .mini-bar {
  flex: 1; height: 8px; background: var(--surface-2);
  border-radius: var(--radius-full); overflow: hidden;
  box-shadow: inset 0 1px 2px color-mix(in srgb, var(--text) 6%, transparent);
}
.rubric-row .mini-bar > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--fjord), var(--pine));
  border-radius: var(--radius-full);
  transition: width .4s var(--ease);
}
.rubric-row .rubric-val { min-width: 38px; text-align: right; font-size: var(--text-xs); color: var(--muted-2); }

/* Practice hub */
.practice-grid { display: grid; gap: var(--sp-3); }
.practice-tile {
  width: 100%; text-align: left;
  transition: transform var(--dur-med) var(--ease-out), box-shadow var(--dur-med) var(--ease-out);
  will-change: transform;
}
.practice-tile:hover { transform: translate3d(0, -2px, 0); box-shadow: var(--shadow-lg), var(--shadow-inset); }
.practice-tile:active { transform: scale(.985); transition-duration: var(--dur-fast); }
.practice-tile.accent {
  box-shadow: var(--shadow-sm), var(--shadow-inset), 0 0 0 1px color-mix(in srgb, var(--fjord) 18%, transparent);
  background: linear-gradient(165deg, var(--surface), color-mix(in srgb, var(--fjord-soft) 70%, var(--surface)) 180%);
}
.practice-tile .pt-icon {
  width: 48px; height: 48px; border-radius: var(--radius-sm);
  display: grid; place-items: center;
  background: var(--surface-2); color: var(--fjord);
  flex: none;
}
.video-intro-lang { margin-bottom: var(--sp-2); }
.video-intro-lang .tiny { display: block; margin-bottom: 2px; font-weight: 600; letter-spacing: .04em; }
.video-recommended .video-card.compact { padding: var(--sp-3); }
.practice-tile .pt-title {
  font-weight: 600;
  line-height: 1.25;
  word-break: normal;
  overflow-wrap: break-word;
}
.practice-tile.accent .pt-icon { background: color-mix(in srgb, var(--fjord) 12%, var(--surface)); }

.immersive-panel { min-height: min(52vh, 420px); }

.finish-screen {
  max-width: 520px; margin: 0 auto;
  text-align: center;
}
.finish-screen .finish-icon { color: var(--fjord); margin-bottom: var(--sp-3); display: flex; justify-content: center; }
.finish-screen .finish-badge { font-size: var(--text-base); padding: var(--sp-2) var(--sp-4); margin: var(--sp-2) 0; }
.finish-actions { display: grid; gap: var(--sp-2); margin-top: var(--sp-4); }

/* Onboarding */
.onb { max-width: 560px; margin: 0 auto; padding-bottom: var(--sp-6); }
.onb-hero { text-align: center; }
.onb-hero .brandmark { font-size: var(--text-xl); margin-bottom: var(--sp-3); justify-content: center; }
.onb-badges { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: center; margin: var(--sp-4) 0; }
.onb-actions { display: grid; gap: var(--sp-2); margin-top: var(--sp-4); }
.onb-meta { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-2); flex-wrap: wrap; }
.onb-meta .spacer { flex: 1; }
.onb-hint { margin-bottom: var(--sp-3); }
.listen-banner {
  text-align: center; padding: var(--sp-4);
  border-radius: var(--radius-lg);
  background: linear-gradient(165deg, var(--surface), color-mix(in srgb, var(--fjord-soft) 75%, var(--surface)) 160%);
  border: none;
  box-shadow: var(--shadow-sm), inset 0 0 0 1px color-mix(in srgb, var(--fjord) 16%, transparent);
  margin-bottom: var(--sp-3);
}
.listen-banner .lb-icon { color: var(--fjord); margin-bottom: var(--sp-2); display: flex; justify-content: center; }

.exercise-card { margin-top: var(--sp-3); }

/* Grammar accordion */
.rule-card { padding: 0; overflow: hidden; }
.rule-card .rule-toggle {
  width: 100%; padding: var(--sp-4);
  border: none; background: none; text-align: left; cursor: pointer;
}
.rule-card .rule-toggle h3 { margin: 0 0 2px; font-size: var(--text-base); }
.rule-card .rule-body { padding: 0 var(--sp-4) var(--sp-4); border-top: 1px solid var(--line); }
.rule-card.is-open { box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--fjord) 18%, transparent); }

/* Dictionary */
.dict-stats {
  display: flex; flex-wrap: wrap; gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.dict-stats .ds-chip {
  font-size: var(--text-xs); font-weight: 600;
  padding: 6px 12px; border-radius: var(--radius-full);
  background: var(--surface-2);
  border: none;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 75%, transparent);
  color: var(--muted);
}
.dict-stats .ds-chip strong { color: var(--text); }

.search-input-wrap { position: relative; margin-bottom: var(--sp-3); }
.search-input-wrap input { padding-left: 42px; }
.search-input-wrap .mag { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }

.ai-chat-wrap {
  max-height: min(58vh, 520px);
  overflow-y: auto;
  padding: var(--sp-1);
  scroll-behavior: smooth;
}

.chip-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }
.rule-card .rule-toggle .card-row-link { width: 100%; }
.rule-card .rule-toggle .cr-body p { margin: 0; font-size: var(--text-sm); color: var(--muted); }

@media (max-width: 420px) {
  .profile-stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 600px) {
  .profile-stat-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Shop */
.shop-wallet {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
@media (max-width: 400px) {
  .shop-wallet { grid-template-columns: 1fr; }
}
.shop-wallet .sw-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: var(--sp-3); border-radius: var(--radius-sm);
  background: var(--surface);
  border: none;
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--sp-3);
}
.shop-item {
  padding: var(--sp-3);
  border-radius: var(--radius-sm);
  border: none;
  background: var(--surface-2);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px color-mix(in srgb, var(--line) 65%, transparent);
  display: flex; flex-direction: column; gap: 6px;
  transition: transform var(--dur-fast) var(--ease-snap), box-shadow var(--dur-med) var(--ease-out);
}
.shop-item:hover { box-shadow: var(--shadow), inset 0 0 0 1px color-mix(in srgb, var(--fjord) 20%, transparent); }
.shop-item .si-icon { color: var(--fjord-2); }
.flash-card { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.pill { cursor: pointer; }
.ad-overlay .card { box-shadow: var(--shadow-lg); }

/* ============================================================
   Premium polish — уроки, грамматика в процессе, главная
   ============================================================ */
.home-alerts {
  display: grid;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.home-alert {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  border: none;
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px color-mix(in srgb, var(--line) 70%, transparent);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-snap), box-shadow var(--dur-med) var(--ease-out);
}
.home-alert:hover { transform: translate3d(0, -1px, 0); box-shadow: var(--shadow); }
.home-alert.accent {
  background: linear-gradient(165deg, var(--surface), color-mix(in srgb, var(--fjord-soft) 70%, var(--surface)));
  box-shadow: var(--shadow-sm), inset 0 0 0 1px color-mix(in srgb, var(--fjord) 18%, transparent);
}
.home-alert b { display: block; font-size: var(--text-base); letter-spacing: -.01em; }

.quest-card { padding: var(--sp-4); }
.quest-card .row { margin-bottom: var(--sp-2); gap: var(--sp-2); }

.lesson-intro h2 { margin-bottom: var(--sp-2); }
.lesson-word-grid {
  display: grid;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}
@media (min-width: 520px) {
  .lesson-word-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.lesson-word-card {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  width: 100%;
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  border: none;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 65%, transparent);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-snap), box-shadow var(--dur-med) var(--ease-out);
}
.lesson-word-card:hover {
  transform: translate3d(0, -1px, 0);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px color-mix(in srgb, var(--fjord) 22%, transparent);
}
.lwc-vol { color: var(--fjord); flex-shrink: 0; margin-top: 2px; }
.lwc-body { flex: 1; min-width: 0; }
.lwc-nor { display: block; font-size: var(--text-lg); letter-spacing: -.02em; }
.lwc-ru { margin-top: 2px; }
.lwc-tag {
  display: inline-block;
  margin-left: 6px;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--bad);
  vertical-align: middle;
}

.grammar-bite {
  margin: var(--sp-3) 0;
  padding: var(--sp-4);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--fjord-soft) 45%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fjord) 14%, transparent);
}
.grammar-bite-head {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
}
.grammar-bite-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--fjord-2);
}
.grammar-bite-summary {
  margin: 0 0 var(--sp-2);
  font-size: var(--text-base);
  color: var(--text);
  font-weight: 600;
  line-height: 1.45;
}
.grammar-table-wrap { overflow-x: auto; margin: var(--sp-2) 0; }
.grammar-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.grammar-table th,
.grammar-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
}
.grammar-table th { font-weight: 700; color: var(--muted); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .04em; }
.grammar-example {
  margin-top: var(--sp-2);
  padding: var(--sp-3);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.grammar-tip { color: var(--pine); display: flex; align-items: flex-start; gap: 6px; margin-top: var(--sp-2); }
.grammar-warn { color: var(--warn); margin-top: var(--sp-2); }

.grammar-strip {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--fjord-soft) 55%, var(--surface));
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: 1.4;
}
.grammar-strip .flex-1 { color: var(--text); font-weight: 500; }

.immersive-panel {
  box-shadow: var(--shadow-sm), var(--shadow-inset);
}
.card.pad-lg.immersive-panel { padding: clamp(var(--sp-4), 4vw, var(--sp-6)); }

.shop-grid {
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  align-items: stretch;
}
.shop-item {
  min-height: 100%;
  justify-content: space-between;
}
.shop-item .btn { margin-top: auto; }
.shop-wallet .sw-item b { font-variant-numeric: tabular-nums; font-size: var(--text-lg); }

.section-title { margin-top: var(--sp-5); }

.chip.sm { padding: 4px 10px; font-size: var(--text-xs); }

.promo-card { display: none; }

/* ---------- Layout polish (responsive / overlap fixes) ---------- */
.row > *, .chip-row > *, .onb-actions > * { min-width: 0; }
.row.wrap, .chip-row { flex-wrap: wrap; row-gap: var(--sp-2); }
.chip-row { display: flex; gap: var(--sp-2); align-items: center; }

#app { overflow-x: clip; }
.screen, .onb, main.stack { min-width: 0; }

.header-bar {
  position: sticky; top: 0; z-index: 90;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
}
.header-bar .row { flex-wrap: wrap; gap: var(--sp-2); }
.header-bar h1 { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }

.plan-card { min-width: 0; }
.plan-card .pc-price-row { flex-wrap: wrap; gap: 6px; }

.choice-grid {
  display: grid;
  gap: var(--sp-3);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 148px), 1fr));
}
button.choice { min-width: 0; text-align: left; }
button.choice .c-meta { min-width: 0; overflow-wrap: anywhere; }

.onb-hero { overflow: hidden; }
.onb-badges { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.onb-actions { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-4); }
.onb-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }

.leader-row, .friends-row, .dict-row, .home-alert, .quest-card .row, .card-row-link {
  display: flex; align-items: center; gap: var(--sp-3);
  flex-wrap: wrap; min-width: 0;
}
.leader-row > *, .friends-row > *, .home-alert > *, .quest-card .row > * { min-width: 0; }
.home-alert b, .quest-card b { overflow-wrap: anywhere; }

.practice-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
}
.practice-tile { min-width: 0; }

.modal-backdrop { z-index: 200; }
.modal-sheet { z-index: 201; max-height: min(92vh, 720px); overflow: auto; }

.exercise-card .options {
  display: grid;
  gap: var(--sp-2);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
}
.prompt-big { overflow-wrap: anywhere; hyphens: auto; }

.profile-hero .ph-rings { flex-wrap: wrap; }

.bento-tile .bt-title, .bento-tile .bt-sub { overflow-wrap: anywhere; }

body.has-checkbar .install-banner {
  bottom: calc(var(--checkbar-h) + var(--sp-3) + env(safe-area-inset-bottom, 0px));
}

body.has-checkbar #app.immersive {
  padding-bottom: calc(var(--checkbar-h) + var(--sp-4) + env(safe-area-inset-bottom));
}

.quest-card .go, .home-alert .go { margin-left: auto; flex-shrink: 0; }

@media (max-width: 480px) {
  .card, .card.pad-lg { padding: var(--sp-4); }
  .btn.lg { padding: 12px 16px; }
  .plan-card .pc-price-sale { font-size: 22px; }
}

@media (max-width: 400px) {
  .pill { padding: 6px 8px; font-size: var(--text-xs); }
  .tabbar .tab { min-width: 44px; padding: 6px 6px; }
  .app-header .title h1 { font-size: var(--text-xl); }
}
