/* Söz. — палитра «Изник». Все цвета — переменные: палитру ещё могут поменять. */

/* Onest лежит у нас, как во Флоу: без внешних загрузок и офлайн.
   Во Флоу — только кириллица 600–800; турецкому нужны латиница и
   расширенная латиница (ş ğ ı İ), поэтому здесь переменный шрифт 100–900
   тремя наборами (@fontsource-variable/onest). */
@font-face { font-family: "Onest"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url("/fonts/onest-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url("/fonts/onest-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Onest"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url("/fonts/onest-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --turkuaz: #1FC0B0;
  --cay: #F4B942;
  --lale: #F0605A;
  --kobalt: #4C7DF0;

  --bg: #F7F4EE;          /* Kâğıt */
  --surface: #FFFFFF;
  --surface-2: #EFEAE1;
  --line: rgba(20, 32, 44, .10);
  --text: #14202C;        /* Mürekkep */
  --muted: #66727E;
  --on-accent: #06231F;
  --shadow: 0 1px 2px rgba(20, 32, 44, .06), 0 4px 16px rgba(20, 32, 44, .06);
  --tint: 16%;

  --ease: cubic-bezier(.22, 1, .36, 1);     /* из Флоу: быстрый разгон, приезд без возврата */
  --spring: cubic-bezier(.2, .9, .3, 1.22);  /* из Флоу: лёгкая пружина */
  --glass: rgba(255, 255, 255, .72);
  --glass-line: rgba(20, 32, 44, .12);
  --glass-blur: saturate(180%) blur(14px);
  /* Фон страницы — как во Флоу: один слой из четырёх красок. Сверху плёнка
     зерна (она же разбивает кольца на больших градиентах), свет бирюзы из
     правого верхнего угла, отсвет кобальта в левом нижнем, общий наклон.
     Рисуется в body::before, здесь только краска. */
  --page-wash:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='128' height='128'%3E%3Cfilter id='g' filterUnits='userSpaceOnUse' x='0' y='0' width='128' height='128'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='128' height='128' filter='url(%23g)' opacity='.045'/%3E%3C/svg%3E"),
    radial-gradient(125% 85% at 100% 0%, rgba(31, 192, 176, .13), transparent 58%),
    radial-gradient(90% 55% at 0% 45%, rgba(76, 125, 240, .09), transparent 60%),
    linear-gradient(170deg, #FAF8F3, #F4F0E8 55%, #EFEAE1);
  --wash-end: #EFEAE1;
  --scrim: rgba(12, 13, 16, .42);
  --scrim-flat: #8E8B86;
  --tabs-deep: var(--wash-end);
  --tabs-shadow: 0 -14px 34px rgba(20, 32, 44, .16), 0 -3px 10px rgba(20, 32, 44, .08);
  --card-shadow: 0 1px 2px rgba(20, 32, 44, .06), 0 6px 20px rgba(20, 32, 44, .07);
  --shadow-pop: 0 8px 28px rgba(20, 32, 44, .15), 0 2px 6px rgba(20, 32, 44, .08);
  --card-edge: rgba(255, 255, 255, .7);
  --side-bg: rgba(255, 255, 255, .55);
  --shadow-rail: 18px 0 50px rgba(20, 32, 44, .08), 2px 0 10px rgba(20, 32, 44, .05);
  --r: 18px;
  --r-sm: 12px;
  --vh: 100dvh;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --page-wash:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='128' height='128'%3E%3Cfilter id='g' filterUnits='userSpaceOnUse' x='0' y='0' width='128' height='128'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='128' height='128' filter='url(%23g)' opacity='.06'/%3E%3C/svg%3E"),
    radial-gradient(125% 85% at 100% 0%, rgba(31, 192, 176, .16), transparent 58%),
    radial-gradient(90% 55% at 0% 45%, rgba(76, 125, 240, .14), transparent 60%),
    linear-gradient(170deg, #111D2C, #0D1622 55%, #0B131E);
  --wash-end: #0B131E;
  --scrim: rgba(0, 0, 0, .6);
  --scrim-flat: #05080C;
  --tabs-deep: var(--wash-end);
  --tabs-shadow: 0 -18px 44px rgba(0, 0, 0, .6), 0 -4px 12px rgba(0, 0, 0, .35);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 10px 28px rgba(0, 0, 0, .22);
  --shadow-pop: 0 10px 34px rgba(0, 0, 0, .6);
  --card-edge: rgba(255, 255, 255, .06);
  --side-bg: rgba(16, 27, 40, .62);
  --shadow-rail: 26px 0 60px rgba(0, 0, 0, .45), 3px 0 14px rgba(0, 0, 0, .3);
  --glass: rgba(21, 34, 49, .72); --glass-line: rgba(255, 255, 255, .07);
  --bg: #0D1622;          /* Gece */
  --surface: #152231;     /* Yüzey */
  --surface-2: #1C2C3E;
  --line: rgba(255, 255, 255, .08);
  --text: #EEF2F6;
  --muted: #8A9AAD;
  --shadow: none;
  --tint: 20%;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D1622; --surface: #152231; --surface-2: #1C2C3E; --line: rgba(255,255,255,.08);
    --text: #EEF2F6; --muted: #8A9AAD; --shadow: none; --tint: 20%; color-scheme: dark;
  --page-wash:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='128' height='128'%3E%3Cfilter id='g' filterUnits='userSpaceOnUse' x='0' y='0' width='128' height='128'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='128' height='128' filter='url(%23g)' opacity='.06'/%3E%3C/svg%3E"),
      radial-gradient(125% 85% at 100% 0%, rgba(31, 192, 176, .16), transparent 58%),
      radial-gradient(90% 55% at 0% 45%, rgba(76, 125, 240, .14), transparent 60%),
      linear-gradient(170deg, #111D2C, #0D1622 55%, #0B131E);
    --wash-end: #0B131E;
  --scrim: rgba(0, 0, 0, .6);
  --scrim-flat: #05080C;
  --tabs-deep: var(--wash-end);
  --tabs-shadow: 0 -18px 44px rgba(0, 0, 0, .6), 0 -4px 12px rgba(0, 0, 0, .35);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 10px 28px rgba(0, 0, 0, .22);
  --shadow-pop: 0 10px 34px rgba(0, 0, 0, .6);
    --card-edge: rgba(255, 255, 255, .06);
    --side-bg: rgba(16, 27, 40, .62);
    --shadow-rail: 26px 0 60px rgba(0, 0, 0, .45), 3px 0 14px rgba(0, 0, 0, .3);
    --glass: rgba(21, 34, 49, .72); --glass-line: rgba(255, 255, 255, .07);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  color: var(--text); position: relative;
  font: 400 16px/1.45 Onest, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior: none;
}
/* Фон — отдельным закреплённым слоем: background-attachment: fixed на iOS не
   работает, а слой с translateZ(0) рисуется один раз и не пересчитывается
   при прокрутке (приём Флоу). */
body::before {
  /* Бесшовный низ на всех экранах. Полосу под жестовой чертой iOS рисует
     за краем страницы одним сплошным цветом (фон корня / theme-color) —
     градиент туда не попадает. Поэтому фон страницы в последних 140px сам
     сходится в этот цвет (--wash-end), и шва нет (снимки Романа 25.09).
     Слой сверху выпущен под вырез, снизу — ровно по краю окна. */
  content: ""; position: fixed; z-index: -1; pointer-events: none;
  left: 0; right: 0; bottom: 0;
  top: calc(-1 * env(safe-area-inset-top, 0px));
  background:
    linear-gradient(180deg, transparent calc(100% - 150px - var(--safe-b)), var(--wash-end) calc(100% - var(--safe-b) - 10px)),
    var(--page-wash);
  transform: translateZ(0);
}
/* Подложка документа — цветом низа градиента: если система всё же рисует
   полосу под жестовой чертой сама (так бывает в standalone), шва не будет. */
html, body { background: var(--wash-end); transition: background-color 140ms linear; }
html.strip-tabs, html.strip-tabs body { background: var(--tabs-deep); }
html.strip-modal, html.strip-modal body { background: var(--scrim-flat); }
/* Экраны с нижней панелью: полосу под жестовой чертой красим цветом низа
   панели, как во Флоу (body::after), — панель доходит до края экрана. */
/* Заглушки поверх зоны жестов (body::after, как во Флоу) здесь нет: у нас
   экран анимируется при появлении и становится своим слоем, и заглушка
   рисовалась поверх нижней панели (снимок Романа 25.09, 22:33). Панель сама
   доходит до низа экрана; если iOS рисует полосу за краем окна — её цвет
   берётся из фона корня и theme-color (см. syncStrip в ui.js). */
/* Документ прибит к экрану (как во Флоу): Сафари не утянет страницу вверх
   при фокусе в поле, прокрутка живёт только внутри .scroll. */
html, body { overflow: hidden; overscroll-behavior: none; position: fixed; inset: 0; width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--kobalt); text-decoration: none; }
svg { display: block; width: 22px; height: 22px; flex-shrink: 0; }
.list svg { color: var(--muted); }

/* ── ЗОНА ЖЕСТОВ (iPhone, режим приложения) — жёсткие правила ──
   Проверено по снимкам Романа 25.09.2026: страница уходит под зону жестов,
   а iOS рисует поверх неё свою НЕПРОЗРАЧНУЮ полосу одного цвета. Цвет она
   берёт из фона документа / theme-color / манифеста. Отсюда три правила:
   1. Один цвет. Всё, что касается низа экрана, сходится в --wash-end ровно
      над полосой (фон — body::before, нижняя панель — --tabs-deep = --wash-end),
      и тот же цвет стоит в html/body, theme-color и манифесте.
   2. Ничего важного под полосой: нижние элементы отступают на --safe-b.
      --safe-b ставит скрипт (fitSafeArea в app.js): на iPhone Романа окно
      кончается НАД полосой (экран 926, окно 879, полоса 47 — замер 25.09),
      и отступ там 0 — панель стоит вплотную и сливается с полосой цветом.
      Фон становится сплошным --wash-end с запасом 10px над полосой.
   3. Открыто окно — полоса гаснет вместе с экраном (--scrim-flat, syncStrip).
   Новый нижний элемент — только через --safe-b; своих заглушек не рисовать. */

/* ── каркас: высота из visualViewport (см. app.js) ── */
/* Каркас НИКОГДА не выше страницы: min() с 100% прибитого к экрану body.
   Без этого завышенная высота окна при запуске PWA (iOS) запоминалась, и
   нижняя панель уезжала под полосу жестов (снимки Романа 22:56, 23:13). */
#app { height: min(var(--vh), 100%); position: relative; top: var(--vv-top, 0px); display: flex; flex-direction: column; overflow: hidden; max-width: 720px; margin: 0 auto; }
.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 16px calc(24px + var(--safe-b)); }
.tabs ~ .scroll, .scroll:has(~ .tabs), .scroll:has(~ .study-foot) { padding-bottom: 24px; }
.topbar {
  display: flex; align-items: center; gap: 8px; min-height: 56px;
  padding: calc(var(--safe-t) + 6px) 8px 6px; flex-shrink: 0;
}
.topbar h1 { flex: 1; font-size: 18px; font-weight: 700; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--text); flex-shrink: 0; }
.icon-btn:active { background: var(--surface-2); }
.icon-btn svg { width: 24px; height: 24px; }

.logo { font-weight: 800; font-size: 26px; letter-spacing: -.02em; padding-left: 8px; }
.logo i { font-style: normal; color: var(--turkuaz); }

/* ── нижние вкладки ── */
.tabs {
  /* Разметка нижней панели — как во Флоу (crm/web/css/app.css, .tabbar).
     Плотный скат, не стекло: полупрозрачная панель над страницей того же
     цвета читалась дырой. Под жестовой чертой — не весь safe-area, а клиренс
     max(2px, inset − 22px): зону ниже закрашивает body::after тем же цветом,
     и панель выглядит тонкой, а цвет доходит до края (снимок Романа 25.09). */
  display: flex; flex-shrink: 0; position: relative; z-index: 2;
  border-top: 1px solid var(--line);
  background:
    radial-gradient(140% 120% at 50% 0%, color-mix(in srgb, var(--turkuaz) 5%, transparent), transparent 72%),
    linear-gradient(180deg, var(--surface) 0%, color-mix(in srgb, var(--surface) 70%, var(--tabs-deep)) 45%, var(--tabs-deep) 100%);
  /* Проверено на айфоне Романа 25.09 (22:40 — «стала хорошо выглядеть»):
     клиренс над жестовой чертой — max(2px, safe-area − 22px), как во Флоу.
     Полный safe-area (22:56) уводил подписи под полосу. НЕ МЕНЯТЬ без снимка. */
  padding: 0 8px max(2px, calc(var(--safe-b) - 22px));
}
.tabs a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-height: 42px; padding: 8px 2px 1px;
  color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: -.1px;
  transition: color 180ms var(--ease);
}
.tabs a svg { width: 24px; height: 24px; stroke-width: 1.8; }
/* Ни заливок, ни «пилюль»: активный раздел — цветом и весом (как во Флоу). */
.tabs a.on { color: var(--turkuaz); font-weight: 600; }
.tabs a.on svg { stroke-width: 2.1; }

