/* Cuaderno · тренажёр
   Тетрадь в клетку, синяя ручка, красная ручка учителя для исправлений. */

:root {
  --paper: #F4F7FC;
  --grid: rgba(27, 63, 160, 0.075);
  --surface: #FFFFFF;
  --line: #D6DFEE;
  --line-strong: #B9C6DE;
  --ink: #1B3FA0;
  --ink-press: #122C75;
  --ink-soft: #E4EAFB;
  --text: #15203B;
  --muted: #5B6886;
  --red: #CF2A3E;
  --red-soft: #FCE8EB;
  --green: #18804B;
  --green-soft: #E2F5EA;
  --hl: #FFE45C;
  --hl-text: #15203B;
  --shadow: 0 1px 0 rgba(21, 32, 59, 0.04), 0 6px 18px -10px rgba(21, 32, 59, 0.25);
  --radius-l: 20px;
  --radius-m: 14px;
  --radius-s: 10px;
  --ui: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0E1630;
    --grid: rgba(150, 175, 255, 0.06);
    --surface: #16213F;
    --line: #26345A;
    --line-strong: #364879;
    --ink: #8EA7FF;
    --ink-press: #6E8BF0;
    --ink-soft: #1E2C55;
    --text: #E9EEF9;
    --muted: #97A3C0;
    --red: #FF7183;
    --red-soft: #3A1C2B;
    --green: #55D394;
    --green-soft: #143426;
    --hl: #E3C83A;
    --hl-text: #0E1630;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 8px 22px -12px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0E1630;
  --grid: rgba(150, 175, 255, 0.06);
  --surface: #16213F;
  --line: #26345A;
  --line-strong: #364879;
  --ink: #8EA7FF;
  --ink-press: #6E8BF0;
  --ink-soft: #1E2C55;
  --text: #E9EEF9;
  --muted: #97A3C0;
  --red: #FF7183;
  --red-soft: #3A1C2B;
  --green: #55D394;
  --green-soft: #143426;
  --hl: #E3C83A;
  --hl-text: #0E1630;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 8px 22px -12px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 22px 22px;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
button { font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: var(--text); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- верх ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + var(--safe-t)) 16px 6px;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
}
.brand .n {
  display: inline-grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--ink);
  color: var(--paper);
  font-size: 19px;
  transform: rotate(-4deg);
}
.chips { display: flex; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-weight: 700; font-size: 14px;
}
.chip svg { width: 16px; height: 16px; }
.chip.streak.on { color: #E3632B; }
.chip.streak.off { color: var(--muted); }

.screen { flex: 1; padding: 6px 16px calc(96px + var(--safe-b)); }

h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
.h-page { font-size: 26px; font-weight: 800; margin: 10px 0 2px; }
.lead { color: var(--muted); margin: 0 0 14px; }

/* ---------- главный блок «урок дня» ---------- */
.today {
  position: relative;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-l);
  padding: 18px 18px 16px;
  margin: 8px 0 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.today::before {
  /* поля тетради */
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 5px;
  background: var(--red);
  opacity: 0.75;
}
.today h2 { font-size: 22px; font-weight: 800; }
.today .meta { color: var(--muted); margin: 4px 0 14px; font-size: 15px; }
.goal {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 16px;
  font-size: 14px; color: var(--muted);
}
.goal-bar { flex: 1; height: 8px; background: var(--ink-soft); border-radius: 99px; overflow: hidden; }
.goal-bar i { display: block; height: 100%; background: var(--ink); border-radius: 99px; transition: width .5s ease; }

.len-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 14px; }
.len-row span { font-size: 14px; color: var(--muted); }
.seg { display: inline-flex; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 9px;
  font-weight: 700; font-size: 15px; color: var(--muted); cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 12px 18px;
  border: 0;
  border-radius: var(--radius-m);
  font-weight: 800; font-size: 17px;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform .06s ease, box-shadow .06s ease, background .15s;
  user-select: none;
}
.btn-primary { background: var(--ink); color: #fff; box-shadow: 0 4px 0 var(--ink-press); }
:root[data-theme="dark"] .btn-primary { color: #0E1630; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { color: #0E1630; } }
.btn-primary:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink-press); }
.btn-primary:disabled { background: var(--line); color: var(--muted); box-shadow: 0 4px 0 var(--line-strong); cursor: default; transform: none; }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1.5px solid var(--line); box-shadow: 0 3px 0 var(--line); }
.btn-ghost:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.btn-ok { background: var(--green); color: #fff; box-shadow: 0 4px 0 color-mix(in srgb, var(--green) 70%, #000); }
.btn-bad { background: var(--red); color: #fff; box-shadow: 0 4px 0 color-mix(in srgb, var(--red) 70%, #000); }
.btn-small { min-height: 40px; font-size: 15px; padding: 8px 14px; width: auto; }
.link { background: none; border: 0; color: var(--ink); font-weight: 700; padding: 6px 0; cursor: pointer; }

/* ---------- режимы ---------- */
.modes { display: grid; gap: 10px; }
.mode {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-m);
  cursor: pointer;
  box-shadow: 0 3px 0 var(--line);
  transition: transform .06s ease, box-shadow .06s ease;
}
.mode:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.mode:disabled { opacity: .5; cursor: default; }
.mode .ic {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--ink-soft); color: var(--ink);
}
.mode .ic svg { width: 24px; height: 24px; }
.mode .ic.red { background: var(--red-soft); color: var(--red); }
.mode .ic.hl { background: color-mix(in srgb, var(--hl) 35%, var(--surface)); color: var(--text); }
.mode b { display: block; font-size: 17px; font-weight: 700; }
.mode small { display: block; color: var(--muted); font-size: 14px; line-height: 1.3; }
.mode .count { font-weight: 800; font-size: 18px; color: var(--ink); min-width: 28px; text-align: right; }
.mode .count.red { color: var(--red); }
.section-title { font-size: 15px; font-weight: 700; color: var(--muted); margin: 22px 2px 10px; }

