/* XII Prep — Notion-style theme: white page, warm charcoal text, hairline borders, flat surfaces,
   system fonts, and colour as soft pastel tags and callouts.
   Layout: sticky app bar; a single centred column (max 1080px). Home = Today cards + subject list;
   subject page = Today card + chapter list; practice = focused question column (+ topic panel on chapters).
   Each subject supplies its own accent through --subj (set inline from subject.json). */
:root{
  --bg:#ffffff; --surface:#ffffff; --surface-2:#f7f7f5; --hover:rgba(55,53,47,.06);
  --ink:#37352f; --ink-2:#4f4d47; --muted:#787774; --line:#e9e9e7; --line-2:#dcdcd9;
  --brand:#2383e2; --brand-soft:#e7f3f8;
  --flame:#d9730d; --flame-soft:#fbecdd;
  --good:#448361; --good-soft:#edf3ec; --bad:#d44c47; --bad-soft:#fdebec; --warn:#cb912f; --warn-soft:#fbf3db; --todo:#ebebea;
  --brand-hover:#0077d4; --active:rgba(55,53,47,.12); --btn-line:rgba(55,53,47,.16); --link-line:rgba(55,53,47,.3);
  --input:rgba(242,241,238,.6); --focus:rgba(35,131,226,.45); --placeholder:rgba(55,53,47,.4);
  --card-ring:0 0 0 1px rgba(15,15,15,.08),0 2px 4px rgba(15,15,15,.04); --card-hover:#fbfbfa;
  --tag-gray:rgba(227,226,224,.6); --tag-yellow:#fdecc8; --tag-yellow-fg:#89632a;
  --subj:var(--brand);
  --f-head:ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI Variable Display","Segoe UI",Helvetica,"Apple Color Emoji",Arial,sans-serif;
  --f-body:ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI Variable Text","Segoe UI",Helvetica,"Apple Color Emoji",Arial,sans-serif;
  --f-mono:"SFMono-Regular",Menlo,Consolas,"Liberation Mono",ui-monospace,monospace;
  --r:6px; --r-s:4px;
  --shadow:none;
  color-scheme:light;
}
/* Dark theme: follows the device unless the student picks one with the sun/moon button (saved per device). */
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){
  --bg:#191919; --surface:#202020; --surface-2:#252525; --hover:rgba(255,255,255,.055);
  --ink:rgba(255,255,255,.86); --ink-2:rgba(255,255,255,.72); --muted:#9b9b9b; --line:#2f2f2f; --line-2:#3a3a3a;
  --brand:#2f8fe8; --brand-soft:#1f2e38;
  --flame:#ffa344; --flame-soft:#3b2a1c;
  --good:#4dab9a; --good-soft:#1f2e28; --bad:#ff7369; --bad-soft:#3a2424; --warn:#ffdc49; --warn-soft:#3a3320; --todo:#2f2f2f;
  --brand-hover:#4aa0ee; --active:rgba(255,255,255,.09); --btn-line:rgba(255,255,255,.13); --link-line:rgba(255,255,255,.3);
  --input:rgba(255,255,255,.055); --focus:rgba(35,131,226,.6); --placeholder:rgba(255,255,255,.35);
  --card-ring:0 0 0 1px rgba(255,255,255,.094); --card-hover:#262626;
  --tag-gray:rgba(255,255,255,.094); --tag-yellow:#59563b; --tag-yellow-fg:#f0dca0;
  color-scheme:dark}}
:root[data-theme="dark"]{
  --bg:#191919; --surface:#202020; --surface-2:#252525; --hover:rgba(255,255,255,.055);
  --ink:rgba(255,255,255,.86); --ink-2:rgba(255,255,255,.72); --muted:#9b9b9b; --line:#2f2f2f; --line-2:#3a3a3a;
  --brand:#2f8fe8; --brand-soft:#1f2e38;
  --flame:#ffa344; --flame-soft:#3b2a1c;
  --good:#4dab9a; --good-soft:#1f2e28; --bad:#ff7369; --bad-soft:#3a2424; --warn:#ffdc49; --warn-soft:#3a3320; --todo:#2f2f2f;
  --brand-hover:#4aa0ee; --active:rgba(255,255,255,.09); --btn-line:rgba(255,255,255,.13); --link-line:rgba(255,255,255,.3);
  --input:rgba(255,255,255,.055); --focus:rgba(35,131,226,.6); --placeholder:rgba(255,255,255,.35);
  --card-ring:0 0 0 1px rgba(255,255,255,.094); --card-hover:#262626;
  --tag-gray:rgba(255,255,255,.094); --tag-yellow:#59563b; --tag-yellow-fg:#f0dca0;
  color-scheme:dark}

/* Tints derived from --subj. Declared wherever --subj can be set (body, or inline on a card)
   so they recompute for that subject instead of inheriting the brand's values from :root. */
