:root {
  --bg: #f7f5f0;
  --card: #ffffff;
  --text: #1c1f24;
  --muted: #5b6169;
  --line: #e3ddd2;
  --line-strong: #cfc7b8;
  --sunk: #f1ede4;
  --accent: #9b1c1c;
  --accent-soft: #f8ebe9;
  --accent-dark: #7a1515;
  --ok: #1e7a3c;
  --ok-soft: #e6f3ea;
  --warn: #8a5300;
  --warn-soft: #fdf3e1;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --part: #2f5d8a;
  --radius: 12px;
  --sea: #dce9f2;
  --land: #ece8df;
  --blr: #f3dcc8;
  --river: #6d9ec4;
  --pin: #2f5d8a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 'Golos Text', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 860px; margin: 0 auto; padding: 16px; }
a { color: var(--accent); }
/* until app.js draws the page (section.html) */
.booting #app { visibility: hidden; }

.top {
  max-width: 860px; margin: 0 auto; padding: 20px 16px 8px;
  display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline;
}
.brand { font-weight: 700; font-size: 20px; color: var(--text); text-decoration: none; }
.sub { color: var(--muted); font-size: 14px; }
/* back to the subject choice at midschool.by/: its own line above the section name */
.home-link { flex-basis: 100%; font-size: 14px; color: var(--muted); text-decoration: none; }
.home-link:hover { color: var(--accent); text-decoration: underline; }
.foot { max-width: 860px; margin: 24px auto; padding: 0 16px 24px; color: var(--muted); font-size: 13px; }

h1 { font-size: 24px; margin: 8px 0 4px; line-height: 1.25; }
h2 { font-size: 19px; margin: 28px 0 10px; }
.lead { color: var(--muted); margin: 0 0 16px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 12px 0;
}

/* Home */
.kim-card {
  display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: var(--accent-soft); border-color: transparent;
}
.kim-card b { display: block; font-size: 17px; }
.kim-card .best { display: block; }
.kim-part { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); font-weight: 700; }
.kim-card + .kim-card { margin-top: 10px; }
.list { list-style: none; padding: 0; margin: 0; }
.list li a {
  display: flex; gap: 12px; align-items: baseline; padding: 10px 12px; border-radius: 8px;
  text-decoration: none; color: var(--text);
}
.list li a:hover { background: var(--bg); }
.num { color: var(--muted); min-width: 36px; font-variant-numeric: tabular-nums; }
.title { flex: 1; }
.best { font-size: 13px; color: var(--muted); white-space: nowrap; }
.best.done { color: var(--ok); }

/* Buttons */
.btn {
  display: inline-block; border: 0; border-radius: 8px; padding: 10px 18px; cursor: pointer;
  background: var(--accent); color: #fff; font: inherit; font-weight: 600; text-decoration: none;
}
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn:disabled { opacity: .45; cursor: default; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }

/* Questions */
.q-head { display: flex; gap: 8px; align-items: baseline; margin-bottom: 10px; }
.q-n { font-weight: 700; color: var(--accent); }
.q-part { font-size: 12px; font-weight: 700; color: var(--part); border: 1px solid currentColor; border-radius: 4px; padding: 0 5px; }
.q-text { font-weight: 600; }
.hint { color: var(--muted); font-size: 13px; margin: -4px 0 8px; }

.opt {
  display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; margin: 4px 0;
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.opt input { margin-top: 4px; accent-color: var(--accent); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }

.match-row { display: grid; grid-template-columns: 1fr; gap: 4px; margin: 8px 0; }
.match-row select, .text-input {
  width: 100%; font: inherit; padding: 8px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
}
@media (min-width: 640px) {
  .match-row { grid-template-columns: 2fr 3fr; align-items: center; gap: 12px; }
}
.match-row.right select { border-color: var(--ok); background: var(--ok-soft); }
.match-row.wrong select { border-color: var(--bad); background: var(--bad-soft); }

.order-item {
  display: flex; gap: 8px; align-items: center; padding: 8px 10px; margin: 4px 0;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card);
}
.order-item .pos { color: var(--muted); min-width: 20px; }
.order-item .txt { flex: 1; }
.order-item button {
  border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 6px;
  width: 32px; height: 32px; cursor: pointer; font-size: 14px;
}
.order-item.right { border-color: var(--ok); background: var(--ok-soft); }
.order-item.wrong { border-color: var(--bad); background: var(--bad-soft); }

.feedback { margin-top: 10px; padding: 10px 12px; border-radius: 8px; font-size: 15px; }
.feedback.ok { background: var(--ok-soft); color: var(--ok); }
.feedback.no { background: var(--bad-soft); color: var(--bad); }
.feedback .expl { color: var(--text); margin-top: 4px; }

/* Result */
.result { text-align: center; }
.score { font-size: 44px; font-weight: 800; margin: 4px 0; }
.grade { font-size: 18px; }
.grade b { font-size: 28px; color: var(--accent); }
.bar { height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; margin: 12px auto; max-width: 360px; }
.bar > div { height: 100%; background: var(--accent); }
.student { max-width: 360px; margin: 0 auto 8px; }
.timer { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 8px 0; font-weight: 600; color: var(--muted); }