.lessons { display: grid; gap: 8px; }
.lesson-row {
  display: grid; grid-template-columns: 58px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  width: 100%; text-align: left; cursor: pointer;
}
.lesson-row .d { font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.lesson-row .bar { height: 6px; background: var(--ink-soft); border-radius: 99px; overflow: hidden; margin-top: 5px; }
.lesson-row .bar i { display: block; height: 100%; background: var(--ink); }
.lesson-row small { color: var(--muted); font-size: 13px; }
.lesson-row .go { color: var(--ink); font-weight: 700; font-size: 14px; }

/* ---------- нижняя навигация ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center;
  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: 6px 8px calc(6px + var(--safe-b));
  z-index: 10;
}
.tabs .in { display: flex; width: 100%; max-width: 520px; }
.tab {
  flex: 1; border: 0; background: none; padding: 6px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--ink); }

/* ---------- урок ---------- */
.lesson {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  background: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 22px 22px;
  z-index: 20;
}
.lesson .wrap { width: 100%; max-width: 520px; margin: 0 auto; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.lesson-top { display: flex; align-items: center; gap: 12px; padding: calc(12px + var(--safe-t)) 16px 8px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent;
  display: grid; place-items: center; cursor: pointer; color: var(--muted); flex: none;
}
.icon-btn svg { width: 24px; height: 24px; }
.progress { flex: 1; height: 14px; border-radius: 99px; background: var(--ink-soft); overflow: hidden; position: relative; }
.progress i {
  display: block; height: 100%; background: var(--ink); border-radius: 99px;
  transition: width .35s cubic-bezier(.3,.7,.3,1);
  position: relative;
}
.progress i::after { content: ""; position: absolute; left: 8px; right: 8px; top: 3px; height: 3px; border-radius: 3px; background: rgba(255,255,255,.35); }
.combo { font-weight: 800; color: #E3632B; font-size: 15px; min-width: 34px; text-align: right; }

.task { flex: 1; overflow-y: auto; padding: 8px 16px 20px; display: flex; flex-direction: column; }
.task-title { font-size: 22px; font-weight: 800; margin: 6px 0 16px; letter-spacing: -0.02em; }
.badge-new {
  display: inline-block; margin: 6px 0 -6px; padding: 3px 10px; border-radius: 99px;
  background: var(--hl); color: var(--hl-text); font-weight: 800; font-size: 13px; align-self: flex-start;
}

.prompt { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.prompt .say {
  flex: none; width: 48px; height: 48px; border-radius: 14px; border: 0; cursor: pointer;
  background: var(--ink); color: #fff; display: grid; place-items: center; box-shadow: 0 3px 0 var(--ink-press);
}
:root[data-theme="dark"] .prompt .say { color: #0E1630; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .prompt .say { color: #0E1630; } }
.prompt .say:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink-press); }
.prompt .say svg { width: 24px; height: 24px; }
.prompt .say.slow { width: 40px; height: 40px; background: var(--ink-soft); color: var(--ink); box-shadow: 0 3px 0 var(--line-strong); margin-top: 4px; }
.prompt .say.slow svg { width: 20px; height: 20px; }
.bubble {
  position: relative;
  padding: 12px 16px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  font-size: 20px; font-weight: 600; line-height: 1.35;
}
.bubble.big { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; border: 0; background: none; padding: 0; }
.bubble .tap { border-bottom: 2px dotted var(--line-strong); cursor: pointer; }
.ru-x { color: var(--muted); font-size: .86em; font-weight: 400; }
.sub { color: var(--muted); font-size: 15px; margin-top: -10px; margin-bottom: 16px; }
.listen-big { display: flex; gap: 14px; justify-content: center; margin: 18px 0 26px; }
.listen-big .say { width: 92px; height: 92px; border-radius: 24px; }
.listen-big .say svg { width: 44px; height: 44px; }
.listen-big .say.slow { width: 64px; height: 64px; border-radius: 18px; align-self: flex-end; }
.listen-big .say.slow svg { width: 30px; height: 30px; }

.options { display: grid; gap: 10px; }
.options.two { grid-template-columns: 1fr 1fr; }
.opt {
  width: 100%; text-align: left;
  padding: 14px 16px; min-height: 56px;
  border: 1.5px solid var(--line); border-radius: var(--radius-m);
  background: var(--surface); box-shadow: 0 3px 0 var(--line);
  font-size: 18px; font-weight: 600; cursor: pointer;
  transition: transform .06s ease, box-shadow .06s ease, border-color .1s, background .1s;
}
.options.two .opt { text-align: center; font-size: 22px; }
.opt:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.opt[aria-pressed="true"] { border-color: var(--ink); background: var(--ink-soft); box-shadow: 0 3px 0 var(--ink); color: var(--ink); }
.opt.right { border-color: var(--green); background: var(--green-soft); box-shadow: 0 3px 0 var(--green); color: var(--green); }
.opt.wrong { border-color: var(--red); background: var(--red-soft); box-shadow: 0 3px 0 var(--red); color: var(--red); }
.opt:disabled { cursor: default; }

/* плитки */
.answer-line {
  min-height: 112px;
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px;
  padding: 8px 0 10px;
  margin-bottom: 18px;
  background-image: linear-gradient(to bottom, transparent 51px, var(--line-strong) 51px, var(--line-strong) 53px, transparent 53px);
  background-size: 100% 56px;
}
.bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tile {
  padding: 9px 13px; border-radius: var(--radius-s);
  border: 1.5px solid var(--line); background: var(--surface); box-shadow: 0 3px 0 var(--line);
  font-size: 18px; font-weight: 600; cursor: pointer; line-height: 1.2;
  transition: transform .06s ease;
}
.tile:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.tile.ghost { visibility: hidden; }
.tile.placeholder { background: var(--line); color: transparent; box-shadow: none; border-color: transparent; cursor: default; }
.kbd-toggle { align-self: center; margin-top: 18px; }

/* ввод */
.input-wrap { position: relative; }
.answer-input {
  width: 100%; min-height: 120px; resize: none;
  padding: 14px 16px; font-size: 20px; font-weight: 500; line-height: 1.4;
  border: 1.5px solid var(--line); border-radius: var(--radius-m);
  background: var(--surface);
}
.answer-input.single { min-height: 0; height: 60px; }
.answer-input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--ink-soft); }
.answer-input:disabled { opacity: .85; }
.accents { display: grid; grid-template-columns: repeat(9, 1fr); gap: 5px; margin-top: 10px; }
.accents button {
  min-width: 0; height: 42px; padding: 0; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface);
  font-size: 18px; font-weight: 600; cursor: pointer; box-shadow: 0 2px 0 var(--line);
}
.hint { color: var(--muted); font-size: 14px; margin: 8px 2px 0; }

