/* Uma bica por dia — стили платформы.
   Португальский текст набирается Literata (засечки), интерфейс и русские инструкции — Golos Text.
   Цвета заданы токенами: светлая тема на :root, тёмная — через prefers-color-scheme и data-theme. */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #edf1f7;
  --ink: #172033;
  --ink-2: #4d586b;
  --ink-3: #6f7a8d;
  --line: #d9dfe8;
  --cobalt: #1e4c9a;
  --cobalt-2: #2f63bf;
  --cobalt-tint: #e4ecf8;
  --tram: #f2b01e;
  --tram-2: #ffc23d;
  --tram-ink: #1b1400;
  --ok: #237a57;
  --ok-tint: #e2f2ea;
  --retry: #b4531a;
  --retry-tint: #fbebdd;
  --shadow: 0 1px 2px rgba(23, 32, 51, 0.06), 0 6px 20px rgba(23, 32, 51, 0.06);
  --radius: 14px;
  --radius-sm: 9px;
  --font-ui: "Golos Text", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-pt: "Literata", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --measure: 40rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1422;
    --surface: #151d2e;
    --surface-2: #1b2538;
    --ink: #e6ebf3;
    --ink-2: #aeb8c8;
    --ink-3: #8b96ab;
    --line: #28344c;
    --cobalt: #86a9ee;
    --cobalt-2: #a3bff5;
    --cobalt-tint: #1c2a48;
    --tram: #f5c04a;
    --tram-2: #ffd36e;
    --tram-ink: #1b1400;
    --ok: #5cc39a;
    --ok-tint: #173226;
    --retry: #f0a869;
    --retry-tint: #3a2718;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e1422;
  --surface: #151d2e;
  --surface-2: #1b2538;
  --ink: #e6ebf3;
  --ink-2: #aeb8c8;
  --ink-3: #8b96ab;
  --line: #28344c;
  --cobalt: #86a9ee;
  --cobalt-2: #a3bff5;
  --cobalt-tint: #1c2a48;
  --tram: #f5c04a;
  --tram-2: #ffd36e;
  --tram-ink: #1b1400;
  --ok: #5cc39a;
  --ok-tint: #173226;
  --retry: #f0a869;
  --retry-tint: #3a2718;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }
[hidden] { display: none !important; }

button, input, textarea, select { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--cobalt-2); outline-offset: 2px; border-radius: 6px; }

a { color: var(--cobalt); text-underline-offset: 3px; }

.pt { font-family: var(--font-pt); }

/* ---------- каркас ---------- */

.topbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  max-width: 44rem;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  margin-right: auto;
  min-width: 0;
}

.brand svg { width: 28px; height: 28px; flex: none; border-radius: 6px; }