:root,body,[style*="--subj"]{
  --subj-fg:var(--subj);
  --subj-soft:color-mix(in srgb,var(--subj) 10%,var(--surface));
  --subj-line:color-mix(in srgb,var(--subj) 35%,var(--line));
}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]),:root:not([data-theme="light"]) body,:root:not([data-theme="light"]) [style*="--subj"]{
  --subj-fg:color-mix(in oklab,var(--subj) 60%,white);
  --subj-soft:color-mix(in srgb,var(--subj) 18%,var(--surface));
  --subj-line:color-mix(in srgb,var(--subj) 50%,var(--line));
}}
:root[data-theme="dark"],:root[data-theme="dark"] body,:root[data-theme="dark"] [style*="--subj"]{
  --subj-fg:color-mix(in oklab,var(--subj) 60%,white);
  --subj-soft:color-mix(in srgb,var(--subj) 18%,var(--surface));
  --subj-line:color-mix(in srgb,var(--subj) 50%,var(--line));
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--f-body);font-size:16px;line-height:1.5;-webkit-font-smoothing:antialiased;padding-bottom:env(safe-area-inset-bottom,0px)}
img{max-width:100%;height:auto}
[hidden]{display:none!important}
h1,h2,h3,h4{font-family:var(--f-head);margin:0;text-wrap:balance;letter-spacing:-.01em;color:var(--ink)}
h1{font-size:2rem;font-weight:700;line-height:1.2}
h2{font-size:1.25rem;font-weight:600}
h3{font-size:1.05rem;font-weight:600}
a{color:var(--subj-fg)}
button{font:inherit;color:inherit;cursor:pointer}
:focus-visible{outline:2px solid var(--subj-fg);outline-offset:2px;border-radius:4px}
.muted{color:var(--muted)}
.mono{font-family:var(--f-mono);font-size:.82em;letter-spacing:-.01em}
.eyebrow{font-size:.82rem;color:var(--muted);font-weight:500}
.wrap{max-width:1080px;margin:0 auto;padding-block:24px 64px;padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px));display:flex;flex-direction:column;gap:28px;outline:none}
.section{display:flex;flex-direction:column;gap:12px}
.section-head{display:flex;justify-content:space-between;align-items:baseline;gap:12px;flex-wrap:wrap}

/* app bar */
.appbar{position:sticky;top:0;z-index:20;background:color-mix(in srgb,var(--surface) 92%,transparent);backdrop-filter:saturate(1.4) blur(8px);border-bottom:1px solid var(--line);padding-top:env(safe-area-inset-top,0px)}
.appbar-in{max-width:1080px;margin:0 auto;height:56px;display:flex;align-items:center;gap:14px;padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px))}
.brand{display:flex;align-items:center;gap:8px;text-decoration:none;color:var(--ink);font-family:var(--f-head);font-weight:700;font-size:1.05rem;flex-shrink:0}
.brand .mark{background:var(--ink);color:var(--bg);border-radius:4px;padding:2px 6px;font-size:.78rem;letter-spacing:.04em}
.crumbs{display:flex;align-items:center;gap:6px;min-width:0;flex:1;font-size:.9rem;color:var(--muted);overflow:hidden;white-space:nowrap}
.crumbs a{color:var(--ink-2);text-decoration:none;overflow:hidden;text-overflow:ellipsis}
.crumbs a:hover{color:var(--ink)}
.crumbs .sep{color:var(--line-2)}
.crumbs span:last-child{overflow:hidden;text-overflow:ellipsis;color:var(--ink)}
.themebtn{display:grid;place-items:center;width:32px;height:32px;border:0;background:none;color:var(--muted);border-radius:var(--r-s);flex-shrink:0;cursor:pointer}
.themebtn:hover{background:var(--hover);color:var(--ink)}
.themebtn svg{width:18px;height:18px}
.who{position:relative;flex-shrink:0}
.chip-btn{display:flex;align-items:center;gap:8px;border:0;background:none;color:var(--ink);border-radius:var(--r-s);padding:4px 8px 4px 6px;font-size:.875rem;font-weight:500}
.chip-btn:hover{background:var(--hover)}
.avatar{width:22px;height:22px;border-radius:50%;background:var(--brand-soft);color:var(--brand);display:grid;place-items:center;font-size:.75rem;font-weight:700;font-family:var(--f-head)}
.dot{width:8px;height:8px;border-radius:50%;background:var(--todo);display:inline-block;flex-shrink:0}
.dot.ok{background:var(--good)} .dot.warn{background:var(--warn)}
.menu{position:absolute;right:0;top:calc(100% + 8px);background:var(--surface);border:1px solid var(--line);border-radius:var(--r);box-shadow:0 0 0 1px rgba(15,15,15,.05),0 3px 6px rgba(15,15,15,.1),0 9px 24px rgba(15,15,15,.2);min-width:260px;padding:8px;display:flex;flex-direction:column;gap:2px;z-index:30}
.menu .status{padding:8px 10px;font-size:.84rem;color:var(--muted);display:flex;gap:8px;align-items:flex-start;line-height:1.4}
.menu .status .dot{margin-top:5px}
.menu a,.menu button{display:block;text-align:left;border:0;background:none;padding:8px 10px;border-radius:var(--r-s);color:var(--ink);text-decoration:none;font-size:.9rem}
.menu a:hover,.menu button:hover{background:var(--surface-2)}
.menu hr{border:0;border-top:1px solid var(--line);margin:4px 0}
@media (max-width:560px){.chip-btn .nm{display:none}.chip-btn{padding:4px}}