/* пропуск в предложении */
.gap-sentence { font-size: 24px; font-weight: 600; line-height: 1.6; margin: 4px 0 8px; }
.gap-slot {
  display: inline-block; min-width: 80px; padding: 0 6px; margin: 0 2px;
  border-bottom: 3px solid var(--ink); color: var(--ink); text-align: center; font-weight: 800;
}
.gap-input {
  display: inline-block; width: 7.5em; max-width: 60%;
  font-size: 22px; font-weight: 700; color: var(--ink);
  border: 0; border-bottom: 3px solid var(--ink); background: transparent; padding: 0 4px; text-align: center;
}
.gap-input:focus { outline: none; border-bottom-color: var(--ink-press); background: var(--ink-soft); border-radius: 6px 6px 0 0; }
.gap-hint { color: var(--muted); font-size: 16px; font-style: italic; }

/* пары */
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match .col { display: grid; gap: 10px; }
.match .opt { text-align: center; font-size: 16px; min-height: 58px; padding: 10px; display: flex; align-items: center; justify-content: center; }
.match .opt.done { opacity: .35; box-shadow: none; transform: none; }
.match .opt.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* нижняя панель урока и обратная связь */
.footer { padding: 12px 16px calc(14px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--paper); }
.footer.ok { background: var(--green-soft); border-top-color: transparent; }
.footer.bad { background: var(--red-soft); border-top-color: transparent; }
.fb { display: none; margin-bottom: 12px; }
.footer.ok .fb, .footer.bad .fb { display: block; animation: rise .22s ease-out; }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.fb-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fb-title { font-size: 21px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.footer.ok .fb-title { color: var(--green); }
.footer.bad .fb-title { color: var(--red); }
.fb-title svg { width: 28px; height: 28px; }
.fb-body { margin-top: 4px; font-size: 17px; }
.fb-body .lbl { font-weight: 700; }
.fb-body .tr { color: var(--muted); font-size: 15px; margin-top: 2px; }
.fb-note { color: var(--muted); font-size: 14px; margin-top: 6px; }
.fb { max-height: 58vh; overflow-y: auto; }
/* почему так: разбор ошибки и шпаргалки — заметки красной ручкой на полях */
.why { margin-top: 10px; padding: 8px 12px; border-left: 3px solid var(--red); background: var(--surface); border-radius: 0 var(--radius-s) var(--radius-s) 0; font-size: 15px; line-height: 1.4; }
.footer.ok .why { border-left-color: var(--green); }
.why p { margin: 2px 0; }
.why-h { font-family: var(--hand); font-size: 21px; line-height: 1.1; color: var(--red); margin-bottom: 2px; }
.footer.ok .why-h { color: var(--green); }
.tips { display: grid; gap: 10px; }
.why.tip { margin-top: 0; box-shadow: var(--shadow); }
.sheet .why.tip { margin-top: 10px; box-shadow: none; background: var(--paper); }
.flag-btn {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  border: 1.5px solid currentColor; background: transparent; border-radius: 99px;
  padding: 5px 11px; font-weight: 700; font-size: 13px; cursor: pointer; color: var(--muted);
}
.flag-btn svg { width: 15px; height: 15px; }
.flag-btn[aria-pressed="true"] { background: var(--hl); color: var(--hl-text); border-color: var(--hl); }

/* красная ручка учителя */
.pen {
  font-family: var(--hand);
  font-size: 28px; font-weight: 700; line-height: 1.1;
  color: var(--red);
  display: inline-block;
  transform: rotate(-1.5deg);
}
.pen mark {
  background: none; color: var(--red);
  text-decoration: underline wavy var(--red);
  text-decoration-thickness: 2px; text-underline-offset: 5px;
}
.pen-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; }
.pen-row .say-mini { border: 0; background: none; color: inherit; cursor: pointer; padding: 2px; }
.pen-row .say-mini svg { width: 20px; height: 20px; }
.ok-text { font-weight: 700; color: var(--green); }
.hl-swipe { background: linear-gradient(transparent 55%, color-mix(in srgb, var(--hl) 85%, transparent) 55%); padding: 0 3px; }

