:root {
  --ink: #1b1b1b;
  --ink-2: #4a4a4a;
  --ink-3: #8a8780;
  --rule: #e4e0d8;
  --paper: #ffffff;
  --beige: #f3efe8;

  --pink: #f6bcb2;   --pink-d: #e8604c;
  --yellow: #fcf09e; --yellow-d: #f2cf1d;
  --lilac: #d6c8f7;  --lilac-d: #8e64e6;
  --blue: #d4e7fb;   --blue-d: #4f97e3;
  --green: #d3f39d;  --green-d: #6cc12c;
  --tag: #fbd94a;

  --good: #2f7d1e;
  --good-bg: #dff5c4;
  --bad: #b8321f;
  --bad-bg: #fbd9d3;

  --radius: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 2px 8px rgba(0, 0, 0, .06);
  --font: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --math: 'STIX Two Text', 'Times New Roman', serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font); color: var(--ink); font-size: 16px; line-height: 1.45;
  background: linear-gradient(180deg, #e2f0f7 0%, #f3f2ee 45%, #fbf1df 100%) fixed;
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
body.plain { background: var(--paper); }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input { font: inherit; color: inherit; }
.app { max-width: 820px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.screen { flex: 1; padding: 0 16px 104px; }
.screen.no-nav { padding-bottom: 32px; }
.narrow { max-width: 560px; margin-left: auto; margin-right: auto; width: 100%; }

/* ---------- type ---------- */
h1 { font-size: 28px; line-height: 1.15; margin: 0 0 6px; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 20px; margin: 0 0 14px; font-weight: 700; letter-spacing: -.005em; }
h3 { font-size: 16px; margin: 0 0 10px; font-weight: 800; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.tiny { font-size: 13px; color: var(--ink-3); }
.center { text-align: center; }
.m, .i { font-family: var(--math); font-style: italic; font-size: 1.1em; }
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; font-size: .9em; line-height: 1.1; margin: 0 2px; }
.frac > span:first-child { border-bottom: 1.5px solid currentColor; padding: 0 3px; }
.vec { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; padding: 2px 8px; position: relative; line-height: 1.25; }
.vec::before, .vec::after { content: ''; position: absolute; top: 0; bottom: 0; width: 6px; border: 1.5px solid currentColor; }
.vec::before { left: 0; border-right: 0; border-radius: 8px 0 0 8px; }
.vec::after { right: 0; border-left: 0; border-radius: 0 8px 8px 0; }
.vec-row { font-size: 19px; display: flex; align-items: center; gap: 6px; }
.vec-row .sp { width: 24px; }
.ul { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; font-size: 15px; color: var(--ink); }

/* ---------- masthead ---------- */
.mast { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 18px 0 6px; gap: 8px; }
.mast .l { justify-self: start; display: flex; gap: 6px; }
.mast .r { justify-self: end; display: flex; gap: 6px; }
.wordmark { display: flex; align-items: center; justify-content: center; line-height: 1; }
.wordmark img { height: 28px; width: auto; display: block; }
.hero-logo { display: block; width: min(320px, 78%); height: auto; margin: 0 auto 4px; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 99px; background: #fff; font-weight: 800; font-size: 13px; letter-spacing: .02em; }
.chip svg { width: 14px; height: 14px; stroke-width: 2.5; }
.chip.dark { background: var(--ink); color: #fff; }
.section-h { text-align: center; font-size: 20px; font-weight: 700; margin: 26px 0 14px; }
@media (max-width: 420px) {
  .wordmark img { height: 23px; }
  .chip { padding: 0 8px; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 50px; padding: 0 26px; border-radius: 99px; font-weight: 800; font-size: 15px;
  text-transform: uppercase; letter-spacing: .04em; font-stretch: 90%;
  background: var(--ink); color: #fff; transition: transform .08s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .3; pointer-events: none; }
.btn.block { width: 100%; }
.btn.light { background: #fff; color: var(--ink); border: 2px solid var(--ink); }
.btn.small { height: 34px; padding: 0 14px; font-size: 12px; }
.btn svg { width: 18px; height: 18px; flex: none; }
.circ { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--ink); display: inline-flex; align-items: center; justify-content: center; background: #fff; flex: none; }
.circ svg { width: 19px; height: 19px; }
.circ.on { background: var(--yellow); }
.circ[disabled] { opacity: .3; pointer-events: none; }
.back { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; }
.back svg { width: 24px; height: 24px; stroke-width: 2.6; }

/* ---------- tags ---------- */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; background: var(--beige); border-radius: 4px; white-space: nowrap; }
.tag svg { width: 12px; height: 12px; stroke-width: 3; }
.tag.good { background: var(--good-bg); color: var(--good); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.hint, .tag.y { background: var(--tag); }

/* ---------- cards & tiles ---------- */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; text-align: left; display: flex; flex-direction: column; position: relative; width: 100%; }
.tile .art { height: 104px; display: flex; align-items: center; justify-content: center; position: relative; }
.tile .art svg.ico { width: 56px; height: 56px; }
.flag { position: absolute; top: 0; left: 0; background: var(--tag); font-size: 12px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; padding: 3px 8px; border-radius: 0 0 6px 0; display: inline-flex; gap: 4px; align-items: center; color: var(--ink); }
.flag.done { background: var(--ink); color: #fff; }
.flag.catch { background: var(--pink-d); color: #fff; }
.flag svg { width: 12px; height: 12px; stroke-width: 3; }
.lockb { position: absolute; right: 10px; bottom: 10px; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; }
.lockb svg { width: 14px; height: 14px; }
.tile .body { padding: 12px; display: flex; flex-direction: column; flex: 1; }
.tile .t { font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.tile .s { font-size: 13px; color: var(--ink-2); margin-top: 1px; }
.tile .foot { border-top: 1px solid var(--rule); margin-top: 10px; padding-top: 8px; display: flex; justify-content: space-between; align-items: center; min-height: 30px; }
.tile.locked { cursor: default; }
.tile.locked .t, .tile.locked .s { color: var(--ink-3); }
.c-pink { background: var(--pink); } .c-yellow { background: var(--yellow); } .c-lilac { background: var(--lilac); } .c-blue { background: var(--blue); } .c-green { background: var(--green); }

.feature { display: grid; grid-template-columns: 1fr 150px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.feature .body { padding: 16px 16px 18px; display: flex; flex-direction: column; }
.feature .t { font-size: 23px; font-weight: 800; letter-spacing: -.01em; line-height: 1.15; }
.feature .s { color: var(--ink-2); font-size: 15px; margin-top: 4px; }
.feature .meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 16px; }
.feature .art { position: relative; display: flex; align-items: center; justify-content: center; }
.feature .art svg.ico { width: 76px; height: 76px; }
@media (max-width: 420px) { .feature { grid-template-columns: 1fr 100px; } .feature .art svg.ico { width: 56px; height: 56px; } }

.paper-strip { display: flex; align-items: center; gap: 16px; }
.paper-strip .score { font-size: 38px; font-weight: 900; line-height: 1; letter-spacing: -.02em; font-stretch: 88%; }
.paper-strip .score small { font-size: 16px; color: var(--ink-3); font-weight: 700; }
.meter { height: 14px; border: 2px solid var(--ink); background: #fff; position: relative; margin-top: 8px; }
.meter > span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--yellow-d); border-right: 2px solid var(--ink); }
.meter > span[style*="width:0"] { border-right: 0; }

/* ---------- bottom nav ---------- */
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; background: #fff; border-top: 1px solid var(--rule); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
.nav .in { max-width: 560px; margin: 0 auto; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.nav button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-3); position: relative; }
.nav button svg { width: 22px; height: 22px; }
.nav button.on { color: var(--ink); }
.nav button.on::after { content: ''; position: absolute; bottom: -6px; left: 30%; right: 30%; height: 3px; background: var(--ink); }

/* ---------- onboarding ---------- */
.onb { display: flex; flex-direction: column; min-height: 100dvh; padding-bottom: 24px; }
.onb .body { flex: 1; }
.onb-hero { text-align: center; padding: 34px 0 10px; }
.onb-hero h1 { font-size: 32px; margin-top: 6px; }
.tiles-mini { display: flex; justify-content: center; gap: 10px; margin: 30px 0 26px; }
.tiles-mini div { width: 66px; height: 66px; border-radius: 8px; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow); }
.tiles-mini svg { width: 42px; height: 42px; }
.steps-bar { display: flex; border: 2px solid var(--ink); margin: 6px 0 26px; background: #fff; }
.steps-bar span { flex: 1; height: 10px; border-right: 1px solid var(--ink); }
.steps-bar span:last-child { border-right: 0; }
.steps-bar span.on { background: var(--ink); }
.option { width: 100%; text-align: left; display: flex; align-items: center; gap: 14px; padding: 10px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 10px; border: 2px solid transparent; }
.option .sw { width: 52px; height: 52px; border-radius: 6px; display: flex; align-items: center; justify-content: center; flex: none; font-weight: 900; font-size: 20px; font-stretch: 88%; }
.option .sw svg { width: 34px; height: 34px; }
.option .t { font-weight: 800; font-size: 17px; }
.option .d { font-size: 14px; color: var(--ink-2); }
.option.on { border-color: var(--ink); }
.option .tick { margin-left: auto; width: 26px; height: 26px; border: 2px solid var(--ink); border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; }
.option .tick svg { width: 14px; height: 14px; stroke-width: 3.5; opacity: 0; }
.option.on .tick { background: var(--ink); color: #fff; }
.option.on .tick svg { opacity: 1; }
.option[disabled] { opacity: .5; cursor: not-allowed; }
.text-input { width: 100%; height: 56px; padding: 0 16px; border: 2px solid var(--ink); border-radius: 4px; background: #fff; font-size: 19px; font-weight: 600; outline: none; }
.text-input:focus { box-shadow: 0 0 0 3px var(--tag); }

/* ---------- sign in / create account ---------- */
.auth h1 { margin-bottom: 6px; }
.auth .field, .form .field { display: block; margin-top: 16px; }
.auth .field-l, .form .field-l { display: block; font-weight: 800; font-size: 15px; margin-bottom: 6px; }
.auth .text-input, .form .text-input { height: 52px; font-size: 17px; }
.auth .field-help { margin: 6px 0 0; }
.auth .two-opt { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.auth .two-opt .option { margin: 0; flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; }
.auth .two-opt .option .sw { width: 40px; height: 40px; font-size: 17px; }
.auth .two-opt .option .tick { position: absolute; top: 10px; right: 10px; }
.auth .two-opt .option { position: relative; }
.auth .two-opt .option .d { font-size: 13px; }
.auth form .btn.block { margin-top: 18px; }
.auth-actions { display: grid; gap: 10px; }
.auth-msg { margin: 14px 0 0; padding: 10px 12px; border-radius: 4px; background: var(--tag); font-size: 15px; }
.auth-msg.bad { background: #fde3df; color: #8a1c0e; }
.auth-link { font-size: 15px; font-weight: 700; }
@media (max-width: 380px) { .auth .two-opt { grid-template-columns: 1fr; } }

/* ---------- classes ---------- */
select.text-input { appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231b1b1b' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 18px; }
.form .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form .check { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-size: 15px; cursor: pointer; }
.form .check input { width: 20px; height: 20px; accent-color: var(--ink); flex: none; }
.form .btn.block { margin-top: 18px; }
.section-row { align-items: center; }
.section-row .section-h { margin-bottom: 0; }
.code-chip { font-weight: 900; letter-spacing: .12em; font-size: 14px; padding: 4px 8px; border: 2px solid var(--ink); border-radius: 4px; margin-left: 8px; font-variant-numeric: tabular-nums; }
.code-card { text-align: center; }
.code-big { font-size: 44px; font-weight: 900; letter-spacing: .18em; margin: 4px 0 10px; font-stretch: 90%; }
.code-card .btn svg { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
.roster { padding: 6px 0; }
.roster-h, .roster-r { display: grid; grid-template-columns: 1fr 48px 60px 62px 54px; align-items: center; gap: 6px; padding: 10px 14px; width: 100%; text-align: left; }
.roster-h { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); padding-bottom: 4px; }
.roster-r { border-top: 1px solid var(--rule); font-variant-numeric: tabular-nums; cursor: pointer; }
.roster-r:hover { background: var(--bg-2, #faf8f4); }
.roster-r > span:first-child { display: flex; flex-direction: column; min-width: 0; }
.roster-r > span:first-child b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster-r .behind { color: var(--bad); font-weight: 800; }
.roster-r small { color: var(--ink-2); }
.icon-btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--ink-2); }
.icon-btn:hover { background: var(--tag); color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; }
.join-form { display: flex; gap: 10px; margin-top: 14px; }
.join-form .code-input { flex: 1; min-width: 0; height: 52px; text-transform: uppercase; letter-spacing: .2em; font-weight: 800; }
.join-form .btn { flex: none; }
.joined { display: flex; gap: 12px; align-items: center; margin-top: 18px; padding: 14px; background: #fff; border: 2px solid var(--ink); border-radius: var(--radius); }
.joined > svg { width: 28px; height: 28px; flex: none; padding: 5px; background: var(--ink); color: #fff; border-radius: 50%; stroke-width: 3; }

/* ---------- session ---------- */
.sess-top { position: sticky; top: 0; z-index: 5; background: #fff; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 10px 12px; gap: 8px; }
.sess-top .l { display: flex; align-items: center; gap: 2px; }
.sess-top .r { display: flex; justify-content: flex-end; gap: 8px; }
.timer { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 15px; }
.banner {
  background: var(--ink); color: #fff; font-weight: 900; text-transform: uppercase; letter-spacing: .03em;
  font-size: 18px; padding: 7px 22px; font-stretch: 85%; white-space: nowrap; line-height: 1.2;
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 10px 100%, 0 50%);
}
.step-cells { display: flex; flex-wrap: wrap; justify-content: center; padding: 0 12px 12px; background: #fff; }
.step-cells .grid { display: flex; flex-wrap: wrap; border-top: 2px solid var(--ink); border-left: 2px solid var(--ink); }
.step-cells span { width: 20px; height: 20px; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); background: #fff; }
.step-cells span.good { background: var(--green); }
.step-cells span.bad { background: var(--pink); }
.step-cells span.part { background: var(--yellow); }
.step-cells span.cur { background: repeating-linear-gradient(135deg, var(--pink-d) 0 3px, #fff 3px 7px); }
.sess-body { max-width: 640px; margin: 0 auto; width: 100%; padding: 14px 16px 260px; }
.q-meta { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--ink); padding-bottom: 8px; margin-bottom: 14px; }
.q-meta .n { font-weight: 900; font-size: 15px; text-transform: uppercase; letter-spacing: .03em; }
.q-stem { font-size: 18px; }
.q-diagram { margin: 18px 0 6px; display: flex; justify-content: center; overflow-x: auto; }
.prev-steps { margin-top: 16px; border-top: 1px solid var(--rule); padding-top: 10px; }
.prev-step { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; color: var(--ink-2); padding: 4px 0; }
.prev-step .ic { width: 20px; height: 20px; flex: none; margin-top: 1px; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--ink); color: var(--ink); }
.prev-step .ic svg { width: 12px; height: 12px; stroke-width: 3.5; }
.prev-step .ic.good { background: var(--green); }
.prev-step .ic.bad { background: var(--pink); }
.step { margin-top: 20px; background: var(--beige); padding: 16px; }
.step-prompt { font-size: 18px; }
.step-label { font-weight: 900; margin-right: 6px; }
.step-marks { margin-top: 8px; }
.answer-area { margin-top: 16px; }
.hint-box { margin-top: 14px; background: var(--yellow); padding: 12px 14px; font-size: 15px; display: flex; gap: 10px; border-left: 4px solid var(--ink); }
.hint-box svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }

.ans-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ans-row .affix { font-size: 19px; font-weight: 700; }
.ans-input { height: 56px; min-width: 0; width: 170px; padding: 0 14px; font-size: 22px; font-weight: 700; border: 2px solid var(--ink); border-radius: 0; background: #fff; outline: none; text-align: center; }
.ans-input.wide { width: 100%; max-width: 340px; text-align: left; }
.ans-input.sm { width: 90px; }
.ans-input:focus { box-shadow: inset 0 0 0 3px var(--tag); }
.ans-input.good { background: var(--green); }
.ans-input.bad { background: var(--pink); }
.pm { height: 56px; width: 48px; border: 2px solid var(--ink); background: #fff; font-size: 20px; font-weight: 800; }
.fields { display: grid; gap: 12px; }
.fields.cols { grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 700; }
.field .ans-input { width: 100%; }
.coord { display: flex; align-items: center; gap: 8px; font-size: 32px; font-weight: 300; }
.vec-input { display: inline-flex; flex-direction: column; gap: 8px; padding: 6px 14px; position: relative; }
.vec-input::before, .vec-input::after { content: ''; position: absolute; top: 0; bottom: 0; width: 12px; border: 2.5px solid var(--ink); }
.vec-input::before { left: 0; border-right: 0; border-radius: 14px 0 0 14px; }
.vec-input::after { right: 0; border-left: 0; border-radius: 0 14px 14px 0; }
.stdform { display: flex; align-items: flex-start; gap: 8px; font-size: 22px; font-weight: 700; }
.stdform .ten { margin-top: 14px; }
.stdform .exp { width: 64px; height: 44px; font-size: 18px; }
.sl-row { display: flex; align-items: stretch; margin-bottom: -2px; }
.sl-row .stem { width: 56px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; border: 2px solid var(--ink); border-right-width: 4px; background: #fff; }
.sl-row .ans-input { flex: 1; text-align: left; letter-spacing: .25em; border-left: 0; }

.choices { display: grid; gap: 8px; }
.choices.two { grid-template-columns: 1fr 1fr; }
.choice { text-align: left; min-height: 52px; border: 2px solid var(--ink); background: #fff; font-weight: 600; display: flex; align-items: stretch; font-size: 16px; }
.choice .k { width: 44px; flex: none; display: flex; align-items: center; justify-content: center; font-weight: 900; border-right: 2px solid var(--ink); background: var(--beige); }
.choice .tx { padding: 12px 14px; display: flex; align-items: center; }
.choice.on { background: var(--yellow); }
.choice.on .k { background: var(--ink); color: #fff; }
.choice.good { background: var(--green); }
.choice.good .k { background: var(--good); color: #fff; }
.choice.bad { background: var(--pink); }
.choice.bad .k { background: var(--bad); color: #fff; }
.locked .choice, .locked .ans-input, .locked .pm { pointer-events: none; }

.action-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--beige); border-top: 2px solid var(--ink); padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); }
.action-bar .in { max-width: 640px; margin: 0 auto; }
.action-bar.good { background: var(--green); }
.action-bar.bad { background: var(--pink); }
.action-bar.part { background: var(--yellow); }
.fb-title { font-weight: 900; font-size: 21px; text-transform: uppercase; letter-spacing: .02em; font-stretch: 85%; display: flex; align-items: center; gap: 8px; }
.fb-title svg { width: 22px; height: 22px; stroke-width: 3.2; }
.fb-pts { margin-left: auto; font-size: 15px; font-weight: 900; }
.fb-sub { font-size: 13px; font-weight: 700; margin-top: 2px; }
.fb-detail { font-size: 16px; margin: 8px 0 2px; }
.fb-why { font-size: 15px; margin: 4px 0 14px; }

/* ---------- diagrams ---------- */
svg.diagram, svg.interactive { max-width: 100%; height: auto; overflow: visible; }
svg .ln { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
svg .ln.thin { stroke-width: 1.1; }
svg .ln.strong { stroke-width: 2.4; }
svg .ln.dash { stroke-dasharray: 4 4; stroke-width: 1.1; }
svg .head { fill: var(--ink); }
svg .grid { stroke: #cfcac0; stroke-width: 1; }
svg .grid.major { stroke: #9d988e; }
svg .box { fill: #fff; stroke: var(--ink); stroke-width: 1.6; }
svg .lbl { fill: var(--ink); font-family: var(--font); font-size: 13px; }
svg .lbl.s { font-size: 11px; fill: var(--ink-2); }
svg .lbl.b { font-weight: 800; font-size: 15px; }
svg .lbl.i { font-family: var(--math); font-style: italic; font-size: 15px; }
svg .bar-given { fill: #c8c4bc; stroke: var(--ink); stroke-width: 1.4; }
svg .bar-user { fill: var(--lilac); stroke: var(--ink); stroke-width: 1.6; }
svg .bar-good { fill: var(--green); stroke: var(--ink); stroke-width: 1.6; }
svg .bar-bad { fill: var(--pink); stroke: var(--ink); stroke-width: 1.6; }
svg .hit { fill: transparent; cursor: pointer; }
svg .pt-given { fill: var(--ink); }
svg .pt-user { fill: var(--lilac-d); stroke: var(--ink); stroke-width: 1.4; }
svg .pt-good { fill: var(--green-d); stroke: var(--ink); stroke-width: 1.4; }
svg .guide { stroke: var(--lilac-d); stroke-width: 2; stroke-dasharray: 6 4; fill: none; }
svg .curve { stroke: var(--good); stroke-width: 2.4; fill: none; }
.steppers { display: flex; gap: 10px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.stepper { display: flex; align-items: stretch; border: 2px solid var(--ink); background: #fff; }
.stepper .nm { font-weight: 800; font-size: 14px; padding: 0 10px; display: flex; align-items: center; background: var(--beige); border-right: 2px solid var(--ink); }
.stepper .val { min-width: 34px; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.stepper button { width: 36px; height: 36px; font-size: 18px; font-weight: 800; }

.qtable { border-collapse: collapse; font-size: 15px; background: #fff; }
.qtable th, .qtable td { border: 1.5px solid var(--ink); padding: 7px 12px; text-align: center; }
.qtable thead th, .qtable tbody th { background: var(--beige); font-weight: 800; }
.timetable td:first-child, .timetable th:first-child { text-align: left; }
.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.note { border: 1.5px solid var(--ink); padding: 12px 14px; font-size: 15px; background: #fff; }
.note-h { font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 4px; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; border-top: 1.5px solid var(--ink); border-left: 1.5px solid var(--ink); }
.chips span { border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); padding: 6px 10px; font-weight: 700; font-variant-numeric: tabular-nums; background: #fff; }

/* ---------- summary ---------- */
.done-hero { text-align: center; padding: 30px 0 6px; }
.done-hero .banner { display: inline-block; font-size: 24px; padding: 9px 30px; }
.done-hero p { margin: 14px 0 0; font-size: 17px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 2px solid var(--ink); border-left: 2px solid var(--ink); margin-top: 22px; background: #fff; }
.stat { border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); padding: 14px 6px; text-align: center; }
.stat .v { font-size: 28px; font-weight: 900; font-stretch: 88%; letter-spacing: -.01em; line-height: 1.15; }
.stat .l { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.stat.y { background: var(--yellow); } .stat.g { background: var(--green); } .stat.p { background: var(--lilac); } .stat.b { background: var(--blue); }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--rule); }
.list-item:first-child { border-top: 0; padding-top: 0; }
.list-item:last-child { padding-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .t { font-weight: 700; }
.score-box { min-width: 50px; height: 32px; padding: 0 8px; border: 2px solid var(--ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; background: #fff; }
.score-box.good { background: var(--green); } .score-box.bad { background: var(--pink); } .score-box.part { background: var(--yellow); } .score-box.none { color: var(--ink-3); }

/* ---------- progress ---------- */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.kpi .bar { height: 8px; }
.kpi .in { padding: 12px 14px 14px; }
.kpi .v { font-size: 32px; font-weight: 900; letter-spacing: -.02em; line-height: 1.1; font-stretch: 88%; margin: 2px 0; }
.kpi .v small { font-size: 15px; color: var(--ink-3); font-weight: 700; }
.kpi .l { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.grade-cells { display: grid; grid-template-columns: repeat(6, 1fr); border-top: 2px solid var(--ink); border-left: 2px solid var(--ink); margin: 4px 0 10px; }
.grade-cells div { border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 900; font-size: 22px; background: #fff; }
.grade-cells div small { font-size: 10px; font-weight: 700; color: var(--ink-3); }
.grade-cells div.reached { background: var(--beige); }
.grade-cells div.me { background: var(--tag); }
.grade-cells div.me small { color: var(--ink); }
.hbar { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; margin-bottom: 14px; }
.hbar:last-child { margin-bottom: 0; }
.hbar .nm { font-size: 15px; font-weight: 700; }
.hbar .pc { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hbar .track { grid-column: 1 / -1; height: 14px; border: 2px solid var(--ink); background: #fff; position: relative; }
.hbar .track span { position: absolute; left: 0; top: 0; bottom: 0; border-right: 2px solid var(--ink); }
.tip { padding: 14px 0; border-top: 1px solid var(--rule); }
.tip:first-of-type { border-top: 0; padding-top: 2px; }
.tip .nm { font-weight: 800; display: flex; align-items: center; gap: 8px; font-size: 16px; }
.tip p { margin: 6px 0 0; font-size: 15px; color: var(--ink-2); }
.empty { text-align: center; padding: 28px 16px; }
.empty .art { width: 96px; height: 96px; border-radius: 8px; margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; }
.empty .art svg { width: 56px; height: 56px; }

/* ---------- leaderboard ---------- */
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 2px solid var(--ink); background: #fff; margin-bottom: 14px; }
.seg button { height: 42px; font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.seg button + button { border-left: 2px solid var(--ink); }
.seg button.on { background: var(--ink); color: #fff; }
.lb-row { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--rule); }
.lb-row:first-child { border-top: 0; }
.lb-row .rk { width: 34px; height: 34px; border: 2px solid var(--ink); display: flex; align-items: center; justify-content: center; font-weight: 900; flex: none; background: #fff; }
.lb-row .rk.r1 { background: var(--tag); } .lb-row .rk.r2 { background: var(--blue); } .lb-row .rk.r3 { background: var(--pink); }
.lb-row .grow { flex: 1; min-width: 0; font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-row .pts { font-weight: 900; font-variant-numeric: tabular-nums; }
.lb-row.me { background: var(--yellow); }
.lb-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; padding: 8px 0; }
.note-bar { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--ink-2); margin: 0 0 14px; }
.note-bar svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }

/* ---------- profile ---------- */
.set-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 0; border-top: 1px solid var(--rule); gap: 12px; }
.set-row:first-child { border-top: 0; padding-top: 0; }
.set-row:last-child { padding-bottom: 0; }
.set-row .k { color: var(--ink-2); font-size: 15px; }
.set-row .v { font-weight: 800; }
.switch { width: 50px; height: 28px; border: 2px solid var(--ink); border-radius: 28px; background: #fff; position: relative; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); transition: left .15s; }
.switch.on { background: var(--tag); }
.switch[disabled] { opacity: .45; cursor: not-allowed; }
.switch.on::after { left: 25px; }
.rules { font-size: 15px; margin: 0; padding-left: 18px; color: var(--ink-2); }
.rules li + li { margin-top: 6px; }
.rules b { color: var(--ink); }
.avatar { width: 52px; height: 52px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 22px; flex: none; }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(20, 20, 20, .5); z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s; }
.modal { width: 100%; max-width: 440px; background: #fff; border: 2px solid var(--ink); padding: 22px 20px 20px; animation: up .2s ease-out; }
.modal h2 { font-size: 22px; margin-bottom: 6px; }
.modal p { color: var(--ink-2); margin: 6px 0 20px; }
.modal .row .btn { flex: 1; padding: 0 12px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(16px); opacity: 0; } }
.toast { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; font-size: 14px; font-weight: 700; z-index: 30; animation: fade .2s; }

/* table answers */
.table-wrap { overflow-x: auto; }
.in-table { width: 100%; table-layout: fixed; }
.in-table td { padding: 0; }
.in-table td.given { padding: 8px 2px; font-weight: 700; background: #fff; }
.in-table th { font-size: 12px; padding: 6px 2px; overflow-wrap: anywhere; }
.in-table tr > th:first-child { width: 24%; }
.in-table .ans-input.cell { width: 100%; height: 44px; font-size: 17px; border: 0; padding: 0 2px; }
.in-table .ans-input.cell.good { background: var(--green); }
.in-table .ans-input.cell.bad { background: var(--pink); }
.choice .tx { min-width: 0; flex: 1; }
.choice svg.opt { width: 100%; max-width: 120px; height: auto; display: block; }

/* review */
.rq { width: 30px; height: 30px; border: 2px solid var(--ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 900; font-size: 13px; flex: none; }
button.list-item { border-top: 1px solid var(--rule); }
button.list-item:first-child { border-top: 0; }

/* calculator */
.calc {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: #2a2a2a; color: #fff;
  border-top: 2px solid var(--ink); padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 24px rgba(0,0,0,.25); max-width: 520px; margin: 0 auto; border-radius: 14px 14px 0 0;
}
.calc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.calc-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.calc-title svg { width: 16px; height: 16px; }
.calc-deg { font-size: 11px; font-weight: 800; background: #444; padding: 2px 6px; border-radius: 4px; }
.calc-use { margin-left: auto; height: 30px; padding: 0 12px; border-radius: 99px; background: var(--tag); color: var(--ink); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.calc-use[disabled] { opacity: .35; }
.calc-x { width: 30px; height: 30px; border-radius: 50%; background: #444; color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.calc-x svg { width: 16px; height: 16px; }
.calc-screen { background: #d9e2c8; color: #1b1b1b; border-radius: 6px; padding: 8px 10px; margin-bottom: 8px; min-height: 70px; font-family: 'Archivo', monospace; }
.calc-expr { font-size: 16px; min-height: 22px; word-break: break-all; font-variant-numeric: tabular-nums; }
.calc-expr .caret { display: inline-block; width: 2px; height: 16px; background: #1b1b1b; vertical-align: -2px; margin-left: 1px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.calc-res { text-align: right; font-size: 28px; font-weight: 800; min-height: 36px; font-variant-numeric: tabular-nums; }
.calc-res .frac { font-size: .8em; }
.calc-err { font-size: 18px; color: #a12; }
.calc-fn { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; margin-bottom: 8px; }
.calc-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.ck { height: 34px; border-radius: 6px; background: #444; color: #fff; font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.ck:active { transform: translateY(1px); filter: brightness(1.2); }
.calc-pad .ck { height: 44px; font-size: 19px; }
.ck.n { background: #f3efe8; color: #1b1b1b; }
.ck.op { background: #5c5c5c; }
.ck.red { background: var(--pink-d); font-size: 15px; }
.ck.eq { background: var(--tag); color: #1b1b1b; }
.ck.shift { background: #8a6d00; font-size: 11px; letter-spacing: .03em; }
.ck.shift.on { background: var(--tag); color: #1b1b1b; }
.ck .frac { font-size: 10px; }
.ck.trig { flex-direction: column; gap: 0; line-height: 1.05; height: 38px; }
.ck.trig .alt { font-size: 9px; font-weight: 800; color: #e8c547; }
.ck.trig.on { background: #8a6d00; }
.ck.trig.on .alt { color: #f3efe8; opacity: .7; }
body.calc-open .sess-body { padding-bottom: 470px; }
@media (min-width: 900px) {
  .calc { left: auto; right: 24px; bottom: 24px; width: 360px; border-radius: 14px; border: 2px solid var(--ink); }
  body.calc-open .sess-body { padding-bottom: 260px; }
}

/* demo paper switcher */
.paper-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.paper-pick button { border: 2px solid var(--ink); background: #fff; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 14px; }
.paper-pick button span { font-size: 11px; color: var(--ink-2); }
.paper-pick button.on { background: var(--tag); }

/* marks bar & grades */
.mbar { margin: 22px 0 6px; }
.mbar-track { position: relative; height: 18px; border: 2px solid var(--ink); background: #fff; margin-top: 18px; }
.mbar-earned { position: absolute; left: 0; top: 0; bottom: 0; background: var(--yellow-d); }
.mbar-lost { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, #c8c4bc 0 3px, #e9e5dd 3px 6px); }
.mbar-track i { position: absolute; top: -6px; bottom: -6px; width: 2px; background: var(--ink); transform: translateX(-1px); }
.mbar-track i b { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 900; font-style: normal; }
.mbar-track em { position: absolute; top: 100%; transform: translateX(-50%); margin-top: 6px; font-size: 10px; font-weight: 800; font-style: normal; text-transform: uppercase; background: var(--ink); color: #fff; padding: 1px 5px; white-space: nowrap; }
.mbar-track em::before { content: ''; position: absolute; left: 50%; top: -5px; transform: translateX(-50%); border: 3px solid transparent; border-bottom-color: var(--ink); }
.mbar-key { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); margin-top: 26px; }
.mbar-key span { display: inline-flex; align-items: center; gap: 5px; }
.mbar-key i { width: 12px; height: 12px; border: 1.5px solid var(--ink); display: inline-block; }
.k-earned { background: var(--yellow-d); } .k-lost { background: #c8c4bc; } .k-left { background: #fff; }
.grade-trio { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 2px solid var(--ink); border-left: 2px solid var(--ink); margin-top: 14px; }
.grade-trio > div { border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); padding: 10px 6px; text-align: center; display: flex; flex-direction: column; }
.grade-trio > div:first-child { background: var(--yellow); }
.grade-trio .l { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.grade-trio .v { font-size: 28px; font-weight: 900; font-stretch: 88%; line-height: 1.15; }
.grade-trio .s { font-size: 11px; color: var(--ink-2); }
.grade-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.grade-pick button { min-width: 40px; height: 36px; padding: 0 10px; border: 2px solid var(--ink); background: #fff; font-weight: 800; }
.grade-pick button.on { background: var(--tag); }
.grade-pick.big button { min-width: 52px; height: 52px; font-size: 20px; }

/* maths input */
math-field.ans-mf {
  display: inline-block; min-width: 170px; min-height: 56px; padding: 8px 12px; font-size: 24px; vertical-align: middle;
  border: 2px solid var(--ink); border-radius: 0; background: #fff; color: var(--ink);
  --caret-color: var(--ink); --selection-background-color: var(--yellow); --contains-highlight-background-color: transparent;
  --primary-color: var(--ink); --keyboard-zindex: 40;
}
math-field.ans-mf:focus-within { outline: none; box-shadow: inset 0 0 0 3px var(--tag); }
math-field.ans-mf.wide { width: 100%; max-width: 360px; }
math-field.ans-mf.sm { min-width: 90px; width: 100px; }
math-field.ans-mf.exp { min-width: 64px; width: 72px; min-height: 44px; font-size: 18px; }
.field math-field.ans-mf { width: 100%; min-width: 0; }
math-field.ans-mf.good { background: var(--green); }
math-field.ans-mf.bad { background: var(--pink); }
math-field::part(menu-toggle) { display: none; }
.action-bar { bottom: var(--kb-h, 0px); }

/* ---------- teacher view ---------- */
.seg.three { grid-template-columns: repeat(3, 1fr); }
.viewas { display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--ink); color: #fff; font-size: 13px; font-weight: 800; padding: 8px 12px; margin: 0 -16px 4px; }
.viewas .ul { color: #fff; font-size: 13px; }
.dash-card .t { font-weight: 800; font-size: 19px; }
.tstats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.tstats > div { display: flex; flex-direction: column; background: var(--bg-2, #faf8f4); border: 1px solid var(--rule); border-radius: 6px; padding: 10px; min-width: 0; }
.tstats .v { font-size: 26px; font-weight: 900; font-stretch: 90%; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tstats .v small { font-size: 14px; color: var(--ink-2); font-weight: 700; }
.tstats .l { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; margin-top: 4px; }
.tstats .s { font-size: 12px; color: var(--ink-2); }
@media (max-width: 520px) { .tstats { grid-template-columns: 1fr 1fr; } }
.dash-sub { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); margin: 18px 0 8px; }
.gbars { display: flex; gap: 6px; align-items: flex-end; height: 92px; }
.gbars > div { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.gbars .bar { width: 100%; min-height: 3px; background: var(--lilac); border: 2px solid var(--ink); border-bottom: 0; position: relative; display: flex; justify-content: center; }
.gbars .bar b { position: absolute; top: -18px; font-size: 12px; }
.gbars .g { border-top: 2px solid var(--ink); width: 100%; text-align: center; font-size: 12px; font-weight: 800; padding-top: 3px; }
.pq { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--rule); }
.pq:first-of-type { border-top: 0; }
.pq .grow { flex: 1; min-width: 0; }
.pq .t { font-weight: 800; font-size: 15px; }
.pq .score-box { min-width: 54px; height: 28px; font-size: 13px; flex: none; }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 6px; }
.qcell { border: 2px solid var(--ink); display: flex; flex-direction: column; align-items: center; padding: 4px 0; font-size: 12px; font-variant-numeric: tabular-nums; background: #fff; }
.qcell b { font-size: 13px; }
.qcell.good { background: var(--green); } .qcell.part { background: var(--yellow); } .qcell.bad { background: var(--pink); } .qcell.none { color: var(--ink-3); border-color: var(--rule); }
.search { margin-bottom: 12px; height: 50px; font-size: 16px; }
.stu-item[hidden] { display: none; }

/* ---------- teacher-made accounts ---------- */
textarea.text-input.area { height: auto; min-height: 120px; padding: 12px 16px; font-size: 16px; font-weight: 500; line-height: 1.5; resize: vertical; font-family: inherit; }
.creds { border: 2px solid var(--ink); border-radius: 4px; overflow: hidden; }
.creds-h, .creds-r { display: grid; grid-template-columns: 1.2fr 1fr 1.2fr; gap: 8px; padding: 8px 12px; align-items: center; }
.creds.one .creds-r { grid-template-columns: 90px 1fr; }
.creds-h { background: var(--ink); color: #fff; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.creds-r { border-top: 1px solid var(--rule); font-size: 15px; }
.creds-r:first-child { border-top: 0; }
.creds code { font: 700 15px ui-monospace, Menlo, monospace; }
@media (max-width: 520px) { .creds-h, .creds-r { grid-template-columns: 1fr 1fr; } .creds-h span:first-child, .creds-r span:first-child { grid-column: 1 / -1; } .creds.one .creds-r span:first-child { grid-column: auto; } }

/* ---------- requests to leave ---------- */
.req-bar { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; margin-top: 12px; padding: 10px 12px; background: var(--yellow); border: 2px solid var(--ink); border-radius: 6px; font-size: 14px; font-weight: 700; }
.req-bar svg { width: 18px; height: 18px; flex: none; }
.req-bar span:not(.ul) { flex: 1; }
.req-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--rule); }
.req-row:first-child { border-top: 0; padding-top: 0; }
.req-row .grow { flex: 1; min-width: 140px; }
.req-card { background: var(--yellow); }

/* ---------- catching up ---------- */
.behind-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 0; border-top: 1px solid var(--rule); }
.behind-row:first-child { border-top: 0; padding-top: 0; }
.behind-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.behind-row .score-box { min-width: 64px; height: 28px; font-size: 13px; }
.chips-list { display: flex; flex-wrap: wrap; gap: 6px; }
.name-chip { padding: 5px 10px; border: 2px solid var(--ink); border-radius: 20px; font-size: 14px; font-weight: 700; background: #fff; }
.name-chip:hover { background: var(--yellow); }
.behind-bar { background: var(--pink); }

/* ---------- streak bar ---------- */
.streak-bar { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center; background: #fff; border: 2px solid var(--ink); border-radius: var(--radius); padding: 12px 14px; margin: 6px 0 4px; }
.streak-n { display: flex; align-items: center; gap: 4px; grid-row: span 2; padding-right: 14px; border-right: 2px solid var(--rule); }
.streak-n svg { width: 28px; height: 28px; color: var(--ink-3); }
.streak-n b { font-size: 34px; font-weight: 900; font-stretch: 85%; line-height: 1; }
.streak-n span { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; width: 44px; line-height: 1.15; }
.streak-bar.hot .streak-n svg { color: #f2711c; fill: #ffb02e; }
.streak-days { display: flex; gap: 6px; }
.sd { position: relative; width: 34px; height: 38px; border-radius: 6px; border: 2px solid var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 2px; background: #fff; }
.sd b { font-size: 11px; font-weight: 800; }
.sd svg { width: 16px; height: 16px; position: absolute; top: 3px; }
.sd.on { background: #ffb02e; } .sd.on svg { color: #b4410a; fill: #f2711c; }
.sd.late { background: var(--rule); } .sd.late svg { color: var(--ink-2); }
.sd.miss { border-style: dashed; border-color: var(--ink-3); color: var(--ink-3); }
.sd.today { box-shadow: 0 0 0 3px var(--tag); }
.sd.future { border-color: var(--rule); color: var(--ink-3); }
.streak-msg { font-size: 14px; font-weight: 700; }
@media (max-width: 380px) { .sd { width: 28px; } .streak-n b { font-size: 28px; } }
.working-box { display: block; margin-top: 12px; }
.working-box textarea { margin-top: 4px; min-height: 90px; }

/* How a question felt: rated on the day summary, shown to teachers */
.rate-item { flex-wrap: wrap; }
.rate { display: flex; gap: 6px; width: 100%; margin-top: 8px; }
.rate button { flex: 1; height: 36px; border: 2px solid var(--ink); border-radius: 4px; background: #fff; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.rate button.on.easy { background: var(--green); }
.rate button.on.ok { background: var(--yellow); }
.rate button.on.hard { background: var(--pink); }
.qcell .felt { font-style: normal; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
.felt-bar { display: flex; gap: 2px; margin-top: 6px; font-size: 11px; font-weight: 700; }
.felt-bar span { min-width: max-content; padding: 2px 6px; border: 1.5px solid var(--ink); white-space: nowrap; }
.felt-bar .easy { background: var(--green); } .felt-bar .ok { background: var(--yellow); } .felt-bar .hard { background: var(--pink); }

/* Exam board switch on the profile page */
.seg-pick { display: inline-flex; border: 2px solid var(--ink); border-radius: 4px; overflow: hidden; }
.seg-pick button { border: 0; background: #fff; font: inherit; font-size: 14px; font-weight: 700; padding: 6px 14px; cursor: pointer; }
.seg-pick button + button { border-left: 2px solid var(--ink); }
.seg-pick button.on { background: var(--ink); color: #fff; }

/* The part's opening text, repeated above its later steps */
.step-intro { font-size: 15px; color: var(--ink-2); padding: 0 0 8px; margin-bottom: 8px; border-bottom: 1px dashed var(--rule); line-height: 1.45; }

/* Account forms on the profile */
.acct-form + .acct-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--rule); }

/* Paper schedule, week picker and week-by-week trends (teacher class page) */
.sched-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--rule); }
.sched-row:first-child { border-top: 0; padding-top: 0; }
.sched-row .t { font-weight: 800; font-size: 15px; }
.sched-row .tag { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; padding: 3px 8px; border: 1.5px solid var(--ink); background: #fff; }
.sched-row.now .tag { background: var(--yellow); }
.sched-row.done { opacity: .6; }
.sched-warn { margin: 12px 0 0; padding: 8px 10px; background: var(--pink); }
.sched-add { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--rule); }
.week-pick { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; }
.week-pick button { flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 12px; border: 2px solid var(--ink); background: #fff; font: inherit; cursor: pointer; }
.week-pick button b { font-size: 13px; } .week-pick button small { font-size: 11px; color: var(--ink-2); }
.week-pick button.on { background: var(--ink); color: #fff; } .week-pick button.on small { color: #ddd; }
.trends .legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; margin: 6px 0 10px; }
.trends .legend i { display: inline-block; width: 12px; height: 4px; margin-right: 5px; vertical-align: middle; }
.trend-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.trend-table th, .trend-table td { text-align: left; padding: 6px 4px; border-top: 1px solid var(--rule); }
.trend-table .up { color: #2e7d32; font-weight: 800; font-size: 11px; } .trend-table .down { color: var(--bad); font-weight: 800; font-size: 11px; } .trend-table .flat { color: var(--ink-3); font-size: 11px; }

/* Catch up on last week's paper (student home) */
.card.catchup { display: flex; align-items: center; gap: 12px; background: var(--yellow); }
.card.catchup.on { background: var(--pink); }
.card.catchup .grow { flex: 1; min-width: 0; }

/* Admin users list */
.user-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--rule); }
.user-row:first-child { border-top: 0; padding-top: 0; }
.user-row .t { font-weight: 800; font-size: 15px; }
.user-row .tag { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; padding: 2px 6px; border: 1.5px solid var(--ink); margin-left: 4px; vertical-align: middle; }
.user-row .right { text-align: right; white-space: nowrap; }
.del-user { color: var(--bad); margin-top: 4px; }

/* Admin: one user's details */
.user-open { text-align: left; background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; flex: 1; min-width: 0; }
.user-open:hover .t { text-decoration: underline; }
.act-strip { display: grid; grid-template-columns: repeat(30, 1fr); gap: 3px; }
.act-strip span { aspect-ratio: 1; background: var(--rule); border-radius: 2px; }
.act-strip span.on { background: var(--green-d); }

/* Admin signed in as someone else */
#as-user-bar { position: fixed; top: 0; left: 0; right: 0; min-height: 36px; box-sizing: border-box; z-index: 100; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap;
  padding: 8px 12px; background: #1b1b1b; color: #fff; font-size: 13px; }
#as-user-bar button { font: inherit; font-weight: 800; background: var(--yellow); color: #1b1b1b; border: 0; padding: 5px 12px; cursor: pointer; }
body.as-user { padding-top: 36px; }
