/* Lernheft — тетрадь в клетку: синие чернила, красная ручка учителя, жёлтый маркер */
:root {
  --paper: #EEF2FA;
  --grid: #D9E1F2;
  --card: #FCFDFF;
  --sheet: #FFFEFA;
  --rule: #DCE5F5;
  --line: #C3CDE7;
  --ink: #1F2E9E;
  --ink-deep: #121C6B;
  --ink-soft: color-mix(in srgb, var(--ink) 10%, var(--card));
  --ink-text: #FFFFFF;
  --text: #161B3D;
  --muted: #5A6592;
  --red: #D23A2E;
  --green: #1B8553;
  --margin: #EDA7A1;
  --flap-a: #E3E9F7;
  --flap-b: #D7DFF2;
  --der: #2757D0;
  --die: #CC3328;
  --das: #1B8553;
  --hl: #FFE45C;
  --hl-soft: color-mix(in srgb, var(--hl) 75%, transparent);
  --lift: 0 1px 0 rgba(31, 46, 158, .06), 0 10px 24px -14px rgba(31, 46, 158, .35);
  --serif: "Literata", ui-serif, "New York", Georgia, serif;
  --sans: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --hand: "Caveat", "Bradley Hand", "Noteworthy", "Segoe Print", cursive;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0E1330; --grid: #18204A; --card: #161E44; --sheet: #19224C; --rule: #222D5E; --line: #2D3978;
    --ink: #A9B8FF; --ink-deep: #6F82E8; --ink-text: #0E1330; --text: #E8ECFF; --muted: #93A0D6;
    --red: #FF7C70; --green: #5AD59E; --margin: #7C3A4B;
    --flap-a: #1F2A5E; --flap-b: #263268; --der: #82A6FF; --die: #FF7C70; --das: #5AD59E;
    --hl: #C9B13A; --hl-soft: color-mix(in srgb, #C9B13A 45%, transparent);
    --lift: 0 1px 0 rgba(0, 0, 0, .25), 0 12px 26px -16px rgba(0, 0, 0, .8);
  }
}
:root[data-theme="dark"] {
  --paper: #0E1330; --grid: #18204A; --card: #161E44; --sheet: #19224C; --rule: #222D5E; --line: #2D3978;
  --ink: #A9B8FF; --ink-deep: #6F82E8; --ink-text: #0E1330; --text: #E8ECFF; --muted: #93A0D6;
  --red: #FF7C70; --green: #5AD59E; --margin: #7C3A4B;
  --flap-a: #1F2A5E; --flap-b: #263268; --der: #82A6FF; --die: #FF7C70; --das: #5AD59E;
  --hl: #C9B13A; --hl-soft: color-mix(in srgb, #C9B13A 45%, transparent);
  --lift: 0 1px 0 rgba(0, 0, 0, .25), 0 12px 26px -16px rgba(0, 0, 0, .8);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font: 16px/1.5 var(--sans); 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: 24px 24px; background-position: -1px -1px;
  padding-bottom: calc(84px + var(--safe-b));
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 560px; margin: 0 auto; padding: calc(14px + var(--safe-t)) 16px 24px; position: relative; }
@media (min-width: 600px) {
  #app { border-left: 2px solid var(--margin); border-right: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 82%, transparent); min-height: 100vh; padding-left: 22px; padding-right: 22px; }
}

/* ---------- появление экрана: отвечает на каждое действие (смена вкладки, следующий вопрос) ---------- */
#view > * { animation: rise .38s var(--ease) both; }
#view > *:nth-child(2) { animation-delay: .04s; }
#view > *:nth-child(3) { animation-delay: .08s; }
#view > *:nth-child(4) { animation-delay: .12s; }
#view > *:nth-child(n+5) { animation-delay: .16s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes swipe { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes fillw { from { width: 0; } }
@keyframes growy { from { transform: scaleY(0); } }
@keyframes write { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

/* ---------- верхняя полоса ---------- */
#top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; min-height: 44px; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--card); border: 1.5px solid var(--line); gap: 2px; }
.seg button { font: 600 15px var(--sans); padding: 7px 14px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; transition: background-color .25s var(--ease), color .25s var(--ease), transform .15s; }
.seg button:hover { color: var(--ink); }
.seg button:active { transform: scale(.96); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--ink-text); box-shadow: 0 2px 0 var(--ink-deep); }
.streak { font: 600 23px/1 var(--hand); color: var(--red); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.streak .ring { position: relative; display: inline-grid; place-items: center; min-width: 38px; height: 38px; font-size: 26px; }
.streak .ring svg { position: absolute; inset: -4px -6px; width: calc(100% + 12px); height: calc(100% + 8px); overflow: visible; }
.brand { font: 700 26px/1 var(--hand); color: var(--ink); }

h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.2; margin: 0 0 8px; color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: 29px; } h2 { font-size: 22px; } h3 { font-size: 18px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.hand { font-family: var(--hand); font-size: 1.3em; }

/* ---------- лист: клетчатая карточка ---------- */
.card {
  background: var(--card); border: 1.5px solid var(--line); border-radius: 10px;
  padding: 16px; margin: 0 0 14px; box-shadow: var(--lift); position: relative;
}
.card.tight { padding: 12px 14px; }
/* лист из тетради в линейку с полями — для главного на экране */
.sheet {
  background-color: var(--sheet);
  background-image: linear-gradient(90deg, transparent 27px, var(--margin) 27px, var(--margin) 29px, transparent 29px),
    repeating-linear-gradient(transparent 0 31px, var(--rule) 31px 32px);
  padding-left: 42px; border-radius: 4px 10px 10px 4px;
}
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }

/* ---------- кнопки ---------- */
.btn {
  font: 600 16px var(--sans); border-radius: 12px; padding: 12px 18px; cursor: pointer;
  border: 1.5px solid var(--ink); background: var(--card); color: var(--ink); min-height: 48px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
  box-shadow: 0 3px 0 color-mix(in srgb, var(--ink) 35%, transparent);
  transition: transform .12s var(--ease), box-shadow .12s var(--ease), background-color .2s, color .2s, opacity .2s;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.btn:hover:not(:disabled) { background: var(--ink-soft); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 35%, transparent); }