/* ---------- итог урока ---------- */
.result { overflow: hidden; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px 16px; }
.result .stamp {
  font-family: var(--hand); font-size: clamp(44px, 14vw, 64px); white-space: nowrap; max-width: 100%; font-weight: 700; color: var(--red);
  border: 4px solid var(--red); border-radius: 18px; padding: 0 22px; line-height: 1.15;
  transform: rotate(-6deg); margin: 10px 0 18px;
  animation: stamp .45s cubic-bezier(.2,1.4,.4,1) both;
}
@keyframes stamp { from { transform: rotate(-6deg) scale(2.2); opacity: 0; } to { transform: rotate(-6deg) scale(1); opacity: 1; } }
.result h2 { font-size: 26px; font-weight: 800; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; margin: 20px 0; }
.stat { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-m); padding: 12px 6px; }
.stat b { display: block; font-size: 24px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
/* частые ошибки: красный значок «!», плашка в обратной связи и в карточке, история ответов */
.x-badge { display: inline-grid; place-items: center; width: 17px; height: 17px; margin: 0 4px; border-radius: 50%; background: var(--red); color: #fff; font-size: 12px; font-weight: 800; line-height: 1; vertical-align: 1px; }
.x-note { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 14px; font-weight: 600; color: var(--red); }
.x-note svg { width: 16px; height: 16px; flex: none; }
.x-note.ok { color: var(--green); }
.x-sub { color: var(--muted); font-size: 14px; margin: 0 0 4px; }
.x-box { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-s); background: var(--red-soft); color: var(--text); font-size: 14px; line-height: 1.4; }
.x-box b { display: block; color: var(--red); margin-bottom: 2px; }
.hist { display: inline-flex; gap: 3px; vertical-align: middle; }
.hist i { width: 10px; height: 10px; border-radius: 50%; background: var(--green); }
.hist i.bad { background: var(--red); }
.mistakes { width: 100%; text-align: left; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-m); padding: 12px 14px; margin-bottom: 18px; }
.mistakes h3 { font-size: 16px; margin-bottom: 6px; }
.mistakes li { margin: 6px 0; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.mistakes ul { list-style: none; padding: 0; margin: 0; }
.mistakes .es { font-weight: 700; }
.mistakes .ru { color: var(--muted); font-size: 14px; }
.result .actions { display: grid; gap: 12px; width: 100%; }

/* ---------- тетрадь ---------- */
.search {
  width: 100%; height: 48px; padding: 0 16px; border-radius: var(--radius-m);
  border: 1.5px solid var(--line); background: var(--surface); font-size: 17px; margin-bottom: 10px;
}
.search:focus { outline: none; border-color: var(--ink); }
.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin: 0 -16px 8px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter {
  flex: none; padding: 7px 13px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--surface);
  font-weight: 700; font-size: 14px; color: var(--muted); cursor: pointer;
}
.filter[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.word-list { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
.word-list li + li { border-top: 1px solid var(--line); }
.word {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center;
  width: 100%; padding: 11px 14px; background: none; border: 0; text-align: left; cursor: pointer;
}
.word .es { font-weight: 700; font-size: 17px; }
.word .ru { color: var(--muted); font-size: 14px; }
.word .right { display: flex; align-items: center; gap: 8px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 6px; height: 14px; border-radius: 2px; background: var(--line); }
.dots i.on { background: var(--ink); }
.dots.learned i.on { background: var(--green); }
.star { color: var(--hl); filter: drop-shadow(0 0 0 #a08900); }
.star svg { width: 18px; height: 18px; display: block; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.list-head { display: flex; justify-content: space-between; align-items: center; margin: 4px 2px 8px; color: var(--muted); font-size: 14px; }

/* ---------- лист (модальное окно снизу) ---------- */
.sheet-back { position: fixed; inset: 0; background: rgba(10, 16, 35, .45); z-index: 40; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  max-width: 520px; margin: 0 auto;
  max-height: 88dvh; overflow-y: auto;
  background: var(--surface); border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(20px + var(--safe-b));
  animation: up .22s cubic-bezier(.3,.7,.3,1);
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-close { position: absolute; right: 10px; top: 10px; }
.sheet .grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line-strong); margin: 0 auto 12px; }
.sheet h2 { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.sheet .kind { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.detail-es { display: flex; align-items: center; gap: 10px; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.detail-ru { font-size: 18px; color: var(--muted); margin: 2px 0 12px; }
.forms { width: 100%; border-collapse: collapse; margin: 8px 0 12px; }
.forms td { padding: 7px 4px; border-top: 1px solid var(--line); font-size: 16px; }
.forms td:first-child { color: var(--muted); width: 42%; }
.forms td:last-child { font-weight: 700; }
.note-box { background: var(--paper); border-radius: 12px; padding: 10px 12px; font-size: 15px; margin: 8px 0 12px; }
.ex { margin: 6px 0; }
.ex .ru { color: var(--muted); font-size: 14px; }
.row-actions { display: flex; gap: 10px; margin-top: 14px; }
.row-actions .btn { flex: 1; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { font-weight: 700; font-size: 14px; color: var(--muted); }
.field textarea, .field select, .field input {
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--paper); padding: 10px 12px; font-size: 16px;
}
.field textarea { min-height: 150px; resize: vertical; font-family: var(--ui); }
.field small { color: var(--muted); font-size: 13px; }

/* ---------- прогресс ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0 16px; }
.kpi { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-m); padding: 12px; }
.kpi b { display: block; font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--muted); font-size: 13px; }
.panel { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-m); padding: 14px; margin-bottom: 14px; }
.panel h3 { font-size: 17px; margin-bottom: 10px; }
.stack { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--line); }
.stack i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; background: var(--c); vertical-align: -1px; }
.week { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; align-items: end; height: 90px; }
.week .col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; }
.week .bar { width: 100%; border-radius: 4px 4px 2px 2px; background: var(--ink); min-height: 3px; }
.week .bar.zero { background: var(--line); }
.week .bar.today { background: var(--red); }
.week small { font-size: 10px; color: var(--muted); }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.set-row:first-of-type { border-top: 0; }
.set-row span { font-weight: 600; }
.set-row small { display: block; color: var(--muted); font-weight: 400; font-size: 13px; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; background: var(--line-strong); border-radius: 99px; transition: background .15s; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + i { background: var(--ink); }
.switch input:checked + i::after { transform: translateX(20px); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.danger { color: var(--red); }
.toast {
  position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%);
  background: var(--text); color: var(--paper); padding: 10px 16px; border-radius: 12px; font-weight: 600; z-index: 60;
  animation: rise .2s ease-out; max-width: calc(100% - 32px);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (min-width: 560px) {
  .screen { padding-top: 12px; }
}

/* сборка формы глагола: корень + окончание */
.conj-word { display: flex; justify-content: center; align-items: flex-end; min-height: 56px; margin: 4px 0 18px; padding-bottom: 6px; border-bottom: 2px solid var(--line); font-size: 30px; font-weight: 800; letter-spacing: -0.01em; color: var(--ink); }
.conj-word .slot { display: inline-block; min-width: 54px; height: 34px; margin: 0 2px; border-radius: 8px; background: var(--line); }
.conj-word .sp { margin-right: 10px; }
.conj-word.right { color: var(--green); border-color: var(--green); }
.conj-word.wrong { color: var(--red); border-color: var(--red); }
.conj-rows { display: grid; gap: 14px; }
.conj-row .lbl { display: block; color: var(--muted); font-size: 13px; text-align: center; margin-bottom: 6px; }
.conj-row .tile[aria-pressed="true"] { border-color: var(--ink); background: var(--ink-soft); box-shadow: 0 3px 0 var(--ink); color: var(--ink); }

/* экран выбора профиля */
.profile-screen { max-width: 440px; margin: 0 auto; padding-top: 24px; }
.profile-screen .brand { margin-bottom: 18px; }
.profile-list { display: grid; gap: 10px; margin-bottom: 14px; }
.profile-list .who { flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; min-height: 64px; padding: 10px 16px; }
.profile-list .who b { font-size: 18px; }
.profile-list .who small { color: var(--muted); font-weight: 500; font-size: 13px; }
.pin-err { color: var(--red); font-weight: 600; min-height: 1.4em; margin: 0 0 10px; }
.profile-screen #pin { font-size: 24px; letter-spacing: 0.4em; text-align: center; }
.profile-screen .link { display: block; margin: 8px auto 0; text-align: center; }

/* Netlify (бесплатный тариф) вставляет плашку «Powered by Netlify» в правый нижний угол — она закрывает кнопку «Проверить» и нижнее меню */
#nl-badge-frame { display: none !important; }