/* ── общие элементы ── */
.card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 100%, #fff 3%), var(--surface));
  border-radius: var(--r); border: 1px solid var(--line);
  /* верхняя светлая грань — плашка читается пластиной над фоном */
  box-shadow: inset 0 1px 0 var(--card-edge), var(--card-shadow);
}
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.section-h { display: flex; align-items: center; justify-content: space-between; margin: 24px 4px 10px; }
.section-h h2 { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0; font-weight: 700; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; padding: 0 20px; border-radius: 16px; font-weight: 700; font-size: 17px;
  background: var(--surface-2); color: var(--text); width: 100%;
  transition: transform 140ms var(--spring), filter 150ms var(--ease), background-color 180ms var(--ease);
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--turkuaz); color: var(--on-accent); }
.btn.t-lale { background: color-mix(in srgb, var(--lale) var(--tint), var(--surface)); color: var(--lale); }
.btn.t-cay { background: color-mix(in srgb, var(--cay) var(--tint), var(--surface)); color: color-mix(in srgb, var(--cay) 70%, var(--text)); }
.btn.t-turkuaz { background: color-mix(in srgb, var(--turkuaz) var(--tint), var(--surface)); color: color-mix(in srgb, var(--turkuaz) 80%, var(--text)); }
.btn.ghost { background: none; color: var(--muted); font-weight: 600; min-height: 44px; }
.btn small { font-weight: 500; opacity: .7; font-size: 12px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin: 0 4px 6px; font-weight: 600; }
.input, textarea.input, select.input {
  width: 100%; min-height: 52px; padding: 13px 16px; border-radius: 14px;
  background: var(--surface); border: 1.5px solid var(--line); outline: none; font-size: 17px;
}
.input:focus { border-color: var(--turkuaz); }
textarea.input { min-height: 180px; resize: vertical; line-height: 1.5; font-size: 16px; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 99px; background: var(--surface-2); font-size: 14px; font-weight: 600; white-space: nowrap; color: var(--muted); }
.chip.on { background: var(--text); color: var(--bg); }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 0 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.badge { min-width: 24px; height: 24px; padding: 0 8px; border-radius: 12px; display: inline-grid; place-items: center; font-size: 13px; font-weight: 700; background: color-mix(in srgb, var(--cay) 22%, var(--surface)); color: color-mix(in srgb, var(--cay) 70%, var(--text)); }

.bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }
.bar .k { background: var(--turkuaz); }
.bar .l { background: var(--cay); }

.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--surface-2); border: 1.5px solid var(--line); }
.dot.learning, .dot.relearning { background: var(--cay); border-color: transparent; }
.dot.review { background: var(--turkuaz); border-color: transparent; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }

/* ── главная ── */
.hero { padding: 20px; margin-top: 4px; }
.hero .big { font-size: 44px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.hero .lbl { color: var(--muted); font-weight: 600; margin-bottom: 8px; font-size: 15px; }
.hero .btn { margin-top: 16px; }
.hero .meta { display: flex; gap: 16px; margin-top: 14px; font-size: 14px; color: var(--muted); }
.hero .meta b { color: var(--text); }
.streak { color: color-mix(in srgb, var(--cay) 75%, var(--text)); font-weight: 700; }

.mlist { display: flex; flex-direction: column; gap: 10px; }
.mitem { display: block; padding: 16px; color: var(--text); }
.mitem:active { background: var(--surface-2); }
.mitem .t { display: flex; align-items: center; gap: 10px; }
.mitem .t b { flex: 1; font-size: 17px; font-weight: 700; line-height: 1.25; }
.mitem .s { margin: 6px 0 10px; font-size: 14px; color: var(--muted); }

/* ── модуль ── */
.mhead { padding: 4px 4px 0; }
.mhead h2 { font-size: 26px; line-height: 1.15; margin: 0 0 6px; font-weight: 800; letter-spacing: -.01em; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.mode { padding: 16px 10px 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: var(--text); }
.mode:active { transform: scale(.97); }
.mode svg { width: 30px; height: 30px; color: var(--turkuaz); }
.mode small { font-weight: 500; color: var(--muted); font-size: 12px; margin-top: -4px; }
.due-strip { margin-top: 10px; }

.words { display: flex; flex-direction: column; }
.word { display: flex; align-items: center; gap: 12px; padding: 12px 4px 12px 14px; border-bottom: 1px solid var(--line); }
.word:last-child { border-bottom: 0; }
.word .w { flex: 1; min-width: 0; }
.word .w b { display: block; font-weight: 600; font-size: 17px; }
.word .w span { display: block; color: var(--muted); font-size: 15px; }
.word .icon-btn { width: 40px; height: 40px; color: var(--muted); }
.word .icon-btn svg { width: 22px; height: 22px; }
.star-on { color: var(--cay) !important; }

/* ── учёба ── */
.study-top { display: flex; align-items: center; gap: 4px; padding: calc(var(--safe-t) + 6px) 8px 0; flex-shrink: 0; }
.study-top .count { flex: 1; text-align: center; font-weight: 700; font-size: 15px; }
.progress-line { height: 4px; background: var(--surface-2); margin: 8px 16px 0; border-radius: 2px; overflow: hidden; flex-shrink: 0; }
.progress-line i { display: block; height: 100%; background: var(--turkuaz); transition: width .3s; }
.study-body { flex: 1; display: flex; flex-direction: column; padding: 16px; min-height: 0; overflow-y: auto; scrollbar-width: none; }
.study-body::-webkit-scrollbar { display: none; }
.study-foot { padding: 8px 16px calc(12px + var(--safe-b)); flex-shrink: 0; display: flex; flex-direction: column; gap: 10px; }

/* карточка-переворот */
.flip { flex: 1; perspective: 1400px; min-height: 260px; position: relative; touch-action: pan-y; }
.flip-in { position: absolute; inset: 0; transition: transform 480ms var(--ease), opacity 200ms var(--ease); transform-style: preserve-3d; }
.flip.back .flip-in { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 56px 24px; overflow: auto;
}
.face.b { transform: rotateY(180deg); }
.face .txt { font-size: clamp(30px, 9vw, 48px); font-weight: 700; line-height: 1.2; word-break: break-word; }
.face.b .txt { font-weight: 600; }
.face .sub { color: var(--muted); margin-top: 12px; font-size: 16px; }
.face .corner { position: absolute; top: 8px; right: 8px; display: flex; }
.face .corner-l { position: absolute; top: 8px; left: 8px; }
.face .icon-btn { color: var(--muted); }
/* Карточка: вылет в сторону ответа с его цветом, перетаскивание пальцем,
   мягкое появление новой (Роман 25.09: «проще и приятнее, с переходом в цвет»). */
.flip { transition: transform 300ms cubic-bezier(.2, .8, .3, 1), opacity 250ms; will-change: transform; }
.flip.dragging { transition: none; }
.flip.out { transition: transform 250ms cubic-bezier(.5, 0, .9, .5), opacity 250ms ease-in; opacity: 0; }
.flip.enter { animation: card-in 280ms var(--ease); }
@keyframes card-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }
.flip .face::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: var(--fly-c, transparent); opacity: var(--fly-o, 0); transition: opacity 160ms var(--ease);
}
.flip.dragging .face::after { transition: none; }
.tap-hint { text-align: center; color: var(--muted); font-size: 14px; }
.counters { display: flex; justify-content: space-between; font-weight: 700; font-size: 15px; padding: 0 4px; }
.counters .l { color: var(--lale); } .counters .k { color: var(--turkuaz); }
.rate { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rate .btn { flex-direction: column; gap: 0; min-height: 60px; font-size: 16px; padding: 0 6px; }

/* вопрос */
.q-label { color: var(--muted); font-size: 14px; font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.q-text { font-size: clamp(24px, 7vw, 34px); font-weight: 700; line-height: 1.2; margin-bottom: 8px; word-break: break-word; }
.q-sub { color: var(--muted); font-size: 15px; margin-bottom: 18px; }
.q-gap { flex: 1; min-height: 16px; }
.options { display: flex; flex-direction: column; gap: 10px; }
.opt {
  /* Никаких эффектов, создающих отдельный слой: ни transform, ни opacity,
     ни переходов, ни размытой тени. Safari на iPhone рисовал такой слой
     кнопки полосами (снимки Романа 25.09, 23:00 и позже). Состояния — только
     цветом фона, рамки и текста, мгновенно. */
  -webkit-appearance: none; appearance: none;
  text-align: left; padding: 15px 16px; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--line);
  box-shadow: inset 0 1px 0 var(--card-edge);
  font-size: 18px; font-weight: 600; min-height: 56px; display: flex; align-items: center; gap: 12px;
}
.opt kbd { font: 600 12px/1 Onest, sans-serif; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
.opt.ok { border-color: var(--turkuaz); background: color-mix(in srgb, var(--turkuaz) var(--tint), var(--surface)); }
.opt.bad { border-color: var(--lale); background: color-mix(in srgb, var(--lale) var(--tint), var(--surface)); }
.opt.dim { color: var(--muted); -webkit-text-fill-color: var(--muted); border-color: transparent; }
.opt.sel { border-color: var(--kobalt); }
.trkeys { display: flex; gap: 6px; margin-top: 10px; }
.trkeys button { flex: 1; height: 40px; border-radius: 10px; background: var(--surface-2); font-weight: 700; font-size: 17px; }

.fb { padding: 16px; border-radius: 16px; margin-top: 14px; }
.fb.ok { background: color-mix(in srgb, var(--turkuaz) var(--tint), var(--surface)); }
.fb.bad { background: color-mix(in srgb, var(--lale) calc(var(--tint) - 4%), var(--surface)); }
.fb.near { background: color-mix(in srgb, var(--cay) var(--tint), var(--surface)); }
.fb h3 { margin: 0 0 8px; font-size: 18px; }
.fb.ok h3 { color: color-mix(in srgb, var(--turkuaz) 75%, var(--text)); }
.fb.bad h3 { color: var(--lale); }
.fb.near h3 { color: color-mix(in srgb, var(--cay) 70%, var(--text)); }
.fb .ans { font-size: 20px; font-weight: 700; margin: 2px 0; }
.fb .lbl { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 10px; }
.fb .note { margin-top: 10px; font-size: 15px; line-height: 1.45; }
.fb .note b { font-weight: 700; }
.fb .override { margin-top: 10px; color: var(--kobalt); font-weight: 600; font-size: 15px; padding: 6px 0; }
.d-bad { color: var(--lale); text-decoration: line-through; text-decoration-thickness: 2px; }
.d-miss { color: var(--turkuaz); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.d-fix { color: color-mix(in srgb, var(--cay) 70%, var(--text)); text-decoration: underline; text-underline-offset: 3px; }

/* итоги */
.result { text-align: center; padding: 24px 8px; }
.result .big { font-size: 64px; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.result h2 { margin: 12px 0 6px; font-size: 24px; }
.ring { width: 140px; height: 140px; margin: 8px auto 12px; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; font-weight: 800; }

/* прогресс */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { padding: 16px; }
.stat b { display: block; font-size: 30px; font-weight: 800; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 14px; font-weight: 600; }
.stat.k b { color: var(--turkuaz); } .stat.l b { color: color-mix(in srgb, var(--cay) 80%, var(--text)); }
.chart { padding: 16px; }
.chart .cols { display: flex; align-items: flex-end; gap: 3px; height: 110px; margin-top: 12px; }
.chart .cols i { flex: 1; background: var(--turkuaz); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .9; }
.chart .cols i.z { background: var(--surface-2); }
.chart .axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.fc { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 12px; text-align: center; }
.fc div { background: var(--surface-2); border-radius: 10px; padding: 8px 0; }
.fc b { display: block; font-size: 17px; }
.fc span { font-size: 11px; color: var(--muted); font-weight: 600; }
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; padding: 9px 8px; border-radius: 9px; font-weight: 700; font-size: 15px; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* список настроек */
.list { overflow: hidden; }
.list > * { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); min-height: 54px; width: 100%; text-align: left; color: var(--text); font-weight: 600; font-size: 16px; }
.list > *:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .danger { color: var(--lale); }

/* Всплывающее окно — как во Флоу (.modal-root / .modal--glass): плавающая
   стеклянная карточка по центру видимой области, отступы от безопасных зон,
   под ней затемнение с размытием. Появление — подъём, закрытие — проседание. */
.sheet-bg {
  /* внизу затемнение сходится в сплошной --scrim-flat — цвет полосы жестов,
     пока открыто окно (syncStrip), — размытый фон уходит в неё без шва */
  position: fixed; inset: 0; z-index: 50;
  background: linear-gradient(180deg, transparent calc(100% - 140px), var(--scrim-flat) calc(100% - 4px)), var(--scrim);
  -webkit-backdrop-filter: blur(18px) saturate(1.1); backdrop-filter: blur(18px) saturate(1.1);
  animation: modal-fade 120ms linear;
}
.sheet-wrap {
  position: fixed; left: 0; right: 0; top: 0; z-index: 51; height: var(--vh);
  display: grid; place-items: center; pointer-events: none;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 12px calc(var(--safe-b) + 12px);
}
.sheet {
  pointer-events: auto; position: relative; overflow-y: auto;
  width: min(460px, 100%); max-height: 100%;
  background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-line); border-radius: 22px;
  box-shadow: var(--shadow-pop), inset 0 1px 0 var(--card-edge);
  padding: 18px 16px 16px;
  animation: modal-rise 180ms var(--ease);
}
/* мягкое свечение сверху, как --grad-glow у стекла Флоу */
.sheet::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: radial-gradient(120% 60% at 50% 0%, color-mix(in srgb, var(--turkuaz) 12%, transparent), transparent 70%);
}
.sheet > * { position: relative; }
.sheet-bg.sheet-closing { animation: modal-gone 120ms linear both; }
.sheet-closing .sheet { animation: modal-sink 120ms var(--ease) both; }
.sheet .grab { display: none; }
.sheet h3 { margin: 0 0 14px; font-size: 20px; }
@keyframes modal-fade { from { opacity: 0; } }
@keyframes modal-gone { to { opacity: 0; } }
@keyframes modal-rise { from { opacity: 0; transform: translateY(8px) scale(.985); } }
@keyframes modal-sink { to { opacity: 0; transform: translateY(6px); } }
.pick { display: flex; flex-direction: column; gap: 8px; }
.pick button { transition: border-color 180ms var(--ease), transform 140ms var(--spring); text-align: left; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--line); box-shadow: inset 0 1px 0 var(--card-edge); }
.pick button b { display: block; font-size: 17px; }
.pick button span { color: var(--muted); font-size: 14px; }
.pick button.on { border-color: var(--turkuaz); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 4px; font-weight: 600; font-size: 16px; min-height: 54px; }
/* переключатель темы: солнце / полумесяц */
.theme-sw { position: relative; width: 76px; height: 38px; border-radius: 19px; background: var(--surface-2);
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 9px; flex-shrink: 0; }
.theme-sw svg { width: 18px; height: 18px; position: relative; z-index: 1; color: var(--muted); transition: color 200ms var(--ease); }
.theme-sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.3); transition: transform 260ms var(--spring); }
.theme-sw.dark::after { transform: translateX(38px); }
.theme-sw:not(.dark) .sun, .theme-sw.dark .moon { color: var(--text); }
.sw { width: 50px; height: 30px; border-radius: 15px; background: var(--surface-2); position: relative; flex-shrink: 0; transition: background-color 200ms var(--ease); border: 1px solid var(--line); }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform 260ms var(--spring); }
.sw.on { background: var(--turkuaz); }
.sw.on::after { transform: translateX(20px); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-b) + 90px); transform: translateX(-50%); z-index: 60;
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 15px;
  max-width: calc(100% - 32px); animation: fade .2s;
}
.offline { background: var(--cay); color: #3a2800; text-align: center; font-size: 13px; font-weight: 700; padding: calc(var(--safe-t) + 2px) 8px 2px; }

/* вход */
.auth { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 24px; max-width: 420px; margin: 0 auto; width: 100%; }
.auth .logo { font-size: 64px; padding: 0; margin-bottom: 4px; }
.auth p { color: var(--muted); margin: 0 0 28px; }

/* редактор */
.ed-row { display: flex; gap: 8px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ed-row .n { width: 24px; color: var(--muted); font-size: 13px; padding-top: 14px; text-align: right; }
.ed-row .f { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.ed-row .input { min-height: 44px; padding: 9px 12px; font-size: 16px; }
.preview { font-size: 14px; }
.preview div { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.preview div b { flex: 1; font-weight: 600; }
.preview div span { flex: 1; color: var(--muted); }

@keyframes fade { from { opacity: 0; } }
@keyframes pop-fade { from { opacity: 0; } }
/* появление экрана: короткий подъём, как у всплывашек Флоу */
@keyframes screen-in { from { opacity: 0; } }
.screen { animation: screen-in 260ms var(--ease); }
.mode:active, .mitem:active { transform: scale(.98); }
.opt:active:not(:disabled) { background: var(--surface-2); }
.opt:disabled:not(.dim) { color: var(--text); -webkit-text-fill-color: var(--text); }
.toast { -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
@keyframes up { from { transform: translateY(100%); } }
@keyframes pop { 50% { transform: scale(1.04); } }
.pop { animation: pop .25s; }

@media (min-width: 700px) {
  .scroll, .study-body, .study-foot { padding-left: 24px; padding-right: 24px; }
  .flip { max-height: 440px; }
}
@media (hover: hover) {
  .mitem:hover, .opt:hover, .pick button:hover { border-color: color-mix(in srgb, var(--turkuaz) 50%, var(--line)); }
  .icon-btn:hover { background: var(--surface-2); }
}

/* ── широкий экран: постоянная панель слева (по мотивам Флоу, но проще) ── */
.side { display: none; }
@media (min-width: 900px) {
  body.with-side .side {
    display: flex; flex-direction: column; gap: 4px;
    position: fixed; left: 0; top: 0; bottom: 0; width: 232px; z-index: 20;
    padding: 20px 14px 16px;
    background:
      linear-gradient(180deg, rgba(255,255,255,.06) 0%, rgba(255,255,255,0) 34%, rgba(0,0,0,.09) 100%),
      var(--side-bg);
    -webkit-backdrop-filter: saturate(200%) blur(26px); backdrop-filter: saturate(200%) blur(26px);
    border-right: 1px solid var(--line);
    box-shadow: var(--shadow-rail), inset -1px 0 0 rgba(255, 255, 255, .06);
  }
  /* ровная бирюзовая кромка по правой грани — «тихий» вариант из Флоу */
  body.with-side .side::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: linear-gradient(to left, color-mix(in srgb, var(--turkuaz) 10%, transparent) 0, transparent 10px);
  }
  .side a.nav, .side .me { transition: background-color 180ms var(--ease), color 180ms var(--ease); }
  .side .logo { font-size: 30px; padding: 0 10px 22px; color: var(--text); }
  .side a.nav {
    display: flex; align-items: center; gap: 12px; height: 46px; padding: 0 12px; border-radius: 12px;
    color: var(--muted); font-weight: 600; font-size: 16px;
  }
  .side a.nav svg { width: 22px; height: 22px; }
  .side a.nav:hover { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); }
  .side a.nav.on { background: color-mix(in srgb, var(--turkuaz) 14%, transparent); color: var(--text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--turkuaz) 18%, transparent); }
  .side a.nav.on svg { color: var(--turkuaz); }
  .side a.nav .badge { margin-left: auto; }
  .side .grow { flex: 1; }
  .side .me { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; color: var(--text); font-weight: 600; }
  .side .me:hover { background: var(--surface-2); }
  .side .me .ava { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800;
    background: color-mix(in srgb, var(--turkuaz) 22%, var(--surface)); color: var(--turkuaz); }
  .side .me svg { width: 20px; height: 20px; margin-left: auto; color: var(--muted); }

  body.with-side #app { max-width: none; margin: 0 0 0 232px; }
  body.with-side .tabs, body.with-side .topbar .logo, body.with-side [data-home-gear] { display: none; }
  body.with-side .scroll, body.with-side .topbar {
    padding-left: max(40px, calc((100% - 880px) / 2));
    padding-right: max(40px, calc((100% - 880px) / 2));
  }
  body.with-side .topbar { min-height: 72px; padding-top: 16px; }
  body.with-side [data-home-top] { min-height: 32px; padding-top: 0; padding-bottom: 0; }
  body.with-side .chips { margin: 0; padding: 0; }
  body.with-side .mlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
  body.with-side .mitem { padding: 20px; }
  body.with-side .hero { padding: 28px; }
  body.with-side .hero .btn { max-width: 320px; }
  body.with-side .stats { grid-template-columns: repeat(4, 1fr); }
  body.with-side .modes { gap: 14px; }
  body.with-side .mode { padding: 24px 12px 20px; font-size: 17px; }
  body.with-side .mode svg { width: 36px; height: 36px; }
  /* учёба — без панели, по центру, как в Quizlet */
  body:not(.with-side) #app { max-width: 760px; }
}

/* ── индекс изученности: 4 уровня (app/mastery.py) ── */
.ix {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
  border: 1.5px dashed var(--line); color: var(--muted);
}
.ix.weak { border: 0; background: color-mix(in srgb, var(--lale) var(--tint), var(--surface)); color: var(--lale); }
.ix.learning { border: 0; background: color-mix(in srgb, var(--cay) var(--tint), var(--surface)); color: color-mix(in srgb, var(--cay) 75%, var(--text)); }
.ix.known { border: 0; background: color-mix(in srgb, var(--turkuaz) var(--tint), var(--surface)); color: color-mix(in srgb, var(--turkuaz) 80%, var(--text)); }
.ix.solid { border: 0; background: var(--turkuaz); color: var(--on-accent); }
.mbar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; display: flex; }
.mbar i { display: block; height: 100%; transition: width 400ms var(--ease); }
.mbar .solid { background: var(--turkuaz); }
.mbar .known { background: color-mix(in srgb, var(--turkuaz) 50%, var(--surface-2)); }
.mbar .learning { background: var(--cay); }
.mbar .weak { background: var(--lale); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.legend .solid { background: var(--turkuaz); } .legend .known { background: color-mix(in srgb, var(--turkuaz) 50%, var(--surface-2)); }
.legend .learning { background: var(--cay); } .legend .weak { background: var(--lale); }
.weak-card { display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin-top: 10px; color: var(--text); }
.weak-card .ix { width: 44px; height: 44px; font-size: 16px; }
.weak-card b { display: block; font-size: 17px; }
.weak-card span { color: var(--muted); font-size: 14px; }
.big-ix { font-size: 56px; font-weight: 800; line-height: 1; letter-spacing: -.03em; }

/* ── «Сегодня»: рабочий стол без прокрутки ── */
.today { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; }
.today-top { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rings-card { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 14px 8px 12px; gap: 6px; }
.rings { width: min(100%, 148px); height: auto; }
.rg-track { stroke: var(--surface-2); }
.rg-goal { stroke: var(--cay); transition: stroke-dasharray 600ms var(--ease); }
.rg-solid { stroke: var(--turkuaz); }
.rg-known { stroke: color-mix(in srgb, var(--turkuaz) 55%, var(--surface-2)); }
.rg-learning { stroke: color-mix(in srgb, var(--cay) 70%, var(--surface-2)); }
.rg-weak { stroke: var(--lale); }
.rg-num { fill: var(--text); font: 800 34px Onest, sans-serif; letter-spacing: -.02em; }
.rg-lbl { fill: var(--muted); font: 600 11px Onest, sans-serif; }
.rings-cap { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.goal-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cay); }
.rings-cap .streak { display: inline-flex; align-items: center; gap: 2px; }
.rings-cap .streak svg { width: 15px; height: 15px; color: var(--cay); }
.start-card {
  border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end;
  gap: 4px; text-align: left; color: var(--on-accent); position: relative; overflow: hidden;
  background: radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, #fff 22%, var(--turkuaz)), var(--turkuaz) 60%, color-mix(in srgb, var(--turkuaz) 80%, #000));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 10px 26px color-mix(in srgb, var(--turkuaz) 30%, transparent);
  transition: transform 140ms var(--spring);
}
.start-card:active { transform: scale(.97); }
.start-card b { font-size: 20px; line-height: 1.15; font-weight: 800; }
.start-card > span:not(.start-ic) { font-size: 13px; font-weight: 600; opacity: .75; }
.start-ic { position: absolute; top: 14px; left: 14px; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .28); }
.start-ic svg { width: 22px; height: 22px; margin-left: 2px; color: var(--on-accent); }
.card-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.card-h b { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; }
.card-h b svg { width: 20px; height: 20px; color: var(--turkuaz); }
.card-h a { font-size: 14px; font-weight: 600; color: color-mix(in srgb, var(--turkuaz) 85%, var(--text)); }
.news-card { padding: 14px 16px 6px; }
.news-row { display: block; padding: 10px 0; border-top: 1px solid var(--line); color: var(--text); }
.news-row:first-of-type { border-top: 0; }
.news-row b { display: block; font-size: 16px; font-weight: 700; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.news-row .ru { display: block; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rub { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: color-mix(in srgb, var(--turkuaz) 85%, var(--text)); margin-bottom: 2px; }
.news-empty { color: var(--muted); font-size: 14px; padding: 6px 0 12px; line-height: 1.45; }
.gram-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; color: var(--text); }
.gram-card .lvl { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 800;
  background: color-mix(in srgb, var(--kobalt) var(--tint), var(--surface)); color: var(--kobalt); flex-shrink: 0; }
.gram-card .g { flex: 1; min-width: 0; }
.gram-card .g span { display: block; font-size: 13px; color: var(--muted); font-weight: 600; }
.gram-card .g b { display: block; font-size: 17px; }
.gram-card > svg { color: var(--muted); }

/* ── дорожная карта грамматики: путь сверху вниз ── */
.road { position: relative; padding: 4px 0 8px; }
.road-lvl { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px; margin: 18px 0 10px; }
.road-lvl:first-child { margin-top: 4px; }
.road-lvl .lv { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 15px;
  background: color-mix(in srgb, var(--kobalt) var(--tint), var(--surface)); color: var(--kobalt); }
.road-lvl.done .lv { background: var(--turkuaz); color: var(--on-accent); }
.road-lvl b { font-size: 16px; }
.road-node { position: relative; display: flex; align-items: flex-start; gap: 14px; padding: 7px 0 7px 8px; color: var(--muted); }
.road-node::before { content: ""; position: absolute; left: 21px; top: -8px; bottom: -8px; width: 2px; background: var(--line); z-index: 0; }
.road-node.done::before { background: color-mix(in srgb, var(--turkuaz) 55%, transparent); }
.road-node .dot { position: relative; z-index: 1; width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; background: var(--bg); border: 2px solid var(--line); color: var(--muted); }
.road-node .dot svg { width: 16px; height: 16px; }
.road-node .t { padding-top: 3px; min-width: 0; }
.road-node .t b { font-weight: 600; font-size: 16px; }
.road-node.done { color: var(--text); }
.road-node.done .dot { background: var(--turkuaz); border-color: var(--turkuaz); color: var(--on-accent); }
.road-node.cur { color: var(--text); margin: 6px 0; }
.road-node.cur .dot { width: 36px; height: 36px; margin-left: -4px; font-size: 14px; border-color: var(--cay); color: var(--text);
  background: color-mix(in srgb, var(--cay) 22%, var(--surface));
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--cay) 16%, transparent), 0 0 24px color-mix(in srgb, var(--cay) 40%, transparent); }
.road-node.cur .t b { font-size: 18px; font-weight: 800; }
.road-node .here { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 800;
  background: var(--cay); color: #3a2800; vertical-align: 2px; }
.road-node .sum { display: block; font-size: 14px; color: var(--muted); margin-top: 2px; }
.lvl-pill { padding: 6px 12px; border-radius: 99px; background: var(--surface-2); font-size: 13px; font-weight: 700; margin-right: 8px; }

/* ── статья и памятка ── */
.doc { padding: 4px 4px 12px; }
.doc h1 { font-size: 28px; line-height: 1.15; margin: 6px 0 8px; font-weight: 800; letter-spacing: -.01em; }
.doc h2 { font-size: 20px; margin: 24px 0 6px; font-weight: 800; }
.doc h3 { font-size: 17px; margin: 18px 0 4px; }
.doc p { margin: 0 0 4px; font-size: 17px; line-height: 1.55; }
.doc .lede p, .doc > .lede { font-size: 18px; font-weight: 500; }
.doc blockquote { margin: 16px 0; padding: 12px 16px; border-left: 3px solid var(--turkuaz); border-radius: 0 12px 12px 0;
  background: color-mix(in srgb, var(--turkuaz) 8%, var(--surface)); }
.doc blockquote p { font-style: italic; }
.doc cite { display: block; margin-top: 6px; font-size: 14px; color: var(--muted); font-style: normal; font-weight: 600; }
.doc ul, .doc ol { margin: 6px 0; padding-left: 22px; font-size: 17px; line-height: 1.5; }
.doc code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: .92em; }
.md-table { overflow-x: auto; margin: 12px 0; }
.md-table table { border-collapse: collapse; width: 100%; font-size: 15px; }
.md-table th, .md-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.md-table th { color: var(--muted); font-weight: 700; font-size: 13px; }
.soon { display: flex; gap: 14px; align-items: center; padding: 16px; margin-top: 16px; }
.soon svg { width: 28px; height: 28px; color: var(--kobalt); flex-shrink: 0; }
.soon b { display: block; }
.soon span { color: var(--muted); font-size: 14px; }
.news-meta { font-size: 13px; color: var(--muted); font-weight: 600; display: flex; gap: 8px; align-items: baseline; }
.news-doc .blk { margin-bottom: 10px; }
.news-doc .ru { color: var(--muted); font-size: 15px; line-height: 1.45; margin-top: 2px; }
.news-doc .title-ru { font-size: 17px; }
.news-doc.tr-hide .ru, .news-doc.tr-tap .blk:not(.open) .ru { display: none; }
.news-doc.tr-tap .blk { cursor: pointer; }
.news-doc .words-h { margin-top: 28px; }
/* полезные слова — цветом бренда, без подчёркивания (Роман 26.09) */
.gl { color: color-mix(in srgb, var(--turkuaz) 85%, var(--text)); font: inherit; font-weight: 600; padding: 0; line-height: inherit; }
.gl-bubble { position: fixed; z-index: 70; max-width: 260px; padding: 10px 14px; border-radius: 12px; pointer-events: none;
  background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-line); box-shadow: var(--shadow-pop); animation: modal-rise 160ms var(--ease); }