.btn.primary { background: var(--ink); color: var(--ink-text); box-shadow: 0 3px 0 var(--ink-deep); }
.btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 88%, #fff); }
.btn.primary:active:not(:disabled) { box-shadow: 0 1px 0 var(--ink-deep); }
.btn.block { display: flex; width: 100%; }
.btn.ghost { border-color: var(--line); color: var(--text); box-shadow: 0 2px 0 var(--line); }
.btn.ghost:hover:not(:disabled) { background: color-mix(in srgb, var(--line) 30%, var(--card)); }
.btn.red { border-color: var(--red); color: var(--red); box-shadow: 0 3px 0 color-mix(in srgb, var(--red) 35%, transparent); }
.btn.red:hover:not(:disabled) { background: color-mix(in srgb, var(--red) 8%, var(--card)); }
.btn.small { min-height: 38px; padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: .4; cursor: default; box-shadow: none; }
.btn:focus-visible, .seg button:focus-visible, .tab:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .chip:focus-visible, .opt:focus-visible, .word-chip:focus-visible, .icon-btn:focus-visible, .flash-in:focus-visible, summary:focus-visible { outline: 3px solid var(--hl); outline-offset: 2px; }
.icon-btn { width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--card); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex: none; transition: transform .15s var(--spring), background-color .2s; }
.icon-btn:hover { background: var(--ink-soft); }
.icon-btn:active { transform: scale(.9); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.speaking svg path:not(:first-child) { animation: wave .9s ease-in-out infinite; }
@keyframes wave { 50% { opacity: .25; } }
.btn .ico { display: inline-flex; width: 20px; height: 20px; }
.btn .ico svg { width: 20px; height: 20px; }

/* ---------- главная ---------- */
.today-main { padding-top: 20px; padding-bottom: 18px; }
.today-main .num { font: 700 58px/1 var(--serif); color: var(--ink); position: relative; display: inline-grid; place-items: center; min-width: 96px; height: 76px; }
.today-main .num svg { position: absolute; inset: -8px -14px; width: calc(100% + 28px); height: calc(100% + 16px); overflow: visible; pointer-events: none; }
.today-main .lead { font: 600 25px/1.15 var(--hand); color: var(--red); transform: rotate(-2deg); display: inline-block; }
.pill { display: inline-block; padding: 3px 11px; border-radius: 999px; border: 1.5px solid var(--line); font-size: 13px; color: var(--muted); background: var(--card); }

/* маркер-прогресс */
.progress { height: 14px; border-radius: 3px 8px 6px 4px; background: color-mix(in srgb, var(--line) 35%, var(--card)); overflow: hidden; position: relative; }
.progress > i { display: block; height: 100%; background: var(--hl); border-radius: 2px 6px 4px 3px; animation: fillw 1s var(--ease) .15s both; box-shadow: inset -3px 0 0 color-mix(in srgb, var(--hl) 60%, #000 10%); }
.progress.ink > i { background: var(--ink); box-shadow: none; }
.hl { background: linear-gradient(transparent 55%, var(--hl-soft) 55%); padding: 0 2px; color: var(--text); }

/* артикли */
.art { font-weight: 700; }
.art-der { color: var(--der); } .art-die { color: var(--die); } .art-das { color: var(--das); }

/* ---------- шапка упражнения ---------- */
.exhead { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.exhead .bar { flex: 1; height: 12px; border-radius: 3px 8px 6px 4px; background: color-mix(in srgb, var(--line) 35%, var(--card)); overflow: hidden; }
.exhead .bar i { display: block; height: 100%; background: var(--hl); transition: width .6s var(--ease); }
.exlabel { font: 600 22px/1 var(--hand); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.xbtn { border: 0; background: transparent; color: var(--muted); font-size: 30px; line-height: 1; cursor: pointer; padding: 0 6px; min-width: 44px; min-height: 44px; border-radius: 50%; transition: transform .2s var(--ease), color .2s; }
.xbtn:hover { color: var(--red); transform: rotate(90deg); }

/* ---------- сложенный лист ---------- */
.fold { position: relative; display: grid; grid-template-columns: 1fr 14px 1fr; background: var(--sheet); border: 1.5px solid var(--line); border-radius: 8px; min-height: 176px; box-shadow: var(--lift); margin-bottom: 14px; perspective: 1100px; }
.fold .col { padding: 18px 12px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 6px; min-width: 0; }
.fold .col .lab { font: 600 19px/1 var(--hand); color: var(--muted); }
.fold .crease { background: linear-gradient(90deg, rgba(0,0,0,.10), rgba(0,0,0,0) 40%, rgba(255,255,255,.35) 60%, rgba(0,0,0,.06)); border-left: 1px dashed var(--line); border-right: 1px dashed var(--line); }
.big { font: 700 29px/1.2 var(--serif); overflow-wrap: anywhere; }
.big.ru { font-family: var(--sans); font-weight: 600; font-size: 22px; }
.flap {
  position: absolute; top: -1px; bottom: -1px; width: calc(50% - 6px); z-index: 2;
  background: repeating-linear-gradient(135deg, var(--flap-a) 0 9px, var(--flap-b) 9px 18px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  font: 600 26px var(--hand); color: var(--red);
  transition: transform .65s var(--ease), opacity .3s ease .4s, box-shadow .65s var(--ease);
  padding: 8px; text-align: center; overflow-wrap: anywhere; backface-visibility: hidden;
  box-shadow: 0 0 0 rgba(0,0,0,0);
}
.flap.l { left: -1px; transform-origin: right center; border-right: 2px solid var(--line); border-radius: 8px 0 0 8px; }
.flap.r { right: -1px; transform-origin: left center; border-left: 2px solid var(--line); border-radius: 0 8px 8px 0; }
.flap.l.open { transform: rotateY(-100deg); opacity: 0; box-shadow: -18px 0 30px rgba(0,0,0,.18); }
.flap.r.open { transform: rotateY(100deg); opacity: 0; box-shadow: 18px 0 30px rgba(0,0,0,.18); }
.flap .mask { letter-spacing: 1px; font-size: 26px; }
.flap .mask.hinted { animation: pop .35s var(--spring); }

/* ---------- перо учителя ---------- */
.pen { position: absolute; z-index: 4; pointer-events: none; color: var(--red); }
.pen svg { width: 100%; height: 100%; overflow: visible; display: block; }
.pen path, .ring path, .num path, .stamp path { fill: none; stroke: currentColor; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; animation: draw .5s var(--ease) forwards; }
.pen.check { width: 58px; height: 52px; top: -14px; right: -6px; transform: rotate(-4deg); }
.pen.cross { width: 46px; height: 46px; top: -12px; right: -4px; }
.ring path, .num path { stroke-width: 2.6; color: var(--red); stroke: var(--red); animation-duration: .8s; animation-delay: .25s; }
.shake { animation: shake .42s cubic-bezier(.36,.07,.19,.97) both !important; }
@keyframes shake { 15%, 85% { transform: translateX(-2px); } 30%, 70% { transform: translateX(5px); } 45%, 55% { transform: translateX(-7px); } }

.note { min-height: 34px; font: 600 25px/1.2 var(--hand); margin: 0 0 10px; }
.note.ok, .note.bad, .note.near { animation: write .5s steps(18) both; }
.note.ok { color: var(--green); } .note.bad { color: var(--red); } .note.near { color: var(--ink); }

/* поле ответа — строка в тетради */
.answer-row { display: flex; gap: 10px; }
.answer-row input, .field {
  flex: 1; min-width: 0; font: 20px var(--serif); padding: 12px 14px; border-radius: 10px 10px 4px 4px;
  border: 1.5px solid var(--line); border-bottom: 2.5px solid var(--ink); background: var(--card); color: var(--text);
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.answer-row input:focus, .field:focus { outline: none; box-shadow: 0 0 0 4px var(--hl-soft); border-color: var(--ink); }
.answer-row input::placeholder, .field::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.answer-row input.is-ok { border-bottom-color: var(--green); background: color-mix(in srgb, var(--green) 7%, var(--card)); }
.answer-row input.is-bad { border-bottom-color: var(--red); background: color-mix(in srgb, var(--red) 6%, var(--card)); }
textarea.field { font: 16px var(--sans); width: 100%; min-height: 96px; resize: vertical; }
select.field { font: 16px var(--sans); width: 100%; appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%; background-size: 6px 6px; background-repeat: no-repeat; }
.specials { display: flex; gap: 8px; margin-top: 10px; }
.chip { font: 600 18px var(--serif); min-width: 46px; min-height: 42px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); border-radius: 10px; cursor: pointer; padding: 4px 10px; box-shadow: 0 2px 0 var(--line); transition: transform .12s var(--ease), box-shadow .12s; }
.chip:active { transform: translateY(2px); box-shadow: none; }
.example { border-left: 3px solid var(--margin); padding: 4px 12px; margin: 10px 0; animation: rise .4s var(--ease) both; }
.example .t { font-family: var(--serif); font-size: 18px; line-height: 1.55; }
.cloze-gap { display: inline-block; min-width: 80px; border-bottom: 2.5px solid var(--ink); margin: 0 2px; transition: color .3s, border-color .3s; }
.cloze-gap.filled { animation: pop .4s var(--spring); }
.miss { background: linear-gradient(transparent 60%, color-mix(in srgb, var(--red) 40%, transparent) 60%); }

/* ---------- сборка предложения ---------- */
.slot { min-height: 62px; border: 1.5px dashed var(--line); border-radius: 10px; padding: 9px; display: flex; flex-wrap: wrap; gap: 8px; background: var(--card); margin-bottom: 12px; align-content: flex-start; transition: border-color .2s, background-color .2s; }
.slot.target { background-color: var(--sheet); background-image: repeating-linear-gradient(transparent 0 51px, var(--rule) 51px 52px); border-color: var(--ink); }
.slot.pool { border-style: solid; background: transparent; box-shadow: none; }
.word-chip { font: 18px var(--serif); padding: 8px 13px; border: 1.5px solid var(--ink); border-radius: 10px; background: var(--card); color: var(--ink); cursor: pointer; min-height: 44px; box-shadow: 0 2px 0 color-mix(in srgb, var(--ink) 30%, transparent); transition: transform .12s var(--ease), box-shadow .12s; touch-action: manipulation; }
.word-chip:active { transform: translateY(2px); box-shadow: none; }
.slot.target .word-chip { background: var(--ink-soft); }

/* ---------- квиз ---------- */
.opt { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: 18px var(--sans); padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); margin-bottom: 10px; cursor: pointer; min-height: 56px; box-shadow: 0 2px 0 var(--line); transition: transform .12s var(--ease), border-color .2s, background-color .25s, box-shadow .12s; }
.opt:hover { border-color: var(--ink); }
.opt:active { transform: translateY(2px); box-shadow: none; }
.opt .key { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; border: 1.5px solid var(--line); font: 600 13px var(--sans); color: var(--muted); }
.opt.right { border-color: var(--green); background: color-mix(in srgb, var(--green) 14%, var(--card)); animation: pop .4s var(--spring); }
.opt.right .key { border-color: var(--green); color: var(--green); }
.opt.wrong { border-color: var(--red); background: color-mix(in srgb, var(--red) 12%, var(--card)); }
.opt[data-done]:not(.right):not(.wrong) { opacity: .55; }
.art-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.art-btns .btn { font: 700 23px var(--serif); min-height: 66px; }
.art-btns .btn.der { color: var(--der); border-color: var(--der); box-shadow: 0 3px 0 color-mix(in srgb, var(--der) 40%, transparent); }
.art-btns .btn.die { color: var(--die); border-color: var(--die); box-shadow: 0 3px 0 color-mix(in srgb, var(--die) 40%, transparent); }
.art-btns .btn.das { color: var(--das); border-color: var(--das); box-shadow: 0 3px 0 color-mix(in srgb, var(--das) 40%, transparent); }
.art-btns .btn.picked-ok { background: color-mix(in srgb, var(--green) 16%, var(--card)); animation: pop .4s var(--spring); }
.art-btns .btn.picked-bad { background: color-mix(in srgb, var(--red) 12%, var(--card)); }

/* ---------- карточка-переворот + свайп ---------- */
.flash { perspective: 1000px; margin-bottom: 14px; position: relative; touch-action: pan-y; }
.flash-in { position: relative; min-height: 240px; transform-style: preserve-3d; transition: transform .6s var(--ease); cursor: grab; user-select: none; -webkit-user-select: none; }
.flash-in:active { cursor: grabbing; }
.flash-in.flipped { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 20px; background: var(--sheet); border: 1.5px solid var(--line); border-radius: 12px; box-shadow: var(--lift); overflow: hidden; }
.face.back { transform: rotateY(180deg); }
.face .corner { position: absolute; top: 10px; right: 10px; }
.face .tip { position: absolute; bottom: 10px; left: 0; right: 0; font: 600 18px var(--hand); color: var(--muted); }
.swipe-tag { position: absolute; top: 16px; z-index: 5; font: 700 30px/1 var(--hand); padding: 4px 12px; border: 3px solid currentColor; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .1s; }
.swipe-tag.yes { left: 16px; color: var(--green); transform: rotate(-10deg); }
.swipe-tag.no { right: 16px; color: var(--red); transform: rotate(10deg); }
.kbd-hint { font-size: 13px; color: var(--muted); text-align: center; margin-top: 10px; }
@media (hover: none) { .kbd-hint { display: none; } .opt .key { display: none; } }

/* ---------- нижняя панель ---------- */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: center; background: color-mix(in srgb, var(--card) 88%, transparent); -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4); border-top: 1.5px solid var(--line); padding-bottom: var(--safe-b); }
#tabs .inner { width: 100%; max-width: 560px; display: grid; grid-template-columns: repeat(6, 1fr); }
.tab { border: 0; background: transparent; color: var(--muted); padding: 8px 2px; min-height: 60px; font: 600 12px var(--sans); display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; transition: color .2s; }
.tab svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s var(--spring); }
.tab:active svg { transform: scale(.85); }
.tab:hover { color: var(--ink); }
.tab[aria-current="page"] { color: var(--ink); }
.tab[aria-current="page"] svg { stroke-width: 2.3; animation: pop .4s var(--spring); }
.tab span { position: relative; padding: 0 3px; }
.tab[aria-current="page"] span::before { content: ""; position: absolute; left: -2px; right: -2px; bottom: 1px; height: 8px; z-index: -1; background: var(--hl-soft); border-radius: 2px 5px 3px 4px; transform-origin: left; animation: swipe .35s var(--ease) .05s both; }
.tab span { isolation: isolate; }

/* ---------- список слов ---------- */
details.group { border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); margin-bottom: 10px; overflow: hidden; }
details.group > summary { padding: 13px 14px; cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; transition: background-color .2s; }
details.group > summary:hover { background: var(--ink-soft); }
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary .cnt { display: inline-flex; align-items: center; gap: 8px; }
details.group > summary .cnt::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-2px); transition: transform .25s var(--ease); }
details.group[open] > summary .cnt::after { transform: rotate(225deg) translateY(-2px); }
details.group .mini { display: block; height: 4px; background: color-mix(in srgb, var(--line) 40%, transparent); }
details.group .mini i { display: block; height: 100%; background: var(--hl); }
.wrow { display: flex; justify-content: space-between; gap: 12px; padding: 9px 14px; border-top: 1px solid var(--rule); align-items: center; animation: rise .3s var(--ease) both; }
.wrow .w { font-family: var(--serif); font-size: 18px; }
.dots { display: inline-flex; gap: 3px; flex: none; }
.dots i { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--ink); display: block; }
.dots i.on { background: var(--ink); }

