/* ============================================================
   Հայերեն — курс восточноармянского (A0 → B1)
   Дизайн-система: современный «app»-стиль.
   Все цвета — в переменных ниже. Меняй здесь — поменяется везде.
   ============================================================ */

:root {
  /* Базовые цвета */
  --bg:          #ffffff;
  --bg-soft:     #f4f6fa;
  --bg-sunk:     #eef1f7;
  --ink:         #1b2030;
  --ink-soft:    #5c6478;
  --ink-faint:   #8b93a7;
  --line:        #e4e8f0;
  --line-strong: #d3d9e6;

  /* Акцент (чистый синий) */
  --primary:      #2f6bf2;
  --primary-deep: #1f4fc4;
  --primary-soft: #e9f0ff;

  /* Армянский акцент (абрикос) — только для крупных букв/брендинга */
  --apricot:      #f29b3d;
  --apricot-soft: #fff2e2;
  --pomegranate:  #c0392f;

  /* Уровни CEFR */
  --a0: #8b93a7;  --a0-bg: #eef0f5;
  --a1: #16a36a;  --a1-bg: #e4f7ee;
  --a2: #d98a00;  --a2-bg: #fdf1da;
  --b1: #7a5af0;  --b1-bg: #efeafe;

  /* Обратная связь */
  --good:    #15a06a;  --good-bg: #e4f7ee;  --good-line: #b9e6d0;
  --bad:     #e0484d;  --bad-bg:  #fdeced;  --bad-line:  #f6c5c7;

  /* Форма */
  --radius:    16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow:    0 1px 2px rgba(20,30,60,.04), 0 8px 24px rgba(20,30,60,.06);
  --shadow-sm: 0 1px 2px rgba(20,30,60,.05), 0 3px 10px rgba(20,30,60,.05);

  /* Шрифты */
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto,
          "Helvetica Neue", "Noto Sans Armenian", "Mshtakan", Arial, sans-serif;
  --hy:   "Noto Sans Armenian", "Mshtakan", "Sylfaen", "Arial Armenian",
          -apple-system, "Segoe UI", sans-serif;

  /* Полупрозрачный фон «стеклянных» панелей (topbar / vbar) — переопределяется в dark */
  --glass: rgba(255,255,255,.82);
}

/* ============================================================
   ТЁМНАЯ ТЕМА (дефолт, подлежит ревью)
   Графитовый фон, мягкий не-белый текст, осветлённый акцент.
   Переопределяем те же переменные, что в :root — этого хватает
   для большинства поверхностей; точечные правки ниже.
   ============================================================ */
html[data-theme="dark"] {
  /* Базовые цвета */
  --bg:          #161b22;
  --bg-soft:     #11151b;
  --bg-sunk:     #0d1117;
  --ink:         #e7e9ee;
  --ink-soft:    #aab2c2;
  --ink-faint:   #7f879a;
  --line:        #2a313c;
  --line-strong: #3a434f;

  /* Акцент — осветлён для контраста на тёмном */
  --primary:      #5b8dff;
  --primary-deep: #84a8ff;
  --primary-soft: #1c2740;

  /* Армянский акцент */
  --apricot:      #f6b15f;
  --apricot-soft: #2b2113;
  --pomegranate:  #e8746b;

  /* Уровни CEFR — текст светлее, подложки тёмные тонированные */
  --a0: #9aa3b5;  --a0-bg: #20262f;
  --a1: #4cd29a;  --a1-bg: #12271f;
  --a2: #f0b450;  --a2-bg: #2c2413;
  --b1: #ac93ff;  --b1-bg: #221d3a;

  /* Обратная связь */
  --good:    #43cf95;  --good-bg: #12271f;  --good-line: #205a44;
  --bad:     #f3787c;  --bad-bg:  #2c161a;  --bad-line:  #5e2a2e;

  /* Тени — мягче и темнее на графите */
  --shadow:    0 1px 2px rgba(0,0,0,.30), 0 8px 24px rgba(0,0,0,.40);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.30), 0 3px 10px rgba(0,0,0,.30);

  /* Стеклянные панели */
  --glass: rgba(22,27,34,.82);

  color-scheme: dark;
}