.gl-bubble b { display: block; font-size: 16px; }
.gl-bubble span { color: var(--muted); font-size: 14px; }
.src { display: inline-flex; align-items: center; gap: 6px; margin-top: 20px; font-weight: 600; font-size: 15px; }
.src svg { width: 16px; height: 16px; }
.tr-mode button { padding: 7px 12px; display: grid; place-items: center; }
.tr-mode button svg { width: 20px; height: 20px; }
.pick button[disabled] { opacity: .45; }

@media (min-width: 900px) {
  body.with-side .today { display: grid; grid-template-columns: 1fr 1fr; align-content: start; }
  body.with-side .today-top { grid-column: 1 / -1; grid-template-columns: 280px 1fr; }
  body.with-side .news-card, body.with-side .gram-card { grid-column: 1 / -1; }
  body.with-side .start-card b { font-size: 26px; }
}

/* Список у нижнего края без панели — тает в фоне, а не обрезается полосой
   жестов (снимок Романа 23:25). Фон там уже --wash-end, как и сама полоса. */
.scroll:not(:has(~ .tabs)):not(:has(~ .study-foot)) {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 56px), transparent);
          mask-image: linear-gradient(to bottom, #000 calc(100% - 56px), transparent);
  padding-bottom: calc(40px + var(--safe-b));
}