.brand__name {
  font-family: var(--font-pt);
  font-style: italic;
  font-weight: 600;
  font-size: 1.08rem;
  letter-spacing: 0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.iconbtn {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  text-decoration: none;
}

.iconbtn:hover { background: var(--surface-2); color: var(--ink); }
.iconbtn svg { width: 22px; height: 22px; }

.page {
  max-width: 44rem;
  margin: 0 auto;
  padding-inline: 16px;
  padding-block: 20px 120px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (min-width: 640px) {
  .page { padding-inline: 24px; padding-block: 28px 140px; gap: 24px; }
}

/* ---------- типографика ---------- */

.eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.h-display {
  font-family: var(--font-pt);
  font-weight: 600;
  font-size: clamp(1.9rem, 6vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}

.h-title {
  font-family: var(--font-pt);
  font-weight: 600;
  font-size: clamp(1.6rem, 5vw, 2.1rem);
  line-height: 1.15;
  margin: 0;
  text-wrap: balance;
}

.h-sub { color: var(--ink-2); margin: 4px 0 0; font-size: 1.02rem; }

.h-section {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  text-wrap: balance;
}

.muted { color: var(--ink-3); }
.small { font-size: 0.875rem; }

.prose { max-width: var(--measure); }
.prose p { margin: 0 0 0.7em; }
.prose p:last-child { margin-bottom: 0; }
.prose ul { margin: 0.2em 0 0.7em; padding-left: 1.2em; }
.prose li { margin: 0.2em 0; }
.prose strong { font-weight: 600; }
.prose .pt { font-size: 1.06em; }

/* ---------- кнопки и чипы ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.97rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.08s;
}

.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn svg { width: 18px; height: 18px; }

.btn--primary { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }
.btn--primary:hover { background: var(--cobalt-2); border-color: var(--cobalt-2); }

:root[data-theme="dark"] .btn--primary { color: #0e1422; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn--primary { color: #0e1422; }
}

.btn--go { background: var(--tram); border-color: var(--tram); color: var(--tram-ink); font-size: 1.02rem; padding: 12px 22px; }
.btn--go:hover { background: var(--tram-2); border-color: var(--tram-2); }

.btn--ghost { background: transparent; border-color: transparent; color: var(--cobalt); padding-inline: 10px; }
.btn--ghost:hover { background: var(--cobalt-tint); border-color: transparent; }

.btn--small { min-height: 36px; padding: 6px 12px; font-size: 0.9rem; border-radius: 10px; }
.btn--block { width: 100%; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}

.chip--cobalt { background: var(--cobalt-tint); color: var(--cobalt); }
.chip--ok { background: var(--ok-tint); color: var(--ok); }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row--between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack--lg { gap: 20px; }

/* ---------- плитки-азулежу ---------- */

.tile { width: 100%; height: auto; display: block; }
.tile__bg { fill: var(--surface); }
.tile__motif { fill: var(--cobalt); }
.tile--empty .tile__bg { fill: transparent; }
.tile--empty .tile__frame { fill: none; stroke: var(--line); stroke-width: 1.2; stroke-dasharray: 3 3; }
.tile--current .tile__frame { fill: none; stroke: var(--tram); stroke-width: 2.4; }
.tile--done .tile__frame { fill: none; stroke: var(--cobalt); stroke-width: 1; opacity: 0.35; }

.panel {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
  gap: 0;
  max-width: 100%;
}

.panel--small { grid-template-columns: repeat(auto-fill, minmax(18px, 18px)); }

/* ---------- карточки ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

@media (min-width: 640px) { .card { padding: 22px; } }

.card--lift { box-shadow: var(--shadow); border-color: transparent; }

.next {
  display: grid;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.next__tiles {
  position: absolute;
  right: -18px;
  top: -18px;
  width: 132px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  opacity: 0.14;
  pointer-events: none;
}

.next__title { font-family: var(--font-pt); font-size: 1.55rem; font-weight: 600; line-height: 1.2; margin: 0; padding-right: 60px; text-wrap: balance; }
.next__goal { color: var(--ink-2); margin: 0; max-width: var(--measure); }

.week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.week__day { display: grid; gap: 6px; justify-items: center; font-size: 0.75rem; color: var(--ink-3); }
.week__day--today { color: var(--ink); font-weight: 600; }
.week__day .tile { max-width: 44px; }

.unitlist { display: grid; gap: 10px; }

.unitrow {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
}

.unitrow:hover { border-color: var(--ink-3); }
.unitrow--locked { opacity: 0.55; }
.unitrow__num { font-family: var(--font-pt); font-size: 1.4rem; font-weight: 600; color: var(--cobalt); text-align: center; font-variant-numeric: tabular-nums; }
.unitrow__title { font-family: var(--font-pt); font-weight: 600; font-size: 1.1rem; line-height: 1.25; }
.unitrow__ru { color: var(--ink-3); font-size: 0.88rem; }
.unitrow__count { font-size: 0.85rem; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

.seqhead { display: flex; align-items: baseline; gap: 10px; margin-top: 8px; }
.seqhead .eyebrow { white-space: nowrap; }
.seqhead::after { content: ""; flex: 1; border-bottom: 1px solid var(--line); transform: translateY(-4px); }

/* ---------- список заданий ---------- */

.tasklist { display: grid; gap: 8px; }

.taskrow {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}

.taskrow:hover { border-color: var(--ink-3); }
.taskrow--locked { opacity: 0.55; pointer-events: none; }
.taskrow--current { border-color: var(--tram); box-shadow: 0 0 0 1px var(--tram) inset; }
.taskrow__code { font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: 0.82rem; }
.taskrow__title { font-family: var(--font-pt); font-weight: 600; line-height: 1.25; }
.taskrow__meta { font-size: 0.82rem; color: var(--ink-3); }
.taskrow__side { font-size: 0.8rem; color: var(--ink-3); }
.taskrow svg.lock { width: 18px; height: 18px; color: var(--ink-3); }

/* ---------- экран задания ---------- */

.goal {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--cobalt-tint);
  color: var(--ink);
}

.goal svg { width: 20px; height: 20px; color: var(--cobalt); margin-top: 2px; }
.goal b { color: var(--cobalt); font-weight: 600; }

.block { display: grid; gap: 12px; }

.block__head { display: grid; gap: 4px; }
.block__num { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cobalt); }
.block__title { font-size: 1.08rem; font-weight: 600; margin: 0; text-wrap: balance; }
.block__instr { color: var(--ink-2); margin: 0; max-width: var(--measure); }

.tip {
  border-left: 3px solid var(--tram);
  background: var(--surface);
  padding: 12px 16px;
  border-radius: 0 12px 12px 0;
}

.tip__title { font-weight: 600; margin-bottom: 4px; }

/* текст на португальском */
.ptext {
  font-family: var(--font-pt);
  font-size: 1.12rem;
  line-height: 1.65;
  max-width: var(--measure);
}

.ptext p { margin: 0 0 0.6em; }

.gloss {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline dotted var(--cobalt);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
}

.gloss[aria-expanded="true"] { background: var(--cobalt-tint); border-radius: 4px; }
.gloss__tr { display: inline-block; margin-left: 4px; font-family: var(--font-ui); font-size: 0.8em; color: var(--cobalt); }

/* диалог */
.dialogue { display: grid; gap: 8px; }
.line { display: grid; grid-template-columns: 5.2rem 1fr; gap: 10px; align-items: baseline; }
.line__sp { font-size: 0.8rem; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; overflow-wrap: anywhere; }
.line__pt { font-family: var(--font-pt); font-size: 1.08rem; }
.line__ru { display: block; font-family: var(--font-ui); font-size: 0.85rem; color: var(--ink-3); }

/* аудиоплеер */
.player {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface-2);
}