/* Точечные переопределения захардкоженных (не через переменную) цветов */
html[data-theme="dark"] .audio:hover     { background: #243657; }
html[data-theme="dark"] .opt--correct    { color: var(--good); }
html[data-theme="dark"] .opt--wrong      { color: var(--bad); }
html[data-theme="dark"] .chip:hover      { background: #232b36; }
html[data-theme="dark"] .ask             { border-color: #4a3a20; }
html[data-theme="dark"] .vrow.is-learned .vru { color: var(--good); }
/* флешкарта: оборотная сторона использует --primary-deep, на тёмном уже читаема */

/* Захардкоженные inline-цвета в HTML (приглушённый серый текст) —
   правим только в тёмной теме, не трогая сами .html файлы. */
html[data-theme="dark"] [style*="color:#666"],
html[data-theme="dark"] [style*="color:#888"] { color: var(--ink-soft) !important; }

/* ---------- Reset / база ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.62;
  color: var(--ink);
  background: var(--bg-soft);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Контейнер / каркас ---------- */
.wrap { max-width: 760px; margin: 0 auto; padding: 0 20px 96px; }
.wrap--wide { max-width: 1040px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--glass);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar__in {
  max-width: 1040px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand__mark {
  font-family: var(--hy); font-size: 22px; line-height: 1;
  color: var(--apricot); font-weight: 700;
}
.brand__sub { color: var(--ink-faint); font-weight: 500; font-size: 14px; }
.topbar__spacer { flex: 1; }
.crumb { color: var(--ink-faint); font-size: 14px; }
.crumb a { color: var(--ink-soft); }

/* ---------- Заголовки ---------- */
h1, h2, h3 { line-height: 1.2; color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: 34px; margin: 28px 0 10px; }
h2 { font-size: 24px; margin: 40px 0 14px; }
h3 { font-size: 19px; margin: 26px 0 10px; }
.lead { font-size: 19px; color: var(--ink-soft); margin: 0 0 24px; }
.eyebrow {
  text-transform: uppercase; letter-spacing: .12em; font-size: 12.5px;
  font-weight: 700; color: var(--primary); margin: 0 0 6px;
}
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }

/* ---------- Карточки и сетки ---------- */
.card {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 22px 24px; margin: 18px 0;
}
.card--soft { background: var(--bg-soft); box-shadow: none; }
.card--accent { border-color: var(--primary-soft); background: var(--primary-soft); }
.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--auto { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
@media (max-width: 680px) { .grid--2, .grid--3 { grid-template-columns: 1fr; } }

/* Кликабельная карточка-ссылка (для оглавления) */
.tile {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 18px 20px; color: var(--ink); transition: transform .12s, box-shadow .12s, border-color .12s;
}
.tile:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.tile--locked { opacity: .55; pointer-events: none; }
.tile__title { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.tile__meta { color: var(--ink-faint); font-size: 14px; }
.tile__done { color: var(--good); font-weight: 700; }

/* ---------- Бейджи уровней / теги ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 700; letter-spacing: .02em;
  padding: 3px 10px; border-radius: 999px; line-height: 1.5;
}
.badge--a0 { color: var(--a0); background: var(--a0-bg); }
.badge--a1 { color: var(--a1); background: var(--a1-bg); }
.badge--a2 { color: var(--a2); background: var(--a2-bg); }
.badge--b1 { color: var(--b1); background: var(--b1-bg); }
.tag {
  display: inline-block; font-size: 13px; color: var(--ink-soft);
  background: var(--bg-sunk); border-radius: 999px; padding: 3px 11px; margin: 2px 4px 2px 0;
}

/* ---------- Армянский текст / буквы ---------- */
.hy { font-family: var(--hy); }
.glyph {
  font-family: var(--hy); font-weight: 600; line-height: 1;
  color: var(--ink); font-size: 64px;
}
.glyph--accent { color: var(--apricot); }
.letter {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 8px; padding: 18px 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.letter .pair { font-family: var(--hy); font-size: 40px; font-weight: 600; }
.letter .name { font-weight: 700; font-size: 15px; }
.letter .sound { color: var(--ink-soft); font-size: 14px; }
.word-hy { font-family: var(--hy); font-size: 1.06em; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-family: inherit; font-size: 15.5px; font-weight: 600;
  padding: 10px 18px; border-radius: 999px; border: 1px solid transparent;
  transition: background .12s, border-color .12s, transform .06s; user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-deep); text-decoration: none; }
.btn--ghost { background: var(--bg); color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--bg-soft); text-decoration: none; }
.btn[disabled] { opacity: .5; cursor: default; }

/* ---------- Внешняя ссылка на Forvo (ОТКРЫВАЕТ ОТДЕЛЬНУЮ ВКЛАДКУ, не плеер) ---------- */
.audio {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600; color: var(--primary);
  background: var(--primary-soft); border-radius: 999px; padding: 4px 11px;
}
.audio:hover { text-decoration: none; background: #dde9ff; }
.audio::before { content: "🔊"; font-size: 12px; }
.audio::after  { content: "↗"; font-size: 10px; opacity: .65; margin-left: 1px; }

/* ---------- Callout / заметки ---------- */
.note {
  border-radius: var(--radius); padding: 14px 18px; margin: 16px 0;
  border: 1px solid var(--line); background: var(--bg-soft); font-size: 15.5px;
}
.note--tip  { border-color: var(--good-line); background: var(--good-bg); }
.note--warn { border-color: var(--a2);        background: var(--a2-bg);  }
.note__h { font-weight: 700; margin: 0 0 4px; }

/* ---------- Таблицы ---------- */
table.tbl { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 15.5px; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--ink-soft); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.tbl tr:hover td { background: var(--bg-soft); }
.tbl .hy { font-size: 18px; }

/* ---------- Квизы (мгновенная проверка) ---------- */
.quiz { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 20px 22px; margin: 18px 0; }
.quiz__q { font-weight: 600; margin: 0 0 14px; font-size: 17px; }
.quiz__q .hy { font-size: 1.15em; }
.quiz__opts { display: grid; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer;
  font-family: inherit; font-size: 16px; color: var(--ink);
  background: var(--bg); border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 12px 16px; transition: border-color .12s, background .12s;
}
.opt .hy { font-size: 19px; }
.opt:hover:not([data-done]) { border-color: var(--primary); background: var(--primary-soft); }
.opt--correct { border-color: var(--good); background: var(--good-bg); color: #0c7a4f; font-weight: 600; }
.opt--wrong   { border-color: var(--bad);  background: var(--bad-bg);  color: #b3393d; }
.opt--reveal  { border-color: var(--good); background: var(--good-bg); }
.opt[data-done] { cursor: default; }
.quiz__fb { margin: 14px 0 0; font-weight: 600; font-size: 15px; min-height: 1px; }
.quiz__fb.is-good { color: var(--good); }
.quiz__fb.is-bad  { color: var(--bad); }
.inp {
  font-family: var(--hy); font-size: 20px; color: var(--ink);
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 10px 14px; width: 100%; margin-bottom: 12px; background: var(--bg);
}
.inp:focus { outline: none; border-color: var(--primary); }

/* ---------- Флешкарта ---------- */
.flash {
  font-family: inherit; cursor: pointer; border: 1px solid var(--line);
  background: var(--bg); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 22px 16px; min-height: 92px; display: flex; align-items: center; justify-content: center;
  text-align: center; transition: border-color .12s, transform .06s;
}
.flash:hover { border-color: var(--primary); }
.flash:active { transform: translateY(1px); }
.flash__front { font-size: 18px; font-weight: 600; }
.flash__back { display: none; font-family: var(--hy); font-size: 26px; font-weight: 600; color: var(--primary-deep); }
.flash.is-flipped .flash__front { display: none; }
.flash.is-flipped .flash__back  { display: block; }

/* Контрол «выучил ✓» под флешкартой (Фаза 6: синхр. с тренажёром).
   .flashcell — обёртка-колонка в .grid--auto; карточка сохраняет размер,
   пилюля-кнопка сидит под ней. Палитра/размер — дефолт, на ревью Андрею. */
.flashcell { display: flex; flex-direction: column; gap: 8px; }
.flashcell .flash { width: 100%; }
.flearn {
  align-self: center; cursor: pointer; font-family: inherit;
  font-size: 13px; font-weight: 600; line-height: 1; color: var(--ink-soft);
  background: var(--bg-soft); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 6px 14px;
  transition: color .12s, background .12s, border-color .12s, transform .06s;
}
.flearn:hover { border-color: var(--good-line); color: var(--good); }
.flearn:active { transform: translateY(1px); }
.flashcell.is-learned .flearn,
.flearn[aria-pressed="true"] {
  color: var(--good); background: var(--good-bg);
  border-color: var(--good-line);
}
.flashcell.is-learned .flash { border-color: var(--good-line); }

/* ---------- Reveal ---------- */
.reveal { margin: 12px 0; }
[hidden] { display: none !important; }

/* ---------- Прогресс ---------- */
.progress { display: flex; align-items: center; gap: 12px; margin: 8px 0 20px; }
.progress__track { flex: 1; height: 10px; background: var(--bg-sunk); border-radius: 999px; overflow: hidden; }
.progress__bar { height: 100%; width: 0; background: var(--primary); border-radius: 999px; transition: width .4s ease; }
.progress__label { font-size: 14px; color: var(--ink-soft); font-weight: 600; white-space: nowrap; }

/* ---------- Шаги / нумерация ---------- */
.steps { counter-reset: s; list-style: none; padding: 0; margin: 18px 0; }
.steps li { position: relative; padding: 4px 0 16px 44px; }
.steps li::before {
  counter-increment: s; content: counter(s);
  position: absolute; left: 0; top: 0; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary-deep);
  font-weight: 700; border-radius: 999px; font-size: 14px;
}

/* ---------- Подвал ---------- */
.foot {
  margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--line);
  color: var(--ink-soft); font-size: 15px; display: flex; flex-direction: column; gap: 10px;
}
.ask {
  background: var(--apricot-soft); border: 1px solid #f4dcb8; border-radius: var(--radius);
  padding: 14px 18px; font-size: 15.5px;
}
.ask strong { color: var(--pomegranate); }
.src { font-size: 14.5px; color: var(--ink-soft); }
.src a { font-weight: 600; }

/* ---------- Навигация урок→урок ---------- */
.lnav { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; }
.lnav a { font-weight: 600; }

/* Трёхпозиционная панель: Назад | Оглавление | Вперёд */
.lnav--bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.lnav--bar > :nth-child(1) { justify-self: start; }
.lnav--bar > :nth-child(2) { justify-self: center; }
.lnav--bar > :nth-child(3) { justify-self: end; }
.lnav--top { margin-top: 0; margin-bottom: 24px; }
.lnav--bar .is-disabled { opacity: .5; pointer-events: none; cursor: default; }

/* ---------- Тренажёр слов (vocabulary.html) ---------- */
.vbar { position: sticky; top: 56px; z-index: 10; background: var(--glass);
  backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin: 16px 0; box-shadow: var(--shadow-sm); }
.vstats { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; font-size: 14px; color: var(--ink-soft); font-weight: 600; }
.vstats b { color: var(--ink); }
.vstats .progress { margin: 0; flex: 1 1 220px; }
.vcontrols { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.vsearch { flex: 1; min-width: 150px; font-family: var(--sans); font-size: 15px;
  border: 1.5px solid var(--line-strong); border-radius: 999px; padding: 8px 14px; }
.vsearch:focus { outline: none; border-color: var(--primary); }
.chip { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-soft);
  background: var(--bg-sunk); border: 1px solid transparent; border-radius: 999px; padding: 5px 12px; user-select: none; }
.chip:hover { background: #e2e6ef; }
.chip.is-active { color: #fff; background: var(--primary); }
.vtheme-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 26px 0 8px; }
.vtheme-head h3 { margin: 0; font-size: 18px; }
.vtheme-prog { font-size: 13px; color: var(--ink-faint); font-weight: 600; white-space: nowrap; }
.vlist { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.vrow { display: flex; align-items: center; gap: 14px; padding: 9px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.vrow:last-child { border-bottom: none; }
.vrow:hover { background: var(--bg-soft); }
.vrow input { width: 20px; height: 20px; accent-color: var(--good); cursor: pointer; flex: none; }
.vrow.is-learned { background: var(--good-bg); }
.vrow.is-learned .vru { color: #0c7a4f; }
.vword { font-family: var(--hy); font-size: 20px; font-weight: 600; min-width: 130px; }
.vru { color: var(--ink-soft); font-size: 15.5px; }
.vempty { padding: 40px 20px; text-align: center; color: var(--ink-faint); }

/* ---------- Тренажёр: режимы (список / карточки) ---------- */
.vmode { display: flex; gap: 8px; margin: 0 0 18px; }
.vmode .chip { font-size: 14px; padding: 9px 18px; }
.cardbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 18px; }
.ccount { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; margin-left: auto; }

/* Одиночная карточка (стиль Anki) */
.study { perspective: 1600px; max-width: 560px; margin: 0 auto; }
.scard { position: relative; width: 100%; min-height: 340px; cursor: pointer;
  transform-style: preserve-3d; transition: transform .5s cubic-bezier(.2,.7,.2,1); }
.scard.is-flipped { transform: rotateY(180deg); }
.sface { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--bg); box-shadow: var(--shadow); padding: 24px 28px; overflow: auto; }
.sface--back { transform: rotateY(180deg); background: var(--bg-soft); }
.sface__top { display: flex; justify-content: space-between; align-items: center;
  color: var(--ink-faint); font-size: 13px; font-weight: 600; flex: none; }
.sface__hy { flex: 1; display: flex; align-items: center; justify-content: center; text-align: center;
  font-family: var(--hy); font-weight: 600; line-height: 1.15; }
.sface--front .sface__hy { font-size: 52px; color: var(--ink); }
.sface__hint { text-align: center; color: var(--ink-faint); font-size: 13px; flex: none; }
.sface--back .sface__hy { font-size: 38px; flex: none; justify-content: flex-start;
  gap: 14px; align-items: baseline; margin-top: 8px; }
.sb-tr { font-family: var(--sans); font-size: 20px; color: var(--apricot); font-weight: 600; }
.sb-ru { font-size: 22px; font-weight: 600; margin: 2px 0 0; }
.sb-row { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.sb-label { font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-faint); font-weight: 700; margin-bottom: 3px; }
.sb-forms { font-family: var(--hy); font-size: 18px; }
.sb-ex { font-family: var(--hy); font-size: 19px; line-height: 1.5; }
.sb-exru { color: var(--ink-soft); font-size: 15px; margin-top: 2px; }
.scard.is-learned .sface--front { border-color: var(--good-line); background: var(--good-bg); }

.studynav { display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  justify-content: center; margin: 18px auto 0; max-width: 560px; }
.studynav .chip { padding: 10px 18px; font-size: 14px; }
.studynav .ccount { margin: 0; }
.chip.is-on { background: var(--good); color: #fff; }
.nav-grow { flex: 1; }

/* Сетка флип-карт */
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.gcard { perspective: 1200px; height: 132px; cursor: pointer; }
.gcard__in { position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d; transition: transform .45s; }
.gcard.is-flipped .gcard__in { transform: rotateY(180deg); }
.gface { 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;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); padding: 10px; overflow: hidden; }
.gface--front { font-family: var(--hy); font-size: 23px; font-weight: 600; }
.gface--back { transform: rotateY(180deg); background: var(--bg-soft); gap: 3px; padding: 8px; }
.gb-tr { color: var(--apricot); font-weight: 600; font-size: 13.5px; }
.gb-ru { font-weight: 600; font-size: 15px; }
.gb-ex { font-family: var(--hy); font-size: 12px; color: var(--ink-soft); line-height: 1.3; }
.gcard.is-learned .gface--front { border-color: var(--good-line); background: var(--good-bg); }
.gcard__chk { position: absolute; top: 5px; right: 8px; font-size: 14px; line-height: 1;
  color: var(--good); font-weight: 700; z-index: 2; cursor: pointer; }

/* ---------- Переключатель темы (вставляется через app.js) ---------- */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  flex: none; cursor: pointer; user-select: none;
  width: 38px; height: 38px; padding: 0; font-size: 18px; line-height: 1;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 999px;
  transition: background .12s, border-color .12s, transform .06s;
}
.theme-toggle:hover { background: var(--bg-soft); border-color: var(--primary); }
.theme-toggle:active { transform: translateY(1px); }
.theme-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Плавающий вариант — для страниц без .topbar */
.theme-toggle--float {
  position: fixed; right: 18px; bottom: 18px; z-index: 50;
  width: 46px; height: 46px; font-size: 20px;
  box-shadow: var(--shadow);
}

/* ============================================================
   ТРЕНАЖЁР СЛОВ — Дашборд + Сессия (Фаза 5)
   ============================================================ */

/* кнопки-расширения */
.btn--good { background: var(--good); color: #fff; }
.btn--good:hover { background: var(--good); filter: brightness(.94); text-decoration: none; }
.btn--lg { font-size: 17px; padding: 13px 26px; }

/* ---------- Дашборд ---------- */
.dash {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 22px 24px; margin: 0 0 24px;
}
.dash__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 16px; }
.dash__title { margin: 0; font-size: 20px; }
.dash__total { font-size: 14px; color: var(--ink-soft); font-weight: 600; }

.meter { margin: 0 0 14px; }
.meter--big { margin-bottom: 18px; }
.meter__label { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-soft); font-weight: 600; margin: 0 0 6px; }
.meter__label b { color: var(--ink); margin-left: auto; }
.meter__track { height: 12px; background: var(--bg-sunk); border-radius: 999px; overflow: hidden; }
.meter--big .meter__track { height: 16px; }
.meter__track--sm { height: 8px; }
.meter__bar { height: 100%; width: 0; border-radius: 999px; transition: width .4s ease; background: var(--primary); }
.meter__bar--all { background: linear-gradient(90deg, var(--primary), var(--primary-deep)); }
.meter__pct { font-size: 13px; color: var(--ink-soft); font-weight: 700; text-align: right; margin-top: 4px; }

.dash__levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 4px 0 14px; }
.dash__levels .meter { margin: 0; }
@media (max-width: 640px) { .dash__levels { grid-template-columns: 1fr; gap: 10px; } }

.dash__toggle {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: none; border: none; padding: 6px 0; margin: 4px 0 0;
  font-family: inherit; font-size: 14px; font-weight: 600; color: var(--primary);
}
.dash__toggle:hover { text-decoration: underline; }
.dash__toggle-ico { font-size: 11px; }
.dash__themes { margin-top: 14px; display: grid; gap: 12px; }
@media (min-width: 720px) { .dash__themes { grid-template-columns: 1fr 1fr; gap: 12px 28px; } }
.tmeter__top { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 0 0 5px; }
.tmeter__name { color: var(--ink-soft); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tmeter__num { margin-left: auto; color: var(--ink-faint); font-weight: 600; white-space: nowrap; }

/* ---------- Кнопка старта сессии ---------- */
.sess-start { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 0 0 28px; }
.sess-start__hint { color: var(--ink-faint); font-size: 14px; }

/* ---------- Экран настройки ---------- */
.setup {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px; margin: 0 0 28px;
}
.setup__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 18px; }
.setup__head h2 { margin: 0; font-size: 22px; }
.setup__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 24px; }
@media (max-width: 640px) { .setup__grid { grid-template-columns: 1fr; } }
.setup__group { min-width: 0; }
.setup__group--wide { grid-column: 1 / -1; margin-top: 18px; }
.setup__label { font-size: 13px; font-weight: 700; color: var(--ink); text-transform: uppercase; letter-spacing: .03em; margin: 0 0 8px; }
.setup__hint { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--ink-faint); }
.setup__select { width: 100%; }

.optrow { display: flex; gap: 8px; flex-wrap: wrap; }
.opt {
  cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink-soft);
  background: var(--bg-soft); border: 1.5px solid var(--line); border-radius: 999px;
  padding: 8px 16px; user-select: none; transition: background .12s, color .12s, border-color .12s;
}
.opt:hover { border-color: var(--line-strong); }
.opt.is-active { color: #fff; background: var(--primary); border-color: var(--primary); }
.optrow--checks .opt.is-active { background: var(--good); border-color: var(--good); }

.picker { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.picker .vsearch { flex: 1 1 240px; }
.picker__results {
  margin-top: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg); max-height: 260px; overflow: auto; box-shadow: var(--shadow-sm);
}
.picker__hit { display: flex; align-items: center; gap: 12px; padding: 8px 14px; cursor: pointer; border-bottom: 1px solid var(--line); }
.picker__hit:last-child { border-bottom: none; }
.picker__hit:hover { background: var(--bg-soft); }
.picker__hy { font-family: var(--hy); font-size: 17px; color: var(--ink); min-width: 90px; }
.picker__hru { color: var(--ink-soft); flex: 1; }
.picker__add { font-size: 13px; font-weight: 600; color: var(--primary); white-space: nowrap; }
.picker__add.is-in { color: var(--good); }
.picker__none, .picker__empty { padding: 12px 14px; color: var(--ink-faint); font-size: 14px; }
.picker__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pchip {
  display: inline-flex; align-items: center; gap: 7px; font-size: 14px;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px;
}
.pchip__ru { color: var(--ink-soft); font-size: 13px; }
.pchip__x { cursor: pointer; color: var(--ink-faint); font-weight: 700; }
.pchip__x:hover { color: var(--bad); }

.setup__foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.setup__deck-info { font-size: 14px; color: var(--ink-soft); font-weight: 600; }
.setup__deck-info.is-empty { color: var(--bad); }

/* ---------- Сессия ---------- */
.session {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 24px; margin: 0 0 28px;
}
.session__bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 18px; }
.session__counts { display: flex; gap: 14px; flex-wrap: wrap; }
.sc { font-size: 14px; color: var(--ink-soft); font-weight: 600; }
.sc b { color: var(--ink); }
.sc--learn b { color: var(--good); }
.sc--rem b { color: var(--primary); }
.session__prog { flex: 1 1 140px; height: 8px; background: var(--bg-sunk); border-radius: 999px; overflow: hidden; min-width: 100px; }
.session__prog-bar { height: 100%; width: 0; background: var(--good); border-radius: 999px; transition: width .35s ease; }
.session__end { margin-left: auto; }

.session__stage { min-height: 320px; }
.sx { max-width: 600px; margin: 0 auto; }
.sx-tag { display: inline-block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-faint); background: var(--bg-sunk); border-radius: 999px; padding: 3px 11px; margin: 0 0 12px; }
.sx-meta { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 13px; color: var(--ink-faint); }
.sx-theme { color: var(--ink-faint); }
.sx-tr { color: var(--apricot); font-weight: 600; font-size: 16px; margin-top: 6px; }