/* Турецкие буквы-подсказки — только на компьютере: на телефоне своя клавиатура (Роман 25.09) */
@media (pointer: coarse) { .trkeys { display: none; } }

.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.days .chip { justify-content: center; padding: 10px 0; min-width: 0; font-size: 14px; }
.list > div .icon-btn { width: 40px; height: 40px; }

/* письменный вопрос: поле под вопросом, разбор ниже; кнопки — внизу над клавиатурой */
.study-body .q-text + .input { margin-top: 12px; }

/* Полос прокрутки нет нигде — прокрутка работает, бар не рисуется (Роман 25.09) */
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* ── «Прогресс» ── */
.pg { display: flex; flex-direction: column; gap: 12px; }
.pg-card, .pg-level { padding: 18px; }
.pg-h { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.pg-h2 { font-size: 13px; font-weight: 700; color: var(--muted); margin: 14px 0 8px; }
.pg-big { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.pg-big b { font-size: 44px; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.pg-big span { color: var(--muted); font-size: 14px; font-weight: 600; }
.pg-sub { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 10px 0 0; }
.pg-row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; font-size: 14px; }
.pg-row b { font-size: 18px; }
.lvl-track { position: relative; height: 12px; border-radius: 6px; background: var(--surface-2); margin: 6px 0 22px; }
.lvl-track > i { display: block; height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--turkuaz) 60%, var(--cay)), var(--turkuaz)); }
.lvl-track span { position: absolute; top: 16px; transform: translateX(-100%); font-size: 11px; font-weight: 700; color: var(--muted); }
.lvl-track span.got { color: var(--turkuaz); }
.vs { display: grid; grid-template-columns: 1fr repeat(2, 76px); gap: 8px 6px; align-items: center; font-size: 14px; }
.vs > b { text-align: center; font-size: 14px; color: var(--muted); }
.vs > b.me { color: var(--text); }
.vs > span { color: var(--muted); }
.vs > i { font-style: normal; text-align: center; font-weight: 800; font-size: 18px; padding: 4px 0; border-radius: 10px; }
.vs > i.lead { background: color-mix(in srgb, var(--turkuaz) var(--tint), var(--surface)); color: color-mix(in srgb, var(--turkuaz) 85%, var(--text)); }
.radar { width: 100%; height: auto; display: block; }
.rd-ring { fill: none; stroke: color-mix(in srgb, var(--text) 7%, transparent); stroke-width: 1; stroke-dasharray: 2 5; }
.rd-shape { stroke: var(--turkuaz); stroke-width: 2.2; stroke-linejoin: round;
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--turkuaz) 35%, transparent)); }
.rd-dot { fill: var(--turkuaz); }
.rd-lbl { fill: var(--muted); font: 600 12.5px Onest, sans-serif; }
.heat { display: grid; grid-template-columns: repeat(13, 1fr); grid-template-rows: repeat(7, 1fr); gap: 4px; }
.heat i { aspect-ratio: 1; border-radius: 4px; background: var(--surface-2); }
.heat i.fut { background: transparent; }
.heat i.l1 { background: color-mix(in srgb, var(--turkuaz) 30%, var(--surface-2)); }
.heat i.l2 { background: color-mix(in srgb, var(--turkuaz) 55%, var(--surface-2)); }
.heat i.l3 { background: color-mix(in srgb, var(--turkuaz) 80%, var(--surface-2)); }
.heat i.l4 { background: var(--turkuaz); }
.acc { display: grid; grid-template-columns: 1fr 80px 44px; gap: 10px; align-items: center; padding: 6px 0; font-size: 14px; }
.acc-bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.acc-bar i { display: block; height: 100%; background: var(--turkuaz); }
.acc b { text-align: right; }
.stack { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; }
.stack i { display: block; min-width: 4px; }
.letters { display: flex; flex-wrap: wrap; gap: 8px; }
.letters span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); font-size: 16px; }
.letters svg { width: 14px; height: 14px; color: var(--muted); }
.letters .typed { color: var(--lale); }
.letters em { font-style: normal; font-size: 12px; color: var(--muted); font-weight: 700; }
.hist { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; height: 120px; align-items: end; }
.hist > div { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.hist i { display: block; width: 100%; border-radius: 6px 6px 2px 2px; background: color-mix(in srgb, var(--turkuaz) 70%, var(--surface-2)); min-height: 3px; }
.hist > div:first-child i { background: var(--turkuaz); }
.hist b { font-size: 12px; }
.hist span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.hours { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; height: 80px; align-items: end; }
.hours i { display: block; border-radius: 3px 3px 1px 1px; background: var(--turkuaz); }
.hours i.best { background: var(--cay); opacity: 1 !important; }
.hours-ax { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }
.gl-levels > div { display: grid; grid-template-columns: 30px 1fr 40px; gap: 10px; align-items: center; padding: 5px 0; font-size: 14px; }
.gl-levels span { text-align: right; color: var(--muted); }
@media (min-width: 900px) {
  body.with-side .pg { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  body.with-side .pg > .seg, body.with-side .pg-level { grid-column: 1 / -1; }
}

/* слово из новости добавлено — галочка с пружинкой */
.news-doc [data-add].added { color: var(--turkuaz); animation: added-pop 380ms var(--spring); }
.news-doc [data-add-all].done { color: var(--turkuaz); }
@keyframes added-pop { 0% { transform: scale(.4) rotate(-20deg); opacity: 0; } 60% { transform: scale(1.18); opacity: 1; } 100% { transform: scale(1); } }

/* Подвал учёбы одной высоты при любом исходе: «Не знаю» и «Дальше» — 56px,
   варианты ответа не сдвигаются (Роман 26.09) */
.study-foot .btn, .study-foot .btn.ghost { min-height: 56px; }

/* кольца: закрытое — светится; подпись с двумя цветными точками */
.rings .rg-done { filter: drop-shadow(0 0 5px color-mix(in srgb, var(--turkuaz) 55%, transparent)); }
.rings-cap span { display: inline-flex; align-items: center; gap: 5px; }
.rings-cap i.goal-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #F4B942; }
.rings-cap i.goal-dot.rev { background: #F0605A; }

/* Заглушки с бликом (как во Флоу): повторяют форму блоков, пока нет данных */
.sk { display: block; border-radius: 8px; position: relative; overflow: hidden;
  background: color-mix(in srgb, var(--text) 7%, var(--surface)); }
.sk.sk-circle { border-radius: 50%; flex-shrink: 0; }
i.sk.start-card { box-shadow: none; }
.sk::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--text) 8%, transparent) 50%, transparent 80%);
  animation: sk-sheen 1.3s ease-in-out infinite; }
@keyframes sk-sheen { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .sk::after { animation: none; } }

.pg-radar { padding: 10px 6px; }
.pg-radar .rd-lbl { font-size: 13.5px; fill: var(--text); opacity: .8; }

/* письменный ответ верен — поле бирюзовое: обводка и лёгкая заливка */
.input.is-ok { border-color: var(--turkuaz); background: color-mix(in srgb, var(--turkuaz) 13%, var(--surface));
  color: var(--text); -webkit-text-fill-color: var(--text); }

/* окна никогда не прокручиваются вбок; поле времени iOS не шире окна */
.sheet { overflow-x: hidden; }
.sheet input[type="time"] { display: block; width: 100%; min-width: 0; max-width: 100%; -webkit-appearance: none; appearance: none; box-sizing: border-box; }