.empty { text-align: center; padding: 26px 10px; }
.empty .hand { font-size: 28px; color: var(--ink); }
.kbd-gap { height: 12px; }
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); background: var(--ink); color: var(--ink-text); padding: 11px 18px; border-radius: 12px; font-weight: 600; z-index: 20; max-width: 90%; box-shadow: 0 10px 30px -10px rgba(0,0,0,.45); animation: toast-in .35s var(--spring) both; }
.toast.out { animation: toast-out .3s var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 16px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translate(-50%, 10px); } }

/* ---------- статистика ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-grid .card { margin: 0; text-align: center; padding: 12px 6px; box-shadow: none; }
.stat-grid .n { font: 700 28px var(--serif); color: var(--ink); }
.hist { display: flex; align-items: flex-end; gap: 6px; height: 90px; }
.hist div { flex: 1; background: var(--ink); min-height: 2px; border-radius: 4px 4px 0 0; position: relative; transform-origin: bottom; animation: growy .7s var(--ease) both; }
.hist div:nth-child(2) { animation-delay: .04s; } .hist div:nth-child(3) { animation-delay: .08s; } .hist div:nth-child(4) { animation-delay: .12s; }
.hist div:nth-child(5) { animation-delay: .16s; } .hist div:nth-child(6) { animation-delay: .2s; } .hist div:nth-child(7) { animation-delay: .24s; } .hist div:nth-child(8) { animation-delay: .28s; background: var(--green); }
.hist-labels { display: flex; gap: 6px; font-size: 12px; color: var(--muted); }
.hist-labels span { flex: 1; text-align: center; }

/* календарь занятий */
.cal { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; grid-template-rows: repeat(7, auto); gap: 4px; }
.cal i { aspect-ratio: 1; border-radius: 3px; background: color-mix(in srgb, var(--line) 35%, transparent); display: block; animation: pop .3s var(--ease) both; }
:is(.cal, .cal-legend) i.l1 { background: color-mix(in srgb, var(--ink) 25%, var(--card)); }
:is(.cal, .cal-legend) i.l2 { background: color-mix(in srgb, var(--ink) 50%, var(--card)); }
:is(.cal, .cal-legend) i.l3 { background: color-mix(in srgb, var(--ink) 75%, var(--card)); }
:is(.cal, .cal-legend) i.l4 { background: var(--ink); }
.cal i.today { outline: 2px solid var(--red); outline-offset: 1px; }
.cal i.future { visibility: hidden; }
.cal-legend { display: flex; align-items: center; gap: 4px; justify-content: flex-end; font-size: 12px; color: var(--muted); }
.cal-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; background: color-mix(in srgb, var(--line) 35%, transparent); }

