:root {
  --ink: #17251f; --muted: #55645d; --paper: #f5f2e8; --card: #fffdf8; --line: #ddd8c8;
  --green: #0b5a40; --green-2: #0e7a55; --amber: #f2b632; --red: #b93a2a; --sc: var(--green);
  --serif: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', Consolas, 'Roboto Mono', monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 var(--sans); color: var(--ink); background: var(--paper); min-height: 100vh; display: flex; flex-direction: column; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .4em; text-wrap: balance; }
a { color: var(--green); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
[hidden] { display: none !important; }

.topbar { background: var(--green); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-family: var(--serif); font-size: 1.1rem; white-space: nowrap; }
.brand b { color: var(--amber); font-weight: 700; }
.topbar nav { display: flex; align-items: center; gap: 12px; font-size: .9rem; }
.topbar nav a { color: #fff; white-space: nowrap; }
.net { font-size: .75rem; background: rgba(255,255,255,.14); padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.net.off { background: var(--amber); color: #2b2000; }
@media (max-width: 560px) { .net { display: none; } .net.off { display: inline; } }

main { width: 100%; max-width: 1120px; margin: 0 auto; padding: 20px 16px 48px; flex: 1; }
.foot { border-top: 1px solid var(--line); padding: 14px 16px; font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 24px; justify-content: center; text-align: center; }

.btn { border: 1.5px solid var(--green); background: #fff; color: var(--green); padding: 10px 16px; border-radius: 8px; font-weight: 600; cursor: pointer; min-height: 44px; }
.btn:hover { background: #eef6f1; }
.btn.primary { background: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-2); }
.btn.ghost { border-color: var(--line); color: var(--muted); }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn.small { min-height: 34px; padding: 4px 12px; border-color: var(--amber); background: var(--amber); color: #2b2000; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--green); text-decoration: underline; cursor: pointer; }

/* home */
.hero { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; padding: 18px 0 22px; border-bottom: 2px solid var(--ink); margin-bottom: 18px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .74rem; font-weight: 700; color: var(--sc); margin: 0 0 8px; }
.eyebrow .ico { vertical-align: -3px; margin-right: 6px; }
.hero h1 { font-size: clamp(1.7rem, 5vw, 2.7rem); max-width: 18ch; }
.lead { color: var(--muted); max-width: 56ch; margin: 0; }
.hero-stat { text-align: right; max-width: 150px; font-size: .8rem; color: var(--muted); line-height: 1.3; }
.hero-stat b { display: block; font: 700 3rem/1 var(--serif); color: var(--green); }
.hero-stat small { font-size: 1.2rem; color: var(--muted); }
@media (max-width: 640px) { .hero { grid-template-columns: 1fr; } .hero-stat { text-align: left; display: flex; align-items: baseline; gap: 10px; max-width: none; } .hero-stat b { font-size: 2rem; } }

.filters { display: grid; gap: 10px; margin-bottom: 8px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.chips button { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); background: var(--card); border-radius: 99px; padding: 7px 14px; cursor: pointer; font-size: .88rem; min-height: 40px; }
.chips button .ico { color: var(--sc); }
.chips button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chips button.on .ico { color: var(--amber); }
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
input[type=search], .fields input, textarea, select, input[type=number], input[type=text] { border: 1.5px solid var(--line); border-radius: 8px; padding: 9px 12px; background: #fff; min-height: 44px; max-width: 100%; }
#f-q { flex: 1 1 200px; max-width: 320px; }

.subject { margin-top: 26px; }
.subject h2 { display: flex; align-items: center; gap: 10px; font-size: 1.3rem; color: var(--sc); border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.subject h2 small { font: 500 .8rem var(--sans); color: var(--muted); margin-left: auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-top: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--sc); border-radius: 10px; padding: 14px 16px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 6px; transition: transform .12s, box-shadow .12s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(23,37,31,.1); }
.card-top { display: flex; justify-content: space-between; align-items: center; }
.badge { color: var(--sc); display: inline-flex; }
.lvl { font: 600 .72rem var(--mono); background: #efeada; padding: 2px 8px; border-radius: 4px; }
.card h3 { font-size: 1.08rem; margin: 2px 0 0; }
.card p { margin: 0; font-size: .88rem; color: var(--muted); flex: 1; }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .74rem; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 4px; }
.chip { padding: 2px 8px; border-radius: 99px; font-weight: 600; white-space: nowrap; }
.chip.done { background: #d9efe2; color: #0b5a40; }
.chip.started { background: #fbeec6; color: #6b4c00; }
.empty { color: var(--muted); background: #efeada; border-radius: 8px; padding: 14px 16px; }

/* lab page */
.back { display: inline-block; font-size: .88rem; margin-bottom: 10px; }
.lab-head h1 { font-size: clamp(1.5rem, 4.5vw, 2.2rem); }
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 2px solid var(--ink); margin: 14px 0 18px; position: sticky; top: 50px; background: var(--paper); z-index: 10; padding-top: 6px; }
.tabs button { flex: 1 0 auto; border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-radius: 8px 8px 0 0; min-height: 44px; }
.tabs button[aria-selected=true] { background: var(--ink); color: #fff; }
.count { background: var(--amber); color: #2b2000; border-radius: 99px; padding: 0 7px; font-size: .78rem; }
.count:empty { display: none; }
.panel h2 { font-size: 1.15rem; margin-top: 1.2em; }
.panel h2:first-child { margin-top: 0; }
.guide { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(220px, 1fr); gap: 28px; }
.guide aside { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; align-self: start; }
.guide aside ul { padding-left: 1.1em; margin: 0 0 16px; }
.guide ol { padding-left: 1.3em; } .guide li { margin-bottom: 6px; }
.callout { border-left: 4px solid var(--amber); background: #fbf3d9; padding: 10px 14px; border-radius: 0 8px 8px 0; font-size: .92rem; margin-top: 16px; }
@media (max-width: 760px) { .guide { grid-template-columns: 1fr; } }
.formula { font-family: var(--serif); font-size: 1.05rem; background: #efeada; padding: 6px 12px; border-radius: 6px; display: inline-block; }

/* simulations */
.sim { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(260px, 1fr); }
.sim.wide { grid-template-columns: 1fr; }
.stage { background-color: #fbfaf4; background-image: linear-gradient(#e7e2d2 1px, transparent 1px), linear-gradient(90deg, #e7e2d2 1px, transparent 1px); background-size: 20px 20px; padding: 12px; display: flex; align-items: center; justify-content: center; min-height: 260px; }
.stage svg { width: 100%; height: auto; max-height: 62vh; display: block; }
.ctls { padding: 16px; display: flex; flex-direction: column; gap: 12px; border-left: 1px solid var(--line); }
.sim.wide .ctls { border-left: 0; border-top: 1px solid var(--line); }
@media (max-width: 760px) { .sim { grid-template-columns: 1fr; } .ctls { border-left: 0; border-top: 1px solid var(--line); } }
.ctl { display: grid; gap: 4px; font-size: .9rem; font-weight: 600; }
.ctl output { font-family: var(--mono); color: var(--sc); }
.ctl input[type=range] { width: 100%; accent-color: var(--sc); min-height: 32px; }
.ctl select, .ctl input { font-weight: 400; width: 100%; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row .btn { flex: 1 1 auto; }
.readouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.readout { background: #14211b; color: #c7f7d4; border-radius: 8px; padding: 8px 10px; }
.readout span { display: block; font-size: .7rem; color: #9db5a8; text-transform: uppercase; letter-spacing: .05em; }
.readout b { font: 600 1.25rem var(--mono); }
.note { font-size: .9rem; background: #efeada; border-radius: 8px; padding: 10px 12px; margin: 0; min-height: 44px; }
.note.ok { background: #d9efe2; } .note.bad { background: #f7ddd7; } .note.warn { background: #fbeec6; }
.hint { font-size: .88rem; color: var(--muted); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { border: 1.5px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 12px; cursor: pointer; min-height: 42px; font-size: .9rem; }
.seg button.on { background: var(--sc); border-color: var(--sc); color: #fff; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: .9rem; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: #f3efe2; border-radius: 6px; padding: 6px 10px; }
.x { border: 0; background: none; color: var(--red); font-size: 1.2rem; cursor: pointer; min-width: 32px; min-height: 32px; }
.bar { height: 14px; border-radius: 99px; background: #e7e2d2; overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }
.sw { fill: #fff; stroke: #17251f; stroke-width: 2; }
svg text { font-family: var(--sans); }
svg .lbl { font-size: 12px; fill: #44524b; }
svg .clk { cursor: pointer; }

.seg.stack { flex-direction: column; }
.seg.stack button { text-align: left; }
.list.steps { counter-reset: none; }
.list.steps li { background: #d9efe2; }
.inset { background: #111; border-radius: 8px; }
.mono { font-family: var(--mono); }
textarea.code { font: 14px/1.5 var(--mono); background: #14211b; color: #e7f5ec; border-color: #14211b; tab-size: 4; min-height: 220px; }
pre.console { font: 13px/1.5 var(--mono); background: #f3efe2; border-radius: 8px; padding: 10px 12px; margin: 0; white-space: pre-wrap; min-height: 60px; max-height: 260px; overflow: auto; }
pre.console.err { background: #f7ddd7; }
table.sheet { border-collapse: collapse; font-size: .9rem; background: #fff; }
.sheet th { background: #efeada; font-weight: 600; padding: 4px 8px; border: 1px solid #ddd8c8; min-width: 32px; }
.sheet td { border: 1px solid #ddd8c8; padding: 0; }
.sheet td input { border: 0; border-radius: 0; width: 120px; min-height: 38px; padding: 6px 8px; background: transparent; font-variant-numeric: tabular-nums; }
.sheet td.target { background: #fdf3cf; }
.sheet td.good { background: #d9efe2; } .sheet td.bad { background: #f7ddd7; }
.sheet td.head input { font-weight: 700; }
.fbar { display: flex; gap: 8px; align-items: center; font-family: var(--mono); font-size: .9rem; }
.fbar b { min-width: 40px; }
.fbar input { flex: 1; min-height: 40px; font-family: var(--mono); }
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.labels label { display: grid; gap: 2px; font-size: .82rem; font-weight: 700; }
.labels select.good { border-color: #3c9a68; background: #eaf6ee; } .labels select.bad { border-color: #c75b4a; background: #fbecea; }
/* exam */
.exam-banner { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--ink); color: #fff; border-radius: 12px; padding: 16px 20px; margin: 18px 0 4px; }
.exam-banner h2 { margin: 0 0 4px; font-size: 1.25rem; } .exam-banner p { margin: 0; color: #c9d6cf; font-size: .9rem; }
.exam-banner .btn { background: var(--amber); border-color: var(--amber); color: #2b2000; }
.exam-bar { position: sticky; top: 50px; z-index: 12; background: var(--ink); color: #fff; border-radius: 0 0 10px 10px; padding: 8px 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.exam-bar .timer { font: 700 1.3rem var(--mono); color: var(--amber); }
.exam-bar .timer.low { color: #ff8a7a; }
.exam-bar .qnav { display: flex; gap: 6px; }
.exam-bar .qnav button { min-height: 40px; min-width: 44px; border-radius: 8px; border: 1px solid #55645d; background: transparent; color: #fff; font-weight: 700; cursor: pointer; }
.exam-bar .qnav button.on { background: #fff; color: var(--ink); }
.part { border: 1px solid var(--line); border-radius: 10px; background: var(--card); padding: 12px 16px; margin: 0 0 12px; }
.part legend { font-weight: 700; padding: 0 6px; }
.part .marks { float: right; font-size: .8rem; color: var(--muted); font-weight: 600; }
.part input[type=number] { width: 180px; }
.paper-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.grade { font: 700 3rem/1 var(--serif); color: var(--green); }
.mark-ok { color: #0b5a40; font-weight: 700; } .mark-no { color: var(--red); font-weight: 700; }
/* results */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
table.results { border-collapse: collapse; width: 100%; font-size: .9rem; }
.results th, .results td { padding: 8px 10px; border-bottom: 1px solid #ece7d8; text-align: left; vertical-align: top; }
.results th { background: #efeada; font-weight: 700; white-space: nowrap; }
.results td { font-variant-numeric: tabular-nums; }
.results tr:last-child td { border-bottom: 0; }
#graph, .graph-img { width: 100%; max-width: 720px; height: auto; border: 1px solid var(--line); border-radius: 8px; display: block; background: #fff; }
.fitline { font-size: .92rem; }
.analysis { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--sc); border-radius: 0 8px 8px 0; padding: 12px 16px; }
.analysis p { margin: 0 0 6px; } .analysis p:last-child { margin: 0; }
details summary { cursor: pointer; color: var(--green); font-weight: 600; }

/* quiz */
.q { border: 1px solid var(--line); border-radius: 10px; background: var(--card); margin: 0 0 14px; padding: 12px 16px; }
.q legend { font-weight: 700; padding: 0 6px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 6px; border-radius: 6px; cursor: pointer; min-height: 40px; }
.opt:hover { background: #f3efe2; }
.opt input { margin-top: 5px; accent-color: var(--green); }
.q.right { border-color: #7fc09c; } .q.wrong { border-color: #e0a096; }
.opt.correct { background: #d9efe2; font-weight: 600; }
.why { font-size: .9rem; margin: 8px 0 0; color: var(--muted); }
.score { font-size: 1.15rem; }

/* report */
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.fields label { display: grid; gap: 4px; font-size: .85rem; font-weight: 600; }
textarea { width: 100%; resize: vertical; }
.sheet { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 28px; margin-top: 24px; box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.sheet header { display: grid; grid-template-columns: 1fr auto; gap: 16px; border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 12px; }
.sheet-sub { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 700; margin: 0 0 4px; color: var(--muted); }
.sheet dl { margin: 0; font-size: .85rem; display: grid; gap: 2px; min-width: 200px; }
.sheet dl div { display: flex; gap: 8px; } .sheet dt { font-weight: 700; min-width: 54px; } .sheet dd { margin: 0; border-bottom: 1px dotted #999; flex: 1; min-height: 1.3em; }
.sheet h3 { font-size: 1rem; margin: 16px 0 4px; }
.sheet p, .sheet ol { margin: 0 0 6px; } .pre { white-space: pre-wrap; }
.blank { display: block; height: 4.5em; border-bottom: 1px dotted #999; }
.sign { margin-top: 28px !important; font-size: .9rem; } .sheet-score { font-weight: 700; }
@media (max-width: 600px) { .sheet { padding: 16px; } .sheet header { grid-template-columns: 1fr; } }

.prose { max-width: 820px; } .prose h1 { font-size: 2rem; } .prose h2 { font-size: 1.2rem; margin-top: 1.6em; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 80px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 99px; font-size: .9rem; opacity: 0; transition: transform .2s, opacity .2s; z-index: 50; max-width: 90vw; pointer-events: none; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.ok { background: var(--green); } .toast.warn { background: #7a5200; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

@media print {
  body { background: #fff; }
  .topbar, .foot, .tabs, .back, .lab-head, .noprint, .toast, .panel:not([data-panel=report]) { display: none !important; }
  main { padding: 0; max-width: none; }
  .sheet { border: 0; box-shadow: none; padding: 0; margin: 0; }
  .tablewrap { overflow: visible; }
  .graph-img { max-width: 480px; }
  h3 { break-after: avoid; } table, img { break-inside: avoid; }
}
@media (max-width: 480px) { .topbar nav { gap: 10px; font-size: .82rem; } .brand span { font-size: .95rem; } }
.brand i.hm { font-style: normal; }
@media (max-width: 440px) { .brand i.hm { display: none; } .topbar { padding: 10px 12px; } }
.scheme-line { font-size: .85rem; color: var(--muted); margin: 4px 0 0; }
.predict { background: #fbf3d9; border: 1px solid #ecd9a0; border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.predict h2 { font-size: 1.05rem; margin: 0 0 6px; }
.predict p { margin: 0 0 6px; }
.next-lab { margin-top: 18px; }
ol.bank li { margin-bottom: 10px; }
.planner { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 12px; }
.banner-update { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 60; background: var(--ink); color: #fff; border-radius: 12px; padding: 10px 14px; display: flex; gap: 12px; align-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 94vw; }
.banner-update .btn { min-height: 38px; padding: 6px 12px; background: var(--amber); border-color: var(--amber); color: #2b2000; }
.code-box { font: 700 1.2rem var(--mono); background: #14211b; color: #c7f7d4; padding: 10px 14px; border-radius: 8px; display: inline-block; letter-spacing: .05em; }

/* accounts and classes */
.acct-link { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.55); }
.acct-link.on { background: #f2b632; color: #0b3d2c; border-color: #f2b632; }
.acct-link.stale { background: transparent; color: #f2b632; border-color: #f2b632; }
.acct-strip { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: #fff8e1; border: 1px solid #ecd9a0; border-radius: 12px; padding: 12px 16px; margin: 0 0 18px; }
.acct-strip p { margin: 0; flex: 1 1 260px; font-size: .92rem; }
.acct-card { background: #fff; border: 1px solid var(--line, #dfe5dc); border-radius: 14px; padding: 4px 18px 10px; margin: 16px 0; }
.acct-card h2 { margin-top: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line, #dfe5dc); border-radius: 10px; overflow: hidden; margin: 4px 0 12px; }
.seg button { border: 0; background: #fff; padding: 10px 14px; font: inherit; min-height: 40px; cursor: pointer; }
.seg button.on { background: var(--green); color: #fff; }
.progress-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.prog { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; background: #fff; border: 1px solid var(--line, #dfe5dc); border-radius: 10px; padding: 10px 12px; }
.prog span { color: var(--sc); font-weight: 600; display: flex; gap: 6px; align-items: center; }
.prog .bar { grid-column: 1 / -1; height: 8px; background: #edf1ea; border-radius: 6px; overflow: hidden; }
.prog .bar i { display: block; height: 100%; background: var(--sc); }
.prog b { grid-row: 1; grid-column: 2; }
ul.marks li { margin-bottom: 8px; } ul.marks span { color: #3d4b44; }
details.student { border: 1px solid var(--line, #dfe5dc); border-radius: 10px; padding: 8px 14px; margin: 8px 0; background: #fff; }
details.student summary { font-weight: 600; cursor: pointer; min-height: 32px; }
ul.work li { margin: 6px 0; } ul.work small { color: #55645d; }
.sheet.marking { margin: 12px 0 20px; }
.code-box.big { font-size: 1.6rem; letter-spacing: .08em; display: inline-block; padding: 10px 16px; }
@media (max-width: 440px) { .topbar { padding: 10px 12px; } .topbar nav { gap: 9px; } .acct-link { width: 32px; height: 32px; } .acct-link svg { width: 20px; height: 20px; } }
.cl-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 8px 0 14px; }
.cl-tools .ctl { min-width: 200px; margin: 0; }
.cl-tools .btn { flex: 0 0 auto; }
.topbar nav .sm { display: none; }
@media (max-width: 400px) { .topbar nav .lg { display: none; } .topbar nav .sm { display: inline; } }
.row.wrap { flex-wrap: wrap; }
.view-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 8px 0; }
.vopt { display: flex; align-items: center; gap: 6px; background: #fff; border: 1.5px solid var(--line); border-radius: 10px; padding: 6px; cursor: pointer; }
.vopt:has(input:checked) { border-color: var(--green); box-shadow: 0 0 0 2px rgba(11,90,64,.2); }
.vopt span { font-weight: 700; }
.vopt svg { width: 100%; max-width: 100px; height: auto; }
.given { margin: 8px 0 14px; }
.given table.results.data td, .given table.results.data th { text-align: center; }

/* streaks, badges, apparatus, languages and read-aloud */
.streak-line { display: block; margin-top: 8px; font-size: .9rem; font-weight: 600; }
.hero-stat .streak-line { color: var(--green); }
ul.badges { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.badge-item { display: grid; grid-template-columns: 44px 1fr; gap: 2px 10px; align-items: center; background: #f6f7f5; border: 1.5px dashed #9aa59f; border-radius: 12px; padding: 10px; color: #3d4b44; }
.badge-item:not(.on) .medal { filter: grayscale(1); opacity: .6; }
.badge-item.on { background: #fff; border: 1.5px solid var(--sc); color: inherit; }
.badge-item:not(.on) small { color: #4a5852; }
.badge-item .medal { grid-row: span 2; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--sc) 15%, #fff); color: var(--sc); }
.badge-item small { color: var(--muted); }
.app-svg { width: 100%; height: auto; max-height: 260px; }
.app-svg.big { max-height: 420px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.app-card { align-items: center; text-align: center; }
.app-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 20px; align-items: start; }
@media (max-width: 720px) { .app-detail { grid-template-columns: 1fr; } }
.btn.say { float: right; margin: 0 0 8px 8px; display: inline-flex; align-items: center; gap: 6px; }
.btn.say.on, .say-q.on { background: var(--green); color: #fff; }
.say-q { border: 1px solid var(--line); background: #fff; border-radius: 8px; min-width: 34px; min-height: 32px; margin-left: 6px; cursor: pointer; vertical-align: middle; }
.foot .lang { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.foot .lang select { padding: 4px 6px; border-radius: 6px; }

/* accessibility: skip link, focus, larger text, high contrast */
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: #fff; color: #0b3d2c; padding: 10px 14px; border-radius: 8px; font-weight: 700; }
.skip-link:focus { top: 8px; }
:focus-visible { outline: 3px solid #f2b632; outline-offset: 2px; }
#app:focus, #app h1:focus { outline: none; }
html.a11y-large { font-size: 118%; }
html.a11y-large .lbl { font-size: 13px; }
html.a11y-contrast { --muted: #1d2a24; --line: #2b3a33; }
html.a11y-contrast body { background: #fff; color: #000; }
html.a11y-contrast a { color: #003d99; text-decoration: underline; }
html.a11y-contrast .btn { border-width: 2px; border-color: #000; }
html.a11y-contrast .hint, html.a11y-contrast small { color: #1d2a24; }
html.a11y-contrast .card { border: 2px solid #000; }
.foot-links { display: inline-flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.foot-links button[aria-pressed="true"] { font-weight: 700; text-decoration: underline; }
label.check { display: block; position: relative; padding-left: 28px; margin: 10px 0; line-height: 1.45; }
label.check input { position: absolute; left: 0; top: 2px; margin: 0; width: 18px; height: 18px; }
fieldset.age { border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px 10px; margin: 10px 0; }
.privacy h2 { margin-top: 22px; }

/* report cards, re-teach, certificates */
.report-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 22px; margin: 14px 0; }
.report-card header { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; border-bottom: 2px solid var(--green); padding-bottom: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.report-card header h1, .report-card header h2 { margin: 0; }
table.rc-id { width: 100%; border-collapse: collapse; margin: 6px 0 12px; }
table.rc-id th { text-align: left; width: 14%; color: var(--muted); font-weight: 600; padding: 4px 6px; }
table.rc-id td { padding: 4px 6px; border-bottom: 1px solid var(--line); }
.rc-lines { height: 72px; background: repeating-linear-gradient(to bottom, transparent 0 23px, #bbb 23px 24px); }
.rc-sign { display: flex; justify-content: space-between; margin-top: 28px; }
.rc-sign span { border-top: 1px solid #555; padding-top: 4px; width: 40%; font-size: .85rem; color: var(--muted); }
ol.reteach-list > li { margin-bottom: 14px; }
ol.reteach-list p { margin: 2px 0; }
.certificate { page: cert; max-width: 1000px; margin: 16px auto; aspect-ratio: 297 / 210; background: #fffdf6; border: 10px double #b98a14; padding: 24px; display: flex; }
.cert-in { border: 1.5px solid #b98a14; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; gap: 4px; }
.cert-in h1 { font-size: clamp(1.6rem, 4vw, 2.6rem); color: #0b3d2c; margin: 4px 0 10px; }
.cert-name { font-size: clamp(1.4rem, 3.6vw, 2.2rem); font-weight: 700; border-bottom: 1.5px solid #555; min-width: 60%; padding: 4px 10px; margin: 6px 0 10px; }
.cert-badge { font-weight: 700; color: #b98a14; letter-spacing: .04em; text-transform: uppercase; }
.cert-foot { display: flex; justify-content: space-between; width: 80%; margin-top: 26px; }
.cert-foot span { border-top: 1px solid #555; padding-top: 4px; min-width: 38%; }
@page cert { size: A4 landscape; margin: 10mm; }
@media print {
  .report-card { border: 0; padding: 0; break-after: page; }
  .cards-print .report-card:last-child { break-after: auto; }
  body.printing-cards #app > article > *:not(#cl-body), body.printing-cards #cl-body > *:not(#rep-view), body.printing-cards #rep-view > :not(#rc-out) { display: none !important; }
  .certificate { border-width: 8px; margin: 0; max-width: none; width: 100%; }
}
.cq-add { margin: 10px 0; }
.cq-add summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.cq-opt { display: grid; grid-template-columns: 22px 18px 1fr; gap: 8px; align-items: center; }
.cq-opt input[type="radio"] { width: 18px; height: 18px; margin: 0; }
textarea { width: 100%; font: inherit; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
/* 3D globe */
.globe { position: relative; display: flex; flex-direction: column; align-items: center; width: 100%; }
.globe canvas { touch-action: none; cursor: grab; max-width: 100%; }
.globe canvas:active { cursor: grabbing; }
.globe-btns { position: absolute; right: 0; top: 0; display: flex; flex-direction: column; gap: 6px; }
.globe-btns .btn { min-width: 40px; min-height: 40px; padding: 4px 8px; background: rgba(255,255,255,.9); font-weight: 700; }
.globe-hint { margin: 6px 0 0; font-size: .8rem; color: #5a6a62; }
.stage.globe-host { background: radial-gradient(circle at 50% 45%, #1f3550 0%, #0e1a2b 70%); }
.stage.globe-host .globe-hint { color: #c9d6e6; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .82rem; }
.legend i { display: inline-block; width: 12px; height: 12px; margin-right: 5px; vertical-align: -1px; border: 1px solid rgba(0,0,0,.35); }
table.data { border-collapse: collapse; font-size: .88rem; background: #fff; margin: 6px 0; }
table.data th, table.data td { border: 1px solid var(--line); padding: 3px 8px; text-align: center; }
table.data th { background: #f1ede1; }
.m3d { position: relative; display: flex; flex-direction: column; align-items: center; width: 100%; }
.m3d canvas { touch-action: none; cursor: grab; max-width: 100%; }
.stage.m3d-host { background: radial-gradient(circle at 50% 40%, #fdfbf4 0%, #e9e4d4 100%); }
/* demonstrations and revision cards */
.demo-start { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 0 0 10px; }
.demo-cap { position: sticky; top: 56px; z-index: 12; background: #17251f; color: #fff; border-radius: 10px; padding: 10px 14px; margin: 0 0 10px; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.demo-cap p { margin: 0 0 6px; font-size: 1rem; line-height: 1.4; }
.demo-cap .btn { background: #fff; color: #17251f; }
.card-flash { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin: 14px 0; box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.card-flash h2 { margin-top: 4px; }
.rv-opts li { margin: 4px 0; }
/* JAMB-style CBT */
.cbt { max-width: 860px; margin: 0 auto; }
.cbt-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 0 0 12px 12px; position: sticky; top: 50px; z-index: 12; }
.cbt-top .btn { margin-left: auto; }
.cbt-time { font-variant-numeric: tabular-nums; font-weight: 700; background: rgba(255,255,255,.15); padding: 3px 10px; border-radius: 8px; }
.cbt-time.low { background: #b3261e; }
.cbt-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.cbt-tabs button { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 12px; font: inherit; cursor: pointer; min-height: 44px; }
.cbt-tabs button.on { background: #1f6f43; color: #fff; border-color: #1f6f43; }
.cbt-q { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.cbt-q h2 { font-size: 1.1rem; line-height: 1.45; }
.cbt-opt { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; cursor: pointer; min-height: 44px; }
.cbt-opt.on { border-color: #1f6f43; background: #e8f4ec; }
.cbt-nav { justify-content: space-between; margin: 12px 0; }
.cbt-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; }
.cbt-map button { min-height: 40px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; cursor: pointer; }
.cbt-map button.done { background: #1f6f43; color: #fff; border-color: #1f6f43; }
.cbt-map button.cur { outline: 3px solid #e0a800; outline-offset: 1px; }
ol.bank li { margin: 8px 0; }
ol.bank li.bad b { color: #b3261e; }
ol.bank li.ok b { color: #1f6f43; }
@media (max-width: 520px) { .cbt-top > b { display: none; } }
/* lesson plans */
.plan .sheet { padding: 20px; }
.plan-head h1 { margin: 0 0 8px; }
table.plan-meta, table.plan-steps { width: 100%; border-collapse: collapse; font-size: .92rem; margin: 6px 0 12px; }
table.plan-meta th, table.plan-meta td, table.plan-steps th, table.plan-steps td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
table.plan-meta th { background: #f4f1e8; width: 16%; white-space: nowrap; }
table.plan-meta input { width: 100%; border: 0; border-bottom: 1px dotted #999; background: transparent; font: inherit; padding: 2px 0; min-height: 0; }
table.plan-steps th { background: #f4f1e8; }
table.plan-steps th:nth-child(1) { width: 14%; } table.plan-steps th:nth-child(2) { width: 30%; } table.plan-steps th:nth-child(3) { width: 34%; }
.plan-opts { display: block; font-size: .88rem; color: var(--muted); }
table.plan-steps ol { margin: 4px 0 0; padding-left: 18px; }
.plan-ans { display: block; color: #1f6f43; font-size: .88rem; }
.plan-lines { margin: 14px 0; }
ul.plan-list { list-style: none; padding: 0; }
ul.plan-list li { padding: 6px 0; border-bottom: 1px solid var(--line); }
ul.plan-list small { display: block; color: var(--muted); }
/* sign-in slips for imported students */
.slips { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: 12px; }
.slip { border: 1.5px dashed #888; border-radius: 8px; padding: 10px 12px; break-inside: avoid; background: #fff; }
.slip p { margin: 0 0 4px; }
.slip-name { font-weight: 700; font-size: 1.05rem; }
.slip table { border-collapse: collapse; margin: 4px 0 6px; }
.slip td { padding: 2px 10px 2px 0; }
.slip .hint { font-size: .78rem; }
@media print {
  .plan .sheet { padding: 0; border: 0; box-shadow: none; }
  .plan h2 { font-size: 1.02rem; margin: 12px 0 4px; break-after: avoid; }
  table.plan-steps { break-inside: auto; } table.plan-meta { break-inside: avoid; }
  .plan .tablewrap { overflow: visible; }
  .plan-opts { color: #333; }
  .plan-ans { color: #000; }
  body.printing-slips #app > article > *:not(#cl-body), body.printing-slips #cl-body > *:not(#rep-view), body.printing-slips #rep-view .import > :not(.slips) { display: none !important; }
  body.printing-slips .slips { grid-template-columns: repeat(3, 1fr); gap: 6px; }
}
