/* Матквест. Светлая тема — тетрадь в клетку и синяя ручка, тёмная — школьная доска и мел.
   Раскладка: одна колонка контента до 1120px, карточки на клетчатом фоне. */
:root {
  --paper: #f3f6fb;
  --grid: #dfe6f2;
  --grid-2: #c8d4e8;
  --card: #ffffff;
  --card-2: #f6f8fc;
  --ink: #17213b;
  --ink-2: #4e5a77;
  --ink-3: #8590a9;
  --line: #dfe5ef;
  --pen: #2447c8;
  --pen-2: #18339a;
  --pen-soft: #e8edfc;
  --on-pen: #ffffff;
  --red: #cf3426;
  --red-soft: #fbe9e6;
  --green: #127a42;
  --green-soft: #e0f3e8;
  --gold: #e3a100;
  --gold-ink: #845800;
  --gold-soft: #fff3d1;
  --shadow: 0 1px 2px rgb(23 33 59 / .06), 0 6px 22px rgb(23 33 59 / .07);
  --f-display: 'Unbounded', 'Arial Black', 'Segoe UI', system-ui, sans-serif;
  --f-body: 'Golos Text', 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
  --f-mono: 'JetBrains Mono', 'Cascadia Mono', Consolas, ui-monospace, monospace;
  --f-hand: 'Caveat', 'Segoe Print', 'Bradley Hand', cursive;
  --cell: 36px;
  --r: 16px;
  --r-sm: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #142019; --grid: #1b2a22; --grid-2: #2a3b32; --card: #1b2922; --card-2: #20302a;
    --ink: #edf3ee; --ink-2: #b2c1b8; --ink-3: #7c8e84; --line: #2c3d34;
    --pen: #9fb9ff; --pen-2: #6f8fe6; --pen-soft: #22324c; --on-pen: #0e1832;
    --red: #ff8b7b; --red-soft: #3c2420; --green: #6fd69b; --green-soft: #1a3a28;
    --gold: #ffcb52; --gold-ink: #ffd77d; --gold-soft: #3a3116;
    --shadow: 0 1px 2px rgb(0 0 0 / .35), 0 8px 24px rgb(0 0 0 / .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #142019; --grid: #1b2a22; --grid-2: #2a3b32; --card: #1b2922; --card-2: #20302a;
  --ink: #edf3ee; --ink-2: #b2c1b8; --ink-3: #7c8e84; --line: #2c3d34;
  --pen: #9fb9ff; --pen-2: #6f8fe6; --pen-soft: #22324c; --on-pen: #0e1832;
  --red: #ff8b7b; --red-soft: #3c2420; --green: #6fd69b; --green-soft: #1a3a28;
  --gold: #ffcb52; --gold-ink: #ffd77d; --gold-soft: #3a3116;
  --shadow: 0 1px 2px rgb(0 0 0 / .35), 0 8px 24px rgb(0 0 0 / .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font: 16px/1.5 var(--f-body);
  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;
}
[hidden] { display: none !important; }
a { color: var(--pen); }
h1, h2, h3 { font-family: var(--f-display); font-weight: 700; line-height: 1.2; margin: 0 0 .4em; text-wrap: balance; letter-spacing: -.01em; }
h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .6em; }
code { font-family: var(--f-mono); font-size: .92em; background: var(--pen-soft); color: var(--pen); padding: .08em .4em; border-radius: 6px; }
:focus-visible { outline: 3px solid var(--pen); outline-offset: 2px; }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.main { padding-block: 22px 60px; display: flex; flex-direction: column; gap: 18px; }
.muted { color: var(--ink-2); }
.small { font-size: .85rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.boot { padding: 40px; text-align: center; color: var(--ink-3); }
.err { color: var(--red); font-weight: 600; }
.eyebrow { font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--ink-3); margin-bottom: 6px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.center { justify-content: center; }

/* ---------- карточки и кнопки */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  font: 600 15px/1.1 var(--f-body); padding: 11px 18px; border-radius: 12px; cursor: pointer; text-decoration: none;
  background: var(--card); color: var(--ink); border: 1.5px solid var(--grid-2); box-shadow: 0 3px 0 var(--grid-2);
  transition: transform .08s, box-shadow .08s, background .15s;
}
.btn:hover { background: var(--card-2); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--grid-2); }
.btn.primary { background: var(--pen); color: var(--on-pen); border-color: var(--pen-2); box-shadow: 0 3px 0 var(--pen-2); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.primary:active { box-shadow: 0 1px 0 var(--pen-2); }
.btn.gold { background: var(--gold); color: #3a2700; border-color: var(--gold-ink); box-shadow: 0 3px 0 var(--gold-ink); }
.btn.danger { background: var(--red); color: #fff; border-color: var(--red); box-shadow: 0 3px 0 rgb(0 0 0 / .25); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--pen); }
.btn.ghost:hover { background: var(--pen-soft); }
.btn.sm { min-height: 36px; padding: 8px 12px; font-size: 14px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.link { background: none; border: 0; padding: 4px 2px; color: var(--pen); font: 600 14px var(--f-body); cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; }
.back { font-weight: 600; text-decoration: none; align-self: flex-start; }

/* ---------- шапка */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--card); border-bottom: 1px solid var(--line); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--card); }
.topin { display: flex; align-items: center; gap: 8px 22px; min-height: 60px; flex-wrap: wrap; padding-block: 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 800 1.1rem var(--f-display); color: var(--ink); text-decoration: none; }
.brand-sub { font: 500 .82rem var(--f-body); color: var(--ink-2); }
.brand.big { font-size: 1.6rem; margin-bottom: 6px; }
.logo { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--pen); color: var(--on-pen); font: 800 17px var(--f-display); box-shadow: inset 0 -3px 0 var(--pen-2); }
.brand.big .logo { width: 46px; height: 46px; font-size: 22px; border-radius: 12px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { padding: 8px 12px; border-radius: 10px; color: var(--ink-2); font-weight: 600; text-decoration: none; }
.tab:hover { background: var(--card-2); color: var(--ink); }
.tab.on { background: var(--pen-soft); color: var(--pen); }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.who-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.lvl-chip { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 6px; border-radius: 50%; background: var(--gold); color: #3a2700; font: 800 14px var(--f-display); box-shadow: inset 0 -3px 0 rgb(0 0 0 / .18); }

/* ---------- медали, звёзды */
.medal { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--gold-soft); color: var(--gold-ink); border: 2px solid var(--gold); font: 700 15px var(--f-display); }
.medal.sm { width: 24px; height: 24px; font-size: 10px; border-width: 1.5px; margin-right: 6px; vertical-align: -6px; }
.stars { display: inline-flex; gap: 1px; letter-spacing: 0; }
.stars i { font-style: normal; color: var(--grid-2); }
.stars i.on { color: var(--gold); }
.star-i { color: var(--gold); margin-left: 2px; }
.xp { font-weight: 700; color: var(--gold-ink); font-variant-numeric: tabular-nums; }

/* ---------- игрок */
.player { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "av main lvl" "st st st"; gap: 14px 18px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow); }
.avatar { grid-area: av; display: grid; place-items: center; }
.avatar svg, .r-ava svg, .nm svg.ava { display: block; flex: none; }
.pl-main { grid-area: main; min-width: 0; }
.pl-name { font: 700 1.15rem var(--f-display); overflow-wrap: anywhere; }
.pl-rank { color: var(--ink-2); font-weight: 600; margin: 2px 0 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
.pl-rank .medal.sm { margin-right: 0; }
.pl-next { font-weight: 500; font-size: .85rem; color: var(--ink-3); }
.xpbar { height: 12px; border-radius: 99px; background: var(--card-2); border: 1px solid var(--line); overflow: hidden; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #f5c542); border-radius: 99px; transition: width .6s ease; }
.xpcap { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: .82rem; color: var(--ink-2); margin-top: 4px; font-variant-numeric: tabular-nums; }
.pl-level { grid-area: lvl; display: grid; justify-items: center; }
.pl-level-n { font: 800 2.6rem/1 var(--f-display); color: var(--pen); }
.pl-level-l { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 700; }
.pl-stats { grid-area: st; display: flex; flex-wrap: wrap; gap: 8px 28px; border-top: 1px dashed var(--line); padding-top: 12px; }
.pl-stats div { display: flex; align-items: baseline; gap: 6px; }
.pl-stats b { font: 700 1.15rem var(--f-display); }
.pl-stats small { font-size: .7em; color: var(--ink-3); }
.pl-stats span { color: var(--ink-2); font-size: .9rem; }

/* ---------- карта */
.next-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; }
.next { border: 2px solid var(--pen); }
.next h2 { font-size: clamp(1.25rem, 1rem + 1vw, 1.6rem); }
.review { background: var(--card-2); }
.chapter { display: flex; flex-direction: column; gap: 10px; }
.ch-head { display: flex; align-items: center; gap: 14px; padding-top: 10px; }
.ch-num { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: var(--ink); color: var(--paper); font: 800 1.05rem var(--f-display); }
.ch-titles { min-width: 0; }
.ch-titles h2 { margin: 0; font-size: 1.1rem; }
.ch-titles p { margin: 0; color: var(--ink-2); font-size: .9rem; }
.ch-prog { margin-left: auto; color: var(--ink-2); font-size: .9rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ch-prog b { color: var(--ink); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.tile { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; min-height: 120px; border-radius: 14px; background: var(--card); border: 1.5px solid var(--line); text-decoration: none; color: var(--ink); box-shadow: 0 2px 0 var(--line); transition: transform .12s, border-color .12s; }
.tile:hover { transform: translateY(-2px); border-color: var(--pen); }
.tile.current { border: 2px solid var(--pen); box-shadow: 0 3px 0 var(--pen-2); }
.tile.current::after { content: "Сейчас"; position: absolute; top: -10px; right: 12px; background: var(--pen); color: var(--on-pen); font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; letter-spacing: .03em; }
.tile.done { background: var(--green-soft); border-color: transparent; }
.tile.locked { opacity: .55; background: var(--card-2); box-shadow: none; }
.tile.locked:hover { transform: none; border-color: var(--line); }
.t-tag { align-self: flex-start; font-size: .72rem; font-weight: 700; color: var(--red); border: 1.5px solid currentColor; border-radius: 6px; padding: 1px 7px; letter-spacing: .02em; }
.t-tag.big { font-size: .82rem; }
.t-title { font-weight: 700; font-size: 1.02rem; line-height: 1.25; }
.t-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.t-stars { font-size: .82rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pips { display: flex; gap: 5px; }
.pip { width: 22px; height: 8px; border-radius: 4px; background: var(--grid-2); }
.pip.s1 { background: #f0c35c; }
.pip.s2 { background: #e8a91b; }
.pip.s3 { background: var(--green); }
.lock { font-size: .85rem; color: var(--ink-3); font-weight: 600; }

/* ---------- тема */
.mod-head { display: flex; flex-direction: column; gap: 6px; }
.mod-head h1 { margin: 0; }
.mod-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.theory p { margin: 0 0 .7em; font-size: 1.05rem; line-height: 1.7; max-width: 62ch; }
.theory h3 { color: var(--pen); }
.levels { display: flex; flex-direction: column; gap: 12px; }
.level { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px; }
.level.locked { opacity: .6; box-shadow: none; }
.level.passed { border-color: var(--green); }
.lv-n { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font: 800 1.2rem var(--f-display); background: var(--pen-soft); color: var(--pen); }
.level.passed .lv-n { background: var(--green-soft); color: var(--green); }
.lv-body h3 { margin: 0; }
.lv-body p { margin: 2px 0 6px; font-size: .9rem; }
.lv-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; font-size: .85rem; color: var(--ink-2); }
.lv-meta .stars { font-size: 1.15rem; }
.note { font-size: .88rem; color: var(--ink-2); }

/* ---------- математика */
.fr { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; margin: 0 .1em; font-size: .9em; line-height: 1.22; }
.fr > span { padding: 0 .25em; }
.fr > span:first-child { border-bottom: max(1.5px, .07em) solid currentColor; padding-bottom: .05em; }
.fr > span:last-child { padding-top: .05em; }
.rt { display: inline-flex; align-items: stretch; white-space: nowrap; }
.rs { margin-right: -.02em; }
.rr { border-top: max(1.5px, .07em) solid currentColor; padding: 0 .12em; margin-top: .16em; }
.sys { display: inline-flex; flex-direction: column; vertical-align: middle; border-left: .13em solid currentColor; border-radius: .7em 0 0 .7em; padding: .15em 0 .15em .5em; margin: .2em .2em; line-height: 1.55; }
sup { font-size: .62em; line-height: 0; }
sub { font-size: .62em; line-height: 0; }

/* ---------- задача */
.run { display: flex; flex-direction: column; gap: 14px; max-width: 860px; width: 100%; margin: 0 auto; }
.run-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.run-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.run-title b { font-family: var(--f-display); font-size: 1.05rem; }
.run-title span { font-size: .85rem; color: var(--ink-2); }
.run-xp { display: flex; gap: 10px; align-items: center; }
.combo { font-size: .8rem; font-weight: 700; color: var(--ink-3); border: 1.5px solid var(--line); padding: 2px 8px; border-radius: 99px; }
.combo.on { color: var(--red); border-color: var(--red); background: var(--red-soft); }
.dots { display: flex; gap: 6px; }
.dots i { flex: 1; height: 8px; border-radius: 4px; background: var(--grid-2); }
.dots i.cur { background: var(--pen); }
.dots i.ok { background: var(--green); }
.dots i.no { background: var(--red); }
.dots i.ok2 { background: var(--gold); }
.dots i.cur2 { background: repeating-linear-gradient(45deg, var(--gold) 0 6px, var(--pen) 6px 12px); }
.task { display: grid; grid-template-columns: minmax(0, 1fr) 70px; padding: 0; overflow: hidden; }
.task-body { padding: 22px 24px 24px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.margin { border-left: 2px solid var(--red); opacity: .9; display: flex; justify-content: center; padding-top: 14px; background: var(--card); }
.mark { font: 700 76px/1 var(--f-hand); color: var(--red); transform: rotate(-8deg); animation: mark .35s ease-out; }
.mark:empty { animation: none; }
@keyframes mark { from { opacity: 0; transform: scale(1.6) rotate(-20deg); } }
.task-n { font-size: .82rem; font-weight: 700; color: var(--ink-3); letter-spacing: .04em; text-transform: uppercase; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.src { text-transform: none; letter-spacing: 0; color: var(--pen); background: var(--pen-soft); padding: 1px 8px; border-radius: 6px; }
.q { font-size: clamp(1.25rem, 1rem + 1.2vw, 1.75rem); line-height: 1.55; font-weight: 500; overflow-wrap: break-word; }
.q .fr { font-size: .85em; }
.answer { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ans-in { flex: 1 1 220px; min-width: 0; max-width: 360px; height: 54px; padding: 0 16px; font: 600 1.35rem var(--f-mono); color: var(--pen); background: var(--card-2); border: 2px solid var(--grid-2); border-radius: 12px; }
.ans-in:focus { outline: none; border-color: var(--pen); background: var(--card); }
.ans-in:disabled { opacity: 1; }
.keys { display: flex; gap: 6px; }
.key { min-width: 44px; height: 44px; padding: 0 10px; border-radius: 10px; border: 1.5px solid var(--grid-2); background: var(--card); color: var(--ink); font: 700 1.1rem var(--f-mono); cursor: pointer; }
.key:active { background: var(--pen-soft); }
.help { font-size: .85rem; color: var(--ink-3); margin: -6px 0 0; }
.hint { background: var(--gold-soft); color: var(--ink); border-radius: 10px; padding: 10px 14px; font-weight: 500; border: 1.5px solid var(--gold); }
.hint.second { background: var(--red-soft); border-color: var(--red); }
.task.try2 .ans-in { border-color: var(--red); background: var(--red-soft); }
.tries { margin: 6px 0 0; font-size: .95rem; }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
.task-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.fb { border-radius: 12px; padding: 12px 16px; font-size: 1.05rem; }
.fb.ok { background: var(--green-soft); color: var(--ink); border-left: 4px solid var(--green); }
.fb.ok b { color: var(--green); }
.fb.no { background: var(--red-soft); border-left: 4px solid var(--red); }
.fb.no b { color: var(--red); }
.fb details { margin-top: 6px; font-size: .95rem; }
.fb summary { cursor: pointer; color: var(--ink-2); font-weight: 600; }
.right-ans { font-weight: 700; font-family: var(--f-mono); }
.sol { margin: 8px 0 0; font-size: .98rem; color: var(--ink); line-height: 1.75; }
.theory.inline { background: var(--card-2); border-radius: 12px; padding: 14px 16px; border: 1px dashed var(--grid-2); }
.theory.inline p { font-size: .98rem; }
.task.is-ok .ans-in { border-color: var(--green); color: var(--green); }
.task.is-no .ans-in { border-color: var(--red); color: var(--red); text-decoration: line-through; text-decoration-thickness: 2px; }

.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.opt { display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px 14px; min-height: 56px; border-radius: 12px; border: 2px solid var(--grid-2); background: var(--card); color: var(--ink); font: 500 1.15rem var(--f-body); cursor: pointer; }
.opt:hover:not(:disabled) { border-color: var(--pen); }
.opt.sel { border-color: var(--pen); background: var(--pen-soft); }
.opt.right { border-color: var(--green); background: var(--green-soft); }
.opt.wrong { border-color: var(--red); background: var(--red-soft); }
.opt:disabled { cursor: default; color: var(--ink); }
.opt-n { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 700 .85rem var(--f-display); background: var(--card-2); border: 1.5px solid var(--grid-2); }
.opt-t { min-width: 0; overflow-wrap: anywhere; }

/* ---------- столбик на клетчатой бумаге */
.colgrid {
  display: grid; grid-template-columns: repeat(var(--w), var(--cell)); grid-auto-rows: var(--cell); width: max-content; max-width: 100%;
  background-image: linear-gradient(var(--grid-2) 1px, transparent 1px), linear-gradient(90deg, var(--grid-2) 1px, transparent 1px);
  background-size: var(--cell) var(--cell); border-right: 1px solid var(--grid-2); border-bottom: 1px solid var(--grid-2);
  font: 600 22px/1 var(--f-mono); color: var(--ink); padding: 0; margin: 2px 0;
}
.colgrid .c { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; }
.colgrid .c.ul { box-shadow: inset 0 -2.5px 0 var(--ink); }
.colgrid .op { color: var(--ink-2); }
.colgrid .ansrow { background: rgb(36 71 200 / .07); }
.cell { width: 100%; height: 100%; border: 0; background: transparent; text-align: center; font: inherit; color: var(--pen); caret-color: var(--pen); padding: 0; border-radius: 0; }
.cell:focus { outline: 2px solid var(--pen); outline-offset: -2px; background: var(--pen-soft); }
.cell.carry { font-size: 13px; width: 55%; height: 52%; margin: 2px 2px 0 auto; color: var(--red); border: 1px dashed var(--grid-2); border-radius: 4px; }
.c.carry { align-items: flex-start; }
.colgrid.div .dv { box-shadow: inset 0 -2.5px 0 var(--ink); }
.colgrid.div .vl { box-shadow: inset 2.5px 0 0 var(--ink); }
.colgrid.div .dv.vl { box-shadow: inset 2.5px 0 0 var(--ink), inset 0 -2.5px 0 var(--ink); }
.qcell { justify-content: flex-start !important; }
.qin { width: 100%; height: 100%; border: 0; background: rgb(36 71 200 / .1); font: inherit; color: var(--pen); padding: 0 0 0 calc((var(--cell) - .6em) / 2); letter-spacing: calc(var(--cell) - .6em); }
.qin:focus { outline: 2px solid var(--pen); outline-offset: -2px; }
.task.is-ok .colgrid .ansrow .cell, .task.is-ok .qin { color: var(--green); }
.task.is-no .colgrid .ansrow .cell, .task.is-no .qin { color: var(--red); }
.colhint { font-size: .82rem; color: var(--ink-3); margin: 0; max-width: 56ch; }

/* ---------- график */
.graph { width: 100%; max-width: 300px; display: block; background: var(--card); }
.g-grid { stroke: var(--grid-2); stroke-width: 1; }
.g-axis { stroke: var(--ink); stroke-width: 1.5; }
.g-arrow { fill: var(--ink); }
.g-lbl { fill: var(--ink-2); font: 600 12px var(--f-body); }
.g-curve { stroke: var(--pen); stroke-width: 2.6; fill: none; }
.g-pt { fill: var(--pen); }

/* ---------- итоги */
.summary { position: relative; text-align: center; padding: 30px 22px; display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 760px; width: 100%; margin: 0 auto; }
.summary h1 { margin: 0; }
.grade-mark { position: absolute; top: 14px; right: 22px; font: 700 64px/1 var(--f-hand); color: var(--red); width: 84px; height: 84px; display: grid; place-items: center; border: 3px solid var(--red); border-radius: 50%; transform: rotate(-10deg); animation: mark .4s ease-out .3s backwards; }
.score { font: 600 1.15rem var(--f-body); color: var(--ink-2); margin: 0; }
.big-stars { display: flex; gap: 8px; font-size: 54px; line-height: 1; margin: 8px 0; }
.big-stars i { font-style: normal; color: var(--grid-2); }
.big-stars i.on { color: var(--gold); animation: pop .45s cubic-bezier(.3, 1.6, .5, 1) var(--d) backwards; }
@keyframes pop { from { transform: scale(0) rotate(-40deg); opacity: 0; } }
.gain { display: flex; flex-direction: column; gap: 2px; font-size: 1.25rem; }
.gain .muted { font-size: .85rem; }
.ups { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.lvlup { display: flex; align-items: center; gap: 14px; background: var(--gold-soft); border: 2px solid var(--gold); border-radius: 14px; padding: 10px 18px; text-align: left; }
.new-achs { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.summary .row { margin-top: 12px; }
.review-list ol { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.review-list li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 4px 10px 30px; border-bottom: 1px dashed var(--line); position: relative; align-items: center; }
.review-list li::before { position: absolute; left: 4px; font: 700 26px/1 var(--f-hand); color: var(--red); }
.review-list li.ok::before { content: "+"; }
.review-list li.no::before { content: "−"; }
.review-list .q { font-size: 1rem; font-weight: 500; min-width: 0; }
.review-list .a { font-family: var(--f-mono); font-weight: 600; white-space: nowrap; color: var(--ink-2); }

/* ---------- профиль */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; }
.stat b { font: 700 1.5rem var(--f-display); font-variant-numeric: tabular-nums; }
.stat small { font-size: .65em; color: var(--ink-3); }
.stat span { color: var(--ink-2); font-size: .88rem; }
.prof-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 18px; align-items: start; }
.ranks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ranks li { display: flex; align-items: center; gap: 12px; padding: 6px 8px; border-radius: 10px; opacity: .5; }
.ranks li .r-ava { filter: grayscale(1); }
.ranks li.got { opacity: 1; }
.ranks li.got .r-ava, .ranks li.cur .r-ava { filter: none; }
.ranks li.cur { opacity: 1; background: var(--gold-soft); outline: 2px solid var(--gold); }
.r-t { font-weight: 700; flex: 1; }
.r-l { font-size: .82rem; color: var(--ink-2); white-space: nowrap; }
.achs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.ach { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--card-2); text-align: left; }
.ach div { display: flex; flex-direction: column; min-width: 0; }
.ach span { font-size: .82rem; color: var(--ink-2); }
.ach:not(.got) { opacity: .55; }
.ach:not(.got) .medal { filter: grayscale(1); opacity: .7; }

/* ---------- таблицы */
.tbl-wrap { overflow-x: auto; margin: 0 -4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: .94rem; }
.tbl th { text-align: left; font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); padding: 8px 10px; border-bottom: 1.5px solid var(--line); white-space: nowrap; }
.tbl th.num { text-align: right; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.me td { background: var(--gold-soft); }
.you { font-size: .75rem; font-weight: 700; color: var(--gold-ink); margin-left: 6px; }
.rowlink { cursor: pointer; }
.rowlink:hover td { background: var(--card-2); }
.rowlink.p-offline td { color: var(--ink-2); }
.class-tbl td { min-width: 110px; }
.class-tbl td:first-child { min-width: 190px; }
.class-tbl td.now { min-width: 210px; font-size: .9rem; }
.p-online td.now { color: var(--green); font-weight: 600; }
.nm { display: flex; gap: 10px; align-items: center; }
.nm div { display: flex; flex-direction: column; }
.dot { flex: none; display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--grid-2); }
.dot.online { background: var(--green); box-shadow: 0 0 0 0 rgb(18 122 66 / .5); animation: pulse 2s infinite; }
.dot.away { background: var(--gold); }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgb(18 122 66 / 0); } 100% { box-shadow: 0 0 0 0 rgb(18 122 66 / 0); } }
.mini-bar { height: 7px; border-radius: 4px; background: var(--card-2); border: 1px solid var(--line); overflow: hidden; margin-bottom: 3px; min-width: 90px; }
.mini-bar i { display: block; height: 100%; background: var(--pen); }
.acc { font-weight: 700; font-variant-numeric: tabular-nums; }
.acc.good { color: var(--green); }
.acc.mid { color: var(--gold-ink); }
.acc.bad { color: var(--red); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; }
.kpi b { font: 700 1.6rem var(--f-display); grid-column: 1 / -1; font-variant-numeric: tabular-nums; }
.kpi .dot + b { grid-column: 2; }
.kpi small { font-size: .6em; color: var(--ink-3); }
.kpi span:last-child { grid-column: 1 / -1; color: var(--ink-2); font-size: .88rem; }
.empty { text-align: center; padding: 40px 20px; }

/* ---------- ученик в кабинете учителя */
.st-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 18px; align-items: start; }
.st-head .avatar { grid-area: auto; }
.st-main h1 { margin: 0 0 4px; }
.st-main p { margin: 0 0 4px; }
.st-now { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.creds code { font-size: 1rem; }
.st-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; max-width: 360px; }
.st-actions select { display: block; width: 100%; margin-top: 4px; }
.praise { display: flex; gap: 8px; flex-wrap: wrap; }
.praise input { flex: 1 1 140px; min-width: 0; }
.weak { border-left: 4px solid var(--red); }
.weak ul { margin: 0; padding-left: 18px; }
.two { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.prog-tbl td { padding: 7px 10px; }
.prog-tbl .stars { font-size: 1rem; }
.chrow td { background: var(--card-2); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.untouched td { color: var(--ink-3); }
.visits { list-style: none; margin: 0; padding: 0; }
.visits li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-variant-numeric: tabular-nums; }
.answers { list-style: none; margin: 0; padding: 0; }
.answers li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.a-mark { flex: none; width: 26px; font: 700 30px/1 var(--f-hand); color: var(--red); text-align: center; }
.answers li.ok .a-mark { color: var(--green); }
.a-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.a-meta { font-size: .8rem; color: var(--ink-3); }
.a-name { color: var(--pen); cursor: pointer; }
.a-q { font-size: 1rem; overflow-wrap: anywhere; }
.a-ans { font-size: .92rem; }
.answers li.no .a-ans b { color: var(--red); }
.answers li.ok .a-ans b { color: var(--green); }

/* ---------- формы */
.form { display: flex; flex-direction: column; gap: 8px; max-width: 520px; }
.form label { font-weight: 600; font-size: .9rem; color: var(--ink-2); margin-top: 6px; }
.form .btn { margin-top: 10px; align-self: flex-start; }
.form .btn.wide { align-self: stretch; }
input, select, textarea { font: 500 1rem var(--f-body); color: var(--ink); background: var(--card-2); border: 1.5px solid var(--grid-2); border-radius: 10px; padding: 10px 12px; min-height: 44px; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pen); background: var(--card); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink) !important; }
.check input { width: 20px; height: 20px; min-height: 0; }
.inline-in { width: 100%; min-width: 120px; padding: 6px 8px; min-height: 36px; background: transparent; border-color: transparent; }
.inline-in:hover { border-color: var(--grid-2); }
.inline-in.sm { min-width: 80px; }
.inline-in.mono { font-family: var(--f-mono); }
.created { margin-top: 16px; background: var(--green-soft); border-radius: 12px; padding: 14px 16px; }
.created ul { margin: 0; padding-left: 18px; }
.login { min-height: 100vh; display: grid; place-items: center; padding-block: 30px; }
.login-card { width: 100%; max-width: 420px; padding: 28px; }
.login-card .form { max-width: none; }

/* ---------- карточки доступа */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.pcard { background: var(--card); border: 1.5px dashed var(--ink-3); border-radius: 12px; padding: 14px; display: flex; gap: 14px; align-items: center; break-inside: avoid; }
.pc-qr svg { display: block; border-radius: 6px; }
.pc-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.pcard .brand { font-size: .95rem; }
.pcard .logo { width: 26px; height: 26px; font-size: 13px; border-radius: 7px; }
.pc-name { font: 700 1.1rem var(--f-display); margin: 4px 0; }

/* ---------- уведомления */
#toasts { position: fixed; z-index: 50; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: .95rem; animation: tin .3s ease-out; }
.toast.gold, .toast.praise { background: var(--gold-soft); color: var(--ink); border: 2px solid var(--gold); }
.toast.err { background: #c4382b; color: #fff; }
.toast.ok { background: #137a42; color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); transition: .35s; }
@keyframes tin { from { opacity: 0; transform: translateY(10px); } }

/* ---------- баллы, метки, общие мелочи */
.coin { display: inline-block; width: 1em; height: 1em; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe08a, var(--gold) 60%, #b97c00); box-shadow: inset 0 0 0 1.5px rgb(120 80 0 / .45); vertical-align: -.14em; margin-right: .3em; flex: none; }
.coin.big { width: 46px; height: 46px; margin: 0; }
.coin-chip { display: inline-flex; align-items: center; gap: 2px; padding: 4px 10px; border-radius: 99px; background: var(--gold-soft); color: var(--gold-ink); font-weight: 700; text-decoration: none; border: 1.5px solid var(--gold); font-variant-numeric: tabular-nums; }
.coin-b { display: inline-flex; align-items: center; }
.coins-line { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: .8rem; font-weight: 700; background: var(--card-2); color: var(--ink-2); border: 1.5px solid var(--line); white-space: nowrap; }
.pill.ok { background: var(--green-soft); color: var(--green); border-color: transparent; }
.pill.warn { background: var(--gold-soft); color: var(--gold-ink); border-color: transparent; }
.pill.no { background: var(--red-soft); color: var(--red); border-color: transparent; }
.pill.big { font-size: .95rem; padding: 6px 14px; white-space: normal; }
.tag { display: inline-block; font-size: .75rem; font-weight: 700; padding: 1px 7px; border-radius: 6px; }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.amber { background: var(--gold-soft); color: var(--gold-ink); }
.t-teacher { font-size: .74rem; font-weight: 700; color: var(--pen); }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px; border-radius: 99px; background: var(--red); color: #fff; font-size: .72rem; font-weight: 800; }
.link.sm { font-size: .8rem; padding: 0 2px; }
.row.end { justify-content: flex-end; }
.grow { flex: 1 1 160px; min-width: 0; }
.num-in { width: 96px; min-height: 38px; padding: 6px 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card-2); font-weight: 600; cursor: pointer; }
.chip-check input { min-height: 0; width: 16px; height: 16px; }
.seg { display: inline-flex; background: var(--card-2); border: 1.5px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font: 600 .9rem var(--f-body); color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--card); color: var(--pen); box-shadow: var(--shadow); }
.place { font-family: var(--f-display); font-weight: 700; }
.place.p1 { color: #c8930a; }
.place.p2 { color: #8a96a8; }
.place.p3 { color: #b0703a; }
.two.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.st-qr { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; max-width: 140px; }
.st-qr svg { border-radius: 6px; border: 1px solid var(--line); }
.st-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px 28px; }
.tool h3 { margin-bottom: 8px; font-size: .92rem; }
.tool select { display: block; width: 100%; margin-top: 4px; }
.tool .row + .row, .tool label + .row { margin-top: 8px; }
.chrow-in { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.prog-tbl td.access { white-space: nowrap; }
.kpi.alarm { border-color: var(--red); background: var(--red-soft); }
.kpi.alarm b { color: var(--red); }
.inactive { border-left: 4px solid var(--red); }
.penalty-form { display: flex; flex-direction: column; gap: 12px; }
.lesson-alert { background: var(--pen-soft); border-color: var(--pen); }
.plist, .ledger, .hw-ul, .hw-students { list-style: none; margin: 0; padding: 0; }
.plist li, .ledger li, .hw-students li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.plist li > div:first-child { display: flex; flex-direction: column; min-width: 0; }
.ledger b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger .plus { color: var(--green); }
.ledger .minus { color: var(--red); }

/* ---------- домашние задания */
.hw-card { border-left: 4px solid var(--gold); }
.hw-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.hw-item:last-child { border-bottom: 0; }
.hw-main { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.hw-main span { font-size: .88rem; color: var(--ink-2); }
.hw-item.over .hw-main span:first-of-type { color: var(--red); font-weight: 600; }
.hw-item.done .hw-main b { color: var(--ink-2); }
.hw-note { font-style: italic; }
.hw-done summary { cursor: pointer; color: var(--ink-2); font-weight: 600; margin-top: 8px; }
.hw-form.wide { max-width: 760px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 18px; }
.grid2 label, .hw-form > label { display: flex; flex-direction: column; gap: 4px; }
.targets { border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 6px; margin: 8px 0 0; }
.targets legend { font-weight: 600; font-size: .9rem; color: var(--ink-2); padding: 0 6px; }
.pick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.hw-form:has(input[value="all"]:checked) .pick { display: none; }
.hw-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.hw-box { display: flex; flex-direction: column; gap: 10px; }
.hw-box.over { border-color: var(--red); }
.hw-box h3 { margin-bottom: 2px; }
.hw-count { text-align: right; display: flex; flex-direction: column; }
.hw-count b { font: 800 1.5rem var(--f-display); }
.hw-count span { font-size: .8rem; color: var(--ink-2); }
.mini-bar.big { height: 10px; }
.hw-box details summary { cursor: pointer; font-weight: 600; color: var(--pen); }

/* ---------- магазин */
.wallet { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; }
.wallet p { flex: 1 1 320px; margin: 0; }
.wallet-coins { display: flex; align-items: center; gap: 12px; }
.wallet-coins b { display: block; font: 800 2rem var(--f-display); line-height: 1; }
.wallet-coins span { color: var(--ink-2); font-size: .9rem; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.item { display: flex; flex-direction: column; gap: 8px; }
.item-title { font-weight: 700; font-size: 1.05rem; line-height: 1.3; }
.item-price { font: 800 1.4rem var(--f-display); display: flex; align-items: center; color: var(--gold-ink); }
.item .btn { margin-top: auto; }
.items-edit { display: flex; flex-direction: column; gap: 8px; }
.item-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-2); }
.item-row.new { border-style: dashed; }
.item-row label.small { display: inline-flex; align-items: center; gap: 6px; }
.item-row select, .item-row input { min-height: 38px; padding: 6px 10px; }

/* ---------- урок: ученик */
.lesson-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; max-width: 860px; width: 100%; margin: 0 auto; }
.lesson-head h1 { margin: 0; }
.lesson-score { color: var(--ink-2); }
.lesson-task, .lesson-wait, .lesson-end { max-width: 860px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.lesson-wait { align-items: center; text-align: center; padding: 40px 20px; }
.fb.sent { background: var(--pen-soft); border-left: 4px solid var(--pen); }
.dots-wait { display: flex; gap: 8px; }
.dots-wait i { width: 12px; height: 12px; border-radius: 50%; background: var(--pen); animation: blink 1.2s infinite; }
.dots-wait i:nth-child(2) { animation-delay: .2s; }
.dots-wait i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: .25; } }
#banner { position: fixed; z-index: 45; left: 50%; transform: translateX(-50%); bottom: max(16px, env(safe-area-inset-bottom, 0px)); width: min(560px, calc(100vw - 32px)); }
.banner-in { display: flex; align-items: center; gap: 12px; background: var(--card); border: 2px solid var(--pen); border-radius: 16px; padding: 12px 14px; box-shadow: 0 10px 30px rgb(0 0 0 / .18); }
.banner-in div { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.banner-in span:not(.banner-dot) { font-size: .85rem; color: var(--ink-2); }
.banner-dot, .live-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--red); flex: none; animation: pulse-red 1.6s infinite; }
@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgb(207 52 38 / .55); } 70% { box-shadow: 0 0 0 9px rgb(207 52 38 / 0); } 100% { box-shadow: 0 0 0 0 rgb(207 52 38 / 0); } }

/* ---------- урок: доска учителя */
.board-bar { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; justify-content: space-between; padding: 12px 16px; }
.bb-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lesson-picker { gap: 10px; }
.lesson-picker label { display: inline-flex; align-items: center; gap: 6px; }
.lesson-picker select { min-height: 38px; padding: 6px 10px; max-width: 260px; }
.lesson-intro { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.lesson-intro p { max-width: 70ch; }
.steps { margin: 0; padding-left: 20px; color: var(--ink-2); }
.board { display: flex; flex-direction: column; gap: 16px; padding: 28px; }
.board-n { font-size: .85rem; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.board-q { font-size: clamp(1.6rem, 1rem + 2.6vw, 2.8rem); font-weight: 600; line-height: 1.45; overflow-wrap: break-word; }
.board .graph { max-width: 360px; }
.board-opts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; font-size: clamp(1.1rem, .9rem + 1vw, 1.6rem); }
.board-opts li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; border: 2px solid var(--grid-2); }
.board-opts li.right { border-color: var(--green); background: var(--green-soft); }
.board-stat { display: flex; flex-direction: column; gap: 8px; }
.big-count { font-size: 1.2rem; color: var(--ink-2); }
.big-count b { font: 800 2.6rem var(--f-display); color: var(--ink); }
.board-chips .chip { padding: 6px 12px; border-radius: 99px; background: var(--card-2); border: 1.5px solid var(--line); font-weight: 600; color: var(--ink-3); }
.board-chips .chip.on { background: var(--pen-soft); color: var(--pen); border-color: var(--pen); }
.board-chips .chip.good { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.board-chips .chip.bad { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.board-answer { font-size: clamp(1.3rem, 1rem + 1.5vw, 2rem); font-weight: 600; }
.board-answer .right-ans { color: var(--green); }
.dist { display: flex; flex-direction: column; gap: 6px; max-width: 640px; }
.dist-row { display: grid; grid-template-columns: minmax(80px, 200px) minmax(0, 1fr) 40px; align-items: center; gap: 10px; }
.dist-k { font-family: var(--f-mono); font-weight: 600; overflow-wrap: anywhere; }
.dist-bar { height: 16px; background: var(--card-2); border-radius: 6px; overflow: hidden; }
.dist-bar i { display: block; height: 100%; background: var(--red); opacity: .75; }
.dist-row.ok .dist-bar i { background: var(--green); opacity: 1; }
.dist-row.ok .dist-k { color: var(--green); }
.btn.big { min-height: 54px; padding: 14px 24px; font-size: 1.05rem; }
.colgrid .qin.ro { display: flex; align-items: center; color: var(--ink-3); }

/* ---------- адаптив */
@media (max-width: 860px) {
  .two.even { grid-template-columns: minmax(0, 1fr); }
  .st-head .st-qr { grid-column: 1 / -1; flex-direction: row; max-width: none; gap: 12px; text-align: left; }
  .next-row, .mod-grid, .prof-grid, .two { grid-template-columns: minmax(0, 1fr); }
  .st-head { grid-template-columns: auto minmax(0, 1fr); }
  .st-actions { grid-column: 1 / -1; max-width: none; }
}
@media (max-width: 560px) {
  :root { --cell: 32px; }
  .main { padding-block: 14px 50px; gap: 14px; }
  .card { padding: 16px; }
  .topin { min-height: 52px; gap: 6px 12px; }
  .brand-sub { display: none; }
  .who-name { display: none; }
  .tabs { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -4px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; flex: none; }
  .board { padding: 18px; }
  .st-tools { grid-template-columns: minmax(0, 1fr); }
  .player { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "av main" "lvl lvl" "st st"; }
  .pl-level { grid-template-columns: auto auto; align-items: baseline; gap: 8px; justify-content: start; }
  .avatar { width: 52px; height: 52px; font-size: 1.05rem; }
  .task { grid-template-columns: minmax(0, 1fr) 46px; }
  .task-body { padding: 16px; }
  .mark { font-size: 54px; }
  .level { grid-template-columns: auto minmax(0, 1fr); }
  .lv-act { grid-column: 1 / -1; }
  .lv-act .btn { width: 100%; }
  .grade-mark { width: 62px; height: 62px; font-size: 46px; top: 10px; right: 12px; }
  .big-stars { font-size: 44px; }
  .summary { padding-top: 70px; }
  .review-list li { flex-direction: column; align-items: flex-start; gap: 2px; }
  .ch-prog { display: none; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .tile { min-height: 110px; padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .top, .no-print, #toasts { display: none !important; }
  body { background: #fff; color: #000; }
  .main { padding: 0; }
  .pcard { border-color: #555; }
}