label.check { display: flex; gap: 12px; align-items: center; min-height: 44px; cursor: pointer; }
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--ink); flex: none; }
input[type=range] { width: 100%; accent-color: var(--ink); }

/* ---------- итог: оценка учителя ---------- */
.result { text-align: center; padding-top: 22px; }
.stamp { position: relative; width: 150px; height: 112px; margin: 2px auto 6px; display: grid; place-items: center; color: var(--red); transform: rotate(-7deg); animation: stamp .55s var(--spring) .1s both; }
.stamp svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.stamp path { stroke-width: 3; animation-duration: .9s; animation-delay: .35s; }
.stamp b { font: 700 46px/1 var(--hand); }
.stamp b small { font-size: .6em; }
.verdict { font: 600 30px/1.1 var(--hand); color: var(--red); margin: 0 0 6px; animation: write .7s steps(20) .6s both; }
.wordlist { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; font-family: var(--serif); font-size: 18px; }
@keyframes stamp { from { opacity: 0; transform: rotate(-7deg) scale(1.6); } to { opacity: 1; transform: rotate(-7deg) scale(1); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; }
}

/* ---------- картинки слов ---------- */
.pic { display: inline-grid; place-items: center; flex: none; line-height: 1; }
.pic img { width: 100%; height: 100%; object-fit: contain; opacity: 0; transform: scale(.7) rotate(-6deg); transition: opacity .3s, transform .5s var(--spring); filter: drop-shadow(0 6px 8px rgba(20, 30, 90, .18)); }
.pic.ready img { opacity: 1; transform: none; }
.pic .glyph { font-size: .8em; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.pic-s { width: 30px; height: 30px; font-size: 30px; }
.pic-m { width: 64px; height: 64px; font-size: 64px; }
.pic-l { width: 112px; height: 112px; font-size: 112px; }
.pic-xl { width: 150px; height: 150px; font-size: 150px; }
.intro-pic { display: flex; justify-content: center; margin-bottom: 4px; }
.intro-pic .pic { transform: rotate(-3deg); }
.wrow .lead { display: flex; align-items: center; gap: 10px; min-width: 0; }
.face .pic { margin-bottom: 4px; }
.opt .pic { margin: -6px 0; }
details.group > summary { position: relative; }
details.group .mini { position: absolute; left: 0; right: 0; bottom: 0; }
.flash-in { min-height: 300px; }
/* стопка картинок слов, которые ждут повторения */
.peek { display: flex; flex: none; padding-right: 4px; }
.peek .pic { width: 50px; height: 50px; font-size: 50px; margin-left: -12px; }
.peek .pic:nth-child(1) { transform: rotate(-8deg); } .peek .pic:nth-child(3) { transform: rotate(8deg); }
@media (min-width: 420px) { .peek .pic { width: 62px; height: 62px; font-size: 62px; margin-left: -6px; } }

/* ---------- синхронизация ---------- */
.keybox { font: 700 26px/1.2 ui-monospace, "SF Mono", Consolas, monospace; letter-spacing: 3px; text-align: center; padding: 14px 10px; border: 2px dashed var(--ink); border-radius: 10px; background: var(--sheet); color: var(--ink); user-select: all; -webkit-user-select: all; overflow-wrap: anywhere; }
.keybox.hidden { user-select: none; -webkit-user-select: none; color: var(--muted); }
.syncstatus { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.syncdot { width: 12px; height: 12px; border-radius: 50%; background: var(--line); flex: none; display: inline-block; }
.syncdot.ok { background: var(--green); }
.syncdot.warn { background: var(--hl); box-shadow: 0 0 0 2px color-mix(in srgb, var(--hl) 40%, transparent); }
.syncdot.bad { background: var(--red); }
.syncdot.busy { background: var(--ink); animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* ---------- стартовая панель с анимацией ---------- */
.welcome { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 24px 24px; background-position: -1px -1px;
  padding: max(10px, var(--safe-t)) 0 max(10px, var(--safe-b)); animation: rise .35s var(--ease) both; transition: opacity .25s ease, transform .25s var(--ease); }
.welcome.out { opacity: 0; transform: translateY(8px); pointer-events: none; }
.w-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px 4px; }
.w-title { font: 700 20px/1.2 var(--serif); color: var(--ink); text-wrap: balance; }
.w-skip { flex: none; font: 600 15px var(--sans); background: var(--card); color: var(--ink); border: 1.5px solid var(--line); border-radius: 999px; padding: 8px 16px; min-height: 40px; cursor: pointer;
  box-shadow: 0 2px 0 var(--line); transition: transform .12s var(--ease), box-shadow .12s var(--ease); touch-action: manipulation; }
.w-skip:active { transform: translateY(2px) scale(.97); box-shadow: none; }
.w-skip:focus-visible { outline: 3px solid var(--hl); outline-offset: 2px; }
.w-frame { flex: 1; width: 100%; min-height: 0; border: 0; background: transparent; color-scheme: normal; }
.w-note { margin: 0; padding: 6px 20px 2px; text-align: center; font-size: 13px; color: var(--muted); }

/* ---------- режим печати: синий экран «как в тетради чернилами» ---------- */
.focus {
  --f-bg1: #2A4FE0; --f-bg2: #1634B8; --f-bg3: #0D2287;
  --f-text: #FFFFFF; --f-dim: rgba(225, 233, 255, .66); --f-ghost: rgba(255, 255, 255, .27); --f-line: rgba(255, 255, 255, .22);
  --f-on: #5FE3F2; --f-on2: #D4E3FF; --f-bad: #FF7A70; --f-btn: #3D9BFF; --f-btn-deep: #1F6FD6;
  --f-der: #8EB2FF; --f-die: #FF9C93; --f-das: #74E6A9;
  position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; color: var(--f-text);
  background: radial-gradient(130% 75% at 50% 0%, var(--f-bg1) 0%, var(--f-bg2) 48%, var(--f-bg3) 100%);
  padding-top: var(--safe-t); font-family: var(--sans); text-align: center;
}
body:has(.focus) { overflow: hidden; }
.focus .exhead.tw-top { margin: 0; width: 100%; max-width: 760px; align-self: center; padding: 14px 16px 6px; gap: 14px; }
.tw-back { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; color: var(--f-text);
  background: rgba(255, 255, 255, .14); transition: background-color .15s ease, transform .12s var(--ease); }
.tw-back svg { width: 20px; height: 20px; }
.tw-back:hover { background: rgba(255, 255, 255, .24); }
.tw-back:active { transform: scale(.94); }
.tw-bar { flex: 1; height: 10px; border-radius: 99px; background: rgba(255, 255, 255, .16); overflow: hidden; }
.tw-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #4FB4FF, var(--f-on)); transition: width .55s var(--ease); }
.tw-count { flex: none; min-width: 44px; font: 600 14px var(--sans); color: var(--f-dim); font-variant-numeric: tabular-nums; text-align: right; }
.tw-body { flex: 1; min-height: 0; overflow-y: auto; width: 100%; max-width: 900px; align-self: center; padding: 8px 16px 20px; display: flex; flex-direction: column; align-items: center; }
.tw-card { position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; margin: auto 0; padding: 12px 0 8px; animation: twIn .26s var(--ease) both; cursor: text; }
@keyframes twIn { from { opacity: 0; transform: translateY(8px); } }
.tw-pic .pic img { filter: drop-shadow(0 10px 18px rgba(0, 0, 20, .35)); }
.tw-ru { font: 500 15px/1.35 var(--sans); color: var(--f-dim); max-width: 34ch; margin-bottom: 14px; }
.tw-forms { font-size: 14px; color: var(--f-dim); margin: -2px 0 6px; }
.tw-tr { font-size: 15px; color: var(--f-dim); max-width: 46ch; margin-top: 2px; }
.tw-msg { min-height: 1.5em; font: 600 15px var(--sans); color: var(--f-on); margin-top: 8px; }

/* строки с буквами */
.tl { line-height: 1.25; max-width: 100%; transition: opacity .25s ease; }
.tw-w { display: inline-block; white-space: nowrap; }
.tl .ch { position: relative; display: inline-block; color: var(--f-ghost); transition: color .08s linear; }
.tl .ch.on { color: var(--f-on2); }
.tl .ch.peek { color: rgba(255, 214, 102, .9); }
.tl .ch.bad { animation: twBad .22s ease; }
@keyframes twBad { 0% { color: var(--f-bad); transform: translateX(0); } 30% { color: var(--f-bad); transform: translateX(-3px); } 60% { color: var(--f-bad); transform: translateX(3px); } 100% { transform: none; } }
.tl.active .ch.cur::before { content: ""; position: absolute; left: -2px; top: 8%; bottom: 10%; width: 2px; border-radius: 2px; background: var(--f-on); animation: twCaret 1.05s steps(1) infinite; }
@keyframes twCaret { 50% { opacity: 0; } }
.focus.noghost .tl .ch:not(.on):not(.peek):not(.punct) { color: transparent; }

/* слово: каждая буква на своей черте */
.tw-wordline { font: 700 clamp(36px, 9vw, 60px)/1.15 var(--sans); }
.tw-wordline .tw-w { margin: 0 .16em; }
.tw-wordline .ch { margin: 0 .07em; padding: 0 .04em; border-bottom: 3px solid var(--f-line); }
.tw-wordline .ch.punct { border-bottom-color: transparent; }
.tw-wordline .ch.on { color: var(--f-on); border-bottom-color: var(--f-on); }
.tw-wordline .art-der .ch.on { color: var(--f-der); border-bottom-color: var(--f-der); }
.tw-wordline .art-die .ch.on { color: var(--f-die); border-bottom-color: var(--f-die); }
.tw-wordline .art-das .ch.on { color: var(--f-das); border-bottom-color: var(--f-das); }

/* предложение: черта под каждым словом */
.tw-sent { font: 600 clamp(22px, 4.8vw, 34px)/1.7 var(--sans); letter-spacing: .07em; margin-top: 18px; max-width: 30ch; }
.tw-sent .tw-w { padding: 0 .06em 1px; border-bottom: 2px solid var(--f-line); margin: 0 .12em; transition: border-color .2s ease; }
.tw-sent .tw-w.ok { border-bottom-color: color-mix(in srgb, var(--f-on) 70%, transparent); }
.tw-sent.wait { opacity: .45; }
.tw-sent.done .ch.on { color: #fff; }

/* поле ввода: невидимое, но настоящее — чтобы на телефоне открывалась клавиатура */
.tw-in { position: absolute; left: 50%; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; font-size: 16px; pointer-events: none; }
.tw-tap { display: none; margin-top: 10px; font: 600 15px var(--sans); color: var(--f-text); background: rgba(255, 255, 255, .14); border: 1.5px dashed rgba(255, 255, 255, .45); border-radius: 12px; padding: 10px 16px; cursor: pointer; }
@media (pointer: coarse) { .focus:not(.typing) .tw-tap { display: inline-block; } }

/* нижняя панель */
.tw-foot { width: 100%; border-top: 1.5px solid rgba(255, 255, 255, .16); background: rgba(6, 18, 90, .28);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 12px max(16px, calc((100% - 900px) / 2)) calc(12px + var(--safe-b)); }
.tw-keys { justify-self: start; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; font-size: 13px; color: var(--f-dim); }
.kb { display: inline-flex; align-items: center; gap: 2px; }
.kb kbd { font: 600 11px var(--sans); color: var(--f-text); background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .28); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; }
.tw-tools { display: flex; gap: 10px; }
.tw-round { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--f-text); padding: 0;
  background: rgba(255, 255, 255, .12); border: 1.5px solid rgba(255, 255, 255, .3); transition: background-color .15s ease, transform .12s var(--ease); flex: none; }
.tw-round svg { width: 21px; height: 21px; }
.tw-round:hover { background: rgba(255, 255, 255, .2); }
.tw-round:active { transform: scale(.93); }
.tw-round[aria-pressed="false"] { color: var(--f-dim); }
.tw-round.main { width: 54px; height: 54px; background: #fff; color: var(--f-bg3); border-color: #fff; }
.tw-next { justify-self: end; min-width: 150px; min-height: 48px; padding: 0 26px; border-radius: 12px; border: 0; cursor: pointer;
  font: 700 16px var(--sans); color: #fff; background: var(--f-btn); box-shadow: 0 3px 0 var(--f-btn-deep); transition: transform .12s var(--ease), box-shadow .12s var(--ease), opacity .2s ease, background-color .2s ease; }
.tw-next:disabled { opacity: .45; cursor: default; box-shadow: none; }
.tw-next:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--f-btn-deep); }
.tw-next.ready { animation: twReady .5s var(--ease); }
@keyframes twReady { 40% { transform: scale(1.05); } }
.focus button:focus-visible { outline: 3px solid var(--f-on); outline-offset: 3px; }
@media (pointer: coarse) { .tw-keys { display: none; } }
@media (max-width: 560px) {
  .tw-foot { grid-template-columns: auto 1fr; }
  .tw-keys { display: none; }
  .tw-next { min-width: 0; width: 100%; }
}

/* ---------- фильмы ---------- */
.mv-video { position: relative; width: 100%; max-width: 760px; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #050A2E; box-shadow: 0 18px 40px -18px rgba(0, 0, 20, .7); flex: none; }
.mv-video iframe, .mv-video > div:first-child { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.mv-err { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; font: 600 16px/1.4 var(--sans); color: var(--f-text); background: #0A1550; }
.mv-err[hidden] { display: none; }
.mv-ctrls { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 14px 0 4px; flex-wrap: wrap; }
.tw-pill { min-height: 40px; padding: 0 14px; border-radius: 99px; font: 600 14px var(--sans); cursor: pointer; color: var(--f-dim); background: transparent; border: 1.5px solid rgba(255, 255, 255, .3); transition: background-color .15s ease, color .15s ease; }
.tw-pill[aria-pressed="true"] { background: #fff; color: var(--f-bg3); border-color: #fff; }
.mv-card { margin: 6px 0 0; }
.mv-line { font: 600 clamp(22px, 4.6vw, 34px)/1.7 var(--sans); max-width: 32ch; }
.mv-line .fixed { color: var(--f-text); }
.mv-line .gap { border-bottom: 2px dotted rgba(255, 255, 255, .5); letter-spacing: .08em; }
.mv-line .gap .ch { color: rgba(255, 255, 255, .55); }
.mv-line .gap .ch.on { color: var(--f-on); }
.mv-line .gap.ok { border-bottom-color: transparent; }
.mv-box { margin-top: 6px; width: min(100%, 460px); min-height: 48px; border-radius: 12px; cursor: text; font: 500 16px var(--sans); color: var(--f-dim);
  background: rgba(255, 255, 255, .08); border: 1.5px solid rgba(255, 255, 255, .24); transition: border-color .15s ease, background-color .15s ease; }
.focus.typing .mv-box { border-color: var(--f-on); background: rgba(255, 255, 255, .12); color: var(--f-text); }
.tw-seg { display: inline-flex; background: rgba(255, 255, 255, .1); border-radius: 12px; padding: 3px; gap: 2px; }
.tw-seg button { border: 0; background: transparent; color: var(--f-dim); font: 600 14px var(--sans); padding: 8px 12px; border-radius: 9px; cursor: pointer; transition: background-color .15s ease, color .15s ease; }
.tw-seg button[aria-pressed="true"] { background: #fff; color: var(--f-bg3); }
@media (max-width: 560px) {
  .focus[data-kind="mv"] .tw-foot { grid-template-columns: 1fr auto; }
  .mv-ctrls .tw-round { width: 42px; height: 42px; }
  .mv-ctrls .tw-round.main { width: 50px; height: 50px; }
}
/* список сцен и редактор */
.mv-list { display: flex; flex-direction: column; gap: 10px; }
.mv-item { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); }
.mv-thumb { width: 96px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: var(--line); flex: none; }
.mv-item .grow { min-width: 140px; }
.mv-subs { min-height: 160px; font-size: 15px; }
.mv-how { font-size: 14px; color: var(--muted); }
.mv-how summary { cursor: pointer; color: var(--ink); font-weight: 600; }
.mv-how ol { margin: 8px 0; padding-left: 20px; }
.mv-preview { margin: 0; padding-left: 20px; font-size: 14px; }
.mv-preview li { margin: 2px 0; }
.mv-field { display: flex; flex-direction: column; gap: 6px; }
.mv-field .field, .mv-subs { width: 100%; box-sizing: border-box; }
/* видео не выше, чем нужно, чтобы под ним поместились фраза и поле ввода */
.mv-video { max-width: min(760px, max(300px, calc((100dvh - 340px) * 16 / 9))); }
.tw-body { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .3) transparent; }
/* телефон: при открытой клавиатуре поднимаем карточку и уменьшаем картинку, чтобы строки не прятались под клавиатурой */
.tw-in { top: 0; bottom: auto; }
@media (pointer: coarse) {
  .focus.typing .tw-card { margin-top: 0; }
  .focus.typing .tw-pic .pic { width: 72px; height: 72px; font-size: 72px; }
}

/* =====================================================================
   Синий стиль для всего приложения (как экран печати). Перекрывает светлую и тёмную тему.
   ===================================================================== */
:root:root:root {
  --paper: #1634B8; --grid: transparent; --card: #2141C6; --sheet: #2244CA; --rule: transparent; --line: #3F5DDB;
  --ink: #BFE6FF; --ink-deep: #1F6FD6; --ink-text: #0D2287; --ink-soft: #2A4BD0;
  --text: #FFFFFF; --muted: #B7C5F3;
  --red: #FF8A80; --green: #6EE7A8; --margin: transparent;
  --flap-a: #2A4BD0; --flap-b: #3053D9;
  --der: #8EB2FF; --die: #FF9C93; --das: #74E6A9;
  --hl: #5FE3F2; --hl-soft: rgba(95, 227, 242, .35);
  --lift: 0 14px 30px -18px rgba(0, 0, 40, .7);
  --serif: var(--sans);
  --hand: var(--sans);
  --btn: #3D9BFF; --btn-deep: #1F6FD6;
  color-scheme: dark;
}
body {
  background: radial-gradient(130% 70% at 50% 0%, #2A4FE0 0%, #1634B8 50%, #0D2287 100%) fixed;
  background-color: #1634B8;
}
@media (min-width: 600px) {
  #app { border: 0; background: transparent; }
}
h1, h2, h3 { color: #fff; letter-spacing: -.015em; }
.brand { font-weight: 800; font-size: 22px; color: #fff; letter-spacing: -.02em; }
.card { border: 1px solid rgba(255, 255, 255, .12); border-radius: 16px; background: rgba(255, 255, 255, .07); box-shadow: var(--lift); }
.sheet { background-image: none; background-color: rgba(255, 255, 255, .09); padding-left: 16px; border-radius: 16px; }
.btn { border-color: rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .08); color: #fff; box-shadow: none; border-radius: 12px; }
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, .16); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.98); box-shadow: none; }
.btn.primary { background: var(--btn); border-color: var(--btn); color: #fff; box-shadow: 0 3px 0 var(--btn-deep); }
.btn.primary:hover:not(:disabled) { background: #55A8FF; }
.btn.primary:active:not(:disabled) { box-shadow: 0 1px 0 var(--btn-deep); }
.btn.ghost { border-color: rgba(255, 255, 255, .22); color: #fff; box-shadow: none; }
.btn.ghost:hover:not(:disabled) { background: rgba(255, 255, 255, .12); }
.btn.red { border-color: var(--red); color: var(--red); box-shadow: none; background: transparent; }
.icon-btn { border-color: rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .1); color: #fff; }
.icon-btn:hover { background: rgba(255, 255, 255, .2); }
.seg { background: rgba(255, 255, 255, .1); border-color: transparent; }
.seg button { color: var(--muted); }
.seg button:hover { color: #fff; }
.seg button[aria-pressed="true"] { background: #fff; color: #0D2287; box-shadow: none; }
.pill { background: rgba(255, 255, 255, .1); border-color: transparent; color: var(--muted); }
.progress, .exhead .bar { background: rgba(255, 255, 255, .16); border-radius: 99px; }
.progress > i, .exhead .bar i { background: linear-gradient(90deg, #4FB4FF, var(--hl)); border-radius: 99px; box-shadow: none; }
.answer-row input, .field { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .28); color: #fff; }
.answer-row input:focus, .field:focus { border-color: var(--hl); box-shadow: 0 0 0 4px var(--hl-soft); }
select.field option { background: #1634B8; color: #fff; }
#tabs { background: rgba(10, 26, 120, .72); border-top-color: rgba(255, 255, 255, .14); }
.tab { color: var(--muted); }
.tab[aria-current="page"] { color: #fff; }
.toast { background: #fff; color: #0D2287; }
.today-main .num, .today-main .lead, .streak { color: #fff; }
.today-main .lead { transform: none; font-weight: 700; font-size: 20px; color: var(--hl); }
.streak { font-size: 18px; font-weight: 700; }
.verdict { font-size: 24px; font-weight: 800; color: var(--hl); }
.welcome { background: radial-gradient(130% 70% at 50% 0%, #2A4FE0 0%, #1634B8 50%, #0D2287 100%); background-size: auto; }
.w-skip { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .35); box-shadow: none; }
.mv-item { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .14); }

/* ---------- новое слово, шаг 1: вспомнить слово по картинке ---------- */
.rc-card { gap: 10px; }
.rc-ru { font: 800 clamp(30px, 7vw, 46px)/1.15 var(--sans); color: #fff; max-width: 18ch; text-wrap: balance; }
.rc-in { margin-top: 10px; width: min(100%, 420px); min-height: 60px; text-align: center; font: 700 clamp(24px, 5vw, 32px) var(--sans); letter-spacing: .06em;
  color: var(--f-on); background: rgba(255, 255, 255, .08); border: 2px solid rgba(255, 255, 255, .28); border-radius: 14px; padding: 8px 14px; outline: none; transition: border-color .15s ease, background-color .15s ease; }
.rc-in::placeholder { color: rgba(255, 255, 255, .35); letter-spacing: 0; font-weight: 500; font-size: 18px; }
.rc-in:focus { border-color: var(--f-on); background: rgba(255, 255, 255, .12); }
.rc-in.is-ok { border-color: #74E6A9; }
.rc-in.is-bad { border-color: var(--f-bad); color: var(--f-bad); text-decoration: line-through; text-decoration-thickness: 2px; }
.rc-answer { font: 800 clamp(30px, 7vw, 44px)/1.2 var(--sans); color: var(--f-on); animation: twIn .25s var(--ease) both; }
.rc-answer[hidden] { display: none; }
.focus .art-der { color: var(--f-der); } .focus .art-die { color: var(--f-die); } .focus .art-das { color: var(--f-das); }
.tw-pic .pic-xl { width: 132px; height: 132px; font-size: 132px; }
@media (max-height: 700px) { .tw-pic .pic-xl { width: 96px; height: 96px; font-size: 96px; } }

/* каталог роликов */
.mv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.mv-cat { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 0; border: 0; background: transparent; color: #fff; cursor: pointer; font: inherit; }
.mv-cat b { font-size: 14px; line-height: 1.3; }
.mv-cat-img { position: relative; display: block; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9; background: rgba(255, 255, 255, .08); transition: transform .15s var(--ease); }
.mv-cat-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mv-cat:hover .mv-cat-img { transform: translateY(-2px); }
.mv-cat:active .mv-cat-img { transform: scale(.98); }
.mv-cat:focus-visible { outline: 3px solid var(--hl); outline-offset: 3px; border-radius: 12px; }
.mv-dur { position: absolute; right: 6px; bottom: 6px; font: 600 12px var(--sans); background: rgba(0, 0, 0, .7); color: #fff; padding: 2px 6px; border-radius: 6px; }

/* =====================================================================
   Уровни (levels.js): дорога-волна с кружками уровней
   ===================================================================== */
.lv-card { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 18px; }
.lv-head { padding: 0 2px; }
.lv-head h2 { margin: 0 0 2px; font-size: 24px; }
.lv-map { position: relative; width: 100%; max-width: 400px; margin: 0 auto; }
.lv-road { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.lv-road-bed { fill: none; stroke: rgba(255, 255, 255, .08); stroke-width: 34; stroke-linecap: round; }
.lv-road-dots { fill: none; stroke: rgba(255, 255, 255, .34); stroke-width: 3.5; stroke-dasharray: .1 13; stroke-linecap: round; }
.lv-road-done { fill: none; stroke: url(#lvGlow); stroke-width: 8; stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(95, 227, 242, .55)); }
.lv-node { position: absolute; width: 132px; display: flex; flex-direction: column; align-items: center; transform: translate(-50%, -46px); text-align: center; }
.lv-disc { position: relative; width: 92px; height: 92px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: conic-gradient(var(--f-on, #5FE3F2) calc(var(--p, 0) * 360deg), rgba(255, 255, 255, .16) 0);
  box-shadow: 0 12px 26px -14px rgba(0, 0, 40, .9); transition: transform .16s cubic-bezier(.23, 1, .32, 1); -webkit-tap-highlight-color: transparent; }
.lv-disc::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: radial-gradient(circle at 50% 30%, #3560EE, #1A39BE 72%); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .2); }
.lv-disc img { position: relative; width: 74%; height: 74%; object-fit: contain; filter: drop-shadow(0 6px 8px rgba(0, 0, 30, .4)); }
.lv-disc:hover { transform: translateY(-2px); }
.lv-disc:active { transform: scale(.96); }
.lv-disc:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
.lv-num { position: absolute; top: -3px; left: -3px; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 99px; display: grid; place-items: center;
  background: #fff; color: #0D2287; font: 800 14px/1 var(--sans); box-shadow: 0 3px 8px -3px rgba(0, 0, 40, .6); font-variant-numeric: tabular-nums; }
.lv-badge { position: absolute; right: -3px; bottom: -3px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: #0D2287; color: rgba(255, 255, 255, .7); border: 2px solid rgba(255, 255, 255, .22); }
.lv-badge svg { width: 16px; height: 16px; }
.lv-badge.ok { background: #5FE3F2; color: #0D2287; border-color: #fff; }
.lv-name { margin-top: 9px; font: 700 15px/1.2 var(--sans); color: #fff; }
.lv-sub { font: 600 13px/1.4 var(--sans); color: var(--muted); font-variant-numeric: tabular-nums; }
.lv-stars { display: flex; gap: 2px; margin-top: 2px; }
.lv-stars span { width: 17px; height: 17px; }
.lv-stars svg, .lv-end-stars svg { width: 100%; height: 100%; fill: rgba(255, 255, 255, .2); }
.lv-stars .on svg, .lv-end-stars .on svg { fill: #FFD166; }
.lv-node.is-locked .lv-disc { background: rgba(255, 255, 255, .1); }
.lv-node.is-locked .lv-disc::before { background: #1B37A8; box-shadow: none; }
.lv-node.is-locked .lv-disc img { filter: grayscale(1) brightness(1.1); opacity: .38; }
.lv-node.is-locked .lv-name { color: var(--muted); }
.lv-node.is-cur .lv-disc { box-shadow: 0 0 0 7px rgba(95, 227, 242, .16), 0 12px 26px -14px rgba(0, 0, 40, .9); }
.lv-go { position: absolute; bottom: calc(100% + 2px); top: auto; left: 50%; transform: translate(-50%, -8px); white-space: nowrap; padding: 7px 14px; border-radius: 12px;
  background: #fff; color: #0D2287; font: 800 14px/1 var(--sans); box-shadow: 0 8px 18px -8px rgba(0, 0, 40, .7); animation: lvFloat 2.6s ease-in-out infinite; pointer-events: none; }
.lv-go::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 12px; height: 12px; background: #fff; border-radius: 2px; transform: translateX(-50%) rotate(45deg); }
.lv-node.is-cur { z-index: 2; }
.lv-node.is-cur .lv-go { bottom: auto; top: -44px; }
@keyframes lvFloat { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -5px); } }

/* экраны уровня */
.lv-pic img { width: 150px; height: 150px; object-fit: contain; filter: drop-shadow(0 12px 18px rgba(0, 0, 25, .4)); }
.lv-pic.sm img { width: 104px; height: 104px; }
@media (max-height: 700px) { .lv-pic img { width: 110px; height: 110px; } .lv-pic.sm img { width: 80px; height: 80px; } }
.lv-step .rc-ru { margin-bottom: 10px; }
.lv-sent { margin-top: 12px; }
.lv-sent .tw-w.fixed { border-bottom-color: transparent; color: #fff; }
.lv-sent .tw-w.blank { border-bottom: 3px solid var(--f-on); padding: 0 .18em 1px; }
.lv-sent .tw-w.blank .ch:not(.on):not(.peek):not(.punct) { color: transparent; }
.lv-sent .tw-w.blank.ok { border-bottom-color: rgba(95, 227, 242, .5); }
.lv-sent .tw-w.blank .ch.on { color: var(--f-on); }
.lv-end { gap: 10px; }
.lv-end h2 { margin: 6px 0 0; font-size: 28px; }
.lv-end-stars { display: flex; gap: 6px; align-items: flex-end; }
.lv-end-stars span { width: 58px; height: 58px; animation: lvStar .5s cubic-bezier(.23, 1, .32, 1) both; animation-delay: calc(var(--i) * .14s); }
.lv-end-stars span:nth-child(2) { width: 74px; height: 74px; }
@keyframes lvStar { from { opacity: 0; transform: scale(.6) rotate(-14deg); } to { opacity: 1; transform: none; } }
.lv-end-words { display: grid; grid-template-columns: repeat(5, 52px); gap: 8px; margin-top: 10px; }
.lv-end-words img { width: 52px; height: 52px; object-fit: contain; }
@media (prefers-reduced-motion: reduce) { .lv-go, .lv-end-stars span { animation: none; } }