/* buttons */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:32px;border:1px solid var(--btn-line);background:transparent;color:var(--ink);border-radius:var(--r-s);padding:0 12px;font-weight:500;font-size:.875rem;line-height:1.2;text-decoration:none;cursor:pointer;white-space:nowrap}
.btn:hover{background:var(--hover)}
.btn:active{background:var(--active)}
.btn.primary{background:var(--brand);border-color:transparent;color:#fff;box-shadow:inset 0 0 0 1px rgba(15,15,15,.1),0 1px 2px rgba(15,15,15,.1)}
.btn.primary:hover{background:var(--brand-hover)}
.btn.ghost{border-color:transparent;color:var(--muted);padding-inline:8px}
.btn.ghost:hover{background:var(--hover);color:var(--ink)}
.btn.lg{min-height:40px;padding:0 16px;font-size:.95rem}
.btn.link{border:0;background:none;color:inherit;padding:0;min-height:0;font-weight:500;text-decoration:underline;text-decoration-color:var(--link-line);text-underline-offset:3px}
.btn.link:hover{background:none;text-decoration-color:currentColor}

/* cards + bars */
.card{background:var(--surface);border:0;border-radius:var(--r);box-shadow:var(--card-ring);padding:20px;min-width:0}
.badge{width:32px;height:32px;border-radius:var(--r-s);background:var(--subj-soft);color:var(--subj-fg);display:grid;place-items:center;font-family:var(--f-head);font-weight:600;font-size:.85rem;flex-shrink:0}
.badge.lg{width:56px;height:56px;border-radius:var(--r);font-size:1.2rem}
.badge.icon{background:none;font-size:1.45rem;font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif;line-height:1}
.badge.icon.lg{font-size:3rem;width:64px;height:64px}
.bar{height:6px;border-radius:999px;background:var(--todo);overflow:hidden;display:flex}
.bar i{display:block;height:100%}
.bar .s{background:var(--subj)} .bar .l{background:color-mix(in srgb,var(--subj) 40%,var(--todo))}
.bar .g{background:var(--good)} .bar .b{background:var(--bad)}
.legend{display:flex;flex-wrap:wrap;gap:14px;font-size:.8rem;color:var(--muted)}
.legend span{display:inline-flex;align-items:center;gap:6px}
.legend i{width:9px;height:9px;border-radius:3px;display:inline-block}

/* home */
.hello{display:flex;justify-content:space-between;align-items:flex-end;gap:16px;flex-wrap:wrap}
.hello p{margin:4px 0 0}
.namecard{display:flex;align-items:center;gap:16px;flex-wrap:wrap;border-style:dashed}
.namecard form{display:flex;gap:8px;flex-wrap:wrap;flex:1;min-width:240px}
input[type=text],input[type=number]{font:inherit;color:var(--ink);background:var(--input);border:1px solid var(--btn-line);border-radius:var(--r-s);padding:6px 10px}
input[type=text]:focus,input[type=number]:focus{outline:none;border-color:transparent;box-shadow:0 0 0 2px var(--focus)}
input::placeholder{color:var(--placeholder)}
.namecard input{flex:1;min-width:160px}
.today-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:14px}
.tcard{display:flex;flex-direction:column;gap:14px;text-decoration:none;color:inherit}
.tcard:hover{background:var(--card-hover)}
.tcard .top{display:flex;align-items:center;gap:10px}
.tcard .big{font-family:var(--f-head);font-weight:600;font-size:1.4rem;line-height:1.1;font-variant-numeric:tabular-nums;color:var(--subj-fg)}
.tcard .meta{font-size:.84rem;color:var(--muted)}