h3 { font-size: 16px; margin: 20px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.btn.small { padding: 6px 12px; font-size: 14px; }

/* Practice tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.tile {
  display: flex; gap: 12px; align-items: center; padding: 12px 14px; text-decoration: none; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.tile:hover { border-color: var(--accent); }
.tile b { display: block; font-weight: 600; }
.tile-ic { font-size: 26px; line-height: 1; }

/* Cloze */
.cloze { line-height: 2.3; margin: 0; }
.cloze select {
  font: inherit; padding: 2px 4px; border-radius: 6px; max-width: 100%;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.cloze select.right { border-color: var(--ok); background: var(--ok-soft); }
.cloze select.wrong { border-color: var(--bad); background: var(--bad-soft); }
.gap-fix { color: var(--ok); font-weight: 600; margin-left: 4px; }

/* Find the errors */
.errors-text { line-height: 1.5; margin: 0; display: grid; gap: 4px; }
.sent { cursor: pointer; border-radius: 4px; padding: 1px 2px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
/* one sentence per line, so each is easy to read and to pick */
.errors-text .sent { display: block; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; }
.sent:hover { background: var(--accent-soft); }
.sent.marked { background: var(--accent-soft); text-decoration: underline wavy var(--accent); }
.sent.found { background: var(--ok-soft); text-decoration: line-through var(--ok); }
.sent.missed { background: var(--bad-soft); text-decoration: underline wavy var(--bad); }
.sent.false-alarm { outline: 2px dashed var(--bad); }
.fixes { margin: 4px 0 0; padding-left: 20px; font-size: 15px; }

/* Classify */
.cls-row { padding: 8px 10px; margin: 6px 0; border: 1px solid var(--line); border-radius: 8px; }
.cls-row.right { border-color: var(--ok); background: var(--ok-soft); }
.cls-row.wrong { border-color: var(--bad); background: var(--bad-soft); }
.cls-item { margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span { display: inline-block; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 14px; }
.chip input:checked + span { background: var(--part); border-color: var(--part); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Chain (cause and effect) */
.chain .pos { color: var(--accent); font-weight: 700; text-align: center; }

/* Timeline */
.tl-axis { width: 100%; height: auto; display: block; margin: 4px 0 8px; overflow: visible; }
.tl-line { stroke: var(--muted); stroke-width: 2; }
.tl-year { fill: var(--muted); font-size: 14px; text-anchor: middle; }
.tl-mark circle { fill: var(--part); }
.tl-mark text { fill: #fff; font-size: 12px; font-weight: 700; text-anchor: middle; }
.tl-mark.right circle { fill: var(--ok); }
.tl-mark.wrong circle { fill: var(--bad); }
.tl-mark.ghost circle { fill: transparent; stroke: var(--ok); stroke-width: 2; stroke-dasharray: 3 2; }
.tl-mark.ghost text { fill: var(--ok); }
.tl-row { padding: 8px 10px; margin: 6px 0; border: 1px solid var(--line); border-radius: 8px; }
.tl-row.right { border-color: var(--ok); background: var(--ok-soft); }
.tl-row.wrong { border-color: var(--bad); background: var(--bad-soft); }
.tl-ctl { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.tl-ctl input { flex: 1; accent-color: var(--part); }
.tl-val { min-width: 44px; font-variant-numeric: tabular-nums; font-weight: 600; }

/* Map */
.map-wrap { margin: 8px 0; }
.map { width: 100%; height: auto; display: block; border-radius: 8px; border: 1px solid var(--line); }
.m-sea { fill: var(--sea); }
.m-land { fill: var(--land); stroke: var(--muted); stroke-width: .6; stroke-opacity: .5; }
.m-blr { fill: var(--blr); stroke: var(--accent); stroke-width: .8; stroke-opacity: .5; }
.m-river { fill: none; stroke: var(--river); stroke-width: 1.6; }
.m-riga { fill: none; stroke: var(--accent); stroke-width: 3; stroke-dasharray: 10 6; }
.m-country { fill: var(--muted); font-size: 15px; letter-spacing: .15em; text-anchor: middle; opacity: .8; }
.m-note { fill: var(--accent); font-size: 15px; font-weight: 600; }
.m-label { fill: var(--text); font-weight: 600; paint-order: stroke; stroke: var(--card); stroke-width: 4px; }
.pin { cursor: pointer; }
.pin:focus { outline: none; }
.pin-hit { fill: transparent; }
.pin-dot { fill: var(--card); stroke: var(--pin); stroke-width: 3; }
.pin-n { fill: var(--pin); font-weight: 700; text-anchor: middle; pointer-events: none; }
.pin:hover .pin-dot, .pin:focus-visible .pin-dot { stroke: var(--accent); }
.pin.sel .pin-dot, .pin.hl .pin-dot { fill: var(--accent); stroke: var(--accent); }
.pin.sel .pin-n, .pin.hl .pin-n { fill: #fff; }
.pin.right .pin-dot { fill: var(--ok); stroke: var(--ok); }
.pin.wrong .pin-dot { fill: var(--bad); stroke: var(--bad); }
.pin.right .pin-n, .pin.wrong .pin-n { fill: #fff; }
.map-credit { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Guess the person */
.guess-hints { margin: 0 0 4px; padding-left: 22px; }
.guess-hints li { margin: 4px 0; }

/* Source */
.source { margin: 0 0 12px; padding: 12px 14px; border-left: 4px solid var(--accent); background: var(--bg); border-radius: 0 8px 8px 0; }
.source p { margin: 0 0 8px; }
.source p:last-child { margin: 0; }
.src-title { font-weight: 700; margin-bottom: 6px; }
.sub-q { margin: 14px 0 0; }
.sub-q .q-text { margin-bottom: 6px; }

/* Images */
.q-img { margin: 0 0 10px; }
.q-img img { display: block; max-width: 100%; max-height: 420px; margin: 0 auto; border-radius: 8px; }
.q-img figcaption { font-size: 12px; color: var(--muted); text-align: center; margin-top: 4px; }

/* Flashcards */
.flash {
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; width: 100%; min-height: 220px;
  padding: 24px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); color: var(--text);
  font: inherit; cursor: pointer; text-align: center;
}
.flash.back { background: var(--accent-soft); }
.flash-main { font-size: 22px; font-weight: 600; }
.flash.back .flash-main { font-size: 18px; font-weight: 400; }

/* Essay */
.essay { width: 100%; font: inherit; padding: 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); resize: vertical; }
.keys { list-style: none; padding: 0; margin: 0; columns: 2 220px; }
.keys li { margin: 2px 0; }
.keys .right { color: var(--ok); }
.keys .wrong { color: var(--bad); }
.score.small { font-size: 28px; text-align: center; }
details summary { cursor: pointer; font-weight: 600; }

/* Projector mode */
.class-progress { color: var(--muted); font-weight: 600; margin-top: 8px; }
body.projector main { max-width: 1200px; }
body.projector { font-size: 22px; }
body.projector .q-text { font-size: 26px; }
body.projector .hint { font-size: 18px; }
body.projector .btn { font-size: 20px; padding: 12px 24px; }
body.projector .chip span { font-size: 20px; }
body.projector .map { max-height: 72vh; width: auto; max-width: 100%; margin: 0 auto; }

@media print {
  .top, .foot, .actions, .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .card { break-inside: avoid; }
}
.ref { margin-top: 8px; padding-top: 8px; border-top: 1px solid currentColor; border-top-color: color-mix(in srgb, currentColor 25%, transparent); color: var(--text); }

/* Layout with side menu */
.top, .foot { max-width: 1180px; }
.layout { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 8px; align-items: start; }
.layout main { max-width: 860px; width: 100%; margin: 0; }
.side {
  position: sticky; top: 0; max-height: 100vh; overflow-y: auto; padding: 16px 8px 24px 16px;
  font-size: 15px; line-height: 1.35;
}
.side a { display: block; padding: 5px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.side a:hover { background: var(--card); }
.side a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side .nav-top { font-weight: 600; padding: 8px 10px; margin-top: 2px; }
.nav-group.open > .nav-top { color: var(--accent); }
.nav-sub { margin: 2px 0 8px 10px; border-left: 2px solid var(--line); padding-left: 4px; }
.nav-sub a { font-size: 14px; }
.nav-sec { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px 2px; }
.menu-btn { display: none; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 8px; width: 40px; height: 36px; font-size: 20px; cursor: pointer; }
body.projector .layout { grid-template-columns: minmax(0, 1fr); }
body.projector .side { display: none; }
body.projector .layout main { max-width: 1200px; margin: 0 auto; }
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .layout main { max-width: none; }
  .menu-btn { display: inline-block; align-self: center; }
  .top { align-items: center; }
  .side {
    display: none; position: fixed; inset: 0 auto 0 0; width: min(320px, 86vw); max-height: none; height: 100vh;
    z-index: 10; background: var(--bg); border-right: 1px solid var(--line); box-shadow: 0 0 40px rgba(0,0,0,.25);
  }
  body.menu-open .side { display: block; }
}
@media print { .side, .menu-btn { display: none !important; } .layout { display: block; } }

/* The subject's picture (--bg-image, set by the section's page) only as the band at the top of the subject's start
   page (.hero-band); every working page has the plain background, so the text is always on one even colour */
.hero-band {
  margin: 0 0 8px; padding: 28px 28px 30px; border-radius: 16px; border: 1px solid var(--line);
  background: linear-gradient(90deg, var(--bg) 0%, rgba(247,245,240,.94) 48%, rgba(247,245,240,.4) 100%), var(--bg-image, none) center 40% / cover no-repeat, var(--card);
}
.hero-band > :last-child { margin-bottom: 0; }
@media (max-width: 700px) {
  .hero-band { padding: 20px 18px; background: linear-gradient(rgba(247,245,240,.88), rgba(247,245,240,.88)), var(--bg-image, none) center / cover no-repeat, var(--card); }
}
body.projector { background: var(--bg); }
@media print { body { background: #fff !important; } }
.nav-toggle {
  display: flex; width: 100%; justify-content: space-between; align-items: center; border: 0; background: none;
  font: inherit; font-weight: 600; color: var(--text); text-align: left; cursor: pointer; padding: 8px 10px; border-radius: 8px;
}
.nav-toggle:hover { background: var(--card); }
.nav-group.current > .nav-toggle { color: var(--accent); }
.chev { font-size: 18px; line-height: 1; transition: transform .15s; color: var(--muted); }
.nav-group.open .chev { transform: rotate(90deg); }
.tile .best { white-space: normal; }

/* Accounts */
.acct {
  margin-left: auto; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--text); text-decoration: none; font-size: 14px; white-space: nowrap;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis;
}
.acct:hover { border-color: var(--accent); }
.side .nav-sep { margin-top: 14px; border-top: 1px solid var(--line); border-radius: 0; padding-top: 12px; }
.form label { display: block; margin: 10px 0; font-size: 14px; color: var(--muted); }
.form label .text-input { margin-top: 4px; color: var(--text); font-size: 16px; }
.form-err { color: var(--bad); font-size: 14px; min-height: 1em; }
.text-input.inline { width: auto; max-width: 100%; }
.btn.danger { background: var(--bad); }
details.card > summary { cursor: pointer; font-weight: 600; }
details.card[open] > summary { margin-bottom: 8px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 4px; }
.tab {
  font: inherit; font-size: 14px; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
}
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.stat b { display: block; font-size: 20px; }
.stat span { color: var(--muted); font-size: 13px; }
.heat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.heat-grid.wide { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.heat {
  display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: 8px;
  text-decoration: none; color: var(--text); font-weight: 600; font-size: 14px; border: 1px solid var(--line);
}
.heat small { font-weight: 400; font-size: 12px; }
.h-hi { background: var(--ok-soft); }
.h-mid { background: color-mix(in srgb, #e9b949 28%, var(--card)); }
.h-lo { background: var(--bad-soft); }
.h-none { background: var(--card); color: var(--muted); }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin: 8px 0; }
.tbl { border-collapse: collapse; width: 100%; font-size: 14px; }
.tbl th, .tbl td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl th { font-weight: 600; color: var(--muted); font-size: 13px; white-space: nowrap; }
.tbl td.num { text-align: center; white-space: nowrap; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.heat-tbl th, .heat-tbl td.num { padding: 6px 4px; min-width: 34px; }
.heat-tbl td:first-child { white-space: nowrap; position: sticky; left: 0; background: var(--card); }
.avg-row td { font-weight: 600; }
.q-cell { font-size: 13px; color: var(--muted); max-width: 420px; }
.code-card { text-align: center; }
.class-code { font: 700 34px/1.2 ui-monospace, Consolas, monospace; letter-spacing: .15em; color: var(--accent); margin: 4px 0; }

/* Final test */
.q-tag { background: var(--accent-soft); color: var(--accent); }
.attempt-badge {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; margin: 8px 0 12px;
  border-left: 4px solid var(--part); background: var(--card); border-radius: 8px; font-weight: 600;
}
.attempt-badge span { font-weight: 400; font-size: 13px; color: var(--muted); }
.final-runs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.sub-num { display: block; font-size: 11px; color: var(--muted); }
.pgroup { margin: 4px 0; line-height: 2; }
.chip-link {
  display: inline-block; padding: 0 8px; margin: 0 2px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--text); text-decoration: none; font-size: 13px; line-height: 1.8;
}

/* Print: list of works */
.p-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; margin: 6px 0 10px; }
.p-picks.wide { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.p-pick {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card);
  color: var(--text); text-decoration: none; font-size: 14px; text-align: center;
}
.p-pick:hover { border-color: var(--accent); }
.p-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.p-keyopt { font-size: 14px; }

/* Print: the sheet itself — fixed A4 geometry in mm, always black on white */
.p-sheet { overflow-x: auto; }
.p-page, .p-stage {
  --text: #000; --muted: #444; --line: #bbb; --card: #fff; --bg: #fff;
  --sea: #eef3f7; --land: #f1f1f1; --blr: #e3e3e3; --river: #8fb0c9; --pin: #000;
  color: #000; background: #fff; font-family: "Times New Roman", Georgia, serif; line-height: 1.22;
}
.p-page {
  width: 190mm; height: 277mm; padding: 0; margin: 0 auto 16px; overflow: hidden;
  box-shadow: 0 0 0 10mm #fff, 0 0 0 calc(10mm + 1px) var(--line);
  margin-top: 10mm; margin-bottom: calc(10mm + 16px);
}
.p-stage { position: absolute; left: -10000px; top: 0; visibility: hidden; }
.p-row { display: flex; gap: 6mm; }
.p-col { width: 92mm; flex: none; }
.p-head { border-bottom: 1px solid #000; padding-bottom: 1.5mm; margin-bottom: 2mm; }
.p-title { font-size: 1.15em; }
.p-who { margin-top: 1.5mm; white-space: nowrap; }
.p-note { font-size: .9em; margin-top: 1mm; }
.p-block { margin-bottom: 1.6mm; break-inside: avoid; display: flow-root; }
.p-sub { margin-top: .8mm; }
.p-q b { font-weight: 700; }
.p-tag { color: #444; font-size: .9em; }
.p-opts { display: flex; flex-wrap: wrap; gap: 0 3mm; margin-top: .4mm; }
.p-opt { max-width: 100%; }
.p-list > div, .p-match div { margin: .2mm 0; }
.p-match { display: grid; grid-template-columns: 1fr 1fr; gap: 2mm; margin-top: .4mm; }
.p-match ol { margin: 0; padding-left: 4mm; }
.p-text { margin: .4mm 0; }
.p-ans { margin-top: .6mm; }
.p-blank { display: inline-block; border-bottom: 1px solid #000; height: .9em; vertical-align: baseline; }
.p-hints { margin: .4mm 0; padding-left: 4mm; }
.p-src { font-size: .92em; font-style: italic; margin: .5mm 0; padding-left: 2mm; border-left: 1px solid #000; }
.p-src p { margin: .3mm 0; }
.p-src b { font-style: normal; }
.p-map { width: 17em; max-width: 100%; margin: .6mm auto; }
.p-map .map-credit { display: none; }
.p-map .map { width: 100%; height: auto; display: block; }
.p-img { float: right; max-width: 8em; max-height: 8em; margin: 0 0 1mm 2mm; }
.p-key { font-size: 9pt; }
.p-key ol { columns: 2; column-gap: 6mm; padding-left: 6mm; margin: 2mm 0 0; }
.p-key li { break-inside: avoid; margin-bottom: 1mm; }

@media print {
  @page { size: A4; margin: 10mm; }
  body.printing { background: #fff !important; }
  body.printing .top, body.printing .side, body.printing .foot, body.printing .no-print, body.printing .menu-btn { display: none !important; }
  body.printing .layout, body.printing main { display: block; max-width: none; margin: 0; padding: 0; }
  body.printing .p-sheet { overflow: visible; }
  body.printing .p-page { margin: 0; box-shadow: none; break-after: page; }
  body.printing .p-page:last-child { break-after: auto; }
}
.tbl td.nowrap { white-space: nowrap; }

/* Grade catalog on the start page */
.grade-n { font-size: 24px; font-weight: 700; color: var(--accent); min-width: 1.6em; text-align: center; }
.tile.soon { opacity: .65; }
.tile.soon .grade-n { color: var(--muted); }
/* a textbook in the menu: the main level, larger and bolder than its sections */
.side .nav-book { margin: 14px 0 4px; padding: 12px 10px 6px; font-size: 18px; font-weight: 800; color: var(--text); letter-spacing: -.01em; border-top: 1px solid var(--line); }
.side .nav-book:first-child, .side .book-pick + .nav-book { border-top: 0; margin-top: 4px; padding-top: 4px; }

/* Checkbox field in forms (consent) */
.form label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.form label.check input { margin-top: 4px; flex: none; }

/* Switching between the teacher's classes */
.class-switch { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.class-switch .chip-link { font-size: 14px; padding: 2px 12px; margin: 0; background: var(--card); }
.class-switch .chip-link:hover { border-color: var(--accent); }
.class-switch .chip-link.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Guests have no side menu */
body.no-side .side, body.no-side .menu-btn { display: none !important; }
/* without the menu the content takes the whole frame, on the same left edge as the header (like the main page) */
body.no-side .layout { grid-template-columns: minmax(0, 1fr); }
body.no-side .layout main { max-width: none; }
.sent-n { color: var(--accent); font-weight: 700; }

[hidden] { display: none !important; }

/* Print buttons next to works (teacher) */
.list li { display: flex; align-items: center; gap: 4px; }
.list li > a:first-child { flex: 1; min-width: 0; }
.print-btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--card); text-decoration: none; font-size: 17px;
}
.print-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.tile-wrap { position: relative; display: grid; }
.tile-wrap .tile { padding-right: 48px; }
.tile-wrap .print-btn { position: absolute; top: 8px; right: 8px; }
.kim-card .actions { margin: 0; }

/* Teacher's classes grouped by school */
.school-head { margin: 18px 0 8px; font-size: 16px; }

/* Teacher's grade picker in the side menu */
.book-pick { display: grid; gap: 4px; padding: 4px 10px 10px; font-weight: 600; }
.book-pick select { font-weight: 400; }
.nav-note { color: var(--muted); font-size: 14px; padding: 4px 10px; margin: 0; }

/* Guest landing */
.hero { padding: 24px 0 8px; }
.hero h1 { font-size: 32px; line-height: 1.15; margin: 0 0 12px; max-width: 640px; }
.hero-lead { font-size: 18px; color: var(--text); margin: 0 0 18px; max-width: 640px; }
.btn.big { padding: 12px 24px; font-size: 17px; text-decoration: none; display: inline-block; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 24px 0 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat b { display: block; font-size: 26px; color: var(--accent); line-height: 1.1; }
.stat span { color: var(--muted); font-size: 14px; }
.sec-h { font-size: 22px; margin: 32px 0 10px; scroll-margin-top: 12px; }
.sec-h-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin: 32px 0 10px; }
.sec-h-row .sec-h { margin: 0; }
.sec-h-row .btn { text-decoration: none; }
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.feature { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.feature-ic { font-size: 26px; display: block; margin-bottom: 6px; }
.feature b { display: block; margin-bottom: 4px; }
.feature p { margin: 0; color: var(--muted); font-size: 15px; }
.demo-tag { display: inline-block; font-size: 13px; color: var(--part); background: var(--sea); border-radius: 999px; padding: 2px 10px; margin-bottom: 8px; }
.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.how .card { margin: 0; display: flex; flex-direction: column; align-items: flex-start; }
.how .btn { margin-top: auto; text-decoration: none; }
.steps { list-style: none; padding: 0; margin: 10px 0 14px; }
.steps li { display: flex; gap: 10px; align-items: baseline; margin: 6px 0; }
.step-n { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; }
@media (max-width: 640px) { .hero h1 { font-size: 26px; } .hero-lead { font-size: 16px; } }
.book-h { font-size: 22px; margin: 28px 0 10px; padding-top: 16px; border-top: 2px solid var(--line); }
.top { position: relative; }
.acct-menu {
  position: absolute; right: 16px; top: calc(100% - 2px); z-index: 30; min-width: 220px; max-width: calc(100vw - 32px);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: 6px; display: flex; flex-direction: column;
}
.acct-menu[hidden] { display: none; }
.acct-who { padding: 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.acct-who b { display: block; }
.acct-who span { color: var(--muted); font-size: 13px; }
.acct-menu a, .acct-menu button {
  display: block; text-align: left; padding: 8px 10px; border-radius: 8px; font: inherit; font-size: 15px;
  color: var(--text); text-decoration: none; background: none; border: 0; cursor: pointer;
}
.acct-menu a:hover, .acct-menu button:hover { background: var(--accent-soft); color: var(--accent); }

/* teacher: access to works */
.acc-group { border-top: 1px solid var(--line, #e5e5e5); padding: 10px 0; }
.acc-master { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; cursor: pointer; }
.acc-master input, .acc-items input { width: 18px; height: 18px; flex: none; }
.acc-group details { margin: 6px 0 0 28px; }
.acc-group summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.acc-items { display: grid; gap: 6px; margin-top: 8px; }
.acc-items label { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
/* a short note at the bottom of the screen */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50; max-width: calc(100vw - 32px);
  background: var(--text, #222); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.toast[hidden] { display: none; }
/* long report sections folded under their heading */
.fold { margin: 8px 0; }
.fold > summary { cursor: pointer; list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary h2 { display: inline-flex; align-items: center; gap: 8px; margin: 18px 0 8px; }
.fold > summary h2::before { content: '▸'; color: var(--muted); transition: transform .15s; }
.fold[open] > summary h2::before { transform: rotate(90deg); }
.acc-own { color: var(--accent); font-weight: 600; }
/* the small ⚙ next to a class name */
h1 .print-btn { display: inline-flex; vertical-align: middle; font-size: 16px; font-weight: 400; }

/* a question whose answer follows the current law, not the textbook: a note for the teacher */
.upd-note { margin: 6px 0; padding: 6px 10px; border-radius: 8px; background: #fff6d6; color: #6b4e00; font-size: 14px; }

/* Line icons (app.js icon/deco) */
.icon { width: 1.15em; height: 1.15em; vertical-align: -.2em; flex-shrink: 0; }
.tile-ic .icon, .feature-ic .icon { width: 28px; height: 28px; color: var(--accent); vertical-align: middle; }
.side .icon, .acct-menu .icon { color: var(--accent); margin-right: 2px; }
.sec-h .icon { color: var(--accent); }

/* A textbook's tile with its picture on top (page.covers) */
.tile.has-pic { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 0 12px; padding: 0; overflow: hidden; align-items: center; align-content: start; }
.tile.has-pic .pic { grid-column: 1 / -1; display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; margin-bottom: 10px; background: var(--line); }
.tile.has-pic > .tile-ic { padding: 0 0 12px 14px; }
.tile.has-pic > span:last-child { padding: 0 14px 12px 0; }
.tile.has-pic:hover .pic { filter: brightness(1.04) saturate(1.08); }
.tile.soon .pic { filter: grayscale(.8); }
/* phones: textbook covers two in a row, the grade number is in the name anyway */
@media (max-width: 560px) {
  .tiles:has(> .tile.has-pic) { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tile.has-pic { grid-template-columns: minmax(0, 1fr); }
  .tile.has-pic > .tile-ic { display: none; }
  .tile.has-pic > span:last-child { padding: 0 10px 10px; font-size: 14px; align-self: start; }
  .tile.has-pic .best { font-size: 12px; }
}

/* the site's logo before the section's name */
.brand .logo { width: 28px; height: 28px; margin-right: 8px; vertical-align: -7px; }

/* ===== Design system (12.11.2026): one look for the main site and the sections =====
   Literata for headings, Golos Text for text (both served from /fonts/); the brand red only for the brand and the
   main actions; success, warning and error have their own colours; working pages on a plain background. */
h1, h2, .sec-h, .book-h { font-family: 'Literata', Georgia, serif; font-weight: 700; letter-spacing: -.005em; }
h1 { font-size: clamp(24px, 3.4vw, 30px); line-height: 1.2; }
.hero h1 { font-size: clamp(28px, 4.4vw, 40px); }
:focus-visible { outline: 3px solid rgba(155, 28, 28, .35); outline-offset: 2px; }

/* header: one row, the whole width; the content keeps the 1180 frame */
.top {
  max-width: none; margin: 0; padding: 10px max(16px, calc((100% - 1180px) / 2 + 16px));
  background: var(--card); border-bottom: 1px solid var(--line);
  flex-wrap: nowrap; align-items: center; gap: 10px; min-height: 64px;
}
.home-link { flex-basis: auto; display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; font-size: 17px; white-space: nowrap; }
.home-link:hover { text-decoration: none; color: var(--accent); }
.home-link .logo { width: 30px; height: 30px; flex: none; }
.home-tx span { color: var(--accent); }
.crumb-sep { color: var(--line-strong); font-size: 20px; }
.brand { font-size: 17px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand:hover { color: var(--accent); }
.sub { white-space: nowrap; }
.acct { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-color: var(--line-strong); font-size: 15px; font-weight: 600; flex: none; }
.acct .icon { color: var(--accent); }
.menu-btn { flex: none; width: 44px; height: 40px; display: none; align-items: center; justify-content: center; padding: 0; }
.menu-btn .icon { width: 22px; height: 22px; }
@media (max-width: 1000px) { .sub { display: none; } }
@media (max-width: 860px) { .menu-btn { display: inline-flex; } }
@media (max-width: 640px) {
  .top { gap: 8px; min-height: 56px; padding-top: 8px; padding-bottom: 8px; }
  .home-tx, .crumb-sep { display: none; }
  .brand { font-size: 16px; }
  .acct { font-size: 0; gap: 0; padding: 0 11px; }
  .acct .icon { width: 18px; height: 18px; }
}
.acct-menu { right: max(16px, calc((100% - 1180px) / 2 + 16px)); top: calc(100% + 4px); }

/* side menu: a white panel next to the content; a drawer on phones */
.layout { gap: 24px; padding: 0 16px; }
.layout main { padding: 20px 0; }
.side { top: 12px; max-height: calc(100vh - 24px); margin-top: 20px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.side a:hover, .nav-toggle:hover { background: var(--bg); }
@media (max-width: 860px) {
  .layout { padding: 0; }
  .layout main { padding: 16px; }
  .side { margin: 0; border-radius: 0; top: 0; max-height: none; background: var(--card); }
}

/* buttons: main (filled), secondary (white), danger; 44 px high */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; line-height: 1.2; font-size: 15px; border: 1px solid transparent; }
.btn:hover:not(:disabled) { background: var(--accent-dark); color: #fff; }
.btn.ghost { background: var(--card); color: var(--text); border-color: var(--line-strong); }
.btn.ghost:hover:not(:disabled) { background: var(--card); color: var(--text); border-color: var(--accent); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.big { min-height: 50px; padding: 0 22px; font-size: 16px; display: inline-flex; }
.btn.danger:hover:not(:disabled) { background: #8f1c14; }
.btn .icon { width: 18px; height: 18px; }

/* cards, tiles */
.card { box-shadow: 0 1px 2px rgba(28, 31, 36, .06); }
.tile { box-shadow: 0 1px 2px rgba(28, 31, 36, .06); transition: border-color .15s, box-shadow .15s; }
.tile:hover { box-shadow: 0 6px 20px rgba(28, 31, 36, .10); }
.stat b { color: var(--text); }
.feature-ic .icon, .tile-ic .icon { color: var(--accent); }
.demo-tag { border-radius: 6px; font-weight: 600; font-size: 12px; background: #e8eff6; color: var(--part); }

/* tabs: an underline for the parts of a page; the classes of a subject — a segmented switch */
.tabs { gap: 0 24px; margin: 18px 0 14px; border-bottom: 1px solid var(--line); }
.tab { border: 0; border-radius: 0; background: none; padding: 10px 2px; margin-bottom: -1px; border-bottom: 2px solid transparent;
  color: var(--muted); font-weight: 600; font-size: 15px; }
.tab:hover { color: var(--text); }
.tab.active { background: none; color: var(--text); border-bottom-color: var(--accent); }
.class-switch { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--sunk); border-radius: 8px; margin: 0; }
.class-switch .chip-link { border: 0; background: none; border-radius: 6px; padding: 6px 14px; font-weight: 600; color: var(--muted); line-height: 1.4; }
.class-switch .chip-link:hover { color: var(--text); }
.class-switch .chip-link.active { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(28, 31, 36, .14); }

/* fields */
.text-input, .match-row select { min-height: 44px; border-color: var(--line-strong); }
.text-input:focus, .match-row select:focus, .essay:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(155, 28, 28, .2); }
.form label { color: var(--text); font-weight: 500; }
.form-err { color: var(--bad); }

/* questions: big targets for fingers */
.q-text { font-size: 17px; line-height: 1.45; }
.opt { align-items: center; min-height: 48px; padding: 10px 14px; margin: 8px 0; border-radius: 10px; background: var(--card); }
.opt:hover { border-color: var(--line-strong); }
.opt input { margin-top: 0; width: 18px; height: 18px; flex: none; }
.feedback { border-radius: 10px; padding: 12px 14px; }
.feedback.ok { border: 1px solid #bfdfc9; }
.feedback.no { border: 1px solid #f3c4bf; }

/* results: the colours of the ranges; the names column stays in view when the table scrolls sideways */
.h-mid { background: var(--warn-soft); }
.tbl td.num.h-hi { color: #14532b; } .tbl td.num.h-mid { color: #6b4300; } .tbl td.num.h-lo { color: #8f1c14; }
.tbl th { background: var(--card); }
.table-wrap .tbl tr > :first-child { position: sticky; left: 0; z-index: 1; background: var(--card); box-shadow: 6px 0 8px -6px rgba(28, 31, 36, .18); }

/* a teacher's class: the code with its link, and what the students can see now */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); margin: 0 0 10px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.class-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 20px; }
.class-head h1 { margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.class-head .lead { margin: 4px 0 0; }
.code-box { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; background: var(--sunk); border-radius: 10px; padding: 6px 6px 6px 14px; }
.code-box .k { font-size: 13px; color: var(--muted); }
.code-box .class-code { font: 700 20px/1.2 'Golos Text', system-ui, sans-serif; letter-spacing: .12em; color: var(--text); margin: 0; }
.status-strip { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 16px 0;
  padding: 12px 16px; border-radius: var(--radius); border: 1px solid #bfdfc9; background: var(--ok-soft); color: #14532b; }
.status-strip.shut { border-color: #ebd3a6; background: var(--warn-soft); color: #5c3a00; }
.status-strip .icon { width: 20px; height: 20px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin: -6px 0 0; }

/* the textbooks of a subject: the cover with the grade on it, the period, how many tests */
.tiles:has(> .book-tile) { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.book-tile { display: flex; flex-direction: column; align-items: stretch; gap: 0; padding: 0; overflow: hidden; }
.book-tile .cover { position: relative; display: block; }
.book-tile .pic { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; background: var(--line); }
.book-tile .badge { position: absolute; left: 10px; top: 10px; background: var(--card); color: var(--text); font-size: 13px; font-weight: 700;
  padding: 3px 10px; border-radius: 6px; box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.book-tile .tx { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 14px; flex: 1; }
.book-tile .tx b { font-family: 'Literata', Georgia, serif; font-weight: 600; font-size: 16px; line-height: 1.3; flex: 1; }
.book-tile .best { white-space: nowrap; }
.book-tile:hover .pic { filter: brightness(1.04) saturate(1.08); }
.book-tile.soon .pic { filter: grayscale(.8); }
.book-tile.no-pic .cover { display: none; }
@media (max-width: 560px) {
  .tiles:has(> .book-tile) { grid-template-columns: 1fr 1fr; gap: 10px; }
  .book-tile .tx { padding: 10px; }
  .book-tile .tx b { font-size: 14px; }
  .book-tile .best { white-space: normal; font-size: 12px; }
}
.class-tiles { display: flex; flex-wrap: wrap; gap: 12px; }
.class-tiles .tile { min-width: 220px; flex: 0 1 auto; }

/* footer: the textbooks used, folded */
.foot { border-top: 1px solid var(--line); padding-top: 18px; }
.sources > summary { cursor: pointer; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.sources > summary:hover { color: var(--accent); }
.sources[open] > summary { margin-bottom: 8px; }
@media print { .hero-band { background: none; border: 0; padding: 0; } }
.class-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hero.hero-band { padding: 32px 32px 30px; margin-top: 4px; }
.hero.hero-band .actions { margin-bottom: 0; }
@media (max-width: 700px) { .hero.hero-band { padding: 22px 18px; } }
.form label.peek { margin-top: -2px; color: var(--muted); font-size: 14px; }
.sec-h-row .btn .icon { width: 16px; height: 16px; }
.acc-master .hint { margin: 0; }
.table-wrap .tbl tr > :first-child { white-space: nowrap; }

/* a class's QR code for the board */
.qr-over { position: fixed; inset: 0; z-index: 60; background: rgba(28, 31, 36, .55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.qr-card { background: var(--card); border-radius: 16px; padding: 24px; width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.qr-card h2 { margin: 0 0 12px; font-size: 22px; }
.qr-img svg { width: min(360px, 100%); height: auto; display: block; margin: 0 auto; }
.qr-code { font: 700 34px/1.2 'Golos Text', system-ui, sans-serif; letter-spacing: .14em; margin: 6px 0 2px; }
.qr-card .hint { margin: 0 0 14px; word-break: break-all; }
@media print {
  body:has(.qr-over) > *:not(.qr-over) { display: none !important; }
  .qr-over { position: static; background: none; padding: 0; }
  .qr-card { box-shadow: none; width: auto; max-height: none; }
  .qr-card .actions { display: none; }
  .qr-img svg { width: 120mm; }
}

/* phones: the test's bar and a student's sections at the bottom of the screen */
.test-bar, .student-tabs { display: none; }
@media (max-width: 860px) {
  body.has-testbar .test-bar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; align-items: center; gap: 12px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line);
    box-shadow: 0 -4px 16px rgba(28, 31, 36, .08);
  }
  .test-bar .tb-text { flex: 1; font-size: 14px; color: var(--muted); font-weight: 600; }
  .test-bar .btn { min-height: 48px; padding: 0 20px; font-size: 16px; }
  body.has-testbar { padding-bottom: 80px; }
  body.has-testbar .card .actions .btn { min-height: 48px; }
  body.has-tabs:not(.has-testbar) .student-tabs:not([hidden]) {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .student-tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; min-height: 56px;
    font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none; box-sizing: border-box; }
  .student-tabs a .icon { width: 22px; height: 22px; color: currentColor; }
  .student-tabs a.on { color: var(--accent); }
  body.has-tabs:not(.has-testbar) { padding-bottom: 72px; }
}
@media print { .test-bar, .student-tabs { display: none !important; } }
/* sign-in pages: the box in the middle */
.auth-box { max-width: 560px; margin: 0 auto; }
.auth-box > h1 { text-align: center; }
.auth-box > .lead { text-align: center; }
.auth-box .tiles { grid-template-columns: 1fr; }

/* the teacher's view of a student's answers in one work */
.ans-panel { scroll-margin-top: 12px; border-color: var(--line-strong); }
.ans-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ans-top h2 { margin: 0; font-size: 20px; }
.ans-panel .tabs { margin: 10px 0 6px; }
.ans-q { padding: 12px 0; border-bottom: 1px solid var(--line); }
.ans-q:last-child { border-bottom: 0; }
.ans-head { display: flex; gap: 10px; align-items: baseline; font-weight: 600; margin-bottom: 6px; }
.ans-n { flex: none; min-width: 26px; height: 26px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
.ans-line { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; margin: 3px 0 3px 36px; padding: 4px 10px; border-radius: 8px; font-size: 15px; }
.ans-line.ok { background: var(--ok-soft); color: #14532b; }
.ans-line.bad { background: var(--bad-soft); color: #8f1c14; }
.ans-line.miss { background: var(--warn-soft); color: #6b4300; }
.ans-mark { font-weight: 700; }
.ans-right { color: var(--text); font-weight: 600; }
.ans-right::before { content: '· '; color: var(--muted); font-weight: 400; }
.ans-sub { margin: 6px 0 0 36px; }
.ans-sub .ans-line { margin-left: 0; }
.ans-subq { font-size: 14px; color: var(--muted); margin-bottom: 2px; }
@media (max-width: 560px) { .ans-line, .ans-sub { margin-left: 0; } }
.ans-q > .hint { margin: 4px 0 0 36px; }
@media (max-width: 560px) { .ans-q > .hint { margin-left: 0; } }
.known-code { margin: 0 0 6px; font-size: 15px; }
.linkish { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }

/* a test on a lesson */
.timed-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: #6b4300; background: var(--warn-soft); border-radius: 6px; padding: 2px 8px; white-space: nowrap; }
.timed-tag .icon { width: 14px; height: 14px; }
.lesson-timer { position: sticky; top: 0; z-index: 5; display: block; margin: 8px 0 12px; padding: 10px 14px;
  border-radius: 10px; background: var(--warn-soft); color: #5c3a00; border: 1px solid #ebd3a6; font-weight: 600; }
.lesson-timer b { font-variant-numeric: tabular-nums; font-size: 18px; }
.lesson-timer.urgent { background: var(--bad-soft); color: #8f1c14; border-color: #f3c4bf; }
.card.lesson > b { display: flex; align-items: center; gap: 6px; font-size: 17px; }
.lesson-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lesson-row select:first-child { flex: 1 1 280px; min-width: 0; }
.lesson-row select { width: auto; }
.lesson-now { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.lesson-now li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; background: var(--warn-soft); border-radius: 8px; }
.status-strip.lesson { border-color: #ebd3a6; background: var(--warn-soft); color: #5c3a00; }
@media (max-width: 860px) { .lesson-timer { top: 0; } }
.lesson-timer .icon { vertical-align: -3px; margin-right: 4px; }