.player__play {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--cobalt);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

:root[data-theme="dark"] .player__play { color: #0e1422; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .player__play { color: #0e1422; } }

.player__play svg { width: 20px; height: 20px; }
.player__body { display: grid; gap: 6px; min-width: 0; }
.player__label { font-size: 0.9rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player__bar { height: 6px; border-radius: 3px; background: var(--line); position: relative; overflow: hidden; cursor: pointer; }
.player__fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--cobalt); border-radius: 3px; }
.player__time { font-size: 0.78rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.player__speed {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.sound {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--cobalt);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  flex: none;
}

.sound svg { width: 16px; height: 16px; }
.sound.is-playing { background: var(--cobalt); color: var(--surface); border-color: var(--cobalt); }

/* словарь */
.vocab { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.vocab__item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); }
.vocab__item:first-child { border-top: none; }
.vocab__em { font-size: 1.5rem; width: 2rem; text-align: center; }
.vocab__pt { font-family: var(--font-pt); font-size: 1.12rem; font-weight: 600; line-height: 1.25; }
.vocab__ru { color: var(--ink-2); font-size: 0.92rem; }
.vocab__note { color: var(--ink-3); font-size: 0.82rem; }
.vocab--hide .vocab__ru, .vocab--hide .vocab__note { filter: blur(6px); transition: filter 0.2s; }
.vocab--hide .vocab__item:hover .vocab__ru, .vocab--hide .vocab__item:focus-within .vocab__ru { filter: none; }

/* упражнения */
.ex { display: grid; gap: 10px; }

