:root {
  --bg: #faf9f5;
  --surface: #ffffff;
  --surface-2: #f3f1ea;
  --ink: #141413;
  --ink-2: #5e5d59;
  --ink-3: #8a8880;
  --line: #e6e3d9;
  --line-2: #d6d2c4;
  --accent: #d97757;
  --accent-ink: #b45a3c;
  --accent-soft: #f6e3da;
  --good: #4f7a52;
  --good-soft: #e3ecdf;
  --mid: #b98a2e;
  --mid-soft: #f4ead2;
  --bad: #b5523b;
  --bad-soft: #f5e0d9;
  --hl: rgba(255, 214, 10, .38);
  --radius: 12px;
  --dock: 400px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --serif: "Tiempos Headline", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Styrene A", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; transition: padding .25s var(--ease); }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: clamp(30px, 4vw, 42px); line-height: 1.1; }
h2 { font-size: 24px; line-height: 1.2; }
h3 { font-size: 18px; line-height: 1.3; }
p { margin: 0; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }

/* ---------- animations ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.94); opacity: 0; } 60% { transform: scale(1.02); opacity: 1; } 100% { transform: scale(1); } }
@keyframes bubblePop { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes grow { from { width: 0; } }
@keyframes drawLine { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes winIn { from { opacity: 0; transform: scale(.97) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.route-in > * { animation: fadeUp .35s var(--ease) both; }
.fade-in { animation: fadeUp .4s var(--ease) both; }
.slide-in { animation: slideIn .3s var(--ease) both; }
.pop-in { animation: pop .32s var(--ease) both; }
.stagger { animation: fadeUp .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
.meter > span { width: var(--w); animation: grow .8s var(--ease) both; }
.chart .bar.grow { animation: grow .7s var(--ease) both; animation-delay: var(--d); }
.chart .line.draw { stroke-dasharray: 1; animation: drawLine 1s var(--ease) both; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(16px, 3vw, 36px); background: rgba(250, 249, 245, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { text-decoration: none; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; }
.topnav { display: flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.topnav a { text-decoration: none; padding: 6px 11px; border-radius: 8px; color: var(--ink-2); font-size: 14px; transition: background .15s, color .15s; }
.topnav a:hover { background: var(--surface-2); color: var(--ink); }
.topnav a.active { background: var(--ink); color: var(--bg); }
body.exam-mode .topbar { display: none; }
main { max-width: 1120px; margin: 0 auto; padding: 36px clamp(16px, 4vw, 40px) 96px; outline: none; }
body.dock-left main, body.dock-left .exam-bar { margin-left: var(--dock); }
body.dock-right main, body.dock-right .exam-bar { margin-right: var(--dock); }
body.dock-left main, body.dock-right main { max-width: none; }

/* ---------- generic ---------- */
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 600; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spacer { flex: 1; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 9px;
  border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .1s; }
.btn:hover { background: var(--surface-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.primary:hover { background: #2c2b28; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.lg { height: 46px; padding: 0 24px; font-size: 15px; }
.btn.flagged { background: var(--mid-soft); border-color: #e2cf9f; color: #7a5b1c; }
.linkish { border: 0; background: none; padding: 0; text-decoration: underline; cursor: pointer; color: var(--ink-2); }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.mid { background: var(--mid-soft); color: var(--mid); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.accent { background: var(--accent-soft); color: var(--accent-ink); }
.src-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--ink-2); }
.src-badge.src-os { border-color: #c9d6e3; color: #44607a; background: #eef3f8; }
.src-badge.src-ap { border-color: #ead2c6; color: var(--accent-ink); background: var(--accent-soft); }
.in { width: 100%; height: 38px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface); font: inherit; color: var(--ink); }
textarea.in { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.in:focus, textarea:focus, .bubble:focus-visible, .btn:focus-visible, .opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num-in { width: 80px; height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); font: inherit; }
.meter { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 99px; background: var(--ink-3); }
.meter.good > span { background: var(--good); } .meter.mid > span { background: var(--mid); } .meter.bad > span { background: var(--bad); }
.empty { padding: 26px; text-align: center; color: var(--ink-2); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 95; }
.kbd { font: 11px var(--mono); padding: 1px 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; background: var(--surface); color: var(--ink-2); }
.attrib { font-size: 12px; color: var(--ink-3); margin-top: 18px; }
.attrib a { color: var(--ink-2); }

/* ---------- dashboard ---------- */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: end; margin-bottom: 30px; }
.hero p.lede { font-size: 17px; color: var(--ink-2); margin-top: 14px; max-width: 56ch; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stat { background: var(--surface); padding: 16px 18px; }
.stat b { display: block; font-family: var(--serif); font-weight: 500; font-size: 30px; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--ink-3); }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-card { padding: 18px 18px 12px; }
.cc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.chart { position: relative; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis, .chart .ylab, .chart .val, .chart .cut-l { font: 11px var(--sans); fill: var(--ink-3); }
.chart .ylab { fill: var(--ink-2); font-size: 12px; }
.chart .val { fill: var(--ink-2); font-weight: 600; }
.chart .cut { stroke: var(--line-2); stroke-dasharray: 3 4; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.chart .pt { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart .pt.test, .chart .pt.printed { fill: var(--ink); }
.chart .track { fill: var(--surface-2); }
.chart .bar { fill: var(--ink-3); } .chart .bar.good { fill: var(--good); } .chart .bar.mid { fill: var(--mid); } .chart .bar.bad { fill: var(--bad); }
.chart .hit { fill: transparent; cursor: pointer; }
.chart-empty { height: 200px; display: flex; align-items: center; justify-content: center; color: var(--ink-3); font-size: 14px; text-align: center; border: 1px dashed var(--line-2); border-radius: 10px; }
.ctip { position: absolute; z-index: 5; background: var(--ink); color: var(--bg); font-size: 12px; line-height: 1.45; padding: 8px 10px; border-radius: 8px; pointer-events: none; white-space: nowrap; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 38px 0 16px; flex-wrap: wrap; }
.units { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.unit-card { padding: 20px; text-decoration: none; display: flex; flex-direction: column; gap: 14px; transition: border-color .15s, transform .2s var(--ease), box-shadow .2s; }
.unit-card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.num { font-family: var(--serif); font-size: 14px; color: var(--accent-ink); }
.unit-card .lessons { font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.unit-card .foot { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--ink-3); }
.focus-list { display: grid; gap: 8px; }
.focus-item { display: flex; align-items: center; gap: 14px; padding: 12px 16px; flex-wrap: wrap; }
.focus-item .score { font-family: var(--serif); font-size: 22px; width: 60px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 8px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--ink-2); transition: background .15s, color .15s; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); font-weight: 600; }
.seg.sm button { padding: 4px 10px; font-size: 12px; }

/* ---------- unit / tests ---------- */
.crumbs { font-size: 13px; color: var(--ink-3); margin-bottom: 14px; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.unit-head { display: grid; grid-template-columns: 1fr 280px; gap: 32px; align-items: start; margin-bottom: 22px; }
.score-box { padding: 20px; }
.score-box .big { font-family: var(--serif); font-size: 44px; line-height: 1; }
.note { padding: 12px 16px; border-radius: 10px; background: var(--mid-soft); color: #7a5b1c; font-size: 13px; margin-top: 16px; }
.test-card { padding: 18px 20px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; border-color: #ead2c6; background: linear-gradient(0deg, #fff, #fff), var(--surface); box-shadow: inset 4px 0 0 var(--accent); }
.bank-actions { padding: 16px 20px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 24px; }
.lesson-row { display: grid; grid-template-columns: 1fr 150px auto; gap: 20px; align-items: center; padding: 18px 20px; }
.lesson-row + .lesson-row { border-top: 1px solid var(--line); }
.lesson-row .meta { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.lesson-row .actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.lesson-score { font-size: 12px; color: var(--ink-2); display: grid; gap: 6px; }
.rand { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; height: 32px; }
.rand select { border: 0; background: var(--surface-2); height: 100%; padding: 0 6px; font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; }
.rand button { border: 0; background: var(--surface); height: 100%; padding: 0 12px; cursor: pointer; font-size: 13px; font-weight: 500; }
.rand button:hover { background: var(--surface-2); }
.tests-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.test-tile { padding: 18px; display: flex; flex-direction: column; gap: 8px; min-height: 170px; }
.backup { padding: 18px 20px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }

/* ---------- builder ---------- */
.builder { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.units-pick { padding: 6px 0; }
.pick-unit { padding: 12px 20px; }
.pick-unit + .pick-unit { border-top: 1px solid var(--line); }
.pick-unit > label { font-weight: 600; }
.pick-lessons, .src-picks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.src-picks { margin-top: 0; }
.chk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 13px; cursor: pointer; user-select: none; background: var(--surface); transition: background .15s, color .15s; }
.chip input { display: none; }
.chip:has(input:checked) { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip .c { color: var(--ink-3); font-size: 12px; }
.chip:has(input:checked) .c { color: #bdbab0; }
.panel { padding: 20px; position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; }
.panel .field + .field { margin-top: 18px; }
.lbl { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .06em; }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
.switch { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; padding: 6px 0; font-size: 14px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .sw { flex: none; width: 34px; height: 20px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .2s; margin-top: 1px; }
.switch .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.switch input:checked + .sw { background: var(--accent); }
.switch input:checked + .sw::after { transform: translateX(14px); }
.switch input:focus-visible + .sw { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch b { font-weight: 500; display: block; } .switch em { font-style: normal; font-size: 12px; color: var(--ink-3); display: block; }

/* ---------- question card & answers ---------- */
.session { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 28px; align-items: start; }
.session-head, .exam-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.q-card { padding: 28px; }
.q-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; font-size: 13px; color: var(--ink-3); }
.q-body { position: relative; }
.q-figure { display: block; max-width: 100%; height: auto; mix-blend-mode: multiply; cursor: zoom-in; }
.ctx-wrap { border-bottom: 1px dashed var(--line-2); margin-bottom: 18px; padding-bottom: 16px; }
.ctx-label { font-size: 12px; color: var(--ink-3); margin-bottom: 6px; }
.q-img-wrap { overflow-x: auto; }
.q-html { font-size: 16px; line-height: 1.6; }
.q-html p { margin: 0 0 10px; }
.q-html img { max-width: 100%; height: auto; mix-blend-mode: multiply; }
.q-html ol, .q-html ul { margin: 6px 0 10px 22px; padding: 0; }
.q-html ol[type="a"] { list-style-type: lower-alpha; }
.q-html table { border-collapse: collapse; margin: 8px 0; font-size: 14px; }
.q-html td, .q-html th { border: 1px solid var(--line-2); padding: 4px 10px; }
.q-html figure { margin: 10px 0; }
.q-html figcaption, .q-html .os-caption-container { font-size: 13px; color: var(--ink-2); }
math { font-size: 1.05em; }
.prompt { margin: 24px 0 12px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.bubbles { display: flex; gap: 10px; flex-wrap: wrap; }
.bubble { width: 52px; height: 52px; border-radius: 50%; border: 1.5px solid var(--line-2); background: var(--surface); font-family: var(--serif); font-size: 20px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: background .15s, border-color .15s, color .15s, transform .1s; }
.bubble.sm { width: 36px; height: 36px; font-size: 15px; }
.bubbles.multi .bubble { border-radius: 12px; }
.bubble:hover:not(:disabled) { border-color: var(--ink); }
.bubble.sel { background: var(--ink); border-color: var(--ink); color: var(--bg); animation: bubblePop .25s var(--ease); }
.bubble.right { background: var(--good); border-color: var(--good); color: #fff; animation: bubblePop .3s var(--ease); }
.bubble.wrong { background: var(--bad); border-color: var(--bad); color: #fff; animation: bubblePop .3s var(--ease); }
.bubble.missed { border-color: var(--good); border-width: 2.5px; color: var(--good); }
.bubble:disabled { cursor: default; }
.opts { display: grid; gap: 8px; }
.opt { display: flex; gap: 14px; align-items: flex-start; text-align: left; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; font-size: 15px; line-height: 1.5; }
.opt:hover:not(:disabled) { border-color: var(--ink-3); }
.opt .bub { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--line-2); display: inline-flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 15px; transition: all .15s; }
.opts.multi .opt .bub { border-radius: 8px; }
.opt .otext { padding-top: 3px; min-width: 0; } .opt .otext p { margin: 0; } .opt .otext img { max-width: 100%; height: auto; mix-blend-mode: multiply; }
.opt.sel { border-color: var(--ink); } .opt.sel .bub { background: var(--ink); border-color: var(--ink); color: var(--bg); animation: bubblePop .25s var(--ease); }
.opt.right { border-color: var(--good); background: var(--good-soft); } .opt.right .bub { background: var(--good); border-color: var(--good); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); } .opt.wrong .bub { background: var(--bad); border-color: var(--bad); color: #fff; }
.opt.missed { border-color: var(--good); } .opt.missed .bub { border-color: var(--good); color: var(--good); border-width: 2.5px; }
.opt:disabled { cursor: default; color: inherit; }
.q-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 22px; }
.feedback { margin-top: 18px; padding: 14px 16px; border-radius: 10px; font-size: 14px; }
.feedback.good { background: var(--good-soft); color: var(--good); } .feedback.bad { background: var(--bad-soft); color: var(--bad); }
.solution { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 18px; animation: fadeUp .3s var(--ease) both; }
.solution .eyebrow { margin-bottom: 10px; }
.frq-parts { display: grid; gap: 14px; margin-top: 8px; }
.frq-part { display: grid; grid-template-columns: 38px 1fr; gap: 10px; align-items: start; }
.frq-part .lab { font-family: var(--serif); font-size: 18px; height: 38px; display: flex; align-items: center; justify-content: center; border-radius: 9px; background: var(--surface-2); }
.frq-part textarea { width: 100%; min-height: 84px; resize: vertical; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--bg); font: 14px/1.5 var(--sans); color: var(--ink); }
.frq-part textarea[readonly] { background: var(--surface-2); }
.grade { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.grade .gl { font-size: 12px; color: var(--ink-3); margin-right: 4px; }
.grade button { height: 30px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; cursor: pointer; transition: all .15s; }
.grade button:hover { background: var(--surface-2); }
.grade button.on[data-g="1"] { background: var(--good); border-color: var(--good); color: #fff; }
.grade button.on[data-g="0.5"] { background: var(--mid); border-color: var(--mid); color: #fff; }
.grade button.on[data-g="0"] { background: var(--bad); border-color: var(--bad); color: #fff; }
.nav-row { display: flex; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.side { position: sticky; top: 76px; padding: 18px; }
.side .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 6px; margin-top: 12px; max-height: 288px; overflow-y: auto; padding: 3px 4px 3px 2px; scrollbar-width: thin; }
.dot { aspect-ratio: 1; min-width: 0; font-variant-numeric: tabular-nums; letter-spacing: -.02em; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); font-size: 11px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--ink-2); transition: all .15s; position: relative; }
.dot.cur { border-color: var(--ink); border-width: 2px; color: var(--ink); font-weight: 700; }
.dot.ans { background: var(--surface-2); }
.dot.flag::after { content: ""; position: absolute; top: -3px; right: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--mid); border: 2px solid var(--surface); }
.dot.right { background: var(--good-soft); border-color: #b9cfb4; color: var(--good); }
.dot.wrong { background: var(--bad-soft); border-color: #e3bcb0; color: var(--bad); }
.dot.partial { background: var(--mid-soft); border-color: #e2cf9f; color: var(--mid); }
.side .tally { margin-top: 14px; font-size: 13px; color: var(--ink-2); display: grid; gap: 4px; }
.done-card { padding: 36px; text-align: center; }
.done-card .big { font-family: var(--serif); font-size: 56px; line-height: 1; margin: 12px 0; }

/* ---------- toolbar + tool windows ---------- */
.toolbar { display: flex; gap: 4px; flex-wrap: wrap; }
.tool-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-size: 13px; transition: all .15s; }
.tool-btn:hover { background: var(--surface-2); }
.tool-btn.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.tool-btn .ti { font-family: var(--serif); font-style: italic; font-size: 14px; min-width: 14px; text-align: center; }
.hl-ic { width: 14px; height: 10px; background: var(--hl); border: 1px solid #c9a400; border-radius: 2px; display: inline-block; }
.tw { position: fixed; z-index: 60; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 12px 40px rgba(20, 20, 19, .14), 0 2px 6px rgba(20,20,19,.06);
  display: flex; flex-direction: column; overflow: hidden; transition: left .22s var(--ease), top .22s var(--ease), width .22s var(--ease), height .22s var(--ease); }
.tw.tw-in { animation: winIn .22s var(--ease) both; }
.tw.dragging, body.tw-dragging .tw { transition: none; }
.tw[data-dock="left"], .tw[data-dock="right"] { border-radius: 0; box-shadow: none; border-top: 0; }
.tw[data-dock="left"] { border-left: 0; } .tw[data-dock="right"] { border-right: 0; }
.tw-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); cursor: grab; user-select: none; touch-action: none; }
.tw.dragging .tw-head { cursor: grabbing; }
.tw-grip { color: var(--ink-3); font-size: 12px; letter-spacing: -2px; }
.tw-title { font-size: 13px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tw-btns { display: flex; gap: 2px; }
.tw-b { width: 26px; height: 26px; border: 0; border-radius: 6px; background: transparent; cursor: pointer; color: var(--ink-2); font-size: 13px; }
.tw-b:hover { background: var(--surface); color: var(--ink); }
.tw[data-dock="left"] [data-dock="left"], .tw[data-dock="right"] [data-dock="right"], .tw[data-dock="float"] [data-dock="float"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line-2); }
.tw-body { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.tw-resize { position: absolute; right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize; background: linear-gradient(135deg, transparent 50%, var(--line-2) 50%, var(--line-2) 60%, transparent 60%, transparent 70%, var(--line-2) 70%, var(--line-2) 80%, transparent 80%); }
.tw[data-dock="left"] .tw-resize, .tw[data-dock="right"] .tw-resize { display: none; }
.desmos { flex: 1; width: 100%; border: 0; min-height: 0; }
.tw-foot { padding: 6px 12px; border-top: 1px solid var(--line); }
body[data-dock-hint="left"]::before, body[data-dock-hint="right"]::before { content: ""; position: fixed; top: 0; bottom: 0; width: var(--dock); background: rgba(217, 119, 87, .12); border: 2px dashed var(--accent); z-index: 55; pointer-events: none; animation: fadeUp .15s both; }
body[data-dock-hint="left"]::before { left: 0; } body[data-dock-hint="right"]::before { right: 0; }
.nw { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.nw-new { display: grid; gap: 8px; }
.nw-title { height: 34px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 10px; font: inherit; }
.nw-body { min-height: 110px; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; font: 14px/1.5 var(--sans); resize: vertical; background: var(--bg); }
.nw-item { padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.nw-item p { margin: 4px 0; color: var(--ink-2); }
.eqsheet { padding: 12px 16px 20px; font-size: 13px; }
.eqsheet h4 { font-family: var(--serif); font-weight: 500; font-size: 15px; margin: 18px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.eq-note { font-size: 12px; color: var(--ink-3); margin: 4px 0; }
.eq-t { width: 100%; border-collapse: collapse; }
.eq-t td, .eq-t th { padding: 4px 6px; vertical-align: top; border-bottom: 1px solid var(--surface-2); }
.eq-t .vars { font-size: 11.5px; color: var(--ink-2); width: 38%; border-left: 1px solid var(--line); padding-left: 10px; line-height: 1.6; }
.eq-t.trig th, .eq-t.trig td { text-align: center; }
.eq-t.compact td { font-size: 12px; }
.lw { padding: 12px 16px; }
.lw-head { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.lw-pick { flex: 1; height: 32px; border-radius: 8px; border: 1px solid var(--line-2); font: inherit; font-size: 13px; padding: 0 8px; min-width: 0; }

/* highlighter */
.hl-host { position: relative; }
.hl-layer { position: absolute; inset: 0; pointer-events: none; }
.hl { position: absolute; background: var(--hl); border-radius: 3px; mix-blend-mode: multiply; }
.hl.ghost { outline: 1px dashed #c9a400; }
body.hl-mode .hl-host { cursor: crosshair; user-select: none; }
body.hl-mode .hl-layer .hl { pointer-events: auto; cursor: pointer; }
body.hl-mode .hl-layer .hl:hover { outline: 2px solid var(--bad); }
body.hl-mode .q-figure { cursor: crosshair; }

/* ---------- exam ---------- */
.exam-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; padding: 10px clamp(14px, 2vw, 28px); background: rgba(250, 249, 245, .95); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.eb-left { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; } .eb-left b { font-size: 14px; } .eb-left span { font-size: 12px; }
.eb-mid { flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.timer { font: 600 20px var(--mono); padding: 4px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); min-width: 96px; text-align: center; transition: color .2s, background .2s; }
.timer.hidden-t { color: transparent; background: var(--surface-2); min-width: 40px; width: 40px; overflow: hidden; padding: 4px; }
.timer.low { color: var(--bad); animation: pulse 1.4s ease-in-out infinite; }
.timer.over { color: #fff; background: var(--bad); border-color: var(--bad); font-size: 15px; }
.pace { font-size: 13px; color: var(--ink-2); padding: 4px 10px; border-radius: 8px; background: var(--surface-2); }
.pace.over { color: var(--bad); background: var(--bad-soft); }
.exam-wrap { max-width: 860px; margin: 0 auto; }
.qdots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 22px; }
.qdots .dot { width: 34px; }
.fs-banner { position: sticky; top: 60px; z-index: 29; margin: 0 auto; max-width: 560px; background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; }
.exam-intro { max-width: 720px; margin: 20px auto; padding: 34px; }
.intro-sections { display: grid; gap: 8px; margin: 6px 0 18px; }
.intro-sec { display: flex; justify-content: space-between; padding: 12px 16px; border-radius: 10px; background: var(--surface-2); font-size: 14px; }
.intro-rules { margin: 0; padding-left: 20px; color: var(--ink-2); display: grid; gap: 6px; font-size: 14px; }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.legend i { width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line-2); display: inline-block; }
.lg-ans { background: var(--surface-2); } .lg-un { background: var(--surface); } .lg-fl { background: var(--mid-soft); border-color: #e2cf9f !important; }
.review-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.rv { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; position: relative; text-align: left; transition: transform .12s, border-color .15s; }
.rv:hover { transform: translateY(-1px); border-color: var(--ink-3); }
.rv b { font-family: var(--serif); font-size: 18px; font-weight: 500; } .rv span { font-size: 12px; color: var(--ink-3); }
.rv.ans { background: var(--surface-2); } .rv.flag { background: var(--mid-soft); border-color: #e2cf9f; }
.rv em { position: absolute; top: 6px; right: 8px; font-style: normal; color: var(--mid); }
.entry-sheet { padding: 8px 20px; }
.entry-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.entry-row:last-child { border-bottom: 0; }
.entry-row > b { width: 34px; font-family: var(--serif); font-weight: 500; font-size: 17px; }
details.qd summary { cursor: pointer; font-size: 13px; color: var(--ink-2); margin-bottom: 10px; }
.result-hero { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 20px; align-items: center; }
.rh-col { display: flex; flex-direction: column; gap: 4px; }
.rh-big { font-family: var(--serif); font-weight: 500; font-size: 52px; line-height: 1; }
.rh-arrow { font-size: 26px; color: var(--ink-3); }
.rh-ap { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 22px; border-radius: 14px; background: var(--surface-2); animation: pop .5s .3s var(--ease) both; }
.rh-ap b { font-family: var(--serif); font-weight: 500; font-size: 56px; line-height: 1; }
.rh-ap.good { background: var(--good-soft); color: var(--good); } .rh-ap.mid { background: var(--mid-soft); color: var(--mid); } .rh-ap.bad { background: var(--bad-soft); color: var(--bad); }
.result-split { display: flex; gap: 32px; flex-wrap: wrap; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.result-split > div { display: flex; flex-direction: column; gap: 2px; } .result-split b { font-family: var(--serif); font-weight: 500; font-size: 24px; }
.review-list { display: grid; gap: 8px; }
.rq summary { display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer; list-style: none; flex-wrap: wrap; }
.rq summary::-webkit-details-marker { display: none; }
.rq summary > b { font-family: var(--serif); font-weight: 500; font-size: 18px; width: 28px; }
.rq-st { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.rq-st.right { background: var(--good-soft); color: var(--good); } .rq-st.wrong { background: var(--bad-soft); color: var(--bad); } .rq-st.partial { background: var(--mid-soft); color: var(--mid); }
.rq-body { padding: 0 22px 22px; }

/* ---------- lessons ---------- */
.lesson-units { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.lu { padding: 20px; }
.lu h3 { margin: 6px 0 10px; }
.sec-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.sec-list a { display: flex; gap: 10px; padding: 6px 8px; border-radius: 8px; text-decoration: none; font-size: 14px; color: var(--ink-2); transition: background .15s, color .15s; }
.sec-list a:hover { background: var(--surface-2); color: var(--ink); }
.sec-list a.cur { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.sn { font-variant-numeric: tabular-nums; color: var(--ink-3); min-width: 34px; }
.reader { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: start; }
.reader-nav { padding: 16px; position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; }
.reader-nav > b { display: block; font-family: var(--serif); font-weight: 500; margin: 4px 0 10px; }
.reader-body { padding: clamp(20px, 4vw, 44px); }
.practice-cta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); margin: 18px 0 8px; font-size: 14px; }
.practice-cta span { flex: 1; }
.lesson-body { font-size: 16px; line-height: 1.7; max-width: 74ch; overflow-wrap: anywhere; }
.lesson-body math[display="block"], .lesson-body .equation { max-width: 100%; overflow-x: auto; }
.reader-body, .q-card { min-width: 0; }
.lesson-body h2, .lesson-body h3, .lesson-body h4 { font-family: var(--serif); font-weight: 500; margin: 28px 0 10px; }
.lesson-body h2 { font-size: 24px; } .lesson-body h3 { font-size: 20px; } .lesson-body h4 { font-size: 17px; }
.lesson-body p { margin: 0 0 14px; }
.lesson-body img { max-width: 100%; height: auto; }
.lesson-body figure { margin: 18px 0; }
.lesson-body .os-figure { margin: 18px 0; }
.lesson-body .os-caption-container, .lesson-body figcaption { font-size: 13px; color: var(--ink-2); line-height: 1.5; margin-top: 6px; }
.lesson-body .note, .lesson-body [data-type="note"], .lesson-body .example, .lesson-body [data-type="example"] { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; margin: 18px 0; color: var(--ink); font-size: 15px; }
.lesson-body .os-title, .lesson-body .os-title-label { font-weight: 700; display: block; margin-bottom: 6px; font-family: var(--sans); }
.lesson-body table { border-collapse: collapse; margin: 14px 0; font-size: 14px; display: block; overflow-x: auto; }
.lesson-body td, .lesson-body th { border: 1px solid var(--line-2); padding: 6px 10px; }
.lesson-body ul, .lesson-body ol { padding-left: 24px; }
.lesson-body .equation, .lesson-body [data-type="equation"] { margin: 12px 0; overflow-x: auto; }
.lesson-body math[display="block"] { display: block math; margin: 10px 0; }
.lesson-body .os-equation-number { float: right; color: var(--ink-3); font-size: 13px; }
.lw .lesson-body { font-size: 14.5px; }

/* ---------- notes ---------- */
.notes-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 24px; }
.note-editor { padding: 18px; display: grid; gap: 10px; position: sticky; top: 76px; }
.note { padding: 16px 18px; margin-bottom: 10px; display: grid; gap: 8px; }
.note .n-title { font-family: var(--serif); font-weight: 500; font-size: 17px; outline: none; }
.note .n-body { white-space: pre-wrap; color: var(--ink-2); outline: none; border-radius: 6px; }
.note [contenteditable]:focus { background: var(--surface-2); box-shadow: 0 0 0 4px var(--surface-2); }

/* ---------- tables ---------- */
.prog-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.prog-table th { text-align: left; font-size: 12px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.prog-table td { padding: 11px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.prog-table tr.unit-row td { background: var(--surface-2); font-weight: 600; }
.prog-table tr:last-child td { border-bottom: 0; }
.prog-table .m { width: 160px; }

.lightbox { position: fixed; inset: 0; background: rgba(20, 20, 19, .72); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; animation: fadeUp .2s both; }
.lightbox img { max-width: min(1200px, 100%); max-height: 100%; background: #fff; border-radius: 8px; padding: 12px; }

@media (max-width: 960px) {
  .hero, .unit-head, .builder, .session, .dash-grid, .reader, .notes-layout { grid-template-columns: minmax(0, 1fr); }
  .side, .panel, .reader-nav, .note-editor { position: static; max-height: none; }
  .lesson-row { grid-template-columns: 1fr; gap: 10px; }
  .lesson-row .actions { justify-content: flex-start; }
  .q-card { padding: 18px; }
  .result-hero { grid-template-columns: 1fr 1fr; }
  .rh-arrow { display: none; }
  .topbar { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 560px) {
  .units, .tests-grid, .lesson-units { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: minmax(0, 1fr); }
  .stat b { font-size: 24px; }
  main { padding: 24px 14px 80px; }
  .bubble { width: 44px; height: 44px; font-size: 18px; }
  .rh-big { font-size: 40px; }
  .exam-bar { gap: 8px; }
  .tool-btn span:not(.ti) { display: none; }
}
.reader-body .row .btn { white-space: normal; height: auto; min-height: 38px; padding: 8px 14px; max-width: 100%; }
.reader-body, .q-html, .lw .lesson-body { overflow-x: auto; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.chart-legend .lg-q { background: var(--accent); } .chart-legend .lg-t { background: var(--ink); }
.chart-legend .lg-c { width: 16px; height: 0; border-radius: 0; border-top: 1px dashed var(--ink-3); }

/* ---------- popups ---------- */
.modal-back { position: fixed; inset: 0; z-index: 120; background: rgba(20, 20, 19, .45); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .16s both; }
.modal-back.out { animation: fadeOut .16s both; }
@keyframes fadeIn { from { opacity: 0; } } @keyframes fadeOut { to { opacity: 0; } }
.modal { width: min(460px, 100%); padding: 24px 24px 18px; box-shadow: 0 20px 60px rgba(20,20,19,.25); animation: pop .26s var(--ease) both; }
.modal h2 { font-size: 22px; }
.modal-body { margin-top: 10px; color: var(--ink-2); display: grid; gap: 8px; font-size: 15px; }
.modal-warn { color: var(--bad); }
.modal-actions { margin-top: 20px; gap: 8px; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover { background: #9a4330; border-color: #9a4330; }

/* ---------- full-screen lock + pause ---------- */
.fs-lock { position: fixed; inset: 0; z-index: 110; background: rgba(250, 249, 245, .82); backdrop-filter: blur(14px) saturate(.6); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .2s both; }
.fs-lock-card { max-width: 440px; padding: 30px; text-align: center; display: grid; gap: 12px; justify-items: center; }
.fsl-ic { width: 54px; height: 54px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; font-size: 26px; animation: pulse 1.8s ease-in-out infinite; }
.paused-card { text-align: left; }
.eb-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.eb-ctl { display: flex; gap: 4px; padding-left: 10px; border-left: 1px solid var(--line); }

/* ---------- tests ---------- */
.test-card { flex-direction: column; align-items: stretch; gap: 4px; }
.test-line { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--line); }
.test-line:first-of-type { border-top: 0; }
.test-line h3 { font-size: 17px; }
.test-tile { min-height: 0; gap: 4px; }
.test-tile h3 { margin-bottom: 6px; }
.tt-row { display: flex; align-items: center; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); }
.tt-row > div { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.tt-row b { font-size: 14px; font-weight: 600; }

/* ---------- completed ---------- */
.done-list { display: grid; gap: 8px; margin-top: 22px; }
.done-row { display: flex; align-items: center; gap: 18px; padding: 14px 18px; text-decoration: none; flex-wrap: wrap; transition: border-color .15s, transform .2s var(--ease); }
.done-row:hover { border-color: var(--line-2); transform: translateX(2px); }
.dr-main { flex: 1; min-width: 220px; display: grid; gap: 4px; justify-items: start; }
.dr-main b { font-family: var(--serif); font-weight: 500; font-size: 17px; }
.dr-scores { display: flex; align-items: center; gap: 14px; }
.dr-scores > span { display: flex; flex-direction: column; align-items: center; font-family: var(--serif); font-size: 20px; line-height: 1.1; }
.dr-scores em { font: 600 10px var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-style: normal; margin-bottom: 2px; }
.dr-scores i { font-style: normal; font-size: 13px; color: var(--ink-3); }
.dr-arrow { color: var(--ink-3); font-size: 16px !important; }
.dr-ap { padding: 4px 12px; border-radius: 10px; background: var(--surface-2); }
.dr-ap.good { background: var(--good-soft); color: var(--good); } .dr-ap.mid { background: var(--mid-soft); color: var(--mid); } .dr-ap.bad { background: var(--bad-soft); color: var(--bad); }
.dr-go { font-size: 22px; color: var(--ink-3); }
.click-row { cursor: pointer; } .click-row:hover td { background: var(--surface-2); }

/* lesson link on feedback */
.lesson-link { display: flex; gap: 12px; align-items: center; margin-top: 16px; padding: 12px 14px; border-radius: 10px; border: 1px solid #c9d6e3; background: #eef3f8; color: #2f4a63; text-decoration: none; font-size: 14px; transition: background .15s, transform .15s; }
.lesson-link:hover { background: #e2ebf4; transform: translateY(-1px); }
.lesson-link > span:last-child { display: grid; }
.lesson-link em { font-style: normal; font-size: 12px; color: #5a7590; }
.ll-ic { width: 30px; height: 30px; flex: none; border-radius: 8px; background: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 17px; }

/* ---------- daily question ---------- */
.daily-btn { position: relative; }
.db-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(217,119,87,.25); animation: pulse 1.8s ease-in-out infinite; }
.daily-stats { max-width: 620px; }
.stat b small { font-size: 16px; color: var(--ink-3); }
.streak-row { display: flex; align-items: center; gap: 5px; margin-top: 14px; flex-wrap: wrap; }
.sd { width: 16px; height: 16px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); }
.sd.on { background: rgba(217, 119, 87, var(--a)); border-color: transparent; }
.sd.today { outline: 2px solid var(--ink); outline-offset: 1px; }
.streak-row .faint { margin-left: 6px; }
.daily-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.daily-tile { padding: 16px 18px; text-decoration: none; display: grid; gap: 6px; min-height: 118px; transition: border-color .15s, transform .2s var(--ease); }
.daily-tile:hover { transform: translateY(-2px); border-color: var(--line-2); }
.daily-tile b { font-family: var(--serif); font-weight: 500; font-size: 18px; }
.daily-tile .dt-st { align-self: end; }
.dt-go { font-size: 13px; color: var(--accent-ink); font-weight: 600; }
.daily-tile.done { background: var(--surface-2); }
.daily-done { margin-top: 18px; padding: 14px 16px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); font-size: 14px; }
.daily-done a { color: inherit; font-weight: 600; }
@media (max-width: 560px) { .eb-ctl { border-left: 0; padding-left: 0; } .dr-scores { width: 100%; justify-content: space-between; } }
@media (max-width: 560px) { .dr-main { min-width: 0; flex-basis: 100%; } .done-row { gap: 10px; } #cfilter { width: 100%; } .dr-go { display: none; } }

/* ================================================================ loader (orange chasing squares) */
.loader-back { position: fixed; inset: 0; z-index: 120; display: flex; flex-direction: column; gap: 16px; align-items: center; justify-content: center;
  background: rgba(250, 249, 245, .72); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); opacity: 0; transition: opacity .18s ease; pointer-events: none; }
.loader-back.on { opacity: 1; pointer-events: auto; cursor: progress; }
.loader-msg { font-size: 13px; color: var(--accent-ink); font-weight: 600; letter-spacing: .01em; min-height: 1em; }
.loader { width: 65px; aspect-ratio: 1; position: relative; }
.loader:before, .loader:after { content: ""; position: absolute; border-radius: 50px; box-shadow: 0 0 0 3px inset var(--accent); animation: l4 2.5s infinite; }
.loader:after { animation-delay: -1.25s; box-shadow: 0 0 0 3px inset var(--accent-ink); background: var(--accent-soft); }
@keyframes l4 {
  0% { inset: 0 35px 35px 0; } 12.5% { inset: 0 35px 0 0; } 25% { inset: 35px 35px 0 0; } 37.5% { inset: 35px 0 0 0; }
  50% { inset: 35px 0 0 35px; } 62.5% { inset: 0 0 0 35px; } 75% { inset: 0 0 35px 35px; } 87.5% { inset: 0 0 35px 0; } 100% { inset: 0 35px 35px 0; }
}
.boot-loader { position: fixed; inset: 0; display: flex; flex-direction: column; gap: 16px; align-items: center; justify-content: center; background: var(--bg); z-index: 130; transition: opacity .3s ease; }
.boot-loader.gone { opacity: 0; pointer-events: none; }

/* ================================================================ wrapping buttons (long lesson titles) */
.btn.wrap { white-space: normal; height: auto; min-height: 32px; padding-top: 7px; padding-bottom: 7px; text-align: left; line-height: 1.35; justify-content: flex-start; max-width: 100%; }
.btn.wrap > span { min-width: 0; overflow-wrap: anywhere; }
.btn.wrap:not(.sm) { min-height: 38px; }
.lesson-pn { flex-wrap: nowrap; align-items: stretch; }
.lesson-pn .btn.wrap { max-width: 48%; }
.lesson-pn .btn.primary.wrap { text-align: right; justify-content: flex-end; }
.lesson-link { min-width: 0; }
.lesson-link .ll-t { min-width: 0; overflow-wrap: anywhere; }

/* ================================================================ generated figures */
.q-figs { margin: 12px 0 6px; }
.gfig { margin: 6px 0; display: inline-block; max-width: 100%; vertical-align: top; }
.gfig-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.gfig-title { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.gfig figcaption { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.fig-svg { display: block; background: var(--surface); border-radius: 8px; }
.fig-table-wrap { overflow-x: auto; }
.fig-table { border-collapse: collapse; font-size: 14px; margin: 4px 0; background: var(--surface); }
.fig-table caption { caption-side: top; text-align: left; font-size: 13px; color: var(--ink-2); padding-bottom: 4px; }
.fig-table th { background: var(--surface-2); font-weight: 600; }
.fig-table th, .fig-table td { border: 1px solid var(--line-2); padding: 5px 12px; text-align: center; }
.opt.has-fig .otext { display: block; }
.opt .otext .gfig { margin: 0; }
.opt .otext .fig-svg { background: transparent; }

/* free-response part prompts */
.frq-prompts { list-style: none; margin: 14px 0 4px; padding: 0; display: grid; gap: 12px; }
.frq-prompts li { display: grid; grid-template-columns: 34px 1fr; gap: 8px; }
.fp-l { font-family: var(--serif); font-size: 17px; color: var(--accent-ink); padding-top: 1px; }
.fp-b p { margin: 0 0 6px; }
.fp-pts { display: inline-block; font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* per-choice explanations */
.why-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.why-list li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14px; line-height: 1.55; }
.why-list li.ok { background: var(--good-soft); }
.why-list li.ok b { color: var(--good); }
.wl-l { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line-2); display: inline-flex; align-items: center; justify-content: center; font-family: var(--serif); background: var(--surface); }
.why-list li.ok .wl-l { background: var(--good); border-color: var(--good); color: #fff; }

/* worked solutions + scoring guideline */
.sol-part { padding: 12px 0; border-top: 1px dashed var(--line-2); }
.sol-part:first-of-type { border-top: 0; }
.sp-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.rk-d { margin-top: 6px; }
.rk-d summary { cursor: pointer; font-size: 13px; color: var(--accent-ink); font-weight: 600; }
.rubric-key { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; }
.rubric-key li { display: grid; grid-template-columns: 46px 1fr; gap: 8px; }
.rk-pts { font-size: 11px; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); border-radius: 6px; text-align: center; height: 20px; line-height: 20px; }

/* rubric self-grading */
.rubric { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); display: grid; gap: 6px; }
.rb-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.rb-head .gl { font-size: 12px; color: var(--ink-3); }
.rb-sum { font-size: 13px; color: var(--ink-2); }
.rb-sum b { font-size: 16px; color: var(--ink); }
.rb-item { display: grid; grid-template-columns: 18px 26px 1fr; gap: 8px; align-items: start; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 13.5px; line-height: 1.45; transition: background .15s; }
.rb-item:hover { background: var(--surface-2); }
.rb-item.on { background: var(--good-soft); }
.rb-item input { margin-top: 2px; }
.rb-pts { font-size: 11px; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); border-radius: 6px; text-align: center; height: 20px; line-height: 20px; }
.rb-item.on .rb-pts { background: var(--good); color: #fff; }
.rb-zero { justify-self: start; }
.frq-total { margin-top: 14px; }
.score-face { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 12px; }
.score-face b { display: block; font-size: 17px; }
.score-face span { font-size: 13px; opacity: .85; }
.score-face.good { background: var(--good-soft); color: var(--good); }
.score-face.mid { background: var(--mid-soft); color: #7a5b1c; }
.score-face.bad { background: var(--bad-soft); color: var(--bad); }
.face { flex: none; }

/* printed-test entry: free-response boxes */
.entry-row.entry-frq { align-items: flex-start; }
.entry-frq .ef-body { flex: 1; min-width: 0; display: grid; gap: 8px; }
@media (prefers-reduced-motion: reduce) { .loader:before, .loader:after { animation-duration: 5s; } }
.opts:has(.opt.has-fig) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 640px) { .opts:has(.opt.has-fig) { grid-template-columns: 1fr; } }

/* ================================================================ toasts (bottom right, stacked) */
.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 140; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; max-width: min(380px, 90vw); }
.toast { display: flex; align-items: center; gap: 10px; background: var(--ink); color: var(--bg); padding: 11px 16px 11px 12px; border-radius: 12px; font-size: 14px; line-height: 1.4;
  box-shadow: 0 10px 30px rgba(20, 20, 19, .18); opacity: 0; transform: translateX(24px) scale(.97); transition: opacity .28s, transform .35s var(--ease); }
.toast.show { opacity: 1; transform: none; }
.toast.out { opacity: 0; transform: translateX(24px); }
.t-ic { flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; background: rgba(255,255,255,.12); color: var(--accent); }
.t-ic .glyph { width: 14px; height: 14px; animation: spin 6s linear infinite; }
.toast.t-ok .t-ic { background: var(--good); color: #fff; }
.toast.t-warn .t-ic { background: var(--accent); color: #fff; }

/* ================================================================ loader phrases */
.loader-msg { opacity: 0; background: none; border: 0; width: auto; max-width: 80vw; text-align: center; }
.loader-msg.msg-in { animation: msgIn .45s var(--ease) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); filter: blur(2px); } to { opacity: 1; transform: none; filter: none; } }

/* ================================================================ glyphs + AI marker */
.glyph { width: 1em; height: 1em; display: inline-block; vertical-align: -0.12em; }
.glyph.acc { color: var(--accent); }
.glyph.big { width: 42px; height: 42px; }
.glyph.spin { animation: spin 5s linear infinite; }
.glyph.spin-slow { animation: spin 14s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.section-head h2 .glyph { width: 16px; height: 16px; margin-right: 10px; vertical-align: 0; transition: transform .6s var(--ease); }
.section-head:hover h2 .glyph { transform: rotate(90deg); }
.eyebrow .glyph { width: 12px; height: 12px; margin-right: 4px; }
.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand-glyph { color: var(--accent); display: inline-flex; }
.brand-glyph .glyph { width: 18px; height: 18px; }
.src-badge { display: inline-flex; align-items: center; }
.src-badge .ai-mark { width: 15px; height: 15px; margin: 0 4px 0 -3px; }
.ai-note { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-3); margin-bottom: 8px; }

/* ================================================================ first-visit notice */
.notice { max-width: 560px; animation: noticeIn .5s var(--ease) both; }
@keyframes noticeIn { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
.notice-top { display: flex; align-items: center; justify-content: flex-start; margin-bottom: 14px; }
.notice-ic { width: 46px; height: 46px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; }
.notice-ic .glyph { width: 24px; height: 24px; }
.notice-logo { height: 30px; width: auto; }
.notice h2 { font-family: var(--serif); font-size: 26px; font-weight: 500; }
.notice .modal-body p { font-size: 14.5px; line-height: 1.6; color: var(--ink-2); margin: 10px 0; }
.notice-back { z-index: 150; }

/* ================================================================ site footer (hidden during quizzes/tests) */
.site-foot { border-top: 1px solid var(--line); margin-top: 56px; padding: 28px 24px 34px; background: var(--surface-2); }
.sf-inner { max-width: 1120px; margin: 0 auto; display: grid; grid-template-columns: 150px 1fr; gap: 24px; align-items: start; }
.sf-brand { display: flex; align-items: center; gap: 10px; }
.sf-brand img { height: 26px; width: auto; opacity: .9; }
.sf-glyph { color: var(--accent); display: inline-flex; }
.sf-glyph .glyph { width: 18px; height: 18px; }
.sf-text p { margin: 0 0 8px; font-size: 12.5px; line-height: 1.6; color: var(--ink-3); }
.sf-text a { color: var(--accent-ink); }
body.exam-mode .site-foot { display: none; }
@media (max-width: 640px) { .sf-inner { grid-template-columns: 1fr; } }

/* ================================================================ In Progress */
.nav-count { display: inline-flex; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; align-items: center; justify-content: center; margin-left: 4px; animation: pop .35s var(--ease) both; }
.ip-list { display: grid; gap: 10px; }
.ip-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; transition: transform .2s var(--ease), box-shadow .2s; }
.ip-row:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(20, 20, 19, .07); }
.ip-ic { flex: none; width: 38px; height: 38px; border-radius: 11px; background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; font-size: 17px; }
.ip-ic.grade { background: var(--accent-soft); color: var(--accent); }
.ip-ic .glyph { width: 18px; height: 18px; }
.ip-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.ip-bar { display: block; height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 4px; max-width: 260px; }
.ip-bar i { display: block; height: 100%; width: var(--w); background: var(--accent); animation: grow .8s var(--ease) both; }
.empty .glyph.big { display: block; margin: 0 auto; }

/* ================================================================ extra motion */
.topnav a { position: relative; }
.topnav a:not(.active)::after { content: ""; position: absolute; left: 11px; right: 11px; bottom: 3px; height: 2px; border-radius: 2px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .25s var(--ease); }
.topnav a:not(.active):hover::after { transform: scaleX(1); }
.unit-card, .test-tile, .daily-tile, .done-row, .focus-item, .lu { transition: transform .22s var(--ease), box-shadow .22s, border-color .2s; }
.unit-card:hover, .test-tile:hover, .daily-tile:hover, .done-row:hover, .lu:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(20, 20, 19, .08); }
.btn { transition: background .15s, border-color .15s, color .15s, transform .12s, box-shadow .2s; }
.btn.accent:hover { box-shadow: 0 6px 16px rgba(217, 119, 87, .32); }
.opt { transition: border-color .15s, background .15s, transform .15s; }
.opt:hover:not(:disabled) { transform: translateX(3px); }
.stat b { animation: pop .5s var(--ease) both; }

.notice { max-height: calc(100vh - 32px); overflow-y: auto; }

/* ================================================================ animated physics glyphs */
.glyph .g-orbit { transform-origin: 12px 12px; animation: spin 3.2s linear infinite; }
.glyph .g-wave { animation: waveSlide 1.8s linear infinite; }
@keyframes waveSlide { to { transform: translateX(12px); } }
.glyph .g-bloom { transform-origin: 12px 12px; animation: bloom 4s var(--ease) infinite; }
@keyframes bloom { 0%, 100% { transform: rotate(0) scale(.88); } 50% { transform: rotate(60deg) scale(1.05); } }
.glyph .g-pend { transform-origin: 12px 2.5px; animation: swing 2.2s ease-in-out infinite alternate; }
@keyframes swing { from { transform: rotate(-24deg); } to { transform: rotate(24deg); } }
.glyph .g-atom { transform-origin: 12px 12px; animation: spin 7s linear infinite; }
.t-ic .glyph { animation: none; }

/* ================================================================ AI sparkle (shiny, animated) */
.ai-mark { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin: 0 4px; vertical-align: -3px; cursor: help; filter: drop-shadow(0 0 3px rgba(91, 124, 243, .55)); animation: aiGlow 2.6s ease-in-out infinite; }
.sparkle { width: 100%; height: 100%; overflow: visible; }
.sparkle .sp-big { transform-origin: 9.5px 9.5px; animation: twinkle 2.6s ease-in-out infinite; }
.sparkle .sp-small { transform-origin: 19.2px 19.2px; animation: twinkle 2.6s ease-in-out infinite; animation-delay: -1.3s; }
@keyframes twinkle { 0%, 100% { transform: scale(.82) rotate(0); } 45% { transform: scale(1.08) rotate(12deg); } 60% { transform: scale(1) rotate(0); } }
@keyframes aiGlow { 0%, 100% { filter: drop-shadow(0 0 2px rgba(91, 124, 243, .35)); } 50% { filter: drop-shadow(0 0 6px rgba(138, 79, 216, .75)); } }
@media (prefers-reduced-motion: reduce) { .glyph *, .sparkle *, .ai-mark { animation: none !important; } }

/* ================================================================ Desmos (official API) */
.tw-body .desmos { position: relative; flex: 1; width: 100%; min-height: 0; }
.desmos-msg { padding: 18px; display: grid; gap: 8px; justify-items: start; }

/* ================================================================ sound toggle */
.sound-toggle { flex: none; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: background .15s, color .15s; }
.sound-toggle:hover { background: var(--surface-2); color: var(--ink); }
.sound-toggle svg { width: 18px; height: 18px; }
.sound-toggle .sx { display: none; }
.sound-toggle.off .sw { display: none; }
.sound-toggle.off .sx { display: inline; }
.sound-toggle.off { color: var(--ink-3, var(--ink-2)); opacity: .7; }

/* ================================================================ notes library (read-only) */
.notes-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-top: 22px; }
.notes-bar .seg button .faint { font-weight: 400; margin-left: 2px; }
.notes-search { flex: 0 1 260px; min-width: 180px; height: 34px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; }
.notes-search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.note-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.note-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.nc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nc-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.nc-date { white-space: nowrap; }
.nc-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; user-select: text; }
.nc-foot { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: auto; }
.nc-q { font-style: italic; }
@media (max-width: 600px) { .notes-bar .seg { grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); width: 100%; } .notes-search { flex: 1 1 100%; } .note-grid { grid-template-columns: 1fr; } }
