/* ---------- tokens ---------- */
:root {
  color-scheme: light;
  --page: #f5f8fc;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --ink: #0b0b0b;
  --ink-2: #4a5160;
  --muted: #737b88;
  --grid: #e3e8ef;
  --axis: #c5cdd8;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --accent-soft: #e3eefc;
  --good: #0ca30c;
  --good-ink: #006300;
  --good-soft: #e5f5e5;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --critical-soft: #fbe9e9;
  --hl1: #d9e8fb;
  --hl2: #fde6d6;
  --hl3: #fff1c2;
  --seq-1: #cde2fb; --seq-2: #9ec5f4; --seq-3: #6da7ec; --seq-4: #3987e5; --seq-5: #256abf; --seq-6: #184f95;
  --shape-a: #cde2fb; --shape-b: #fde0cf; --shape-c: #d7f0e4; --shape-cut: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(30,60,110,.05), 0 4px 16px rgba(30,60,110,.06);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #262624; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #8f8d86;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,0.10);
  --accent: #3987e5; --accent-soft: #1b2d45; --good-ink: #3fcf3f; --good-soft: #13301a; --critical-soft: #3a1a1a;
  --hl1: #1d3554; --hl2: #4a2a1a; --hl3: #4a3d10;
  --seq-1: #184f95; --seq-2: #1c5cab; --seq-3: #256abf; --seq-4: #3987e5; --seq-5: #6da7ec; --seq-6: #9ec5f4;
  --shape-a: #1d3a5f; --shape-b: #5a3420; --shape-c: #1d4a36; --shape-cut: #1a1a19;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); line-height: 1.5; font-size: 16px; }
a { color: var(--accent); }
button { font: inherit; cursor: pointer; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--ink); text-decoration: none; }
.logo { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: #fff; font-family: Georgia, serif; font-style: italic; }
.grade { font-weight: 400; color: var(--muted); font-size: .85rem; }
.topbar nav { display: flex; align-items: center; gap: .25rem; }
.topbar nav a { padding: .4rem .75rem; border-radius: 999px; text-decoration: none; color: var(--ink-2); }
.topbar nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.theme-toggle { border: 1px solid var(--border); background: transparent; color: var(--ink-2); border-radius: 999px; width: 34px; height: 34px; }
main { max-width: 1040px; margin: 0 auto; padding: 1.25rem 16px 4rem; outline: none; }
.grid { display: grid; gap: 1rem; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: 1rem; }
.grid > .card + .card { margin-top: 0; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin: 1.5rem 0 .75rem; }
.loading, .empty { color: var(--muted); padding: 2rem 0; text-align: center; }

/* ---------- buttons & form ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 1px solid var(--border); background: var(--surface); color: var(--ink); padding: .6rem 1rem; border-radius: 10px; font-weight: 600; text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; }
.btn.small { padding: .35rem .7rem; font-size: .875rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.spread { justify-content: space-between; }
label.field { display: block; font-weight: 600; margin: .9rem 0 .4rem; }
select, input[type=number] { font: inherit; padding: .55rem .7rem; border-radius: 10px; border: 1px solid var(--axis); background: var(--surface); color: var(--ink); width: 100%; }
.seg { display: flex; flex-wrap: wrap; gap: .4rem; }
.seg button { border: 1px solid var(--axis); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: .45rem .9rem; }
.seg button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.count-row { display: flex; gap: .75rem; align-items: center; }
.count-row input[type=range] { flex: 1; accent-color: var(--accent); }
.count-row input[type=number] { width: 5.5rem; }
.hint { color: var(--muted); font-size: .85rem; margin-top: .3rem; }
.error { color: var(--critical); font-weight: 600; margin-top: .5rem; }

/* ---------- home ---------- */
.hero { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(125px, 100%), 1fr)); gap: .75rem; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .8rem 1rem; }
.tile .label { color: var(--muted); font-size: .8rem; }
.tile .value { font-size: 1.6rem; font-weight: 700; }
.tile .sub { color: var(--ink-2); font-size: .8rem; }
.focus { border-left: 4px solid var(--accent); }
.topic-card { display: flex; flex-direction: column; gap: .5rem; }
.topic-card .desc { color: var(--ink-2); font-size: .9rem; margin: 0; }
.meter { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 4px; }
.diff-chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.diff-chip { font-size: .75rem; border-radius: 999px; padding: .1rem .55rem; background: var(--surface-2); color: var(--ink-2); }
.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; border: 1px solid var(--border); color: var(--ink); white-space: nowrap; }
.badge .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.st-strong .dot { background: var(--good); }
.st-developing .dot { background: var(--warning); }
.st-needs-practice .dot { background: var(--critical); }
.st-too-few .dot, .st-not-started .dot { background: var(--axis); }
.diff-simple { color: var(--good-ink); }
.diff-medium { color: #a86b00; }
.diff-complex { color: var(--critical); }

/* ---------- quiz ---------- */
.quiz-head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.progressbar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin: .25rem 0 1rem; }
.progressbar > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; }
.timers { display: flex; gap: 1rem; font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: .9rem; }
.timers b { color: var(--ink); }
.prompt { color: var(--ink-2); font-weight: 600; margin-bottom: .25rem; }
.question { font-size: 1.6rem; padding: .75rem 0 1rem; overflow-x: auto; }
.choices { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.choice { display: flex; gap: .75rem; align-items: center; text-align: left; border: 2px solid var(--border); background: var(--surface); color: var(--ink); padding: .75rem .9rem; border-radius: 12px; font-size: 1.15rem; min-height: 64px; overflow-x: auto; }
.choice .letter { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); font-size: .85rem; font-weight: 700; color: var(--ink-2); }
.choice:hover:not([disabled]) { border-color: var(--accent); }
.choice.selected { border-color: var(--accent); background: var(--accent-soft); }
.choice.selected .letter { background: var(--accent); color: #fff; }
.choice.wrong { border-color: var(--critical); background: var(--critical-soft); }
.choice.right { border-color: var(--good); background: var(--good-soft); }
.choice[disabled] { cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; align-items: center; }
.feedback { margin-top: 1rem; padding: .75rem 1rem; border-radius: 12px; font-weight: 600; display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.feedback.ok { background: var(--good-soft); color: var(--good-ink); }
.feedback.bad { background: var(--critical-soft); color: var(--critical); }
.feedback.learn { background: var(--accent-soft); color: var(--ink); }
.feedback .why { font-weight: 400; color: var(--ink-2); flex-basis: 100%; }
.reveal { margin-top: .75rem; }
.reveal-box { margin-top: .6rem; padding: .9rem 1rem; border-radius: 12px; background: var(--surface-2); }
.answer-math { font-size: 1.35rem; }
details.method { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin-top: .6rem; }
details.method > summary { cursor: pointer; padding: .7rem 1rem; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: .5rem; }
details.method > summary::-webkit-details-marker { display: none; }
details.method > summary::after { content: '＋'; color: var(--muted); }
details.method[open] > summary::after { content: '－'; }
mark.key { background: #ffe58a; color: #0b0b0b; padding: 0 .2em; border-radius: 3px; font-weight: 600; }
ol.steps li.key-step { border-left: 4px solid var(--warning); padding: .35rem 0 .35rem .7rem; margin-left: -.7rem; background: linear-gradient(90deg, rgba(250,178,25,.10), transparent 70%); border-radius: 0 8px 8px 0; }
.key-badge { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .02em; color: #7a5200; background: #ffe58a; border-radius: 999px; padding: 0 .5rem; margin-right: .4rem; vertical-align: 1px; }
.idea b, .watch b { text-transform: uppercase; font-size: .78rem; letter-spacing: .04em; }
.stuck-panel { margin-top: .9rem; padding: .8rem 1rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.inline-confirm { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .6rem; padding: .6rem .8rem; border-radius: 10px; background: #fff6dc; border: 1px solid #f3d27a; color: #4a3a05; }
.inline-confirm.danger { background: var(--critical-soft); border-color: #efb3b3; color: var(--ink); }
.notice { margin-bottom: .75rem; padding: .6rem .9rem; border-radius: 10px; background: var(--accent-soft); color: var(--ink); }
.hint-box { margin-top: .9rem; padding: .8rem 1rem; border-radius: 12px; border: 2px dashed var(--warning); background: #fffaf0; }
.method-flat { border: 0; margin-top: .5rem; }
.idea { margin: 0 1rem .6rem; padding: .6rem .8rem; border-radius: 10px; background: var(--accent-soft); font-size: .95rem; }
.watch { margin: 0 1rem 1rem; padding: .6rem .8rem; border-radius: 10px; background: var(--critical-soft); font-size: .95rem; }
.step-nav { padding: 0 1rem 1rem; }
.muted-on { font-weight: 400; opacity: .8; }
ol.steps li.fresh { animation: fadein .35s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.nf { font-weight: 600; font-style: normal; }
.why { color: var(--ink-2); font-size: .92rem; display: block; margin-top: .2rem; }
ol.steps { margin: 0; padding: 0 1rem 1rem 2.4rem; }
ol.steps li { margin: .65rem 0; }
.step-math { margin-top: .35rem; font-size: 1.15rem; overflow-x: auto; padding: .15rem 0; }
kbd { font: inherit; font-size: .75rem; border: 1px solid var(--axis); border-bottom-width: 2px; border-radius: 4px; padding: 0 .3rem; color: var(--ink-2); }

/* ---------- maths typesetting ---------- */
.question i, .choice i, .step-math i, .answer-math i, .illus i, .math i { font-family: Georgia, "Times New Roman", serif; }
sup { font-size: .68em; line-height: 0; }
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; margin: 0 .12em; }
.frac > .num { padding: 0 .2em .05em; border-bottom: 1.5px solid currentColor; }
.frac > .den { padding: .05em .2em 0; }
.frac .frac { font-size: .9em; }
.bp { font-size: 2.1em; font-weight: 200; vertical-align: middle; line-height: 1; }
.restr { font-size: .85em; color: var(--ink-2); white-space: nowrap; }
.cancel { position: relative; color: var(--muted); }
.cancel::after { content: ''; position: absolute; left: -2px; right: -2px; top: 50%; border-top: 2px solid var(--critical); transform: rotate(-14deg); }
.hl { border-radius: 4px; padding: 0 .15em; }
.hl1 { background: var(--hl1); } .hl2 { background: var(--hl2); } .hl3 { background: var(--hl3); }

/* ---------- illustrations ---------- */
figure.illus, div.illus { margin: .6rem 0; padding: .7rem .8rem; background: var(--surface); border: 1px dashed var(--axis); border-radius: 10px; overflow-x: auto; }
figure.illus figcaption { color: var(--ink-2); font-size: .88rem; margin-top: .4rem; }
figure.illus svg { width: 100%; max-width: 520px; height: auto; display: block; }
.illus .lbl { fill: var(--ink); font: 15px Georgia, serif; font-style: italic; }
.illus .lbl.sm { font-size: 13px; }
.illus .fill-a { fill: var(--shape-a); stroke: var(--accent); stroke-width: 1.5; }
.illus .fill-b { fill: var(--shape-b); stroke: var(--serious); stroke-width: 1.5; }
.illus .fill-c { fill: var(--shape-c); stroke: var(--good); stroke-width: 1.5; }
.illus .fill-cut { fill: var(--shape-cut); stroke: var(--critical); stroke-width: 1.5; stroke-dasharray: 4 3; }
.illus .dash { stroke: var(--accent); stroke-dasharray: 4 3; }
table.area-grid { border-collapse: separate; border-spacing: 4px; font-size: 1.05rem; }
table.area-grid th { color: var(--ink-2); font-weight: 600; padding: .3rem .6rem; }
table.area-grid th.corner { color: var(--muted); }
table.area-grid td.cell { padding: .7rem 1rem; border-radius: 8px; text-align: center; min-width: 4.5rem; }
table.area-grid td.c0 { background: var(--hl1); } table.area-grid td.c1 { background: var(--hl2); }
table.pairs { border-collapse: collapse; font-size: .95rem; }
table.pairs th, table.pairs td { padding: .25rem .8rem; border-bottom: 1px solid var(--grid); text-align: left; }
table.pairs tr.hit td { background: var(--good-soft); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; font-size: 1.05rem; }
.chips.stack { flex-direction: column; align-items: flex-start; }
.chips .bar { width: 100%; max-width: 360px; border-top: 2px solid var(--ink); }
.chip { display: inline-grid; place-items: center; min-width: 1.9em; height: 1.9em; padding: 0 .3em; border-radius: 6px; margin: 1px; background: var(--surface-2); }
.chip.c1 { background: var(--hl1); } .chip.c2 { background: var(--hl2); }
.chip.gone { background: transparent; color: var(--muted); text-decoration: line-through; text-decoration-color: var(--critical); text-decoration-thickness: 2px; border: 1px dashed var(--axis); }
.eq { color: var(--ink-2); font-size: .9rem; margin-left: .4rem; }
.groups { font-size: 1.1rem; }
.foil { font-size: 1.1rem; }
.foil-note { font-size: .85rem; color: var(--ink-2); margin-top: .35rem; }
.cancel-wrap { font-size: 1.15rem; }

/* ---------- summary & tables ---------- */
.score-hero { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: center; }
.score-big { font-size: 3rem; font-weight: 800; line-height: 1; }
.score-pct { font-size: 1.1rem; color: var(--ink-2); }
.delta-up { color: var(--good-ink); font-weight: 600; }
.delta-down { color: var(--critical); font-weight: 600; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th { text-align: left; color: var(--muted); font-weight: 600; font-size: .8rem; padding: .45rem .5rem; border-bottom: 1px solid var(--axis); white-space: nowrap; }
table.data td { padding: .5rem; border-bottom: 1px solid var(--grid); vertical-align: top; }
table.data td.n { font-variant-numeric: tabular-nums; white-space: nowrap; }
.res-ok { color: var(--good-ink); font-weight: 700; }
.res-bad { color: var(--critical); font-weight: 700; }
.res-learn { color: var(--accent); font-weight: 700; }
.review-q { border-top: 1px solid var(--grid); padding: .9rem 0; }
.review-q:first-child { border-top: 0; }
.review-q .question { font-size: 1.25rem; padding: .3rem 0; }
.your-answer { font-size: 1.05rem; }
/* admin: a student's round */
.admin-choices { display: grid; gap: .4rem; margin: .5rem 0; }
.admin-choices .choice { min-height: 0; padding: .5rem .75rem; font-size: 1.05rem; }
.admin-choices .c-html { flex: 1; min-width: 0; }
.pick-tag { flex: none; font-size: .78rem; font-weight: 700; color: var(--critical); }
.choice.right .pick-tag { color: var(--good-ink); }
.pick-tag.ok { color: var(--good-ink); }
.review-q.focus-q { box-shadow: inset 4px 0 0 var(--accent); padding-left: .75rem; }
.review-q[hidden] { display: none; }
.seg button:disabled { opacity: .45; cursor: default; }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .series { stroke: var(--accent); stroke-width: 2; fill: none; }
.chart .marker { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .bar { fill: var(--accent); }
.chart .bar.zero { fill: var(--grid); }
.chart .crosshair { stroke: var(--axis); stroke-dasharray: 3 3; }
.chart .direct { fill: var(--ink-2); font-size: 11px; }
.bars-h { display: grid; gap: .7rem; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 210px) 1fr 12.5rem; gap: .75rem; align-items: center; }
.bar-row .name { font-size: .9rem; }
.bar-row .track { height: 14px; background: var(--surface-2); border-radius: 4px; position: relative; overflow: hidden; }
.bar-row .track > span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; }
.bar-row .val { font-variant-numeric: tabular-nums; font-size: .9rem; display: flex; gap: .5rem; justify-content: flex-end; align-items: center; }
.fill-strong { background: var(--good); } .fill-developing { background: var(--warning); } .fill-needs-practice { background: var(--critical); } .fill-too-few, .fill-not-started { background: var(--axis); }
.fill-accent { background: var(--accent); }
table.heat { border-collapse: separate; border-spacing: 3px; width: 100%; font-size: .9rem; }
table.heat th { text-align: left; font-weight: 600; color: var(--ink-2); padding: .3rem .4rem; font-size: .82rem; }
table.heat td { text-align: center; padding: .55rem .3rem; border-radius: 6px; font-variant-numeric: tabular-nums; min-width: 5rem; }
.h1 { background: var(--seq-1); } .h2 { background: var(--seq-2); } .h3 { background: var(--seq-3); }
.h4 { background: var(--seq-4); } .h5 { background: var(--seq-5); } .h6 { background: var(--seq-6); }
table.heat td.h1, table.heat td.h2, table.heat td.h3 { color: #0b0b0b; }
table.heat td.h4, table.heat td.h5, table.heat td.h6 { color: #ffffff; }
:root[data-theme="dark"] table.heat td.h1, :root[data-theme="dark"] table.heat td.h2,
:root[data-theme="dark"] table.heat td.h3, :root[data-theme="dark"] table.heat td.h4 { color: #ffffff; }
:root[data-theme="dark"] table.heat td.h5, :root[data-theme="dark"] table.heat td.h6 { color: #0b0b0b; }
table.heat td.empty-cell { background: var(--surface-2); color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: .75rem; font-size: .8rem; color: var(--ink-2); margin-top: .6rem; }
.legend span { display: inline-flex; align-items: center; gap: .3rem; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.tooltip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: var(--surface); font-size: .82rem; padding: .4rem .6rem; border-radius: 8px; box-shadow: var(--shadow); max-width: 260px; }

@media (max-width: 600px) {
  .grade { display: none; }
  .topbar { gap: .5rem; }
  .topbar nav { gap: .1rem; }
  .topbar nav a { padding: .4rem .55rem; }
  .who { max-width: 4.6rem; overflow: hidden; text-overflow: ellipsis; font-size: .78rem; }
  .question { font-size: 1.3rem; }
  .bar-row { grid-template-columns: minmax(0, 1fr) auto; }
  .bar-row .name { min-width: 0; overflow-wrap: anywhere; }
  .bar-row .val { min-width: 0; }
  .bar-row .track { grid-column: 1 / -1; grid-row: 2; }
  .score-big { font-size: 2.4rem; }
}
@media (max-width: 420px) {
  .brand-name { display: none; }
}
@media (max-width: 360px) {
  .who-name { display: none; }
}
/* an admin has one more link (Students): make room for it on phones */
@media (max-width: 600px) {
  .topbar:has(#studentsNav:not([hidden])) .brand-name { display: none; }
  .topbar:has(#studentsNav:not([hidden])) nav a { padding: .4rem .45rem; }
}
@media (max-width: 480px) {
  .topbar:has(#studentsNav:not([hidden])) .who-name { display: none; }
}
@media (max-width: 360px) {
  .topbar:has(#studentsNav:not([hidden])) nav { gap: 0; }
  .topbar:has(#studentsNav:not([hidden])) nav a { padding: .35rem .28rem; font-size: .86rem; }
}

/* "multiply along the arrow" diagrams (arrows drawn in app.js) */
.dist { display: grid; grid-template-columns: max-content auto; column-gap: 1.1rem; row-gap: .45rem; align-items: baseline; font-size: 1.08rem; }
.dist .d-row { white-space: nowrap; }
.dist .d-lbl { color: var(--muted); font-style: italic; font-size: .85rem; white-space: nowrap; }
.d-expr { position: relative; display: inline-block; white-space: nowrap; padding: 2.5em .25em .2em; }
.d-expr.down { padding-bottom: 2.5em; }
.d-src { font-weight: 700; color: var(--critical); }
.d-src.c1 { color: var(--accent); }
.d-arrows { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.d-arrows path { fill: none; stroke-width: 2; stroke-linecap: round; }
.d-arrows path.c0 { stroke: var(--critical); } .d-arrows path.c1 { stroke: var(--accent); }
.d-arrows polygon.c0, .d-arrows text.c0 { fill: var(--critical); } .d-arrows polygon.c1, .d-arrows text.c1 { fill: var(--accent); }
.d-arrows text { font: 700 11px system-ui, sans-serif; }
.step-math .illus { font-size: 1rem; }
.reset-panel { border: 1px solid #efb3b3; }
.reset-opt { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .45rem 0; cursor: pointer; }
.reset-opt select { width: auto; max-width: 100%; }

/* ---------- website: sign-in screen ---------- */
.who { font-size: .85rem; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.who[hidden] { display: none; }
.lock { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: var(--page); }
.lock[hidden] { display: none; }
.lock .card { width: min(420px, 100%); }
.lock input[type=password], .lock input[type=text] { font: inherit; padding: .6rem .75rem; border-radius: 10px; border: 1px solid var(--axis); background: var(--surface); color: var(--ink); width: 100%; box-sizing: border-box; }
.lock .remember { display: flex; gap: .5rem; align-items: center; margin: .7rem 0; font-size: .95rem; }
.lock .msg { min-height: 1.4em; margin: .5rem 0 0; color: var(--ink-2); }
