:root {
  --bg: #f5f6fd;
  --surface: #ffffff;
  --ink: #1f2438;
  --muted: #757d95;
  --line: #e7e9f4;
  --brand: #5b58d8;
  --brand-ink: #ffffff;
  --brand-soft: #ecebfc;
  --ok: #17915e;
  --ok-soft: #e3f6ec;
  --bad: #d2453f;
  --bad-soft: #fdeceb;
  --warn: #c9821c;
  --accent: #f0f1fe;
  --radius: 15px;
  --tap: 52px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1f2e;
    --surface: #262b3d;
    --ink: #eaecf7;
    --muted: #9ba3bd;
    --line: #353b52;
    --brand: #9092f2;
    --brand-ink: #1b1f2e;
    --brand-soft: #33345a;
    --ok: #58cf9a;
    --ok-soft: #1d3d31;
    --bad: #f08b86;
    --bad-soft: #43272a;
    --warn: #e6b45c;
    --accent: #2e3348;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* классовые правила вроде .btn{display:block} перебивают атрибут hidden */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}
.view {
  max-width: 560px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom));
  min-height: 100%;
}
h1, h2 { margin: 0; font-weight: 650; letter-spacing: -0.3px; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }

/* ---------------- buttons ---------------- */
.btn {
  display: block; width: 100%; min-height: var(--tap);
  border: 0; border-radius: var(--radius); padding: 14px 18px;
  font-weight: 600; transition: transform .06s ease, opacity .15s ease;
}
.btn:active { transform: scale(.985); }
.btn-lg { font-size: 18px; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-ghost { background: transparent; color: var(--muted); font-weight: 500; }
.btn:disabled { opacity: .45; }

.icon-btn {
  width: 40px; height: 40px; border: 0; border-radius: 11px;
  background: transparent; color: var(--muted); font-size: 20px; line-height: 1;
}
.icon-btn:active { background: var(--line); }
.linkish { background: none; border: 0; color: var(--brand); font-weight: 600; padding: 4px 6px; }

/* ---------------- auth ---------------- */
.auth-wrap { padding-top: 8vh; }
.brand { text-align: center; margin-bottom: 30px; }
.brand-mark {
  width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 19px;
  background: linear-gradient(140deg, var(--brand), #8f6ce0);
  color: #fff; font-weight: 700; font-size: 20px;
  display: flex; align-items: center; justify-content: center; letter-spacing: -.5px;
  box-shadow: 0 6px 18px -6px var(--brand);
}
.brand h1 { font-size: 27px; }
.brand p { color: var(--muted); font-size: 15px; margin: 6px 0 0; }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.field input {
  width: 100%; min-height: var(--tap); border: 1.5px solid var(--line);
  border-radius: var(--radius); background: var(--surface); color: var(--ink);
  padding: 12px 14px; font-size: 17px; font-family: inherit;
}
.field input:focus { outline: none; border-color: var(--brand); }
.at-input { position: relative; }
.at-input i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-style: normal; }
.at-input input { padding-left: 30px; }
#f-pin { letter-spacing: 8px; font-size: 22px; text-align: center; }
.error { background: var(--bad-soft); color: var(--bad); padding: 11px 14px; border-radius: 11px; font-size: 15px; margin: 0 0 14px; }

/* вход / регистрация — два явных режима */
.switch {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 20px;
  background: var(--accent); border-radius: 13px;
}
.switch-btn {
  flex: 1; padding: 10px 8px; border: 0; border-radius: 10px; background: transparent;
  color: var(--muted); font-size: 15px; font-weight: 600; font-family: inherit;
  transition: background .16s ease, color .16s ease;
}
.switch-btn.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.10); }
.field .hint { display: block; font-size: 12.5px; color: var(--muted); font-style: normal; margin-top: 7px; line-height: 1.35; }
.auth-note { font-size: 13px; color: var(--muted); text-align: center; line-height: 1.45; margin: 14px 2px 0; }