.q {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.q__text { font-family: var(--font-pt); font-size: 1.08rem; line-height: 1.5; }
.q__text--ru { font-family: var(--font-ui); font-size: 1rem; }
.q__row { display: flex; align-items: center; gap: 10px; }

.opts { display: flex; flex-wrap: wrap; gap: 8px; }

.opt {
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  cursor: pointer;
  font-family: var(--font-pt);
  font-size: 1.02rem;
  text-align: left;
}

.opt--ru { font-family: var(--font-ui); font-size: 0.97rem; }
.opt:hover:not(:disabled) { border-color: var(--cobalt); }
.opt.is-right { background: var(--ok-tint); border-color: var(--ok); color: var(--ok); font-weight: 600; }
.opt.is-wrong { background: var(--retry-tint); border-color: var(--retry); color: var(--retry); text-decoration: line-through; text-decoration-thickness: 1px; }
.opt:disabled { cursor: default; }

.dots { display: inline-flex; gap: 4px; align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dot--ok { background: var(--ok); }
.dot--no { background: var(--retry); }

.feedback { font-size: 0.9rem; color: var(--ink-2); }
.feedback--ok { color: var(--ok); }
.feedback--retry { color: var(--retry); }

.explain { font-size: 0.9rem; color: var(--ink-2); padding: 8px 12px; border-radius: 10px; background: var(--surface-2); }

/* пропуски */
.gapline { font-family: var(--font-pt); font-size: 1.08rem; line-height: 2.3; }

.gap {
  display: inline-block;
  min-width: 5ch;
  max-width: 100%;
  padding: 2px 8px;
  border: none;
  border-bottom: 2px solid var(--cobalt);
  border-radius: 6px 6px 0 0;
  background: var(--cobalt-tint);
  font-family: var(--font-pt);
  font-size: 1.05rem;
  line-height: 1.4;
}

.gap:focus { outline: none; background: var(--surface-2); border-bottom-color: var(--cobalt-2); }
.gap.is-right { background: var(--ok-tint); border-bottom-color: var(--ok); color: var(--ok); }
.gap.is-wrong { background: var(--retry-tint); border-bottom-color: var(--retry); }
.gap__answer { font-family: var(--font-ui); font-size: 0.82rem; color: var(--ok); margin-left: 4px; white-space: nowrap; }

.accents { display: flex; flex-wrap: wrap; gap: 6px; }
.accents button {
  min-width: 38px;
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--font-pt);
  font-size: 1.05rem;
  cursor: pointer;
}

/* сопоставление */
.match { display: grid; gap: 8px; }
.match__row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.match__left { font-family: var(--font-pt); font-size: 1.05rem; overflow-wrap: anywhere; }
.match select {
  width: 100%;
  min-height: 42px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.match select.is-right { border-color: var(--ok); background: var(--ok-tint); color: var(--ok); }
.match select.is-wrong { border-color: var(--retry); background: var(--retry-tint); }

@media (max-width: 460px) {
  .match__row { grid-template-columns: 1fr auto; }
  .match__row select { grid-column: 1 / -1; grid-row: 2; }
}

/* порядок слов */
.order__line {
  min-height: 52px;
  padding: 8px;
  border-radius: 12px;
  border: 1.5px dashed var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.order__line.is-right { border-style: solid; border-color: var(--ok); background: var(--ok-tint); }
.order__line.is-wrong { border-color: var(--retry); }
.order__bank { display: flex; flex-wrap: wrap; gap: 6px; }

.word {
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--font-pt);
  font-size: 1.02rem;
  cursor: pointer;
}

.word--placed { background: var(--cobalt-tint); border-color: var(--cobalt-tint); }

/* правило */
.rule {
  border: 1.5px solid var(--cobalt);
  border-radius: var(--radius);
  padding: 16px 18px;
  background: var(--surface);
  display: grid;
  gap: 10px;
}

.rule__title { font-weight: 600; color: var(--cobalt); }
.tablewrap { overflow-x: auto; }
.rtable { border-collapse: collapse; min-width: 100%; font-size: 0.95rem; }
.rtable th, .rtable td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.rtable th { font-size: 0.78rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.rtable td.pt, .rtable td .pt { font-family: var(--font-pt); font-size: 1.02rem; }
.rtable tr:last-child td { border-bottom: none; }

.note-skip { font-size: 0.85rem; color: var(--ink-3); }

/* запись голоса */
.rec { display: grid; gap: 10px; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.rec__controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rec__btn { display: inline-flex; align-items: center; gap: 8px; }
.rec__dot { width: 10px; height: 10px; border-radius: 50%; background: #d4382c; }
.rec__timer { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 0.9rem; }
.rec audio { width: 100%; height: 40px; }
.is-recording .rec__dot { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

textarea.write {
  width: 100%;
  min-height: 140px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--font-pt);
  font-size: 1.05rem;
  line-height: 1.55;
  resize: vertical;
}

.checklist { display: grid; gap: 6px; padding: 0; margin: 0; list-style: none; }
.checklist label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.checklist input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--cobalt); flex: none; }

details.reveal { border-radius: 12px; border: 1px dashed var(--line); padding: 10px 14px; }
details.reveal summary { cursor: pointer; color: var(--cobalt); font-weight: 600; list-style: none; }
details.reveal summary::-webkit-details-marker { display: none; }
details.reveal[open] summary { margin-bottom: 8px; }

/* нижняя панель задания */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.dock__inner { max-width: 44rem; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.dock__time { font-size: 0.88rem; color: var(--ink-3); font-variant-numeric: tabular-nums; margin-right: auto; }
.dock__time--late { color: var(--retry); }

/* итоговый лист */
.sheet-back { position: fixed; inset: 0; z-index: 40; background: rgba(10, 16, 28, 0.45); display: grid; align-items: end; }
@media (min-width: 640px) { .sheet-back { align-items: center; justify-items: center; } }

.sheet {
  background: var(--bg);
  width: 100%;
  max-width: 34rem;
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  padding: 22px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  display: grid;
  gap: 16px;
}

@media (min-width: 640px) { .sheet { border-radius: 20px; padding: 26px; } }

.sheet__tile { width: 72px; justify-self: center; animation: paint 0.6s ease-out both; }
@keyframes paint { from { transform: rotate(-8deg) scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: 10px; }
.stat { padding: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.stat__n { font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat__l { font-size: 0.8rem; color: var(--ink-3); }

/* формы */
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: 0.92rem; }
.field input[type="text"], .field input[type="email"], .field textarea, .field select {
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 1rem;
}
.field .hint { font-size: 0.82rem; color: var(--ink-3); }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.seg button { border: none; background: transparent; padding: 10px 16px; cursor: pointer; font-weight: 600; min-width: 48px; }
.seg button[aria-pressed="true"] { background: var(--cobalt); color: var(--surface); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 60;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 0.92rem;
  max-width: calc(100% - 32px);
  box-shadow: var(--shadow);
}

/* календарь */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal__dow { font-size: 0.72rem; color: var(--ink-3); text-align: center; text-transform: uppercase; letter-spacing: 0.05em; }
.cal__day { aspect-ratio: 1; max-width: 100%; border-radius: 8px; display: grid; place-items: center; position: relative; font-size: 0.85rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.cal__day--today { outline: 2px solid var(--tram); outline-offset: -2px; color: var(--ink); font-weight: 600; }
.cal__day .tile { position: absolute; inset: 0; }
.cal__day--done { color: transparent; }
.cal__count { position: absolute; right: 2px; bottom: 1px; font-size: 0.65rem; font-weight: 700; color: var(--cobalt); background: var(--surface); border-radius: 6px; padding: 0 4px; }

/* карточки слов */
.flash {
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 10px;
  padding: 26px 18px;
}

.flash__pt { font-family: var(--font-pt); font-size: 2rem; font-weight: 600; line-height: 1.2; }
.flash__ru { font-size: 1.15rem; color: var(--ink-2); }

.empty { text-align: center; color: var(--ink-3); padding: 28px 12px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* вступительный тест */
.testbar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.testbar > span { display: block; height: 100%; background: var(--cobalt); border-radius: 3px; transition: width .25s ease; }
.opts--col { flex-direction: column; align-items: stretch; }
.opts--col .opt { text-align: left; }
.opt--idk { color: var(--ink-3); border-style: dashed; }

/* несколько записей в одном блоке аудио */
.audio__title { font-weight: 600; margin-top: 6px; }
.block > .audio__title:not(:first-child) { margin-top: 14px; }
.word.word--ok { border-color: var(--ok); background: var(--ok-tint); color: var(--ok); }

/* ---------- с сервером: ответ преподавателя, пометки, скрытый ответ, «Приду», устройства ---------- */
.btn[aria-pressed="true"] { background: var(--cobalt); border-color: var(--cobalt); color: var(--surface); }
.btn--danger { color: var(--retry); border-color: var(--retry); background: transparent; }
.spoiler { background: var(--ink-3); color: transparent; border-radius: 4px; padding: 0 3px; cursor: pointer; }
.spoiler * { color: inherit; }
.spoiler.is-open { background: var(--cobalt-tint); color: inherit; cursor: auto; }
.marked { white-space: pre-wrap; line-height: 1.9; margin: 0; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; overflow-wrap: anywhere; }
.mark { background: var(--retry-tint); color: inherit; border-bottom: 2px solid var(--retry); border-radius: 3px; padding: 0 1px; }
.mark__code { font-family: var(--font-ui); font-size: 0.72rem; font-weight: 700; color: var(--retry); margin-left: 2px; }
.fb__main { border-left: 3px solid var(--cobalt); padding-left: 12px; }
.fb__codes { margin: 0; padding-left: 18px; font-size: 0.9rem; }
.fb__sep { border: none; border-top: 1px dashed var(--line); margin: 2px 0; width: 100%; }
.devlist { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
