/* Physics Challenge Training — single stylesheet; fonts are served locally (works behind the Great Firewall). */
@font-face { font-family: "Libre Baskerville"; font-style: normal; font-weight: 400; font-display: swap; src: url(/static/fonts/libre-baskerville-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Libre Baskerville"; font-style: normal; font-weight: 700; font-display: swap; src: url(/static/fonts/libre-baskerville-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 500; font-display: swap; src: url(/static/fonts/space-grotesk-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 700; font-display: swap; src: url(/static/fonts/space-grotesk-latin-700-normal.woff2) format("woff2"); }
:root {
  color-scheme: light;
  --bg: #f3f3f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --ink: #17182e;
  --ink-2: #474a63;
  --muted: #66697f;
  --line: #e4e4ee;
  --line-2: #cfd0de;
  --brand: #3d3b94;
  --brand-hover: #2f2d7a;
  --brand-soft: #ececf8;
  --violet: #6a4c9c;
  --cyan: #06b6d4;
  --grad: linear-gradient(120deg, #23265f 0%, #5a4688 52%, #c97f5c 100%);
  --grad-cool: linear-gradient(120deg, #23265f 0%, #3d5a99 55%, #5f9fb5 100%);
  --space: linear-gradient(180deg, #0f1230 0%, #1b1d46 45%, #382f6c 80%, #5b437c 100%);
  --brand-ink: #ffffff;
  --series: #2a78d6;
  --good: #0ca30c;
  --good-ink: #006300;
  --good-soft: #e9f7e9;
  --bad: #d03b3b;
  --bad-ink: #a52828;
  --bad-soft: #fdecec;
  --warn: #fab219;
  --warn-ink: #8a5a00;
  --warn-soft: #fff6e0;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(23, 24, 46, .04), 0 6px 18px -12px rgba(23, 24, 46, .14);
  --shadow-lg: 0 14px 40px -18px rgba(15, 18, 48, .55);
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --display: "Libre Baskerville", Baskerville, Georgia, "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "PingFang SC", "Microsoft YaHei", serif;
  /* night observatory: the sky, the dusk, the afterglow on the horizon, the lit rock, starlight */
  --night: #15183a;
  --night-2: #23265f;
  --dusk: #4a3d7c;
  --horizon: #e6a872;
  --mesa: #9a5a43;
  --starlight: #f1f0fa;
  --night-img: url(../img/cosmic-cliffs.jpg);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font: 15px/1.55 var(--font);
  background-color: var(--bg);
  /* faint graph-paper grid */
  background-image: linear-gradient(rgba(35, 38, 95, .04) 1px, transparent 1px), linear-gradient(90deg, rgba(35, 38, 95, .04) 1px, transparent 1px);
  background-size: 28px 28px;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }
h1, h2, .display { font-family: var(--display); letter-spacing: 0; }
h1 { font-weight: 400; }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .8em; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }
code, .mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: rgba(19, 21, 52, .94); border-bottom: 1px solid rgba(255, 255, 255, .06); color: var(--starlight);
  -webkit-backdrop-filter: saturate(160%) blur(10px); backdrop-filter: saturate(160%) blur(10px);
  display: flex; align-items: center; gap: 18px; padding: 0 20px; min-height: 56px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; color: #fff; white-space: nowrap; font-family: var(--display); }
.brand:hover { text-decoration: none; }
.brand svg { width: 28px; height: 28px; flex: none; }
.mainnav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a { padding: 16px 10px; color: #b7b6d6; white-space: nowrap; border-bottom: 2px solid transparent; font-weight: 500; }
.mainnav a:hover { color: #fff; text-decoration: none; }
.mainnav a.active { color: #fff; border-bottom-color: var(--horizon); }
.tools { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.langswitch { display: inline-flex; border: 1px solid rgba(255, 255, 255, .28); border-radius: 999px; overflow: hidden; font-size: .82rem; }
.langswitch a { padding: 3px 10px; color: #cfcde6; }
.langswitch a.on { background: var(--starlight); color: var(--night); }
.langswitch a:hover { text-decoration: none; }
.usermenu { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.usermenu a, .usermenu .linkbtn { color: #d6d4ec; }
.usermenu a:hover, .usermenu .linkbtn:hover { color: #fff; }
.usermenu form { margin: 0; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }

@media (min-width: 861px) and (max-width: 1360px) { /* the teacher menu has ten links: keep them all on screen */
  .topbar { gap: 12px; }
  .mainnav a { padding-left: 6px; padding-right: 6px; }
}
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; padding: 0 12px; gap: 0 12px; }
  .brand { padding: 12px 0; }
  .brand .brand-text { max-width: 44vw; overflow: hidden; text-overflow: ellipsis; }
  .tools { margin-left: auto; }
  .mainnav { order: 3; flex-basis: 100%; border-top: 1px solid rgba(255, 255, 255, .08); }
  .mainnav a { padding: 10px 10px; }
  .usermenu .uname { display: none; }
}

/* ---------- layout ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 24px 20px 64px; }
.container.narrow { max-width: 760px; }
@media (max-width: 600px) { .container { padding: 16px 16px 48px; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin: 4px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 900px) { .grid.cols-3, .grid.cols-4, .grid.side { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.side > * { grid-column: 1 / -1; } }
@media (max-width: 600px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: minmax(0, 1fr); } }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid rgba(226, 232, 240, .9); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; min-width: 0; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card.flush { padding: 0; }
.card.flush > .card-head { padding: 16px 20px 0; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty .big { font-size: 1.05rem; color: var(--ink-2); margin-bottom: 6px; }

/* stat tiles */
.stat { position: relative; overflow: hidden; background: var(--surface); border: 1px solid rgba(226, 232, 240, .9); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--grad); opacity: .9; }
.stat .label { color: var(--muted); font-size: .84rem; }
.stat .value { font-size: 1.75rem; font-weight: 400; line-height: 1.2; margin-top: 2px; font-family: var(--display); }
.stat .value small { font-size: .9rem; font-weight: 500; color: var(--muted); }
.stat .foot { font-size: .82rem; color: var(--muted); margin-top: 2px; }

/* countdown */
.countdown { display: flex; align-items: center; gap: 14px; }
.countdown .days { font-size: 2.2rem; font-weight: 400; line-height: 1; min-width: 3ch; text-align: center; font-family: var(--display); background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.countdown .days small { display: block; font-size: .72rem; font-weight: 600; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; margin-top: 4px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: .92rem;
  cursor: pointer; line-height: 1.2; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .choice:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn { transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease; }
.btn.primary { background: var(--night-2); border-color: var(--night-2); color: var(--brand-ink); }
.btn.primary:hover { background: var(--night); border-color: var(--night); }
.btn.glass { background: transparent; border-color: rgba(255, 255, 255, .5); color: #fff; }
.btn.glass:hover { background: rgba(255, 255, 255, .16); }
.btn.danger { color: var(--bad-ink); border-color: #f0c2c2; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 5px 10px; font-size: .84rem; }
.btn.lg { padding: 11px 20px; font-size: 1rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.inline-form { display: inline; margin: 0; }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .82rem; margin-top: 3px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=search], input[type=url], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #fff; color: var(--ink); font: inherit;
}
textarea { min-height: 84px; resize: vertical; }
textarea.tall { min-height: 160px; }
input[type=file] { font: inherit; max-width: 100%; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 0; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; flex: none; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.checkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 14px; }
.form-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters .field { margin: 0; min-width: 140px; }
.filters input[type=search] { min-width: 200px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 0 14px; }
legend { font-weight: 700; font-size: .9rem; padding: 0 6px; }
.bi-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 700px) { .bi-inputs { grid-template-columns: 1fr; } }
.opt-row { display: grid; grid-template-columns: 52px 1fr 1fr; gap: 8px; align-items: center; margin-bottom: 8px; }
.opt-row .opt-key { display: flex; align-items: center; gap: 6px; font-weight: 700; }
@media (max-width: 700px) { .opt-row { grid-template-columns: 52px 1fr; } .opt-row input:last-child { grid-column: 2; } }

/* ---------- alerts & badges ---------- */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid; font-weight: 500; }
.alert.ok { background: var(--good-soft); border-color: #bfe5bf; color: var(--good-ink); }
.alert.err { background: var(--bad-soft); border-color: #f3c4c4; color: var(--bad-ink); }
.alert.info { background: var(--brand-soft); border-color: #cddafc; color: #1a3a99; }
.alert.warn { background: var(--warn-soft); border-color: #f5dc9f; color: var(--warn-ink); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .76rem; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; vertical-align: middle; }
.badge.comp { background: #eef2ff; border-color: #d9e0ff; color: #2c3fa8; }
.badge.board { font-size: .7rem; padding: 0 7px; }
.badge.board-edx { background: #fff4e5; border-color: #f4d8a6; color: #8a4b00; }
.badge.board-cie { background: #e6f3ff; border-color: #b9dbf7; color: #0b4f8a; }
.badge.ok { background: var(--good-soft); border-color: #cbe9cb; color: var(--good-ink); }
.badge.bad { background: var(--bad-soft); border-color: #f3cfcf; color: var(--bad-ink); }
.badge.warn { background: var(--warn-soft); border-color: #f3dfaa; color: var(--warn-ink); }
.badge.live { background: var(--brand); border-color: var(--brand); color: #fff; }
.diff { letter-spacing: 1px; color: var(--muted); font-size: .8rem; white-space: nowrap; }
.diff b { color: var(--warn-ink); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; background: var(--surface-2); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fbfcfe; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .stem-preview { max-width: 520px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card.flush .table th:first-child, .card.flush .table td:first-child { padding-left: 20px; }
.card.flush .table th:last-child, .card.flush .table td:last-child { padding-right: 20px; }

.pager { display: flex; gap: 6px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.pager a, .pager span { padding: 4px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #fff; }
.pager span.cur { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- bars (single-series, one hue) ---------- */
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 1.1fr) minmax(0, 2fr) 92px; gap: 12px; align-items: center; font-size: .9rem; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 12px; background: #eef0f3; border-radius: 4px; position: relative; overflow: hidden; }
.bar-fill { position: absolute; inset: 0 auto 0 0; background: var(--series); border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-track .tick { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink); opacity: .55; }
.bar-row .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.bar-row.nodata .val, .bar-row.nodata .name { color: var(--muted); }
@media (max-width: 560px) { .bar-row { grid-template-columns: 1fr 80px; } .bar-row .bar-track { grid-column: 1 / -1; grid-row: 2; } }

/* histogram */
.histo { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; align-items: end; height: 120px; border-bottom: 1px solid var(--line-2); }
.histo .col { background: var(--series); border-radius: 4px 4px 0 0; min-height: 0; position: relative; }
.histo .col[data-n="0"] { background: transparent; }
.histo-labels { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; font-size: .72rem; color: var(--muted); text-align: center; margin-top: 4px; }

/* heatmap */
.heat { border-collapse: separate; border-spacing: 2px; font-size: .84rem; }
.heat th { font-weight: 600; color: var(--ink-2); padding: 4px 6px; text-align: left; white-space: nowrap; }
.heat thead th { vertical-align: bottom; font-size: .74rem; width: 82px; min-width: 82px; max-width: 82px; white-space: normal; line-height: 1.2; overflow-wrap: anywhere; hyphens: auto; }
.heat thead th:first-child { width: auto; max-width: none; }
.heat td { width: 64px; min-width: 56px; height: 34px; text-align: center; border-radius: 4px; font-variant-numeric: tabular-nums; font-weight: 600; }
.heat td.nodata { background: repeating-linear-gradient(45deg, #f3f4f6, #f3f4f6 4px, #ebedf0 4px, #ebedf0 8px); color: var(--muted); font-weight: 400; }
.heat td.total { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.legend-ramp { display: flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--muted); margin-top: 10px; flex-wrap: wrap; }
.legend-ramp .ramp { width: 160px; height: 10px; border-radius: 3px; background: linear-gradient(90deg, #cde2fb, #6da7ec, #2a78d6, #184f95, #0d366b); }
.legend-ramp .nod { width: 18px; height: 10px; border-radius: 3px; background: repeating-linear-gradient(45deg, #f3f4f6, #f3f4f6 3px, #e5e7eb 3px, #e5e7eb 6px); }

/* ---------- question display ---------- */
.q-stem { font-size: 1.04rem; line-height: 1.65; }
.q-stem .bi-alt, .opt-text .bi-alt, .explain .bi-alt, .fact .bi-alt { display: none; color: var(--ink-2); font-size: .94em; margin-top: 4px; }
html.show-both .bi-alt { display: block !important; }
html.show-both .q-stem .bi-alt { border-left: 3px solid var(--line-2); padding-left: 10px; margin-top: 8px; }
.q-figure { margin: 10px 0; }
.q-fig { max-width: 100%; height: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.q-inl { vertical-align: middle; max-width: 100%; height: auto; }
.q-tab { border-collapse: collapse; margin: 8px 0; }
.q-tab td { border: 1px solid var(--line-2); padding: 3px 10px; text-align: center; }
.explain .q-fig, .marking .q-fig { border: 0; }
.q-img { margin: 12px 0; max-height: 420px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.choices { display: grid; gap: 8px; margin-top: 14px; }
.choice {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1.5px solid var(--line-2);
  border-radius: var(--radius-sm); background: #fff; cursor: pointer; font-weight: 400; margin: 0; text-align: left; width: 100%; font: inherit; color: inherit;
}
.choice:hover { border-color: #9fb3ea; background: #fbfcff; }
.choice .key { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line-2); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice.selected { border-color: var(--brand); background: var(--brand-soft); }
.choice.selected .key { background: var(--brand); border-color: var(--brand); color: #fff; }
.choice.correct { border-color: var(--good); background: var(--good-soft); }
.choice.correct .key { background: var(--good); border-color: var(--good); color: #fff; }
.choice.wrong { border-color: var(--bad); background: var(--bad-soft); }
.choice.wrong .key { background: var(--bad); border-color: var(--bad); color: #fff; }
.choice .mark { font-weight: 700; font-size: .85rem; white-space: nowrap; }
.choice.correct .mark { color: var(--good-ink); }
.choice.wrong .mark { color: var(--bad-ink); }
.choice[disabled], .choices.locked .choice { cursor: default; }
.explain { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.explain h4 { margin: 0 0 4px; font-size: .9rem; }
.verdict { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-top: 12px; }
.verdict.ok { color: var(--good-ink); }
.verdict.bad { color: var(--bad-ink); }
.verdict svg { width: 20px; height: 20px; flex: none; }

/* ---------- attempt runner ---------- */
.runner { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; align-items: start; }
@media (max-width: 900px) { .runner { grid-template-columns: minmax(0, 1fr); } .runner .side { order: -1; } }
.runner .side { position: sticky; top: 72px; }
.side-top { display: flex; flex-direction: column; gap: 14px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.submit-form { margin: 0; }
.submit-form .btn { width: 100%; }
.side-hint { margin: 14px 0 0; }
@media (max-width: 900px) {
  .runner .side { position: static; }
  .side-card { padding: 12px 14px; }
  .side-top { flex-direction: row; align-items: center; justify-content: space-between; padding-bottom: 10px; margin-bottom: 10px; }
  .submit-form .btn { width: auto; }
  .side-top .timer { font-size: 1.35rem; }
  .palette { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 38px; overflow-x: auto; padding: 3px; scrollbar-width: thin; }
  .side-hint, .palette-legend { display: none; }
  .qnav { flex-wrap: nowrap; gap: 6px; }
  .qnav .row { flex-wrap: nowrap; gap: 6px; }
  .qnav .btn { padding-left: 10px; padding-right: 10px; }
}
.runner-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.qnum { font-weight: 700; color: var(--muted); font-size: .9rem; }
.timer { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.timer.low { color: var(--bad-ink); }
.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 6px; }
.palette button {
  height: 36px; border-radius: 6px; border: 1px solid var(--line-2); background: #fff; font: inherit; font-weight: 600; font-size: .85rem; cursor: pointer; position: relative; padding: 0;
}
.palette button.answered { background: #dbe6ff; border-color: #9fb3ea; }
.palette button.correct { background: var(--good-soft); border-color: var(--good); color: var(--good-ink); }
.palette button.wrong { background: var(--bad-soft); border-color: var(--bad); color: var(--bad-ink); }
.palette button.current { outline: 2px solid var(--ink); outline-offset: 1px; }
.palette button.flagged::after { content: ""; position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 1.5px #fff; }
.palette-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .76rem; color: var(--muted); margin-top: 10px; }
.palette-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; border: 1px solid var(--line-2); background: #fff; }
.palette-legend .l-ans::before { background: #dbe6ff; border-color: #9fb3ea; }
.palette-legend .l-flag::before { background: var(--warn); border-color: var(--warn); border-radius: 50%; }
.savestate { font-size: .8rem; color: var(--muted); }
.savestate.err { color: var(--bad-ink); font-weight: 600; }
.qnav { display: flex; gap: 8px; justify-content: space-between; margin-top: 18px; flex-wrap: wrap; }
.flagbtn.on { background: var(--warn-soft); border-color: #f0cf7c; color: var(--warn-ink); }

/* result */
.score-hero { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.score-ring { --p: 0; width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(#4f46e5 0, #7c3aed calc(var(--p) * .5%), #06b6d4 calc(var(--p) * 1%), #e8ebf0 0); }
.score-ring > div { font-family: var(--display); }
.score-ring > div { width: 88px; height: 88px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 1.5rem; font-weight: 800; }
.review-item { border-top: 1px solid var(--line); padding: 18px 0; }
.review-item:first-child { border-top: 0; padding-top: 4px; }
.review-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }

/* item analysis option distribution */
.dist { display: flex; gap: 4px; flex-wrap: wrap; }
.dist span { font-size: .78rem; padding: 1px 7px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dist span.key { background: var(--good-soft); border-color: #b6dfb6; color: var(--good-ink); font-weight: 700; }

/* ---------- auth pages ---------- */
.auth-wrap { min-height: calc(100vh - 57px); display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .brand-big { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 18px; text-align: center; }
.auth-card .brand-big svg { width: 48px; height: 48px; }
.auth-card .brand-big .name { font-family: var(--display); font-weight: 400; font-size: 1.45rem; }

/* resource list */
.res-item { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.res-item:first-child { border-top: 0; }
.res-icon { width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; font-size: .7rem; font-weight: 800; color: #fff; background: #64748b; }
.res-icon.pdf { background: #c2410c; }
.res-icon.img { background: #0e7490; }
.res-icon.doc { background: #1d4ed8; }
.res-icon.ppt { background: #b45309; }
.res-icon.link { background: #4a3aa7; }
.res-icon.vid { background: #be185d; }
.res-title { font-weight: 600; }
.res-meta { font-size: .82rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 2px; }

/* credential slips (printable) */
.slips { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.slip { border: 1.5px dashed var(--line-2); border-radius: 8px; padding: 12px 14px; background: #fff; break-inside: avoid; }
.slip .site { font-size: .78rem; color: var(--muted); word-break: break-all; }
.slip .who { font-weight: 700; font-size: 1.05rem; margin: 2px 0 6px; }
.slip dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0; }
.slip dt { color: var(--muted); font-size: .84rem; }
.slip dd { margin: 0; font-family: var(--mono); font-weight: 700; }

.invite-code { font-family: var(--mono); font-size: 1.6rem; font-weight: 800; letter-spacing: .12em; background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: 8px; padding: 6px 14px; display: inline-block; }
.kbd { font-family: var(--mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; font-size: .85em; }

.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 8px 0; }
.steps li::before { content: counter(s); width: 24px; height: 24px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 800; font-size: .8rem; }
.steps li.done::before { content: "✓"; background: var(--good-soft); color: var(--good-ink); }
.steps li.done { color: var(--muted); }

.site-foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 18px; }

details.more > summary { cursor: pointer; color: var(--brand); font-weight: 600; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "▸ "; }
details.more[open] > summary::before { content: "▾ "; }

.katex { font-size: 1.05em; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 2px 0; }

@media print {
  .topbar, .no-print, .site-foot, .alert { display: none !important; }
  body { background: #fff; }
  .container { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .slips { grid-template-columns: repeat(3, 1fr); }
}

/* ======================================================================
   Physics look: animated logo, landing page, login pages, home banners
   ====================================================================== */
.brand svg.logo { filter: none; }

.space { background: var(--space); color: #e2e8f0; position: relative; overflow: hidden; }
.space canvas.bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.space .katex { color: #e0e7ff; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font-size: .88rem; font-weight: 600; letter-spacing: .02em; color: #efc9a3; }
.eyebrow::before { content: ""; width: 22px; height: 1px; background: var(--horizon); }
.grad-text { background: linear-gradient(100deg, #c7d2fe 0%, #a5f3fc 40%, #f0abfc 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- landing: a night sky over the desert, a serif wordmark ---------- */
.landing { background: #090913; }
.landing .topbar { position: absolute; left: 0; right: 0; background: transparent; border-bottom: 0; backdrop-filter: none; -webkit-backdrop-filter: none; padding: 0 clamp(16px, 4vw, 56px); min-height: 72px; }
.landing .topbar .brand { color: #fff; font-weight: 400; letter-spacing: .02em; }
.landing main { padding: 0; }
.sitenav { display: flex; gap: clamp(8px, 2.4vw, 34px); flex: 1; margin-left: clamp(8px, 3vw, 40px); }
.sitenav a { color: rgba(255, 255, 255, .86); padding: 8px 0; font-size: .98rem; }
.sitenav a:hover { color: #fff; text-decoration: none; box-shadow: inset 0 -1px 0 var(--horizon); }
.signin { display: inline-flex; align-items: center; gap: 8px; color: #fff; font-size: .95rem; }
.signin svg { width: 22px; height: 22px; }
.signin:hover { text-decoration: none; color: #fff; }
.signin:hover span { box-shadow: inset 0 -1px 0 var(--horizon); }

.hero { position: relative; min-height: max(640px, min(100vh, 1000px)); display: flex; align-items: center; overflow: hidden; color: #fff;
  background: linear-gradient(90deg, rgba(9, 10, 30, .62) 0%, rgba(9, 10, 30, .25) 45%, rgba(9, 10, 30, 0) 70%), linear-gradient(to bottom, rgba(9, 10, 30, 0) 75%, rgba(9, 9, 19, .85) 100%), var(--night-img) 50% 38% / cover, var(--night); }
.hero-inner { position: relative; z-index: 2; width: 100%; padding: 110px clamp(20px, 4vw, 56px) 12vh; }
.wordmark { display: inline-flex; flex-direction: column; margin: 0; font-family: var(--display); font-weight: 400; color: #fff; line-height: .98; text-transform: uppercase; font-size: clamp(3.1rem, 9vw, 7.4rem); text-shadow: 0 2px 30px rgba(9, 10, 30, .35); }
.wordmark .w1 { letter-spacing: .03em; }
.wordmark .w2 { display: flex; justify-content: space-between; margin-top: .12em; padding-right: .03em; }
.hero .rule { width: min(260px, 34%); height: 3px; background: #fff; border: 0; margin: clamp(22px, 3vw, 34px) 0 18px; }
.hero .tagline { font-size: clamp(1.15rem, 2vw, 1.5rem); margin: 0 0 10px; color: #fff; }
.hero .lead { font-size: 1rem; line-height: 1.65; color: rgba(240, 238, 252, .86); max-width: 33em; margin: 0 0 34px; text-shadow: 0 1px 14px rgba(9, 10, 30, .9); }
.hero .tagline { text-shadow: 0 1px 14px rgba(9, 10, 30, .9); }
.hero .cta { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.btn.outline-light { background: transparent; color: #fff; border: 1.5px solid rgba(255, 255, 255, .9); border-radius: 2px; padding: 13px 34px; font-size: 1.02rem; font-weight: 500; letter-spacing: .08em; }
.btn.outline-light:hover { background: #fff; color: var(--night); }
.textlink { color: #f3d3b2; text-decoration: underline; text-decoration-color: rgba(230, 168, 114, .6); text-underline-offset: 5px; }
.textlink:hover { color: #fff; text-decoration-color: #fff; }

/* the "video" card: a live animation that leads to the gallery */
.motion-card { position: absolute; z-index: 2; right: clamp(84px, 9vw, 150px); bottom: clamp(36px, 7vh, 80px); width: clamp(220px, 21vw, 320px); aspect-ratio: 16 / 10; border: 1px solid rgba(255, 255, 255, .35); background: rgba(10, 11, 32, .82); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); overflow: hidden; color: #fff; box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .8); }
.motion-card canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.motion-card .play { position: absolute; left: 50%; top: 46%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .6); }
.motion-card .play::after { content: ""; position: absolute; left: 21px; top: 16px; border-style: solid; border-width: 11px 0 11px 17px; border-color: transparent transparent transparent #fff; }
.motion-card .label { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 12px 9px; font-size: .84rem; color: rgba(255, 255, 255, .92); background: linear-gradient(to bottom, transparent, rgba(9, 10, 30, .85)); }
.motion-card:hover { border-color: #fff; text-decoration: none; }
.motion-card:hover .play { background: rgba(255, 255, 255, .26); }

/* the page index on the right edge */
.page-index { position: absolute; z-index: 2; right: clamp(24px, 3vw, 46px); top: 30%; bottom: 0; width: 24px; }
.page-index::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: rgba(255, 255, 255, .45); }
.page-index ol { list-style: none; margin: 0; padding: 0; position: absolute; top: 18%; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 26px; }
.page-index a { position: relative; display: block; width: 9px; height: 9px; border-radius: 50%; background: #fff; }
.page-index a[aria-current] { width: 22px; height: 22px; background: transparent; border: 2px solid #fff; }
.page-index a[aria-current]::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: #fff; }
.page-index a span { position: absolute; right: 30px; top: 50%; transform: translateY(-50%); white-space: nowrap; font-size: .84rem; color: #fff; opacity: 0; pointer-events: none; transition: opacity .15s ease; }
.page-index a:hover span, .page-index a:focus-visible span { opacity: 1; }

@media (max-width: 900px) {
  .sitenav { display: none; }
  .page-index { display: none; }
  .motion-card { right: 20px; }
}
@media (max-width: 720px) {
  .hero { background: linear-gradient(180deg, rgba(9, 10, 30, .2) 0%, rgba(9, 10, 30, .55) 52%, rgba(9, 10, 30, .78) 100%), var(--night-img) 14% 0 / cover, var(--night); align-items: flex-start; }
  .hero-credit { display: none; }
  .hero-inner { padding-top: 120px; padding-bottom: 210px; }
  .hero .cta { gap: 20px; }
  .motion-card { left: 20px; right: auto; bottom: 28px; width: 190px; }
  .signin span { display: none; }
}

.section { padding: 96px 24px; }
.section .inner { max-width: 1180px; margin: 0 auto; }
.section h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); font-weight: 400; margin-bottom: 12px; }
.section .sub { color: var(--muted); max-width: 40em; margin-bottom: 44px; font-size: 1.05rem; }
.section.dark { background: #090913; color: #e6e5f5; }
.section.dark h2 { color: #fff; }
.section.dark .sub { color: #a7a6c3; }

.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
@media (max-width: 980px) { .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .gallery { grid-template-columns: minmax(0, 1fr); } }
.phys-card { border-radius: 4px; overflow: hidden; background: #10112a; border: 1px solid rgba(255, 255, 255, .09); transition: border-color .2s ease; }
.phys-card:hover { border-color: rgba(230, 168, 114, .55); }
.phys-card .stage { position: relative; aspect-ratio: 4 / 3; background: radial-gradient(90% 90% at 50% 40%, #191a3d 0%, #0d0e24 72%); }
.phys-card .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.phys-card .stage .tag { position: absolute; top: 12px; left: 12px; z-index: 1; font-size: .8rem; color: #f0cba6; background: rgba(9, 9, 19, .6); border: 1px solid rgba(230, 168, 114, .3); padding: 2px 9px; border-radius: 2px; }
.phys-card .body { padding: 18px 20px 20px; }
.phys-card h3 { color: #fff; font-family: var(--display); font-weight: 400; font-size: 1.18rem; margin: 0 0 8px; }
.phys-card p { color: #a7a6c3; font-size: .93rem; margin: 0 0 12px; }
.phys-card .eq { color: #e4e2fa; font-size: 1.02rem; }

.features { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
@media (max-width: 980px) { .features { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 34px; } }
@media (max-width: 560px) { .features { grid-template-columns: minmax(0, 1fr); } }
.feature { padding: 4px 26px 4px 22px; border-left: 1px solid var(--line-2); }
.feature .ico { color: var(--mesa); margin-bottom: 16px; }
.feature .ico svg { width: 26px; height: 26px; display: block; }
.feature h3 { font-family: var(--display); font-weight: 700; font-size: 1.08rem; margin-bottom: 8px; }
.feature p { color: var(--muted); font-size: .94rem; margin: 0; }

.cta-band { color: #fff; border-radius: 4px; padding: clamp(40px, 6vw, 72px) clamp(24px, 5vw, 64px); display: flex; align-items: center; justify-content: space-between; gap: 28px; flex-wrap: wrap; position: relative; overflow: hidden;
  background: linear-gradient(90deg, rgba(13, 15, 42, .92) 0%, rgba(13, 15, 42, .7) 55%, rgba(13, 15, 42, .45) 100%), url(../img/lab.jpg) 50% 45% / cover, var(--night); }
.cta-band h2 { color: #fff; margin: 0 0 8px; }
.cta-band p { color: #dcdaf0; margin: 0; max-width: 32em; }
.cta-band .row { gap: 26px; }
.landing-foot { text-align: center; color: #7e7d99; padding: 34px 16px 44px; font-size: .85rem; background: var(--bg); }
.landing .section:not(.dark) { background-color: var(--bg); }

/* hero credit, the night-sky photo wall, the Solvay photo */
.hero-credit { position: absolute; z-index: 2; left: clamp(20px, 4vw, 56px); bottom: 16px; margin: 0; max-width: 46em; font-size: .74rem; color: rgba(236, 234, 250, .55); }
.skygrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr); gap: 22px; }
.skygrid .col { display: flex; flex-direction: column; gap: 22px; }
.skygrid figure { margin: 0; display: flex; flex-direction: column; }
.skygrid .ph { position: relative; overflow: hidden; border-radius: 4px; background: #10112a; border: 1px solid rgba(255, 255, 255, .08); }
.skygrid .ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.skygrid .tall { flex: 1; }
.skygrid .tall .ph { flex: 1; min-height: 320px; }
.skygrid .wide .ph { aspect-ratio: 16 / 10; }
.skygrid .sky-telescope img { object-position: 30% 50%; }
.skygrid figcaption { padding: 14px 2px 0; }
.skygrid h3 { font-family: var(--display); font-weight: 400; font-size: 1.15rem; color: #fff; margin: 0 0 6px; }
.skygrid p { color: #a7a6c3; font-size: .92rem; margin: 0 0 8px; max-width: 34em; }
.skygrid .eq { color: #efc9a3; font-size: .98rem; }
@media (max-width: 980px) {
  .skygrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skygrid .col { display: contents; }
  .skygrid .tall .ph, .skygrid .wide .ph { flex: none; min-height: 0; aspect-ratio: 4 / 3; }
}
@media (max-width: 600px) { .skygrid { grid-template-columns: minmax(0, 1fr); } }
.section.dark.sky { padding-bottom: 40px; }
.features-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 500px); gap: 56px; align-items: end; margin-bottom: 52px; }
.features-head .sub { margin-bottom: 0; }
.solvay { margin: 0; }
.solvay img { display: block; width: 100%; height: auto; border-radius: 4px; }
.solvay figcaption { font-size: .84rem; color: var(--muted); margin-top: 10px; }
@media (max-width: 860px) { .features-head { grid-template-columns: minmax(0, 1fr); gap: 28px; } }
.landing-foot .credits { margin: 0 0 6px; font-size: .78rem; }

/* ---------- login / join / setup ---------- */
.auth-split { min-height: calc(100vh - 57px); display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.auth-art { position: relative; overflow: hidden; background: var(--night-img) 30% 0 / cover, var(--night); color: #e6e5f5; display: flex; align-items: flex-end; }
.auth-art canvas { position: absolute; inset: 0 0 35% 0; width: 100%; height: 65%; display: block; opacity: .55; }
.auth-art .caption { position: relative; z-index: 1; padding: 36px 40px; max-width: 560px; }
.auth-art .caption h2 { color: #fff; font-weight: 400; font-size: 1.9rem; margin: 12px 0 10px; }
.auth-art .caption p { color: #d9d7ee; margin: 0 0 14px; }
.auth-art .maxwell { display: grid; grid-template-columns: repeat(2, auto); gap: 8px 28px; justify-content: start; color: #e4e2fa; font-size: 1rem; opacity: .95; }
.auth-art::after { content: ""; position: absolute; inset: auto 0 0 0; height: 60%; background: linear-gradient(to bottom, transparent, rgba(9, 9, 19, .88)); pointer-events: none; }
.auth-panel { display: grid; place-items: center; padding: 40px 20px; }
.auth-panel .auth-card { width: 100%; max-width: 410px; }
@media (max-width: 900px) {
  .auth-split { grid-template-columns: minmax(0, 1fr); }
  .auth-art { min-height: 250px; background-position: 30% 62%; }
  .auth-art canvas { opacity: .4; }
  .auth-art::after { height: 100%; background: linear-gradient(to bottom, rgba(9, 9, 19, .1), rgba(9, 9, 19, .8)); }
  .auth-art .caption { padding: 22px 20px; }
  .auth-art .caption h2 { font-size: 1.4rem; }
  .auth-art .maxwell { display: none; }
}

/* ---------- home banners ---------- */
.banner { position: relative; overflow: hidden; border-radius: var(--radius); background: linear-gradient(90deg, rgba(13, 15, 40, .92) 0%, rgba(13, 15, 40, .62) 48%, rgba(13, 15, 40, .12) 100%), var(--night-img) 60% 52% / cover, var(--night); color: #e2e8f0; padding: 28px 30px; margin-bottom: 18px; min-height: 190px; box-shadow: var(--shadow-lg); }
.banner canvas { position: absolute; top: 0; right: 0; height: 100%; width: 58%; display: block; -webkit-mask-image: linear-gradient(to right, transparent, #000 35%); mask-image: linear-gradient(to right, transparent, #000 35%); }
.banner .content { position: relative; z-index: 1; max-width: 62%; }
.banner h1 { color: #fff; font-size: clamp(1.5rem, 3vw, 2.15rem); margin: 8px 0 8px; }
.banner .sub { color: #d9d7ee; margin: 0 0 16px; }
.banner .actions .btn.primary { background: var(--starlight); border-color: var(--starlight); color: var(--night); }
.banner .actions .btn.primary:hover { background: #fff; }
.banner .actions .btn:not(.primary) { background: transparent; border-color: rgba(255, 255, 255, .5); color: #fff; }
.banner .actions .btn:not(.primary):hover { background: rgba(255, 255, 255, .1); }
.banner .pill { display: inline-flex; align-items: baseline; gap: 8px; background: rgba(9, 9, 25, .35); border: 1px solid rgba(230, 168, 114, .45); border-radius: 4px; padding: 5px 14px; font-size: .9rem; color: #e0e7ff; margin: 0 8px 10px 0; }
.banner .pill b { font-family: var(--display); font-weight: 400; font-size: 1.15rem; color: #fff; }
@media (max-width: 760px) {
  .banner { padding: 22px 20px 20px; }
  .banner canvas { width: 100%; opacity: .45; -webkit-mask-image: none; mask-image: none; }
  .banner .content { max-width: none; }
}

.fact { position: relative; overflow: hidden; }
.fact .label { display: inline-flex; align-items: center; gap: 6px; font-family: var(--display); font-size: .95rem; font-weight: 700; color: var(--mesa); }
.fact .text { margin: 8px 0 10px; font-size: .98rem; }
.fact .eq { font-size: 1.1rem; padding: 10px 12px; background: var(--brand-soft); border-radius: var(--radius-sm); overflow-x: auto; }
.fact .alt { color: var(--muted); font-size: .88rem; margin-top: 8px; }

/* animations on/off switch */
.site-foot .linkbtn, .landing-foot .linkbtn { font-size: inherit; color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.motion-pill { position: fixed; right: 14px; bottom: 14px; z-index: 30; }
.motion-pill .linkbtn { background: rgba(15, 23, 42, .72); color: #e2e8f0; border: 1px solid rgba(255, 255, 255, .22); border-radius: 999px; padding: 4px 12px; font-size: .78rem; }
.motion-pill .linkbtn:hover { background: rgba(15, 23, 42, .9); }
@media (prefers-reduced-motion: reduce) { [data-motion-toggle] { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .scroll-hint::after { animation: none; }
  .phys-card, .btn { transition: none; }
}
@media print { .banner canvas, .auth-art { display: none !important; } .banner { background: #fff; color: #000; box-shadow: none; } }

/* ---------- past-paper questions shown as the original page image ---------- */
.q-picture { margin: 4px 0 2px; }
.q-full { display: block; max-width: 100%; height: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #fff; }
.q-alt-img { display: none; margin-top: 10px; }
html.show-both .q-alt-img { display: block; }
.choices.letters { grid-template-columns: repeat(auto-fit, minmax(56px, 1fr)); gap: 10px; }
.choices.letters .choice { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 10px 6px; gap: 4px; }
.choices.letters .choice .key { width: 40px; height: 40px; font-size: 1.15rem; }
.choices.letters .opt-text { display: none; }
.choices.letters .mark { font-size: .72rem; white-space: normal; line-height: 1.2; }
.choices.letters .mark:empty { display: none; }
#review-list.only-wrong .review-item.is-right { display: none; }
.q-thumb { width: 150px; max-height: 90px; object-fit: cover; object-position: top left; border: 1px solid var(--line); border-radius: 6px; float: right; margin: 0 0 6px 10px; background: #fff; }

/* ---------- chapter practice (分章练习) ---------- */
.chapters { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.chapter { background: #fff; border: 1px solid rgba(226, 232, 240, .95); border-radius: 16px; padding: 16px 16px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.chapter::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad-cool); opacity: .8; }
.chapter:nth-child(3n+2)::before { background: var(--grad); }
.chapter:nth-child(3n)::before { background: linear-gradient(90deg, #10b981, #06b6d4); }
.chapter.empty { opacity: .6; box-shadow: none; }
.ch-head { display: flex; align-items: baseline; gap: 10px; }
.ch-no { font-family: var(--display); font-weight: 700; font-size: .95rem; color: var(--brand); background: var(--brand-soft); border-radius: 8px; padding: 2px 7px; }
.ch-head h3 { margin: 0; font-family: var(--display); font-size: 1.06rem; line-height: 1.25; }
.ch-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .85rem; color: var(--muted); }
.ch-meta b { color: var(--ink); font-family: var(--display); font-size: 1rem; }
.ch-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.layout-switch .img-only { display: none; }
#qform.layout-image .layout-switch .img-only { display: block; }
#qform.layout-image .opt-row input[type=text] { display: none; }
#qform.layout-image .opt-row { grid-template-columns: auto; display: inline-flex; margin-right: 14px; }
.pack-card { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; border-left: 4px solid var(--brand); }

/* ---------- lessons (课程) ---------- */
.lessons { display: grid; gap: 12px; }
.lesson-card { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 16px; align-items: center; background: #fff; color: inherit;
  border: 1px solid rgba(226, 232, 240, .95); border-radius: 16px; padding: 14px 18px; box-shadow: var(--shadow); position: relative; transition: border-color .15s, transform .15s; }
.lesson-card:hover { text-decoration: none; border-color: #c7cdfb; transform: translateY(-1px); }
.lesson-card.current { border-color: var(--brand); box-shadow: var(--shadow-lg); }
.lesson-card.unseen::after { content: ""; position: absolute; top: 14px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: #db2777; }
.lesson-card h3 { margin: 2px 0 2px; font-family: var(--display); font-size: 1.1rem; line-height: 1.3; }
.lesson-sum { margin: 2px 0 6px; font-size: .88rem; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lesson-go { font-size: 1.3rem; color: var(--muted); }
.lesson-when { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .82rem; color: var(--muted); font-weight: 600; }
.lesson-no { width: 64px; height: 64px; border-radius: 14px; background: var(--grad); color: #fff; display: grid; place-content: center; text-align: center; line-height: 1; box-shadow: 0 8px 18px -10px rgba(79, 70, 229, .8); }
.lesson-no span { font-size: .62rem; letter-spacing: .06em; text-transform: uppercase; opacity: .85; font-weight: 700; }
.lesson-no b { font-family: var(--display); font-size: 1.7rem; margin-top: 3px; }
.lesson-no.big { width: 78px; height: 78px; border-radius: 18px; }
.lesson-no.big b { font-size: 2.1rem; }
.chip-vid { color: #be185d; font-weight: 600; }
.lesson-now { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 16px; align-items: center; color: inherit; border-left: 4px solid var(--brand); }
.lesson-now:hover { text-decoration: none; border-color: var(--brand); }
.crumbs { margin: -4px 0 10px; font-size: .88rem; }
.lesson-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: center; margin-bottom: 18px; }
.lesson-head h1 { margin: 4px 0 2px; font-family: var(--display); line-height: 1.2; }
.lesson-head .sub { color: var(--muted); }
.lesson-summary { margin-bottom: 16px; line-height: 1.65; border-left: 4px solid var(--brand); }
.video-card .card-head h2 { font-size: 1.05rem; }
.player { width: 100%; max-height: 72vh; border-radius: 10px; background: #0b1020; display: block; }
.video-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #0b1020; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-link { display: flex; align-items: center; justify-content: center; gap: 12px; aspect-ratio: 16 / 9; max-height: 240px; width: 100%; border-radius: 10px;
  background: linear-gradient(135deg, #0b1020, #312e81); color: #fff; font-weight: 700; font-size: 1.05rem; }
.video-link span { width: 54px; height: 54px; border-radius: 50%; background: rgba(255, 255, 255, .16); display: grid; place-items: center; font-size: 1.3rem; }
.video-link:hover { text-decoration: none; color: #fff; filter: brightness(1.15); }
.pdf-view { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #525659; }
.pdf-view iframe { display: block; width: 100%; height: 78vh; min-height: 520px; border: 0; }
@media (max-width: 720px) { .pdf-view { display: none; } }
.after-class h2 { margin-bottom: 8px; }
.homework { background: var(--warn-soft); border: 1px solid #f3dfaa; border-radius: var(--radius-sm); padding: 10px 12px; line-height: 1.6; }
.homework h4 { margin: 0 0 4px; font-size: .88rem; color: var(--warn-ink); }
.paper-link { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 6px; justify-items: start; }
.lesson-nav { display: grid; gap: 10px; }
.lesson-nav a { display: grid; gap: 2px; color: inherit; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.lesson-nav a:hover { text-decoration: none; border-color: var(--brand); }
.lesson-nav a.right { text-align: right; }
.mat-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); }
.mat-row:first-of-type { border-top: 0; }
.mat-edit { display: grid; gap: 6px; min-width: 0; }
.mat-names { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mat-names input { padding: 6px 8px; }
.mat-meta { overflow-wrap: anywhere; }
.mat-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mat-controls select { width: auto; padding: 5px 8px; }
.mat-controls .check { margin: 0; }
.mat-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.upload-box { margin-top: 16px; padding: 16px; border: 2px dashed #c7cdfb; border-radius: 12px; background: var(--brand-soft); }
.upload-box h3 { margin-top: 0; }
.upload-progress { margin: 4px 0 12px; }
.upload-progress .bar-fill { background: var(--grad); transition: width .2s; }
.upload-status { margin-top: 6px; }
.upload-status.err { color: var(--bad-ink); font-weight: 600; }
@media (max-width: 700px) {
  .lesson-card, .lesson-now { grid-template-columns: 52px minmax(0, 1fr); padding: 12px 14px; }
  .lesson-card .lesson-go, .lesson-now > .btn { display: none; }
  .lesson-no { width: 52px; height: 52px; }
  .lesson-no b { font-size: 1.4rem; }
  .mat-row { grid-template-columns: 40px minmax(0, 1fr); }
  .mat-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .mat-names { grid-template-columns: 1fr; }
}

/* ---------- v1.4: written (self-marked) questions, IPC ---------- */
.badge.wq { background: #f3e8ff; border-color: #e3ccfb; color: #6b21a8; }
.written-note { margin-top: 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: #faf5ff; border: 1px dashed #d8b4fe; color: #581c87; font-size: .92rem; }
.explain.marking { background: #fffdf5; border-color: #f3dfaa; }
.explain.marking h4 { color: var(--warn-ink); }
.selfmark { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.selfmark .lbl { font-weight: 700; margin-right: 4px; }
.selfmark .btn { min-width: 38px; justify-content: center; }
.selfmark .btn.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.verdict.mid { color: var(--warn-ink); }
.palette button.partial { background: var(--warn-soft); border-color: var(--warn); color: var(--warn-ink); }
.palette button.w { border-style: dashed; }
.palette-legend .l-w::before { border-style: dashed; border-color: #a78bfa; }
.review-item[id] { scroll-margin-top: 80px; }
.layout-switch .w-only, #qform .w-only, #qform .w-only-inline { display: none; }
#qform.layout-written .w-only { display: block; }
#qform.layout-written .w-only-inline { display: inline; }
#qform.layout-written .mc-only, #qform.layout-written .mc-only-inline { display: none; }

/* ---------- Syllabus (exam courses) ---------- */
.eyebrow-sm { display: inline-block; font-size: .76rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); margin-bottom: 2px; }
.syl-unit { margin-bottom: 26px; }
.syl-unit-title { font-size: 1.05rem; display: flex; align-items: center; gap: 10px; margin: 0 0 10px; color: var(--ink-2); }
.syl-topic { background: var(--surface); border: 1px solid rgba(226, 232, 240, .9); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 10px; }
.syl-topic > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "no name meta" "no bar bar"; gap: 4px 12px; align-items: center; padding: 14px 18px; }
.syl-topic > summary::-webkit-details-marker { display: none; }
.syl-topic > summary .ch-no { grid-area: no; }
.syl-tname { grid-area: name; font-weight: 700; font-family: var(--display); font-size: 1.05rem; }
.syl-tmeta { grid-area: meta; text-align: right; }
.syl-bar { grid-area: bar; height: 4px; }
.syl-topic[open] > summary { border-bottom: 1px solid var(--line); }
.syl-sub { padding: 12px 18px 6px; }
.syl-sub + .syl-sub { border-top: 1px dashed var(--line); }
.syl-sub-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.syl-sub-head h3 { margin: 0; font-size: .98rem; }
.syl-points { list-style: none; margin: 6px 0 8px; padding: 0; }
.syl-point { display: grid; grid-template-columns: 58px 1fr auto; gap: 10px; align-items: baseline; padding: 7px 8px; border-radius: var(--radius-sm); color: var(--ink); }
.syl-point:hover { background: var(--surface-2); text-decoration: none; }
.syl-point.current { background: #eef2ff; }
.syl-code { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--brand); }
.syl-text { font-size: .93rem; line-height: 1.45; }
.syl-right { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.syl-n { font-size: .8rem; color: var(--ink-2); }
.syl-eqflag { font-style: italic; font-weight: 700; color: var(--muted); font-family: serif; }
.syl-dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--line-2); display: inline-block; }
.syl-dot.good { background: #16a34a; border-color: #16a34a; }
.syl-dot.mid { background: #f59e0b; border-color: #f59e0b; }
.syl-dot.low { background: #ef4444; border-color: #ef4444; }
.syl-points.compact .syl-point { grid-template-columns: 50px 1fr; padding: 5px 6px; }
.syl-points.compact .syl-text { font-size: .86rem; }
/* chapter-based syllabus (textbook chapters: IGCSE, A-Level) */
.sylc-unit { font-size: .72rem; padding: 1px 6px; margin-left: 4px; vertical-align: 1px; }
.sylc-tier { font-size: .72rem; padding: 1px 7px; margin-left: 4px; vertical-align: 1px; border: 1px solid transparent; }
.sylc-tier.tier-core { background: #e8f3ec; color: #1d6b3d; border-color: #bfe0cb; }
.sylc-tier.tier-ext { background: #f1eafb; color: #5b34a3; border-color: #d9c9f2; }
.sylc-units .btn { min-width: 64px; }
.sylc-table .sylc-no { width: 46px; }
.sylc-name { font-weight: 600; color: var(--ink); }
.sylc-name:hover { color: var(--brand); }
.sylc-actions { white-space: nowrap; }
.sylc-actions .inline-form { display: inline-block; margin-right: 4px; }
.sylc-spec-row td { padding-top: 0; border-top: 0; }
.sylc-spec > summary { cursor: pointer; font-size: .88rem; color: var(--ink-2); padding: 4px 0; }
.sylc-qlink { font-weight: 600; }
.sylc-prev td { background: var(--surface-2); text-align: center; }
.sylc-xb { margin-top: 18px; }
.sylc-xb > summary { cursor: pointer; padding: 8px 14px; font-weight: 600; }
.sylc-xb .table-wrap { border-top: 1px solid var(--line); }
.board-filter { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sylc-also { margin: 4px 0 0; line-height: 1.7; }
.sylc-also a { white-space: normal; }
.sylc-c.dim { opacity: .55; }
.sylc-xb-group > summary { cursor: pointer; padding: 8px 14px; }
.sylc-prev-img { max-width: 100%; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
@media (max-width: 720px) { .sylc-actions { white-space: normal; } }
.crumbs { color: var(--muted); margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.spec-head { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 18px; }
.spec-code { font-family: var(--display); font-weight: 700; font-size: 2rem; line-height: 1; padding: 12px 14px; border-radius: var(--radius); background: var(--grad); color: #fff; min-width: 84px; text-align: center; }
.spec-statement { flex: 1; min-width: 0; font-size: 1.1rem; }
.spec-statement .bi-alt { display: none; }
html.show-both .spec-statement .bi-alt { display: block; color: var(--ink-2); font-size: .95em; margin-top: 6px; }
.spec-eq .eq-display { overflow-x: auto; padding: 4px 0; }
.spec-notes h4 { margin: 14px 0 6px; font-size: .98rem; color: var(--ink); }
.spec-notes h4:first-child { margin-top: 0; }
.spec-notes ul { margin: 4px 0 10px; padding-left: 20px; }
.spec-notes li { margin: 3px 0; }
.spec-notes p { margin: 6px 0; }
.spec-notes .bi-alt { display: none; }
html.show-both .spec-notes .bi-alt { display: block; border-top: 1px dashed var(--line-2); margin-top: 14px; padding-top: 10px; }
.tagchip { display: inline-block; padding: 0 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font-size: .78rem; color: var(--ink-2); margin: 1px 0; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; }
.teacher-edit { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.teacher-edit textarea { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: .86rem; }
@media (max-width: 720px) {
  .spec-head { flex-direction: column; gap: 10px; }
  .spec-code { font-size: 1.5rem; min-width: 0; }
  .syl-topic > summary { grid-template-columns: auto 1fr; grid-template-areas: "no name" "meta meta" "bar bar"; }
  .syl-tmeta { text-align: left; }
  .syl-point { grid-template-columns: 48px 1fr; }
  .syl-right { grid-column: 2; }
}

/* ---------- mark scheme page (one per paper, printable) ---------- */
.ms-doc { display: grid; gap: 12px; }
.ms-q { padding: 14px 18px; }
.ms-q-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 8px; }
.ms-q-head h2 { margin: 0; font-size: 1.05rem; }
.ms-q-meta { font-size: .9rem; color: var(--ink-2); }
.ms-body p { margin: 6px 0 2px; font-weight: 600; }
.ms-body ul { margin: 2px 0 6px; padding-left: 22px; }
.ms-body li { margin: 2px 0; }
.ms-body .bi-alt { display: none; color: var(--ink-2); border-left: 3px solid var(--line-2); padding-left: 10px; margin-top: 10px; }
html.show-both .ms-body .bi-alt { display: block; }
.ms-parts { display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 6px 0 2px; font-size: .85rem; color: var(--ink-2); }
.ms-part { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; }
.ms-part i { font-style: normal; color: var(--muted); }
.ms-answer { font-weight: 700; margin: 4px 0; }
.ms-showq { margin-top: 8px; }
.ms-showq summary { cursor: pointer; color: var(--accent, #2563eb); font-size: .9rem; }
.ms-showq .q-picture { margin-top: 8px; }
.explain.marking .md p { margin: 6px 0 2px; }
.explain.marking .md ul { margin: 2px 0 6px; padding-left: 20px; }
@media print {
  .ms-doc { display: block; }
  .ms-q { break-inside: avoid; page-break-inside: avoid; border-bottom: 1px solid #ccc !important; padding: 8px 0 !important; margin: 0 0 8px; }
  .ms-q-head { border-bottom: 0; }
}

/* official mark-scheme crops (old papers) */
.ms-img { display: block; max-width: 100%; height: auto; margin: .5rem 0; border: 1px solid var(--line, #ddd); border-radius: 6px; background: #fff; }
@media print { .ms-img { max-width: 100%; page-break-inside: auto; border: 0; } }

/* ---------- answer boxes (written questions) ---------- */
.ans-area { margin: 14px 0 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.ans-title { font-weight: 600; margin-bottom: 8px; }
.ans-part { margin: 10px 0; }
.ans-label { margin-bottom: 4px; }
.ans-text { width: 100%; box-sizing: border-box; font: inherit; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); resize: vertical; }
.ans-final { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.ans-final span { font-weight: 600; font-size: .92em; }
.ans-final input { font: inherit; padding: 6px 10px; border: 1px solid var(--line-2); border-radius: 8px; min-width: 12em; }
.ans-mcq { display: flex; gap: 8px; flex-wrap: wrap; }
.ans-letter input { position: absolute; opacity: 0; pointer-events: none; }
.ans-letter span { display: inline-flex; align-items: center; justify-content: center; width: 2.6em; height: 2.6em; border: 1.5px solid var(--line-2);
  border-radius: 10px; font-weight: 700; cursor: pointer; background: var(--surface); }
.ans-letter input:checked + span { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.ans-letter input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.ans-photos { margin-top: 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ph-list { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; }
.ph-list:empty { display: none; }
.ph { position: relative; display: inline-block; }
.ph img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.ph-list.review img { width: 160px; height: auto; max-height: 220px; object-fit: contain; background: #fff; }
.ph-del { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--bad); color: #fff; cursor: pointer; line-height: 1; }

/* review: ticking marking points, teacher's mark */
.wr-part { padding: 8px 0; border-top: 1px dashed var(--line); }
.wr-part:first-of-type { border-top: 0; }
.wr-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.wr-ans { margin: 4px 0 6px; }
.wr-ans .lbl { font-size: .85em; color: var(--muted); }
.pre { white-space: pre-wrap; word-break: break-word; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.wr-note { color: var(--ink-2); font-size: .95em; }
.wr-pt { display: flex; gap: 8px; align-items: flex-start; padding: 3px 0; cursor: pointer; font-weight: 400; }
.wr-pt input { margin-top: .35em; flex: none; }
.md-inline p { margin: 0; }
.wr-ms { margin: 4px 0 8px; }
.wr-pick { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-weight: 400; }
.wr-pick select { width: auto; padding: 2px 6px; }
.teacher-mark { margin: 10px 0; padding: 8px 12px; border-left: 4px solid var(--brand); background: var(--brand-soft); border-radius: 6px; }
.teacher-mark .pre { margin-top: 6px; }
.tm-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0; padding-top: 8px; border-top: 1px solid var(--line); }
.tm-form input[type=text] { flex: 1; min-width: 14em; font: inherit; padding: 5px 8px; border: 1px solid var(--line-2); border-radius: 8px; }
.tm-form input[type=number] { font: inherit; padding: 5px 6px; border: 1px solid var(--line-2); border-radius: 8px; }

/* paused by the teacher */
.paused-banner { position: sticky; top: 0; z-index: 30; margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn-ink); font-weight: 600; text-align: center; }
body.is-paused .runner { filter: blur(5px); pointer-events: none; user-select: none; }
.timer.paused { color: var(--warn-ink); }

/* papers set for one student */
.assign-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; align-items: end; }
.assign-form label { display: flex; flex-direction: column; gap: 4px; font-size: .9em; }
.assign-form label.grow { grid-column: 1 / -1; }
.assign-form select, .assign-form input { font: inherit; padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); }
.assign-table .inline-form { display: inline-flex; gap: 4px; }
.nowrap { white-space: nowrap; }
.card.assigned { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.assigned-note { color: var(--brand); font-weight: 600; font-size: .9em; margin-bottom: 4px; }
@media print { .ans-photos, .tm-form, .ph-del { display: none !important; } }

/* homework builder, homework pages, question record, question preview */
.scroll-box { max-height: 190px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; background: var(--surface-2); }
.scroll-box.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 12px; }
.assign-form label.grow-2 { grid-column: span 2; }
@media (max-width: 560px) { .assign-form label.grow-2 { grid-column: 1 / -1; } }
@media (min-width: 901px) { .hw-builder .hw-side { position: sticky; top: 12px; align-self: start; max-height: calc(100vh - 24px); overflow: auto; } }
.hw-qtable tr.in-basket td { background: var(--good-soft); }
.hw-qtable td { vertical-align: top; }
.basket-list { list-style: none; margin: 0; padding: 0; max-height: 40vh; overflow: auto; }
.basket-list li { display: flex; gap: 8px; align-items: baseline; padding: 5px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.basket-list li:first-child { border-top: 0; }
.basket-list li a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.qlink { color: inherit; }
a.qlink:hover { color: var(--brand); text-decoration: none; }
.hw-due { margin-top: 4px; font-size: .92rem; color: var(--ink-2); }
.hw-due.bad { color: var(--bad-ink); font-weight: 600; }
.hw-score { margin-top: 6px; }
.card.hw-overdue { border-color: #f3c4c4; box-shadow: 0 0 0 2px var(--bad-soft); }
.hw-matrix th, .hw-matrix td { padding: 6px 8px; white-space: nowrap; }
.hw-matrix th:first-child, .hw-matrix td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.hw-matrix td.hwc { text-align: center; font-size: .85rem; min-width: 38px; }
.hw-matrix td.hwc a { color: inherit; display: block; }
.hw-matrix td.ok { background: var(--good-soft); color: var(--good-ink); font-weight: 700; }
.hw-matrix td.bad { background: var(--bad-soft); color: var(--bad-ink); font-weight: 700; }
.hw-matrix td.part { background: var(--warn-soft); color: var(--warn-ink); font-weight: 700; }
.hw-matrix td.pend { background: #f3e8ff; color: #6b21a8; font-weight: 700; }
.hw-matrix td.blank, .hw-matrix td.none { color: var(--muted); }
.hw-matrix tfoot th { border-top: 2px solid var(--line-2); background: var(--surface-2); text-transform: none; font-size: .82rem; }
.rec-bars .bar-row { grid-template-columns: minmax(150px, 1.3fr) minmax(0, 2fr) 120px; align-items: center; }
.rec-bars .bar-row .name { white-space: normal; }
@media (max-width: 560px) { .rec-bars .bar-row { grid-template-columns: 1fr 100px; } .rec-bars .bar-row .bar-track { grid-column: 1 / -1; grid-row: 2; } }
.st-ok { color: var(--good-ink); } .st-part { color: var(--warn-ink); } .st-bad { color: var(--bad-ink); }
.qp-bar { margin-bottom: 14px; padding: 12px 16px; }
.qp-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; opacity: .9; }
.qp-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 14px; margin: 0; }
.qp-dl dt { color: var(--muted); font-size: .86rem; }
.qp-dl dd { margin: 0; }
.qp-student .choice { cursor: default; }
@media (max-width: 560px) { .qp-nav { width: 100%; } .qp-nav .btn { flex: 1; text-align: center; } }

/* T15 year-group distribution (student result page + teacher homework / results pages) */
.dist-card .card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.dist-card .inline-form { display: inline-flex; align-items: center; gap: 8px; }
.dist-lead { font-size: 1.05rem; margin: 2px 0 8px; }
.dist-svg { display: block; width: 100%; max-width: 760px; height: auto; }
.dist-grid { stroke: var(--line); stroke-width: 1; }
.dist-axis { stroke: var(--muted); stroke-width: 1.2; }
.dist-tick { fill: var(--muted); font-size: 12px; }
.dist-bar { fill: var(--series); opacity: .32; }
.dist-bar.you { opacity: 1; }
.dist-curve { fill: none; stroke: var(--violet); stroke-width: 2; stroke-dasharray: 6 4; }
.dist-mean { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 3 3; }
.dist-you { stroke: #d9480f; stroke-width: 2.4; }
.dist-label { font-size: 12px; font-weight: 700; }
.dist-label.mean { fill: var(--muted); }
.dist-label.you { fill: #d9480f; }
@media (max-width: 640px) {
  .dist-tick { font-size: 21px; }
  .dist-label { font-size: 23px; }
}

/* T16 leaving the exam page: notice on the runner and the warning on return */
.focus-notice { margin: 0 0 12px; padding: 7px 12px; border: 1px solid var(--warn); background: var(--warn-soft); color: var(--warn-ink); border-radius: var(--radius-sm); font-size: .9rem; }
.focus-modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 18, 48, .55); }
.focus-modal[hidden] { display: none; }
.focus-modal-card { width: 100%; max-width: 440px; background: var(--surface); color: var(--ink); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 22px 22px 18px; text-align: center; border-top: 5px solid var(--bad); }
.focus-modal-icon { font-size: 2.2rem; line-height: 1; margin-bottom: 6px; }
.focus-modal-title { margin: 0 0 8px; font-size: 1.2rem; color: var(--bad-ink); }
.focus-modal-body { margin: 0 0 16px; line-height: 1.6; }
.focus-modal-ok { min-width: 200px; }
.focus-log { margin-top: 4px; max-width: 520px; }

/* T17 colleague accounts */
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 4px 0 2px; }

/* T19 teacher UI */
.js .js-hide { display: none; }
.course-select { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.course-select select { max-width: 100%; min-width: 220px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cls-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.cls-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.cls-chip { display: inline-block; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: .86rem; text-decoration: none; }
.cls-chip.on { background: var(--primary, #1f3a68); color: #fff; border-color: transparent; }
.cls-sec { margin-bottom: 10px; }
.cls-sec > summary { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 10px 14px; cursor: pointer; }
.cls-sec .cls-name { font-weight: 600; }
.cls-dot { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: #c0392b; color: #fff; font-size: .75rem; text-align: center; line-height: 18px; }
.cls-sec .cls-link { margin-left: auto; font-size: .86rem; }
.cls-nomatch { padding: 14px; }
.hw-sec { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 6px; background: var(--surface-2); }
.hw-sec > summary { padding: 6px 10px; cursor: pointer; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hw-sec .checks.scroll-box { border: 0; border-top: 1px solid var(--line); border-radius: 0; margin: 0; }
@media (max-width: 600px) { .course-select select { min-width: 0; width: 100%; } .cls-sec .cls-link { margin-left: 0; } }

/* T20: homework styles, nav badge, homework page */
.navbadge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 999px; background: #e5484d; color: #fff; font-size: .72rem; font-weight: 800; line-height: 18px; text-align: center; vertical-align: 1px; }
.badge.hw-style-homework { background: #eef7ee; border-color: #c7e3c7; color: #1f6b2a; }
.badge.hw-style-exam { background: #fdecec; border-color: #f3c4c4; color: #9b1c1c; }
.hw-style-options { display: grid; gap: 8px; }
.hw-style-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; font-weight: 400; background: var(--surface); }
.hw-style-opt.on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.hw-style-opt input { margin-top: 4px; }
.hw-style-opt > span { display: flex; flex-direction: column; gap: 2px; }
.hw-facts { margin: 14px 0 0; display: grid; gap: 8px; }
.hw-facts > div { display: grid; grid-template-columns: 9em 1fr; gap: 10px; }
.hw-facts dt { color: var(--muted); font-weight: 600; }
.hw-facts dd { margin: 0; }
.hw-desc { white-space: normal; }
.btn.block { display: block; width: 100%; text-align: center; box-sizing: border-box; }
.hw-pledge { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 12px; font-weight: 500; }
.hw-pledge input { margin-top: 3px; }
.hw-rules ul { margin: 6px 0 0; padding-left: 20px; }
.hw-rules li { margin-bottom: 4px; }
.hw-reminder { margin-bottom: 12px; }
.reopen-form { display: inline-flex; gap: 6px; align-items: center; }
body.no-practice form[action="/practice/start"], body.no-practice form[action="/syllabus/practice"], body.no-practice form[action="/mistakes/start"] { display: none !important; }
@media (max-width: 600px) { .hw-facts > div { grid-template-columns: 1fr; gap: 0; } }

/* T35: homework in one flow */
.basket-mv { display: inline-flex; gap: 2px; }
.basket-mv .linkbtn:disabled { opacity: .3; cursor: default; }
.hw-due-quick[hidden], button[data-same-groups][hidden] { display: none !important; }
.hw-summary { margin: 0 0 8px; font-weight: 600; }

/* T36: homework to collect (teacher home), not-handed-in card, class review */
.hwc-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(120px, 1fr) auto; gap: 14px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.hwc-row:first-of-type { border-top: 0; }
.hwc-bar { display: grid; gap: 4px; }
.hwc-links { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.hwc-links a.badge { text-decoration: none; }
@media (max-width: 720px) { .hwc-row { grid-template-columns: 1fr; gap: 8px; } .hwc-links { justify-content: flex-start; } }
.miss-class { padding: 8px 0; border-top: 1px solid var(--line); }
.miss-class:first-of-type { border-top: 0; }
.miss-names { margin: 4px 0 8px; line-height: 1.7; }
.miss-copy { display: flex; gap: 10px; align-items: flex-start; }
.miss-copy textarea { flex: 1; min-width: 0; font: inherit; font-size: .9rem; resize: vertical; }
.hw-filter { font-weight: 400; }
.hwr-top { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }
.hwr-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.hwr-chips .chip { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink-2); }
.hwr-chips .chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.hwr-q { margin-bottom: 16px; scroll-margin-top: 70px; }
.hwr-body { margin-bottom: 4px; }
.hwr-counts { display: flex; gap: 16px; flex-wrap: wrap; color: var(--ink-2); }
.hwr-opts { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.hwr-opt { padding: 2px 10px; border: 1px solid var(--line); border-radius: 6px; font-variant-numeric: tabular-nums; }
.hwr-opt.key { border-color: var(--good-ink); color: var(--good-ink); font-weight: 600; }
.hwr-d { margin-top: 10px; }
.hwr-d > summary { cursor: pointer; color: var(--brand); font-weight: 600; }
.hwr-who { list-style: none; margin: 8px 0 0; padding: 0; columns: 2 220px; }
.hwr-who li { padding: 2px 0; }

/* T37: mark by question */
.hwm-qs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.hwm-qs .chip { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink-2); }
.hwm-qs .chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.hwm-row { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(0, 3fr) minmax(220px, 1.4fr); gap: 16px; margin-bottom: 10px; align-items: start; }
.hwm-row.changed { border-left: 4px solid var(--brand); }
.hwm-who { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.hwm-part + .hwm-part { margin-top: 8px; }
.hwm-photos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.hwm-photos img { max-height: 160px; border: 1px solid var(--line); border-radius: 6px; }
.hwm-mark { display: flex; flex-direction: column; gap: 6px; }
.hwm-mark input[type=number] { width: 5em; }
.hwm-mark input[type=text] { width: 100%; }
.hwm-fill { display: flex; gap: 6px; flex-wrap: wrap; }
.hwm-fill[hidden] { display: none; }
.hwm-bar { position: sticky; bottom: 0; display: flex; gap: 12px; align-items: center; justify-content: flex-end; padding: 10px 16px; background: var(--card, #fff); border-top: 1px solid var(--line); box-shadow: 0 -2px 8px rgba(0,0,0,.08); z-index: 5; }
@media (max-width: 760px) { .hwm-row { grid-template-columns: 1fr; } }

/* ======================================================================
   T38 — site look, direction B (signed-in pages only: body.app).
   One sans font, indigo tokens, left sidebar, calm cards. Visitor pages (landing, login, join, forgot, reset), the game page,
   print.css, print-form.css and report.css are not touched: every rule below is scoped to body.app.
   ====================================================================== */
body.app {
  --bg: #F6F6FB; --surface: #FFFFFF; --surface-2: #F1F1F8; --ink: #17182E; --ink-2: #3F4160; --muted: #5A5D78; --line: #E4E4EE; --line-2: #C9CADB;
  --brand: #3D3B94; --brand-hover: #2F2D7A; --brand-soft: #E9E8F8; --side: #1B1A4A; --side-on: #34327A; --side-ink: #D5D4F0; --accent: #F2B45A;
  --radius: 14px; --radius-sm: 8px; --shadow: 0 1px 2px rgba(23,24,46,.06);
  --display: var(--font);
  --grad: #3D3B94; --grad-cool: #3D3B94;
  background-color: var(--bg); background-image: none; font: 16px/1.5 var(--font);
}
body.app h1, body.app h2, body.app .display { font-family: var(--font); letter-spacing: 0; }
body.app h1 { font-size: 28px; font-weight: 700; }
body.app h2 { font-size: 20px; font-weight: 700; }
body.app h3 { font-size: 17px; font-weight: 700; }
body.app .num, body.app .table td, body.app .stat .value, body.app .bar-row .val { font-variant-numeric: tabular-nums; }
/* nothing under 13 px */
body.app .badge, body.app .badge.board, body.app .countdown .days small, body.app .histo-labels, body.app .heat thead th, body.app .legend-ramp, body.app .palette-legend,
body.app .dist span, body.app .res-icon, body.app .slip .site, body.app .tagchip, body.app .sylc-unit, body.app .sylc-tier, body.app .choices.letters .mark,
body.app .lesson-no span, body.app .navbadge, body.app .cls-dot, body.app .eyebrow-sm, body.app .site-foot, body.app .diff { font-size: .8125rem; }
body.app .field .hint { font-size: .8125rem; }

.skip-link { position: absolute; left: 12px; top: -80px; z-index: 100; padding: 10px 16px; border-radius: 10px; background: #fff; color: #3D3B94; font-weight: 600; box-shadow: 0 4px 16px rgba(23,24,46,.25); }
.skip-link:focus { top: 12px; text-decoration: none; }
body.app :focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
body.app .btn:focus-visible, body.app input:focus-visible, body.app select:focus-visible, body.app textarea:focus-visible, body.app .choice:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- navigation: sidebar (>= 1024 px) / top bar + menu (< 1024 px) ---------- */
body.app .sidebar, body.app .mobilebar { color: var(--side-ink); }
body.app .brand { font-family: var(--font); }
body.app .sidebar .brand, body.app .mobilebar .brand { color: #fff; font-weight: 700; font-size: 1.05rem; }
body.app .mainnav { display: flex; flex-direction: column; gap: 2px; overflow: visible; flex: none; order: 0; flex-basis: auto; border-top: 0; }
body.app .mainnav a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; color: var(--side-ink); font-weight: 500; white-space: normal; }
body.app .mainnav a:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }
body.app .mainnav a.active, body.app .mainnav a[aria-current="page"] { background: var(--side-on); color: #fff; }
body.app .mainnav .ico { flex: none; }
body.app .mainnav .nl { flex: 1; min-width: 0; }
body.app .mainnav .navbadge { margin-left: 0; }
body.app .navgroup { margin: 14px 12px 4px; font-size: .8125rem; font-weight: 600; letter-spacing: .04em; color: var(--side-ink); }
body.app .navgroup.rule { margin: 10px 12px; height: 1px; padding: 0; background: rgba(255, 255, 255, .14); }
body.app .sidebar :focus-visible, body.app .mobilebar :focus-visible { outline-color: #fff; }
body.app .tools { display: flex; flex-direction: column; align-items: stretch; gap: 8px; white-space: normal; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .14); margin-top: 12px; }
body.app .langswitch { align-self: flex-start; border-color: rgba(255, 255, 255, .35); font-size: .875rem; }
body.app .langswitch a { padding: 4px 12px; color: var(--side-ink); }
body.app .langswitch a.on { background: #fff; color: var(--side); }
body.app .usermenu { flex-direction: column; align-items: stretch; gap: 2px; font-size: 1rem; }
body.app .usermenu .uname, body.app .usermenu .linkbtn { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: var(--side-ink); text-decoration: none; width: 100%; text-align: left; }
body.app .usermenu .uname:hover, body.app .usermenu .linkbtn:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }
body.app .usermenu .uname span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar, .mobilebar { display: none; }
@media (min-width: 1024px) {
  body.app { padding-left: 232px; }
  body.app .sidebar { display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; width: 232px; z-index: 30; background: var(--side); padding: 16px 12px; overflow-y: auto; }
  body.app .sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 12px 16px; }
  body.app .sidebar .mainnav { flex: 1; }
  body.app .sidebar .tools { margin-top: 16px; }
}
@media (max-width: 1023px) {
  body.app .mobilebar { display: flex; position: sticky; top: 0; z-index: 40; height: 56px; align-items: center; gap: 12px; padding: 0 16px; background: var(--side); }
  body.app .mobilebar .brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
  body.app .mobilebar .brand .brand-text { max-width: 44vw; overflow: hidden; text-overflow: ellipsis; }
  body.app .mobilebar .barbadge { display: inline-block; margin: 0; min-width: 24px; line-height: 24px; text-decoration: none; }
  body.app .mobilebar details.menu { position: static; }
  body.app .mobilebar summary { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 10px; background: var(--side-on); color: #fff; font-weight: 600; cursor: pointer; list-style: none; }
  body.app .mobilebar summary::-webkit-details-marker { display: none; }
  body.app .mobilebar .menu-panel { position: fixed; top: 56px; left: 0; right: 0; max-height: calc(100vh - 56px); max-height: calc(100dvh - 56px); overflow-y: auto; padding: 10px 16px 20px; background: var(--side); box-shadow: 0 16px 32px rgba(23, 24, 46, .35); }
  body.app .mobilebar .tools { margin-top: 12px; }
}

/* ---------- cards, tiles ---------- */
body.app .card, body.app .stat { background: var(--surface); border: 0; border-radius: 14px; box-shadow: var(--shadow); padding: 22px; }
body.app .card.flush { padding: 0; }
body.app .card.flush > .card-head { padding: 18px 22px 0; }
body.app .card.flush .table th:first-child, body.app .card.flush .table td:first-child { padding-left: 22px; }
body.app .card.flush .table th:last-child, body.app .card.flush .table td:last-child { padding-right: 22px; }
body.app .card.assigned { border: 1px solid var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
body.app .card.hw-overdue { border: 1px solid #f3c4c4; box-shadow: 0 0 0 2px var(--bad-soft); }
body.app .stat::before { display: none; }
body.app .stat .value { font-size: 30px; font-weight: 700; font-family: var(--font); }
body.app .stat .label { font-size: .875rem; }
body.app .countdown .days { font-family: var(--font); font-weight: 700; background: none; color: var(--brand); -webkit-background-clip: border-box; background-clip: border-box; }
body.app .chapter::before, body.app .chapter:nth-child(3n+2)::before, body.app .chapter:nth-child(3n)::before { background: var(--brand); }
body.app .site-foot { color: var(--muted); }

/* ---------- buttons ---------- */
body.app .btn { min-height: 40px; border-radius: 10px; font-weight: 600; font-size: .9375rem; }
body.app .btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
body.app .btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
body.app .btn.sm { min-height: 32px; padding: 4px 12px; font-size: .875rem; }
body.app .btn.lg { min-height: 48px; }
@media (max-width: 1023px) { body.app .btn { min-height: 44px; } body.app .btn.sm { min-height: 40px; } }
body.app .upload-progress .bar-fill, body.app .lesson-no, body.app .spec-code { background: var(--brand); box-shadow: none; }

/* ---------- tables ---------- */
body.app .table th { font-size: .8125rem; text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--ink-2); background: var(--surface-2); }
body.app .table th, body.app .table td { padding: 12px 14px; }
body.app .table tbody tr:hover td { background: var(--surface-2); }

/* ---------- badges, alerts, inputs ---------- */
:where(body.app) .badge { background: var(--surface-2); border-color: var(--line); color: var(--ink-2); } /* plain badge only: zero extra specificity, so every .badge.<variant> of the base sheet keeps its own colours */
body.app .badge.live { background: var(--brand); border-color: var(--brand); color: #fff; }
body.app .alert { border-radius: var(--radius-sm); }
body.app .alert.info { background: var(--brand-soft); border-color: var(--line-2); color: var(--brand-hover); }
body.app input[type=text], body.app input[type=password], body.app input[type=number], body.app input[type=date], body.app input[type=datetime-local], body.app input[type=search], body.app input[type=url], body.app select, body.app textarea { border-radius: var(--radius-sm); border-color: var(--line-2); background: var(--surface); color: var(--ink); }
body.app fieldset { border-radius: var(--radius-sm); border-color: var(--line); }
body.app details > summary { border-radius: var(--radius-sm); }
body.app .linkbtn { color: var(--brand); }

/* ---------- banner (teacher dashboard, student home): a soft block with one flat illustration ---------- */
body.app .banner { background: var(--brand-soft); color: var(--ink); box-shadow: none; border-radius: var(--radius); min-height: 0; padding: 28px 32px; }
body.app .banner .content { max-width: 62%; }
body.app .banner h1 { color: var(--ink); font-size: 28px; margin: 6px 0 8px; }
body.app .banner .sub { color: var(--ink-2); }
body.app .banner .eyebrow { color: var(--brand); }
body.app .banner .eyebrow::before { background: var(--brand); }
body.app .banner .actions .btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
body.app .banner .actions .btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
body.app .banner .actions .btn:not(.primary) { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
body.app .banner .actions .btn:not(.primary):hover { background: var(--surface-2); }
body.app .banner .pill { background: var(--surface); border: 1px solid var(--line-2); border-radius: 999px; color: var(--ink); }
body.app .banner .pill b { font-family: var(--font); font-weight: 700; color: var(--brand); }
body.app .banner-art { position: absolute; right: 32px; top: 50%; transform: translateY(-50%); width: 220px; height: auto; }
@media (max-width: 600px) { body.app .banner-art { display: none; } body.app .banner { padding: 22px 20px; } body.app .banner .content { max-width: none; } }

@media print { body.app { padding-left: 0; } .sidebar, .mobilebar, .skip-link { display: none !important; } }

/* ---------- class mistakes (T42) ---------- */
.cmiss-filters .field { flex: 1 1 130px; min-width: 120px; }
.cmiss-table td:nth-child(2), .cmiss-table td:nth-child(3) { white-space: nowrap; }
.cmiss-rate { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.cmiss-bar { width: 64px; height: 8px; flex: none; display: block; border-radius: 4px; overflow: hidden; }
.cmiss-bar-bg { fill: var(--line); }
.cmiss-bar-fill { fill: var(--bad); }
.cmiss-pct { min-width: 38px; text-align: right; font-weight: 600; color: var(--bad-ink); }
.cmiss-who summary { cursor: pointer; color: var(--brand); font-weight: 500; white-space: nowrap; }
.cmiss-names { margin-top: 4px; font-size: .84rem; color: var(--ink-2); max-width: 260px; line-height: 1.4; white-space: normal; }
.cmiss-foot-ticked { padding: 14px 22px 8px; border-top: 1px solid var(--line); }
.cmiss-form-all { padding: 0 22px 16px; margin: 0; }

/* T46 question bank: exam cards, chapter cards, knowledge-point panel */
.bank-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 14px; font-size: .92rem; }
.bank-crumbs a { color: var(--ink-2); }
.bank-crumbs a[aria-current] { color: var(--ink); font-weight: 600; }
.bank-crumbs .sep { color: var(--muted); }
.bank-search { display: flex; gap: 8px; margin: 0 0 18px; max-width: 520px; }
.bank-search input[type=search] { flex: 1; min-width: 0; }
.bank-fam-title { font-size: 1.05rem; color: var(--ink-2); margin: 22px 0 10px; }
.bank-fam:first-of-type .bank-fam-title, .bank-section:first-of-type .bank-fam-title { margin-top: 4px; }
.bank-section, .bank-fam { margin-bottom: 14px; }
.bank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.bank-card { position: relative; display: flex; flex-direction: column; gap: 6px; transition: box-shadow .15s, transform .15s; }
body.app .bank-card { padding: 16px 18px; }
.bank-card:hover, .bank-card:focus-within { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.bank-card h3 { margin: 0; font-size: 1rem; line-height: 1.35; }
.bank-main { color: var(--ink); text-decoration: none; }
.bank-main::after { content: ""; position: absolute; inset: 0; border-radius: 14px; }
.bank-no { display: inline-block; margin-right: 6px; color: var(--brand); font-weight: 700; font-variant-numeric: tabular-nums; }
.bank-stat { font-size: .9rem; color: var(--ink-2); }
.bank-meter { display: flex; flex-direction: column; gap: 3px; margin-top: 2px; }
.bank-bar { display: block; width: 100%; height: 5px; border: 0; border-radius: 3px; background: var(--line); overflow: hidden; appearance: none; -webkit-appearance: none; }
.bank-bar::-webkit-progress-bar { background: var(--line); border-radius: 3px; }
.bank-bar::-webkit-progress-value { background: var(--series); border-radius: 3px; }
.bank-bar::-moz-progress-bar { background: var(--series); border-radius: 3px; }
.pack-title { margin: 4px 0 2px; }
.bank-links { display: flex; gap: 14px; margin-top: auto; padding-top: 6px; position: relative; z-index: 1; }
.bank-listall { margin: 0 0 6px; }
.bank-packs { margin-top: 30px; }
.bank-packs > summary { cursor: pointer; font-weight: 600; color: var(--ink-2); margin-bottom: 10px; }
.bank-packs .pack-card { margin-bottom: 10px; }
.bank-layout { display: block; }
.bank-side { margin-bottom: 14px; }
.bank-points { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); }
.bank-points > summary { cursor: pointer; padding: 12px 16px; font-weight: 700; }
.bank-points-form { padding: 0 14px 14px; }
.bank-points-top { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.bank-all { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2); font-size: .86rem; text-decoration: none; }
.bank-all.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.bank-sub { border: 0; margin: 0 0 10px; padding: 0; min-width: 0; }
.bank-sub legend { font-size: .82rem; font-weight: 700; color: var(--brand); padding: 0; margin-bottom: 4px; }
.bank-chip { display: block; font-weight: 400; padding: 5px 8px; margin: 2px 0; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: .86rem; line-height: 1.35; cursor: pointer; }
.bank-chip:hover { background: var(--surface-2); }
.bank-chip.on { background: var(--brand-soft); border-color: var(--brand); }
.bank-chip input { margin-right: 4px; vertical-align: -1px; }
.bank-n { color: var(--muted); }
.bank-main-col { min-width: 0; }
.bank-more { flex-basis: 100%; }
.bank-more > summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: .9rem; }
.bank-more[open] > .filters { margin-top: 10px; }
.bank-sel { font-weight: 600; color: var(--brand); }
.bank-sel:empty { display: none; }
.js [data-bulk] .bank-bulk { display: none; }
.js [data-bulk].has-sel .bank-bulk { display: block; position: sticky; bottom: 0; z-index: 15; background: var(--surface); border-top: 1px solid var(--line-2); box-shadow: 0 -6px 18px -10px rgba(23, 24, 46, .35); padding: 12px 22px; order: 9; }
.js [data-bulk] { display: flex; flex-direction: column; }
.js [data-bulk] .table-wrap, .js [data-bulk] .empty { order: 1; }
@media (min-width: 900px) {
  .bank-layout.has-points { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 18px; align-items: start; }
  .bank-layout.has-points .bank-side { position: sticky; top: 12px; margin: 0; max-height: calc(100vh - 24px); overflow: auto; }
  .bank-points > summary { cursor: default; pointer-events: none; }
}
@media (max-width: 520px) { .bank-grid { grid-template-columns: minmax(0, 1fr); } }