.tcard .foot{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:auto}
.tcard.done .big{color:var(--good)}
@media (max-width:560px){.tcard{padding:16px;gap:10px}.tcard .big{font-size:1.25rem}.today-grid{gap:10px}}
.slist,.clist{display:flex;flex-direction:column;background:var(--surface);border-top:1px solid var(--line);border-bottom:1px solid var(--line)}
.srow{display:grid;grid-template-columns:auto minmax(0,1fr) minmax(120px,240px) auto;align-items:center;gap:14px;padding:10px 8px;text-decoration:none;color:inherit;border-top:1px solid var(--line)}
.srow:first-child{border-top:0}
.srow:hover{background:var(--hover)}
.srow .t{display:flex;flex-direction:column;min-width:0}
.srow .t b{font-family:var(--f-head);font-size:1rem;font-weight:500;text-decoration:underline;text-decoration-color:var(--link-line);text-underline-offset:3px}
.srow .t span{font-size:.84rem;color:var(--muted)}
.srow .p{display:flex;flex-direction:column;gap:6px;font-size:.8rem;color:var(--muted)}
.chev{color:var(--muted);font-size:1.2rem}
@media (max-width:640px){.srow{grid-template-columns:auto minmax(0,1fr) auto}.srow .p{grid-column:2/4;grid-row:2}}