/* ---------------- topbar ---------------- */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; min-height: 44px; }
.who { flex: 1; font-weight: 600; color: var(--muted); font-size: 15px; }
#btn-back, #btn-stats-back { font-size: 30px; margin-left: -8px; }
/* лист ответов: квадратик на каждый вопрос.
   Всегда две строки по десять; когда заданий больше двадцати, лист
   прокручивается вбок, а не растёт вниз на пол-экрана. */
.sheet-wrap { position: relative; margin-bottom: 16px; }
.sheet { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
/* Свыше двадцати заданий лист становится лентой: две строки, счёт идёт
   сверху вниз и вправо, так что позиция в ленте — это и есть прогресс. */
.sheet.wide {
  grid-template-columns: none; grid-template-rows: repeat(2, auto);
  grid-auto-flow: column; grid-auto-columns: var(--cw, 30px);
  overflow-x: auto; scroll-behavior: smooth; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  /* прокрутка обрезает всё, что выходит за рамку: увеличенной текущей клетке
     и обводке разбора нужен запас, иначе у них срезает края */
  padding: 5px 4px; margin: -5px -4px; scroll-padding: 0 34px;
}
.sheet::-webkit-scrollbar { display: none; }
/* подсказка, что справа есть ещё: размытая кромка со стрелкой */
.sheet-more {
  position: absolute; right: -2px; top: 0; bottom: 0; width: 46px;
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 2px; font-size: 24px; line-height: 1; color: var(--muted);
  pointer-events: none; opacity: 0; transition: opacity .2s ease;
  background: linear-gradient(to right, transparent, var(--bg) 62%);
  backdrop-filter: blur(1.5px); -webkit-backdrop-filter: blur(1.5px);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 38%);
  mask-image: linear-gradient(to right, transparent, #000 38%);
}
.sheet-more.on { opacity: 1; }
.cell {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 7px; background: var(--surface); border: 1.5px solid var(--line);
  font-size: 12px; font-weight: 650; color: var(--muted);
  font-variant-numeric: tabular-nums; line-height: 1;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}
.sheet.wide .cell { aspect-ratio: auto; height: var(--cw, 30px); }
.cell.skip { border-style: dashed; color: var(--muted); }
.cell.now { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); transform: scale(1.08); }
.cell.ok  { border-color: transparent; background: var(--ok);  color: #fff; font-size: 14px; }
.cell.err { border-color: transparent; background: var(--bad); color: #fff; font-size: 14px; }
.cell.done { cursor: pointer; }
.cell.done:active { transform: scale(.92); }
.cell.viewing { outline: 2.5px solid var(--brand); outline-offset: 2px; }
.counter { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 46px; text-align: right; }

/* ---------------- home ---------------- */
.today {
  background: linear-gradient(165deg, var(--accent), var(--surface) 62%);
  border-radius: 19px; padding: 20px 18px; margin-bottom: 26px; border: 1px solid var(--line);
}
.goal { position: relative; width: 132px; height: 132px; margin: 2px auto 10px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.ring-bg { stroke: var(--line); }
.ring-fg { stroke: var(--brand); transition: stroke-dashoffset .5s cubic-bezier(.3,1,.4,1), stroke .3s ease; }
.ring-fg.done { stroke: var(--ok); }
.goal-mid { position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; }
.goal-mid b { font-size: 34px; font-weight: 700; letter-spacing: -1.2px; line-height: 1; font-variant-numeric: tabular-nums; }
.goal-mid span { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.goal-label { text-align: center; font-size: 13.5px; color: var(--muted); margin: 0 0 16px; font-weight: 500; }

.today-nums { display: flex; gap: 8px; }
.today-nums > div { flex: 1; text-align: center; }
.today-nums b { display: block; font-size: 24px; font-weight: 680; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.today-nums span { font-size: 12px; color: var(--muted); }

.hint { text-align: center; color: var(--muted); font-size: 13px; margin: 12px 0 0; }

.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 26px 0 10px; font-weight: 600; }
.deck-list { display: flex; flex-direction: column; gap: 9px; }
.deck {
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px;
  /* без явного цвета текст внутри <button> берёт дефолт браузера —
     в некоторых он ссылочно-синий */
  color: var(--ink); font-family: inherit;
}
.deck:active { background: var(--brand-soft); }
.deck-task {
  flex: 0 0 auto; min-width: 35px; height: 35px; padding: 0 8px; border-radius: 10px;
  background: hsl(var(--h, 245) 78% 94%); color: hsl(var(--h, 245) 52% 42%);
  font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center;
}
@media (prefers-color-scheme: dark) {
  .deck-task { background: hsl(var(--h, 245) 32% 27%); color: hsl(var(--h, 245) 72% 76%); }
}
.deck-body { flex: 1; min-width: 0; }
.deck-title { display: block; font-weight: 600; font-size: 16px; color: var(--ink); }
.deck-sub { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-bar { display: block; height: 4px; background: var(--line); border-radius: 2px; margin-top: 7px; overflow: hidden; }
.deck-bar i { display: block; height: 100%; background: hsl(var(--h, 245) 55% 58%); border-radius: 2px; }
.deck-badge {
  flex: 0 0 auto; font-size: 12px; font-weight: 700; color: var(--brand-ink);
  background: var(--brand); border-radius: 20px; min-width: 24px; padding: 2px 7px; text-align: center;
}
.deck-badge:empty { background: none; padding: 0; min-width: 0; }
.foot { color: var(--muted); font-size: 13px; text-align: center; margin-top: 22px; }
.build {
  flex: 0 0 auto; font-size: 10.5px; font-weight: 600; letter-spacing: .3px;
  color: var(--muted); opacity: .6; font-variant-numeric: tabular-nums;
  padding: 3px 7px; border-radius: 6px; background: var(--line);
}

/* работа над ошибками */
.btn-err { background: var(--bad); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-err { color: #2a1618; } }

.action-err {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  margin-top: 10px; padding: 14px 16px; min-height: var(--tap);
  background: var(--bad-soft); border: 1.5px solid transparent; border-radius: var(--radius);
  color: var(--bad); transition: opacity .15s ease;
}
.action-err:active { border-color: var(--bad); }
.action-err:disabled { background: var(--surface); border-color: var(--line); color: var(--muted); }
.ae-body { flex: 1; min-width: 0; }
.ae-title { display: block; font-weight: 650; font-size: 16px; }
.ae-sub { display: block; font-size: 12.5px; opacity: .8; }
.ae-count { flex: 0 0 auto; font-weight: 700; font-size: 15px; min-width: 26px; text-align: right; }

.deck-badge.err { background: var(--bad); }
.tag-err { background: var(--bad-soft); color: var(--bad); padding: 3px 9px; border-radius: 20px; font-weight: 700; }

.achieve {
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--ok-soft); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px;
}
.achieve-mark { font-size: 28px; line-height: 1; }
.achieve b { display: block; color: var(--ok); font-size: 15.5px; }
.achieve span { font-size: 12.5px; color: var(--muted); }

/* ---------------- study ---------------- */
.card-area { display: flex; flex-direction: column; }
.card-tag { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; font-size: 12px; }
#card-task { background: var(--brand-soft); color: var(--brand); padding: 3px 9px; border-radius: 20px; font-weight: 700; }
#card-deck { color: var(--muted); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 19px;
  padding: 30px 20px; text-align: center; margin-bottom: 16px;
  box-shadow: 0 2px 10px -6px rgba(31, 36, 56, .3);
}
.prompt { font-size: 26px; font-weight: 620; line-height: 1.3; letter-spacing: -.3px; word-break: break-word; }
.prompt.small { font-size: 19px; font-weight: 550; line-height: 1.45; }
.prompt.para {
  font-size: 15.5px; font-weight: 450; line-height: 1.55; text-align: left;
  letter-spacing: 0; white-space: pre-line;
  /* длинные условия (задания 8, 16, 21) прокручиваются внутри карточки,
     иначе кнопки ответа уезжают за пределы экрана */
  max-height: 44vh; overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* ---- формулировка задания над условием ---- */
.lead { font-size: 12.5px; font-weight: 500; color: var(--muted); line-height: 1.4; margin-bottom: 12px; }
/* ряды-варианты: в карточке остаётся одна формулировка */
.prompt.lead-only {
  font-size: 14.5px; font-weight: 500; line-height: 1.45;
  letter-spacing: 0; text-align: left; color: var(--muted);
}

/* ---- задания 15, 17–20: позиции прямо в предложении ---- */
.prompt.as-slots {
  font-size: 16px; font-weight: 450; letter-spacing: 0; text-align: left;
}
.slotted {
  line-height: 2; white-space: pre-wrap; overflow-wrap: break-word;
  max-height: 46vh; overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
.gap {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 26px; padding: 0 6px; margin: 0 3px;
  /* по середине строки, а не ниже её: иначе метки «пляшут» под текстом */
  vertical-align: middle;
  border-radius: 8px; border: 1.5px dashed var(--line); background: var(--surface);
  color: var(--muted); font-size: 16px; font-weight: 650; line-height: 1;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
}
/* номер позиции — мелкой пометкой в углу: ответ всё равно сдаётся цифрами */
.gap i {
  position: absolute; top: -8px; right: -3px; font-style: normal;
  font-size: 10px; font-weight: 700; color: var(--muted); opacity: .8;
}
/* палец толще метки: зона нажатия расширена, на вёрстку не влияет */
.gap::after { content: ''; position: absolute; inset: -10px -7px; }
.gap:active { transform: scale(.92); }
.gap.on   { border-style: solid; border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.gap.on i { color: var(--brand); }
.gap.hit  { border-style: solid; border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.gap.hit i { color: var(--ok); }
/* пропущенная позиция: контур есть, заливки нет — видно, что сам не поставил */
.gap.need  { border-style: dashed; border-color: var(--ok); color: var(--ok); }
.gap.need i { color: var(--ok); }
.gap.miss  { border-style: solid; border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.gap.miss i { color: var(--bad); }
.gap:disabled { opacity: 1; }

/* ---- задания 4, 9–14, 16: ряды как кнопки ---- */
.row {
  width: 100%; display: flex; gap: 11px; align-items: flex-start; text-align: left;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: var(--radius); padding: 12px 14px;
  font-size: 15.5px; font-weight: 450; line-height: 1.45;
  transition: background .12s ease, border-color .12s ease;
}
.row i {
  flex: none; width: 25px; height: 25px; border-radius: 8px; margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); border: 1.5px solid var(--line);
  font-style: normal; font-size: 13px; font-weight: 700; color: var(--muted);
}
.row span { white-space: pre-line; }
.row:active { background: var(--brand-soft); }
.row.on   { border-color: var(--brand); background: var(--brand-soft); }
.row.on i { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.row.hit  { border-color: var(--ok); background: var(--ok-soft); }
.row.hit i { background: var(--ok); border-color: var(--ok); color: #fff; }
.row.need  { border-color: var(--ok); }
.row.need i { border-color: var(--ok); color: var(--ok); }
.row.miss  { border-color: var(--bad); background: var(--bad-soft); }
.row.miss i { background: var(--bad); border-color: var(--bad); color: #fff; }
.row:disabled { opacity: 1; }

/* ---- задания 8 и 22: два столбца соответствия ---- */
.mhead {
  font-size: 11.5px; font-weight: 700; letter-spacing: .06em; color: var(--muted);
  text-transform: uppercase; margin: 6px 2px 1px;
}
.mhead + .mcell { margin-top: 0; }
.mcell {
  width: 100%; display: flex; gap: 10px; align-items: flex-start; text-align: left;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: var(--radius); padding: 11px 12px;
  font-size: 15px; font-weight: 450; line-height: 1.42;
  transition: background .12s ease, border-color .12s ease;
}
.mcell i {
  flex: none; width: 24px; height: 24px; border-radius: 7px; margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); border: 1.5px solid var(--line);
  font-style: normal; font-size: 13px; font-weight: 700; color: var(--muted);
}
.mcell span { flex: 1; white-space: pre-line; }
/* назначенный номер (у букв) или буквы, которые сюда поставили (у номеров) */
.mcell b {
  flex: none; min-width: 20px; text-align: right;
  font-size: 15px; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.mcell:active { background: var(--brand-soft); }
.mcell.active { border-color: var(--brand); background: var(--brand-soft); }
.mcell.active i { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.mcell.active b { color: var(--brand); }
.mcell.used i { border-color: var(--brand); color: var(--brand); }
.mcell.used b { color: var(--brand); }
.mcell.hit { border-color: var(--ok); background: var(--ok-soft); }
.mcell.hit i { background: var(--ok); border-color: var(--ok); color: #fff; }
.mcell.hit b { color: var(--ok); }
.mcell.miss { border-color: var(--bad); background: var(--bad-soft); }
.mcell.miss i { background: var(--bad); border-color: var(--bad); color: #fff; }
.mcell.miss b { color: var(--bad); font-size: 13px; }
.mcell:disabled { opacity: 1; }

/* задание 8: пять ячеек соответствия */
.pairs { display: flex; gap: 7px; justify-content: center; margin-bottom: 14px; }
.pair {
  flex: 1; max-width: 62px; padding: 7px 4px 9px; border-radius: 12px;
  background: var(--surface); border: 1.5px solid var(--line); color: var(--ink);
}
.pair i { display: block; font-style: normal; font-size: 12px; color: var(--muted); font-weight: 600; }
.pair b { display: block; font-size: 21px; font-weight: 700; line-height: 1.2; }
.pair.active { border-color: var(--brand); background: var(--brand-soft); }
.pair.active i { color: var(--brand); }
.pair.hit { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.pair.miss { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }

/* выбор позиций: цифры-переключатели */
.slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.slot {
  width: 52px; height: 52px; border-radius: 13px; font-size: 20px; font-weight: 650;
  background: var(--surface); border: 1.5px solid var(--line); color: var(--ink);
  transition: background .14s ease, border-color .14s ease, color .14s ease, transform .08s ease;
}
.slot:active { transform: scale(.94); }
.slot.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.slot.need { border-color: var(--ok); color: var(--ok); }
.slot.hit  { background: var(--ok); border-color: var(--ok); color: #fff; }
.slot.miss { background: var(--bad); border-color: var(--bad); color: #fff; }
/* ---- ударения: буквы-плитки ---- */
.prompt.as-letters { font-size: inherit; font-weight: inherit; letter-spacing: normal; }
/* --fs выставляется из JS по длине слова, чтобы оно всегда влезало в строку */
.letters { --fs: 32px; display: flex; flex-wrap: nowrap; justify-content: center; gap: 4px; }
.letter {
  position: relative; border: 0; background: transparent; color: var(--ink);
  font-size: var(--fs); font-weight: 620; line-height: 1; letter-spacing: 0;
  min-width: calc(var(--fs) * 0.82); border-radius: 9px;
  padding: calc(var(--fs) * 0.8) 1px calc(var(--fs) * 0.26);
  transition: background .15s ease, color .15s ease;
}
.letter:disabled { opacity: 1; }
.letter.vowel:active { background: var(--brand-soft); }
.letter:not(.vowel) { color: var(--muted); }
.letter .acc {
  position: absolute; left: 50%; top: calc(var(--fs) * 0.3); border-radius: 2px;
  width: calc(var(--fs) * 0.1); height: calc(var(--fs) * 0.44);
  background: var(--brand); opacity: 0;
  transform: translate(-50%, calc(var(--fs) * -0.45)) rotate(20deg) scale(.6);
  transition: transform .22s cubic-bezier(.2, 1.6, .4, 1), opacity .16s ease;
}
.letter.picked .acc, .letter.right .acc, .letter.bad .acc {
  opacity: 1; transform: translate(-50%, 0) rotate(20deg) scale(1);
}
.letter.picked { background: var(--brand-soft); color: var(--brand); }
.letter.right { background: var(--ok-soft); color: var(--ok); }
.letter.right .acc { background: var(--ok); }
.letter.bad { background: var(--bad-soft); color: var(--bad); }
.letter.bad .acc { background: var(--bad); }

.reveal { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.answer { font-size: 25px; font-weight: 650; color: var(--ok); word-break: break-word; }
.answer.wrong { color: var(--bad); }
.note { font-size: 14px; color: var(--muted); margin-top: 9px; }

.options { display: flex; flex-direction: column; gap: 9px; }
.opt {
  width: 100%; min-height: var(--tap); border: 1.5px solid var(--line); background: var(--surface);
  color: var(--ink); border-radius: var(--radius); padding: 13px 16px; font-size: 18px; font-weight: 550;
  text-align: center; transition: background .12s ease, border-color .12s ease;
}
.opt:active { background: var(--brand-soft); }
.opt.correct { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.opt:disabled { opacity: 1; }

/* ---------------- выбор размера тренировки ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 50; display: flex;
  align-items: flex-end; justify-content: center;
  background: rgba(10, 12, 20, .55); backdrop-filter: blur(3px);
  padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom));
}
.modal-card {
  width: 100%; max-width: 460px; background: var(--bg);
  border-radius: 20px; padding: 20px 18px 16px;
  animation: rise .18s ease-out;
}
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }
.modal-card h3 { margin: 0; font-size: 20px; font-weight: 700; }
.modal-card p { margin: 5px 0 16px; font-size: 14px; color: var(--muted); }
.sizes { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; }
.size {
  padding: 13px 6px; border-radius: 13px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink); font-family: inherit;
}
.size b { display: block; font-size: 21px; font-weight: 700; line-height: 1.1; }
.size span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.size.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.size.on span { color: var(--brand); }
.size:active { transform: scale(.96); }
#ask-cancel { margin-top: 12px; }

.actions { display: flex; gap: 8px; margin-top: 18px; }
/* «Пропустить» — рядом с проверкой, но заметно тише её */
.btn-skip { flex: 0 0 auto; width: auto; padding-left: 18px; padding-right: 18px; }
.actions .btn { margin: 0; }
.grade { flex: 1; min-height: var(--tap); border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); border-radius: var(--radius); padding: 9px 4px; font-size: 13px; font-weight: 600; }
.grade b { display: block; font-size: 11px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.grade[data-g="0"] { border-color: var(--bad); color: var(--bad); }
.grade[data-g="5"] { border-color: var(--ok); color: var(--ok); }

/* ---------------- done + stats ---------------- */
.done-wrap { text-align: center; padding-top: 14vh; }
.done-mark { width: 68px; height: 68px; margin: 0 auto 18px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); font-size: 32px; display: flex; align-items: center; justify-content: center; }
.done-wrap h2 { font-size: 25px; margin-bottom: 8px; }
.done-wrap p { color: var(--muted); margin: 0 0 22px; }
.done-wrap .btn { margin-bottom: 9px; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 26px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-align: center; }
.stat b { display: block; font-size: 27px; font-weight: 680; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.chart { display: flex; align-items: flex-end; gap: 3px; height: 110px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; overflow: hidden; }
.chart i { flex: 1; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .9; }
.chart i.empty { background: var(--line); }
.chart i.goal { background: var(--ok); }