.sx-prompt { font-size: 34px; font-weight: 700; color: var(--ink); text-align: center; margin: 6px 0 4px; word-break: break-word; }
.sx-prompt--hy { font-family: var(--hy); }
.sx--input .sx-tr, .sx--choice .sx-tr { text-align: center; }
.sx-ask { text-align: center; color: var(--ink-soft); font-size: 15px; margin: 8px 0 16px; }

.sx-form { display: flex; gap: 10px; }
.sx-field {
  flex: 1; font-family: var(--hy); font-size: 22px; color: var(--ink);
  background: var(--bg); border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 12px 16px; width: 100%;
}
.sx-field:focus { outline: none; border-color: var(--primary); }
.sx-field[disabled] { opacity: .8; }
.sx-verdict { margin: 16px 0 0; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 16px; }
.sx-verdict.is-ok { background: var(--good-bg); color: var(--good); border: 1px solid var(--good-line); }
.sx-verdict.is-bad { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad-line); }
.sx-correct { font-family: var(--hy); font-weight: 700; }
.sx-tr-inline { color: var(--ink-soft); font-size: 14px; }

.sx-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .sx-opts { grid-template-columns: 1fr; } }
.sx-opt {
  cursor: pointer; font-family: inherit; font-size: 18px; font-weight: 600; color: var(--ink);
  background: var(--bg); border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 16px; text-align: center; transition: border-color .12s, background .12s;
}
.sx-opt--hy { font-family: var(--hy); font-size: 21px; }
.sx-opt:hover:not([disabled]) { border-color: var(--primary); }
.sx-opt.is-correct { background: var(--good-bg); border-color: var(--good-line); color: var(--good); }
.sx-opt.is-wrong { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }

.sx-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.sx-actions--match { justify-content: center; }
.sx-act { flex: 1 1 auto; justify-content: center; }
@media (max-width: 520px) { .sx-act { flex: 1 1 100%; } }

/* флип в сессии — переиспользуем .study/.scard/.sface, но шире */
.sx--flip .study { max-width: 100%; }
.sx--flip .scard { min-height: 300px; }
.sface__hy--ru { font-family: var(--sans); }
.sx--flip .sface--back .sface__hy { font-size: 30px; }

/* сопоставление */
.mgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.mcol { display: flex; flex-direction: column; gap: 10px; }
.mtile {
  cursor: pointer; font-family: inherit; font-size: 17px; font-weight: 600; color: var(--ink);
  background: var(--bg); border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 14px 12px; text-align: center; transition: border-color .12s, background .12s, transform .08s;
}
.mtile--left { font-family: var(--hy); font-size: 19px; }
.mtile:hover:not([disabled]) { border-color: var(--primary); }
.mtile.is-picked { border-color: var(--primary); background: var(--primary-soft); }
.mtile.is-solved { background: var(--good-bg); border-color: var(--good-line); color: var(--good); cursor: default; opacity: .85; }
.mtile.is-shake { border-color: var(--bad); background: var(--bad-bg); animation: sx-shake .3s; }
@keyframes sx-shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* ---------- Итог сессии ---------- */
.result__card { max-width: 560px; margin: 0 auto; text-align: center; padding: 30px 28px; }
.result__title { margin: 0 0 22px; font-size: 24px; }
.result__stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 0 0 26px; }
@media (max-width: 520px) { .result__stats { grid-template-columns: 1fr 1fr; } }
.rstat { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px 8px; }
.rstat__n { font-size: 32px; font-weight: 800; color: var(--ink); line-height: 1; }
.rstat__l { font-size: 12px; color: var(--ink-soft); font-weight: 600; margin-top: 6px; }
.rstat--learn .rstat__n { color: var(--good); }
.rstat--pct .rstat__n { color: var(--primary); }
.result__actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- Свободный просмотр: заголовок + кнопка «+ в подборку» ---------- */
.browse__title { margin: 8px 0 16px; font-size: 22px; }
.vrow__check { display: flex; align-items: center; flex: none; cursor: pointer; }
.vrow__pick {
  margin-left: auto; flex: none; cursor: pointer; width: 28px; height: 28px;
  border-radius: 999px; border: 1.5px solid var(--line-strong); background: var(--bg);
  color: var(--ink-soft); font-size: 16px; font-weight: 700; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s, border-color .12s;
}
.vrow__pick:hover { border-color: var(--primary); color: var(--primary); }
.vrow__pick.is-in { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Тёмная тема: точечные правки ---------- */
html[data-theme="dark"] .opt.is-active { color: #11151b; }
html[data-theme="dark"] .optrow--checks .opt.is-active { color: #11151b; }
html[data-theme="dark"] .sx-verdict.is-ok,
html[data-theme="dark"] .sx-opt.is-correct,
html[data-theme="dark"] .mtile.is-solved { color: var(--good); }

/* ---------- Печать ---------- */
@media print {
  body { background: #fff; font-size: 12pt; }
  .topbar, .btn, .audio, .lnav, .ask, .theme-toggle, .setup, .session, .sess-start { display: none !important; }
  .card, .quiz, .tile, .letter { box-shadow: none; break-inside: avoid; }
  a { color: #000; text-decoration: none; }
  .quiz__fb, .reveal[hidden] { display: block !important; }
}