/* why this works */
.tipline{margin:-14px 0 0;display:flex;gap:10px;align-items:baseline;font-size:.92rem;color:var(--ink);background:var(--surface-2);border-radius:var(--r-s);padding:10px 14px}
.tip-k{font-size:.8rem;font-weight:500;color:#1f6c9f;background:#d3e5ef;border-radius:3px;padding:0 6px;flex-shrink:0;line-height:1.6}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) .tip-k{color:#c4dcec;background:#28456c}}
:root[data-theme="dark"] .tip-k{color:#c4dcec;background:#28456c}
.nudge{margin:0 0 18px;padding:10px 14px;border-radius:var(--r-s);background:var(--surface);border:1px dashed var(--line-2);font-size:.9rem;color:var(--ink-2)}
.page{max-width:760px;width:100%;margin:0 auto;display:flex;flex-direction:column;gap:20px}
.prose{gap:14px}
.prose h2{font-size:1.25rem;margin-top:14px}
.prose p,.prose ul,.prose ol{max-width:68ch}

/* how to learn / welcome — one column of full-width rows:
   [headline] / [six habit cards in one row] / [curve strip] / [start] */
.learn{display:flex;flex-direction:column;gap:16px;margin-top:-8px}
.lhero{display:block;max-width:760px}
.lintro{display:flex;flex-direction:column;gap:10px}
.lintro h1{font-size:clamp(1.75rem,3.4vw,2.5rem);line-height:1.15;font-weight:700;letter-spacing:-.015em}
.lead p{margin:0;font-size:1.05rem;color:var(--ink-2);max-width:64ch}
.credit{margin:0;font-size:.8rem;color:var(--muted)}
.habits{display:flex;flex-direction:column;gap:10px}
.habits h2,.curvecard h2{font-size:1.05rem}
.flips{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:10px}
@media (max-width:1000px){.flips{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media (max-width:520px){.flips{grid-template-columns:repeat(2,minmax(0,1fr))}}
.flip{position:relative;height:138px;border:0;border-radius:var(--r);background:var(--surface);box-shadow:var(--card-ring);padding:0;text-align:left;perspective:800px}
.flip:hover{border-color:var(--line-2)}
.flip .face{position:absolute;inset:0;padding:12px 13px;border-radius:var(--r);display:flex;flex-direction:column;backface-visibility:hidden;transition:transform .45s cubic-bezier(.2,.7,.2,1)}
.flip .front{justify-content:space-between;color:var(--hc,var(--brand));background:var(--surface)}
.flip .front svg{background:color-mix(in srgb,var(--hc,var(--brand)) 16%,var(--surface));border-radius:9px;padding:6px;width:38px;height:38px}
.flip:hover{background:var(--surface-2)}
.flip .front b{font-family:var(--f-head);font-size:1rem;color:var(--ink);line-height:1.25}
.flip .back{transform:rotateY(180deg);background:var(--surface-2);gap:6px;font-size:.78rem;line-height:1.36;color:var(--ink-2);overflow:hidden}
.flip .back p{margin:0}
.flip .back blockquote{margin:auto 0 0;padding-top:6px;border-top:1px dashed var(--line-2);font-size:.74rem;color:var(--muted)}
.flip .back blockquote p::before{content:"Here: ";font-weight:600;color:var(--ink-2)}
.flip[aria-pressed="true"] .front{transform:rotateY(-180deg)}
.flip[aria-pressed="true"] .back{transform:rotateY(0)}
@media (prefers-reduced-motion:reduce){.flip .face{transition:none}}
.curvecard{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.3fr);gap:12px 28px;align-items:center;padding:14px 22px}
@media (max-width:760px){.curvecard{grid-template-columns:minmax(0,1fr)}}
.curve-text{display:flex;flex-direction:column;gap:8px}
.curve-text p{margin:0;font-size:.9rem;color:var(--ink-2)}
.curve-text p.hint{font-size:.76rem;color:var(--muted)}
.curve{width:100%;height:auto;max-height:160px}
.curve .c-ax{stroke:var(--line-2);stroke-width:1}
.curve .c-t{fill:var(--muted);font-size:10px;font-family:var(--f-mono)}
.curve .c-none{fill:none;stroke:var(--muted);stroke-width:1.5;stroke-dasharray:4 4}
.curve .c-rev{fill:none;stroke:var(--brand);stroke-width:2.2}
.curve .c-dot{fill:var(--brand);stroke:var(--surface);stroke-width:1.5}
.lg-rev{background:var(--brand)} .lg-none{background:none;border:1.5px dashed var(--muted)}
.startcard{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px 24px;align-items:center;padding:16px 22px;}
@media (max-width:760px){.startcard{grid-template-columns:minmax(0,1fr)}}
.startcard h2{font-size:1.1rem}
.startcard p{margin:4px 0 0;font-size:.88rem}
.startcard form{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.startcard input{font-size:.95rem;padding:8px 12px;width:260px;flex:1 1 200px}



/* subject page */
.shero{display:flex;gap:16px;align-items:center;flex-wrap:wrap;padding:4px 0 8px}
.shero .stat b{color:var(--subj-fg)}
.shero .t{flex:1;min-width:220px}
.shero p{margin:4px 0 0;color:var(--muted)}
.stats{display:flex;gap:24px;flex-wrap:wrap}
.stat{display:flex;flex-direction:column}
.stat b{font-family:var(--f-head);font-size:1.35rem;font-weight:700;font-variant-numeric:tabular-nums;line-height:1.2}
.stat span{font-size:.78rem;color:var(--muted)}
.todaybox{background:var(--subj-soft);border-color:var(--subj-line);display:grid;grid-template-columns:minmax(0,1fr) auto;gap:16px 24px;align-items:center}
.todaybox h2{display:flex;align-items:center;gap:10px}
.todaybox p{margin:6px 0 0;color:var(--ink-2);max-width:60ch}
.todaybox .act{display:flex;align-items:center;gap:14px;flex-wrap:wrap;justify-content:flex-end}
@media (max-width:640px){.todaybox{grid-template-columns:minmax(0,1fr)}.todaybox .act{justify-content:flex-start}}
.stepper{display:inline-flex;align-items:center;border:1px solid var(--btn-line);border-radius:var(--r-s);background:var(--surface);overflow:hidden}
.stepper button{border:0;background:none;width:30px;height:30px;font-size:1rem;color:var(--muted)}
.stepper button:hover{background:var(--hover);color:var(--ink)}
.stepper button:disabled{color:var(--line-2);cursor:not-allowed;background:none}
.stepper input{width:2.8em;border:0;border-inline:1px solid var(--line);border-radius:0;text-align:center;padding:5px 2px;font-size:.875rem;font-variant-numeric:tabular-nums;-moz-appearance:textfield}
.stepper input::-webkit-inner-spin-button{-webkit-appearance:none}
.stepper-l{font-size:.84rem;color:var(--muted);display:flex;align-items:center;gap:8px}
.crow{display:grid;grid-template-columns:52px minmax(0,1fr) minmax(120px,200px) auto;gap:16px;align-items:center;padding:10px 8px;border-top:1px solid var(--line)}
.crow:first-child{border-top:0}
.crow:hover{background:var(--hover)}
.crow .u{font-size:.78rem;color:var(--muted);line-height:1.2}
.crow .u b{display:block;font-family:var(--f-head);font-size:1.15rem;color:var(--ink);font-weight:600}
.crow .t{min-width:0}
.crow .t a{font-family:var(--f-head);font-weight:500;font-size:1rem;color:var(--ink);text-decoration:underline;text-decoration-color:var(--link-line);text-underline-offset:3px}
.crow .t a:hover{text-decoration-color:currentColor}
.crow .t span{display:block;font-size:.82rem;color:var(--muted)}
.crow .p{display:flex;flex-direction:column;gap:6px;font-size:.78rem;color:var(--muted)}
.crow .a{display:flex;gap:6px}
@media (max-width:720px){.crow{grid-template-columns:44px minmax(0,1fr);gap:10px 14px}.crow .p,.crow .a{grid-column:2}}
.more{display:flex;gap:10px;flex-wrap:wrap}

/* practice */
.session{max-width:780px;width:100%;margin:0 auto;display:flex;flex-direction:column;gap:16px}
.shead{display:flex;justify-content:space-between;align-items:flex-end;gap:12px;flex-wrap:wrap}
.shead .eyebrow,.chero .eyebrow{color:var(--subj-fg)}
.shead .count{font-size:.85rem;color:var(--muted)}
.segs{display:flex;gap:3px}
.segs i{flex:1;height:6px;border-radius:999px;background:var(--todo)}
.segs i.g{background:var(--good)} .segs i.b{background:var(--bad)} .segs i.cur{background:var(--subj)}
.qcard{display:flex;flex-direction:column;gap:16px;padding:24px}
.qmeta{display:flex;flex-wrap:wrap;gap:6px;align-items:center;font-size:.78rem}
.tag{padding:0 6px;border-radius:3px;background:var(--subj-soft);color:var(--subj-fg);font-weight:400;line-height:1.6}
.tag.src{background:var(--tag-yellow);color:var(--tag-yellow-fg)}
.tag.why{background:var(--tag-gray);color:var(--ink-2)}
.tag.ch{background:none;color:var(--muted);padding-inline:2px}
.qtext{font-size:1.12rem;font-weight:600;line-height:1.5;font-family:var(--f-body)}
.qimg{border:1px solid var(--line);border-radius:var(--r-s);background:#fff;padding:8px;align-self:flex-start}
.opts{display:flex;flex-direction:column;gap:8px}
.opt{display:flex;gap:12px;align-items:flex-start;text-align:left;color:var(--ink);background:var(--surface);border:1px solid var(--btn-line);border-radius:var(--r-s);padding:9px 12px;line-height:1.45}
.opt:hover:not(:disabled){background:var(--hover)}
.opt .k{font-size:.75rem;font-weight:500;border:0;background:var(--tag-gray);border-radius:3px;min-width:24px;height:22px;display:grid;place-items:center;flex-shrink:0;color:var(--muted);margin-top:1px}
.opt:disabled{cursor:default}
.opt.right{border-color:var(--good);background:var(--good-soft)}
.opt.right .k{background:var(--good);color:#fff}
.opt.wrong{border-color:var(--bad);background:var(--bad-soft)}
.opt.wrong .k{background:var(--bad);color:#fff}
.opt.dim{opacity:.55}
.fb{border-left:3px solid var(--good);padding:4px 0 4px 14px;display:flex;flex-direction:column;gap:8px}
.fb.no{border-left-color:var(--bad)}
.fb .v{font-family:var(--f-head);font-weight:600}
.fb p{margin:0;color:var(--ink-2)}
.qfoot{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap}
.hint{font-size:.78rem;color:var(--muted)}
.hint kbd{font-family:var(--f-mono);font-size:.74rem;border:1px solid var(--line-2);border-bottom-width:2px;border-radius:4px;padding:0 5px;background:var(--surface)}
.summary{display:flex;flex-direction:column;gap:14px}
.summary .score{font-family:var(--f-head);font-weight:700;font-size:2rem;line-height:1}
.summary ul{margin:0;padding-left:18px;display:flex;flex-direction:column;gap:4px}
.memline{display:flex;flex-direction:column;gap:8px;padding:14px 18px}
.toolbar{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.fchip{border:1px solid var(--line-2);background:var(--surface);border-radius:999px;padding:5px 12px;font-size:.82rem;font-weight:500;color:var(--ink-2)}
.fchip[aria-pressed="true"]{background:var(--ink);border-color:var(--ink);color:var(--surface)}
.fnote{font-size:.82rem;color:var(--muted)}

/* chapter page */
.chero{display:flex;justify-content:space-between;align-items:flex-end;gap:16px;flex-wrap:wrap}
.tabs{display:inline-flex;gap:2px;background:var(--surface);border:1px solid var(--line);border-radius:8px;padding:3px}
.tabs a{padding:6px 16px;border-radius:6px;font-weight:600;font-size:.88rem;color:var(--muted);text-decoration:none}
.tabs a[aria-current="page"]{background:var(--subj);color:#fff}
.work{display:grid;grid-template-columns:minmax(0,1fr) 290px;gap:20px;align-items:start}
@media (max-width:880px){.work{grid-template-columns:minmax(0,1fr)}}
.work .session{max-width:none;margin:0}
.aside{display:flex;flex-direction:column;gap:12px;padding:18px;position:sticky;top:72px}
@media (max-width:880px){.aside{position:static}}
.score3{display:flex;gap:18px}
.score3 div{display:flex;flex-direction:column}
.score3 b{font-family:var(--f-head);font-size:1.25rem;font-variant-numeric:tabular-nums;line-height:1.2}
.score3 span{font-size:.76rem;color:var(--muted)}
.cov{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px}
.cov button{width:100%;display:flex;justify-content:space-between;align-items:center;gap:10px;border:0;background:none;padding:6px;border-radius:var(--r-s);text-align:left;font-size:.84rem}
.cov button:hover{background:var(--surface-2)}
.cov button[aria-pressed="true"]{background:var(--subj-soft)}
.dots{display:flex;gap:3px;flex-wrap:wrap;justify-content:flex-end;max-width:55%;flex-shrink:0}
.dots i{width:7px;height:7px;border-radius:50%;background:var(--todo)}
.dots i.g{background:var(--good)} .dots i.b{background:var(--bad)}

/* guide */
.guide{display:grid;grid-template-columns:220px minmax(0,1fr);gap:28px;align-items:start}
@media (max-width:880px){.guide{grid-template-columns:minmax(0,1fr)}}
.toc{position:sticky;top:72px;display:flex;flex-direction:column;gap:2px}
@media (max-width:880px){.toc{position:static;flex-direction:row;flex-wrap:wrap;gap:6px}}
.toc a{color:var(--ink-2);text-decoration:none;font-size:.86rem;padding:6px 10px;border-radius:var(--r-s);border-left:2px solid var(--line)}
.toc a:hover{background:var(--surface);border-left-color:var(--subj)}
@media (max-width:880px){.toc a{border:1px solid var(--line);border-radius:999px;background:var(--surface)}}
.gsecs{display:flex;flex-direction:column;gap:16px;min-width:0}
.gsec{display:flex;flex-direction:column;gap:14px;scroll-margin-top:72px;padding:24px}
.gbody{display:flex;flex-direction:column;gap:12px;min-width:0}
.gbody p,.gbody ul,.gbody ol{margin:0;max-width:72ch}
.gbody ul,.gbody ol{padding-left:20px;display:flex;flex-direction:column;gap:4px}
.gbody code{font-family:var(--f-mono);font-size:.85em;color:#eb5757;background:rgba(135,131,120,.15);padding:.15em .4em;border-radius:4px}
.gbody img{border:1px solid var(--line);border-radius:var(--r-s);background:#fff}
.gbody .katex-display{margin:4px 0;overflow-x:auto;overflow-y:hidden;padding:2px 0}
.fx{font-family:var(--f-mono);font-size:.88rem;background:var(--surface-2);border:0;border-radius:var(--r-s);padding:16px 18px;overflow-x:auto;white-space:pre-wrap;margin:0}
pre.fx code{background:none;border:0;padding:0}
.work-ex{border:1px dashed var(--line-2);border-radius:var(--r-s);padding:12px 14px;display:flex;flex-direction:column;gap:8px}
.work-ex .h{font-size:.82rem;color:var(--subj-fg);font-weight:700}
.trap,.note{border-radius:var(--r-s);padding:10px 14px;font-size:.93rem}
.trap{background:var(--warn-soft)} .trap > b:first-child{color:var(--warn)}
.note{background:var(--subj-soft)} .note p{margin:0}
.tw{overflow-x:auto}
table{border-collapse:collapse;width:100%;font-size:.88rem;min-width:420px;font-variant-numeric:tabular-nums}
th,td{border-bottom:1px solid var(--line);padding:8px 10px;text-align:left;vertical-align:top}
th{font-size:.82rem;color:var(--muted);font-weight:500}
.gsec .foot{display:flex;justify-content:flex-end}
.katex{font-size:1.06em}

/* parent view */
.studs{display:flex;flex-direction:column;gap:16px}
.stud{display:flex;flex-direction:column;gap:18px}
.stud .h{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.stud .h .avatar{width:36px;height:36px;font-size:.95rem}
.stud .h b{font-family:var(--f-head);font-size:1.1rem}
.sgrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:20px}
.sgrid h4{font-size:.82rem;color:var(--muted);margin:0 0 8px;font-family:var(--f-body);font-weight:500}
.chrow{display:grid;grid-template-columns:minmax(0,1fr) 110px;gap:10px;align-items:center;font-size:.85rem;padding:4px 0}
.wk{display:flex;gap:5px;align-items:flex-end;height:70px}
.wk div{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;font-size:.7rem;color:var(--muted);font-variant-numeric:tabular-nums}
.wk i{display:block;width:100%;background:var(--brand);border-radius:3px 3px 0 0;min-height:2px}
.recent{list-style:none;margin:0;padding:0;font-size:.84rem;display:flex;flex-direction:column;gap:5px}
.recent li{display:flex;gap:8px;align-items:baseline}
.recent .ok{color:var(--good)} .recent .no{color:var(--bad)}
.weak{margin:0;padding-left:18px;font-size:.88rem;display:flex;flex-direction:column;gap:4px}

@media (prefers-reduced-motion:no-preference){.opt,.btn,.tcard,.srow,.fchip{transition:background .15s,border-color .15s,color .15s}}

/* touch screens: no keyboard hints, roomier tap targets */
@media (hover:none) and (pointer:coarse){
  .hint.kbd-hint,.qfoot .hint kbd{display:none}
  .qfoot>.hint{display:none}
  .fchip{padding:9px 14px}
  .cov button{padding:10px 6px;min-height:44px}
  .stepper button{width:42px;height:42px}
  .btn{min-height:40px}
  .btn.link{min-height:0}
}

/* momentum: streak, week, weekly goal */
.momentum{background:var(--surface);display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1.2fr) minmax(0,1fr);gap:18px 28px;align-items:center;padding:18px 22px;margin-top:-10px}
@media (max-width:860px){.momentum{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.m-week{grid-column:1/-1;order:3}}
@media (max-width:520px){.momentum{grid-template-columns:minmax(0,1fr)}}
.m-streak,.m-goal{display:flex;gap:14px;align-items:center}
.m-big{font-size:.95rem;color:var(--ink-2)}
.m-big b{font-family:var(--f-head);font-weight:700;font-size:1.9rem;line-height:1;color:var(--ink);margin-right:2px;font-variant-numeric:tabular-nums}
.m-sub{font-size:.82rem;color:var(--muted);margin-top:4px}
.m-best{font-size:.76rem;color:var(--muted);margin-top:2px}
.flame{width:44px;height:44px;border-radius:12px;display:grid;place-items:center;background:var(--surface-2);border:1px solid var(--line);flex-shrink:0}
.flame svg{width:24px;height:24px;fill:var(--line-2)}
.flame.on{background:var(--flame-soft);border-color:color-mix(in srgb,var(--flame) 35%,var(--line))}
.flame.on svg{fill:var(--flame)}
.m-streak.on .flame svg{animation:flicker 2.4s ease-in-out infinite;transform-origin:50% 90%}
@keyframes flicker{0%,100%{transform:scale(1)}50%{transform:scale(1.08)}}
.m-days{display:flex;gap:6px}
.m-days span{flex:1;max-width:40px;aspect-ratio:1;border-radius:10px;display:grid;place-items:center;background:var(--surface-2);border:1.5px solid var(--line);font-size:.74rem;font-weight:600;color:var(--muted)}
.m-days span.on{background:var(--flame-soft);border-color:var(--flame-soft);color:var(--flame)}
.m-days span.today{border-color:var(--ink)}
.m-days span.today.on{border-color:var(--flame)}
.m-days span.future{opacity:.55}
.m-days i{font-style:normal}
.ring{width:58px;height:58px;flex-shrink:0}
.ring circle{fill:none;stroke-width:7}
.ring .r-bg{stroke:var(--todo)}
.ring .r-fg{stroke:var(--brand);stroke-linecap:round;transition:stroke-dasharray .6s ease}
.ring .r-fg.met{stroke:var(--good)}
.m-set{display:flex;align-items:center;gap:6px;font-size:.78rem;color:var(--muted);margin-top:6px}
.m-set button{width:24px;height:24px;border-radius:6px;border:1px solid var(--line-2);background:var(--surface);line-height:1;padding:0;color:var(--ink-2)}
.m-set button:disabled{opacity:.4;cursor:not-allowed}
.m-set span{font-weight:700;color:var(--ink);min-width:1ch;text-align:center}
.mline{display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:var(--r-s);background:var(--surface-2);border:1px solid var(--line);font-size:.9rem;color:var(--ink-2)}
.mline .flame{width:32px;height:32px;border-radius:9px}
.mline .flame svg{width:18px;height:18px}
.mline.on{background:var(--flame-soft);border-color:color-mix(in srgb,var(--flame) 30%,var(--line))}
.toast{position:fixed;left:50%;bottom:calc(20px + env(safe-area-inset-bottom,0px));transform:translate(-50%,24px);opacity:0;pointer-events:none;z-index:50;display:flex;align-items:center;gap:12px;background:var(--surface);border:0;border-radius:8px;padding:10px 16px 10px 10px;box-shadow:0 0 0 1px rgba(15,15,15,.05),0 3px 6px rgba(15,15,15,.1),0 9px 24px rgba(15,15,15,.2);font-size:.92rem;max-width:calc(100% - 32px);transition:opacity .25s,transform .35s cubic-bezier(.2,.8,.2,1.2)}
.toast.show{opacity:1;transform:translate(-50%,0)}
.toast .flame{width:36px;height:36px}
.toast .flame svg{animation:pop .6s cubic-bezier(.2,.8,.2,1.4)}
@keyframes pop{0%{transform:scale(.4)}100%{transform:scale(1)}}
.pill-m{display:inline-flex;align-items:center;gap:8px;font-size:.86rem;color:var(--ink-2)}
.pill-m .flame{width:28px;height:28px;border-radius:8px}
.pill-m .flame svg{width:16px;height:16px}
@media (prefers-reduced-motion:reduce){.m-streak.on .flame svg,.toast .flame svg{animation:none}.toast{transition:none}}
@media (hover:none) and (pointer:coarse){.m-set button{width:34px;height:34px}}

/* sign-in form */
.formmsg{flex-basis:100%;margin:0;font-size:.86rem;color:var(--bad);min-height:0}
.formmsg:empty{display:none}
.stud .h{position:relative}
.btn.sm{padding:0 8px;font-size:.8rem;min-height:28px}
