/* Layout: app bar, quiet topic rail with search, one working bench. Neutral greys with one brand accent (violet);
   green/red only for right/wrong. The theme follows the device by default. */
:root{
  --bg:#F6F6F9; --surface:#FFFFFF; --sunk:#F9F9FB; --ink:#16161D; --muted:#646473; --line:#E4E4EA; --soft:#EFEFF4; --hl:#E9E6FD; --fluid:#ECEAF8;
  --acc:#6D5DFC; --acc-hover:#5B4AF0; --acc-ink:#FFFFFF; --acc-text:#5141E0; --acc-soft:#EFEDFF; --acc-line:#CDC6FF;
  --good:#2E7D4F; --good-soft:#E8F3EC; --bad:#B3433B; --bad-soft:#F8EAE8;
  --f-display:"Bricolage Grotesque","Figtree",system-ui,sans-serif;
  --f-body:"Figtree",system-ui,-apple-system,"Segoe UI",sans-serif;
  --f-math:"Cambria Math",Cambria,"STIX Two Text","Times New Roman","Noto Serif","DejaVu Serif",serif;
  --f-mono:"JetBrains Mono",ui-monospace,"SFMono-Regular",Menlo,monospace;
}
/* Thai: Figtree and Bricolage have no Thai letters, so Thai system fonts come right after them (Latin keeps Figtree).
   Vietnamese: Figtree lacks most stacked accents (ậ, ế, ư...), so the whole text uses a system font instead of mixing two. */
:root:lang(th){--f-display:"Bricolage Grotesque","Figtree","Noto Sans Thai","Leelawadee UI","Tahoma",system-ui,sans-serif;
  --f-body:"Figtree","Noto Sans Thai","Leelawadee UI","Tahoma",system-ui,-apple-system,"Segoe UI",sans-serif}
:root:lang(vi){--f-display:system-ui,-apple-system,"Segoe UI",Roboto,"Noto Sans",Arial,sans-serif;
  --f-body:system-ui,-apple-system,"Segoe UI",Roboto,"Noto Sans",Arial,sans-serif}
.langmenu button:lang(th){font-family:"Figtree","Noto Sans Thai","Leelawadee UI","Tahoma",system-ui,sans-serif}
.langmenu button:lang(vi){font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Noto Sans",Arial,sans-serif}
/* tight display headings would clip stacked Thai vowels/tones and Vietnamese double accents */
:lang(th) :is(h1,h2,h3,.hero-title){letter-spacing:0;line-height:1.3}
:lang(vi) :is(h1,h2,h3,.hero-title){line-height:1.18}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){
  --bg:#0F0F14; --surface:#17171F; --sunk:#13131A; --ink:#ECECF2; --muted:#9A9AAA; --line:#2A2A36; --soft:#20202A; --hl:#2C2848; --fluid:#22213A;
  --acc:#6D5DFC; --acc-hover:#7E70FF; --acc-ink:#FFFFFF; --acc-text:#ABA0FF; --acc-soft:#221F3D; --acc-line:#3F3878;
  --good:#5DBE86; --good-soft:#16241B; --bad:#EE8077; --bad-soft:#2A1716; color-scheme:dark}}
:root[data-theme="dark"]{
  --bg:#0F0F14; --surface:#17171F; --sunk:#13131A; --ink:#ECECF2; --muted:#9A9AAA; --line:#2A2A36; --soft:#20202A; --hl:#2C2848; --fluid:#22213A;
  --acc:#6D5DFC; --acc-hover:#7E70FF; --acc-ink:#FFFFFF; --acc-text:#ABA0FF; --acc-soft:#221F3D; --acc-line:#3F3878;
  --good:#5DBE86; --good-soft:#16241B; --bad:#EE8077; --bad-soft:#2A1716; color-scheme:dark}
*{box-sizing:border-box}
[hidden]{display:none!important}
html,body{min-height:100%}
body{background:var(--bg);color:var(--ink);font-family:var(--f-body);font-size:15px;line-height:1.5}
button,input,textarea{font:inherit;color:inherit}
button{cursor:pointer}
:focus-visible{outline:2px solid var(--acc);outline-offset:2px}
html[data-in] .out-only{display:none!important}
html:not([data-in]) .in-only{display:none!important}
.gut{padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px))}

/* buttons */
.btn{border:1px solid var(--line);background:var(--surface);border-radius:9px;padding:9px 15px;font-weight:600;font-size:14px;display:inline-flex;align-items:center;gap:8px;line-height:1.2}
.btn:hover{border-color:var(--muted)}
.btn.primary{background:var(--acc);border-color:var(--acc);color:var(--acc-ink)}
.btn.primary:hover{background:var(--acc-hover);border-color:var(--acc-hover)}
.btn.ghost{border-color:transparent;background:transparent}
.btn.ghost:hover{background:var(--soft)}
.btn[disabled]{opacity:.4;cursor:not-allowed}
.btn svg{width:16px;height:16px;flex:none}
.cost{font-family:var(--f-mono);font-size:11.5px;font-weight:500;padding:2px 7px;border-radius:999px;border:1px solid currentColor;opacity:.75}
.iconbtn{width:38px;height:38px;border-radius:9px;border:1px solid var(--line);background:var(--surface);display:grid;place-items:center}
.iconbtn:hover{border-color:var(--muted)}
.iconbtn svg{width:18px;height:18px}

/* header: one for the whole site, the app included (server/sitenav.js, styles in sitenav.css) */
body::before{content:"";position:fixed;inset:0 0 auto;height:env(safe-area-inset-top,0px);z-index:21;background:var(--surface)}
.brand{display:flex;align-items:center;gap:10px;margin-right:auto;min-width:0}
.brand-mark{width:30px;height:30px;border-radius:8px;background:var(--acc);display:grid;place-items:center;flex:none}
.brand-mark svg{stroke:#fff}
.brand-mark svg{width:18px;height:18px}
.brand-name{font-family:var(--f-display);font-weight:700;font-size:18px;letter-spacing:-.01em;white-space:nowrap}
.credits{display:inline-flex;align-items:center;gap:8px;height:38px;padding:0 12px;border:1px solid var(--line);border-radius:9px;background:var(--surface);font-weight:600;font-size:14px}
.credits:hover{border-color:var(--muted)}
.credits b{font-family:var(--f-mono);font-weight:600}
.credits .plus{font-size:12px;color:var(--muted);font-weight:600;border-left:1px solid var(--line);padding-left:8px}
.avatar{width:38px;height:38px;border-radius:50%;background:var(--acc-soft);color:var(--acc-text);box-shadow:inset 0 0 0 1px var(--acc-line);border:0;font-weight:700;font-size:13.5px;letter-spacing:.02em}
.acct{position:relative}
.menu{position:absolute;right:0;top:46px;width:260px;background:var(--surface);border:1px solid var(--line);border-radius:12px;box-shadow:0 12px 32px rgba(0,0,0,.12);padding:8px;z-index:30}
.menu .who{padding:8px 10px 10px;border-bottom:1px solid var(--line);margin-bottom:6px}
.menu .who b{display:block}
.menu .who span{font-size:13px;color:var(--muted);word-break:break-all}
.menu button{width:100%;text-align:left;border:0;background:transparent;padding:9px 10px;border-radius:8px;font-size:14px;font-weight:500}
.menu button:hover{background:var(--soft)}
@media (max-width:560px){.brand-name{display:none}.credits .plus{display:none}}

/* layout */
.layout{max-width:1180px;margin:0 auto;display:grid;grid-template-columns:250px minmax(0,1fr);gap:32px;padding-block:26px 56px}
@media (max-width:880px){.layout{grid-template-columns:minmax(0,1fr);gap:16px;padding-block:16px 48px}}

/* rail */
.rail{display:flex;flex-direction:column;gap:18px;position:sticky;top:calc(env(safe-area-inset-top,0px) + 88px);align-self:start;max-height:calc(100vh - 150px);overflow:auto;overscroll-behavior:contain;padding-bottom:8px}
@media (max-width:880px){.rail{position:static;max-height:none;overflow:visible}}
.search{position:relative}
.search svg{position:absolute;left:11px;top:50%;transform:translateY(-50%);width:16px;height:16px;color:var(--muted);pointer-events:none}
.search input{width:100%;height:40px;border:1px solid var(--line);border-radius:9px;background:var(--surface);padding:0 34px 0 34px;outline:0}
.search input:focus{border-color:var(--acc)}
.search kbd{position:absolute;right:9px;top:50%;transform:translateY(-50%);font-family:var(--f-mono);font-size:11px;color:var(--muted);border:1px solid var(--line);border-radius:5px;padding:1px 6px}
.rail-label{font-size:11px;font-weight:600;letter-spacing:.09em;text-transform:uppercase;color:var(--muted);margin-bottom:6px}
.branches{display:grid;grid-template-columns:1fr 1fr;gap:6px}
.branch{border:1px solid var(--line);background:var(--surface);border-radius:9px;padding:8px 10px;text-align:left;font-weight:600;font-size:13.5px;display:flex;justify-content:space-between;align-items:center}
.branch span{font-family:var(--f-mono);font-size:11px;color:var(--muted);font-weight:500}
.branch[aria-pressed="true"]{background:var(--acc-soft);color:var(--ink);border-color:var(--acc)}
.branch[aria-pressed="true"] span{color:inherit;opacity:.7}
.tlist{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:1px}
.tgroup{font-size:12.5px;color:var(--muted);padding:10px 10px 3px;font-weight:600}
.tgroup:first-child{padding-top:0}
.topic{width:100%;border:0;background:transparent;text-align:left;padding:7px 10px;border-radius:8px;font-size:14px;color:var(--ink);display:flex;flex-direction:column}
.topic:hover{background:var(--soft)}
.topic[aria-current="true"]{background:var(--surface);box-shadow:inset 3px 0 0 var(--acc),0 0 0 1px var(--line);font-weight:600}
[dir="rtl"] .topic[aria-current="true"]{box-shadow:inset -3px 0 0 var(--acc),0 0 0 1px var(--line)}
.topic small{color:var(--muted);font-size:12px;font-weight:400}
.empty-search{font-size:13.5px;color:var(--muted);padding:6px 10px}
.rail-note{font-size:12.5px;color:var(--muted);border-top:1px solid var(--line);padding-top:12px}
.rail-toggle{display:none}
@media (max-width:880px){
  .rail-toggle{display:flex;justify-content:space-between;align-items:center;width:100%}
  .rail .browse{display:none}
  .rail.open .browse{display:flex}
}
.browse{display:flex;flex-direction:column;gap:18px}

/* main */
.main{min-width:0;display:flex;flex-direction:column;gap:18px}
.topbar{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:flex-end;gap:14px}
.crumbs{font-size:13px;color:var(--muted)}
h1{font-family:var(--f-display);font-weight:700;font-size:clamp(26px,4vw,34px);letter-spacing:-.02em;line-height:1.1;margin:4px 0 0;text-wrap:balance}
.stats{display:flex;gap:18px;font-size:13px;color:var(--muted)}
.stats b{font-family:var(--f-mono);color:var(--ink);font-weight:600;font-size:15px;margin-right:4px}

.seg{display:inline-flex;background:var(--sunk);border:1px solid var(--line);border-radius:9px;padding:3px;gap:2px}
.seg button{border:0;background:transparent;padding:6px 14px;border-radius:6px;font-size:13.5px;font-weight:600;color:var(--muted)}
.seg button[aria-pressed="true"]{background:var(--surface);color:var(--ink);box-shadow:0 0 0 1px var(--line),0 1px 2px rgba(0,0,0,.06)}

.bench{background:var(--surface);border:1px solid var(--line);border-radius:14px;overflow:hidden}
.bench-head{display:flex;flex-wrap:wrap;align-items:center;gap:10px 14px;padding:12px 16px 12px 20px;border-bottom:1px solid var(--line)}
.lvl{font-size:13px;color:var(--muted)}
.bench-head .sp{flex:1}
/* one row on wider screens: the level description shortens (…) so the buttons never move to a second line */
#bench{container-type:inline-size}
@container (min-width:640px){.bench-head{flex-wrap:nowrap}.bench-head>*{flex:none}.bench-head .lvl{flex:1 1 0;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.bench-head .sp{display:none}}
.pnum{font-family:var(--f-mono);font-size:12px;color:var(--muted)}
.diagram{background:var(--sunk);padding:20px 12px;overflow-x:auto;border-bottom:1px solid var(--line)}
.diagram svg{display:block;margin:0 auto;width:100%;max-width:780px;min-width:500px;height:auto}
.q{padding:20px;display:flex;flex-direction:column;gap:16px}
.q-text{font-size:17px;max-width:64ch;margin:0}
.sym{font-family:var(--f-math);font-size-adjust:.5;font-weight:600}
.givens{display:flex;flex-wrap:wrap;gap:6px}
.chip{font-family:var(--f-math);font-size-adjust:.5;font-size:12.5px;padding:4px 9px;border-radius:6px;background:var(--sunk);border:1px solid var(--line)}
.answer{display:flex;flex-wrap:wrap;gap:10px;align-items:stretch}
.field{display:flex;align-items:stretch;border:1.5px solid var(--line);border-radius:9px;background:var(--surface);overflow:hidden;min-width:0;flex:1 1 230px;max-width:340px}
.field:focus-within{border-color:var(--acc)}
.field label{display:flex;align-items:center;white-space:nowrap;padding:0 12px;font-family:var(--f-math);font-size-adjust:.5;font-size:15px;font-weight:600;border-right:1px solid var(--line);background:var(--sunk)}
.field label sub{font-size:.7em;vertical-align:-.35em;line-height:0;margin-left:1px}
.field input{border:0;outline:0;background:transparent;font-family:var(--f-mono);font-size:16px;padding:10px 12px;min-width:0;flex:1}
.field .unit{display:flex;align-items:center;padding:0 12px;color:var(--muted);font-family:var(--f-math);font-size-adjust:.5;white-space:nowrap}
.anote{font-size:13px;color:var(--muted);margin:-6px 0 0}
.feedback{border-radius:9px;padding:11px 14px;font-weight:500;font-size:14.5px}
.feedback.good{background:var(--good-soft);color:var(--good)}
.feedback.bad{background:var(--bad-soft);color:var(--bad)}
.feedback.meh{background:var(--soft)}
.hints{display:flex;flex-direction:column;gap:8px}
.hint{display:flex;gap:12px;padding:11px 14px;background:var(--sunk);border:1px solid var(--line);border-radius:9px;font-size:14.5px}
.hint .n{font-family:var(--f-mono);font-size:12px;color:var(--muted);font-weight:600;padding-top:2px;flex:none}
.tools{display:flex;flex-wrap:wrap;gap:8px;border-top:1px solid var(--line);padding-top:16px}
.tools .sp{flex:1}
@media (max-width:560px){.tools{gap:6px}.tools .btn{padding:9px 11px;font-size:13.5px;gap:6px;white-space:nowrap}.tools .btn svg{width:14px;height:14px}.tools #nextCost{display:none}}
@media (max-width:380px){.tools{gap:5px}.tools .btn{padding:8px 9px;font-size:13px}.tools .btn svg{display:none}}
.start{padding:44px 24px;display:flex;flex-direction:column;align-items:center;text-align:center;gap:12px}
.start h2{font-family:var(--f-display);font-size:24px;margin:0;letter-spacing:-.01em}
.start p{margin:0;color:var(--muted);max-width:46ch}
.start .meta{font-size:13px}

.solution{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:22px 20px;display:flex;flex-direction:column;gap:20px}
.solution h2{font-family:var(--f-display);font-size:22px;font-weight:700;margin:0;letter-spacing:-.01em}
.principle{font-size:14.5px;color:var(--muted);max-width:70ch;margin:0}
.principle b{color:var(--ink)}
.step{display:grid;grid-template-columns:minmax(0,300px) minmax(0,1fr);gap:20px;align-items:start;padding-top:18px;border-top:1px solid var(--line)}
.step.nofig{grid-template-columns:minmax(0,1fr)}
@media (max-width:720px){.step{grid-template-columns:minmax(0,1fr)}}
.step-fig{background:var(--sunk);border:1px solid var(--line);border-radius:9px;padding:8px;overflow-x:auto}
.step-fig svg{width:100%;min-width:260px;height:auto;display:block}
.step h3{margin:0 0 4px;font-size:15.5px;font-weight:700}
.why{margin:0 0 10px;color:var(--muted);font-size:14px;max-width:70ch}
.math{font-family:var(--f-math);font-size-adjust:.5;font-size:13.5px;display:flex;flex-direction:column;gap:6px;overflow-x:auto}
.math div{white-space:nowrap}
.res{font-weight:700;border-bottom:2px solid var(--acc)}
sub{font-size:.72em}

/* modals */
.modal{position:fixed;inset:0;z-index:50;background:rgba(10,10,10,.45);display:grid;place-items:center;padding:20px max(16px,env(safe-area-inset-right,0px)) 20px max(16px,env(safe-area-inset-left,0px))}
.sheet{background:var(--surface);border:1px solid var(--line);border-radius:16px;width:100%;max-width:560px;max-height:calc(100% - 20px);overflow:auto;padding:22px}
.sheet-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:6px}
.sheet h2{font-family:var(--f-display);font-size:22px;margin:0;letter-spacing:-.01em}
.sheet .sub{color:var(--muted);font-size:14px;margin:0 0 16px}
.packs{display:grid;grid-template-columns:1fr 1fr;gap:10px}
@media (max-width:480px){.packs{grid-template-columns:1fr}}
.pack{border:1px solid var(--line);border-radius:12px;padding:16px;display:flex;flex-direction:column;gap:6px;position:relative}
.pack .amt{font-family:var(--f-display);font-size:26px;font-weight:700;letter-spacing:-.02em;line-height:1}
.pack .amt small{font-family:var(--f-body);font-size:13px;font-weight:500;color:var(--muted);letter-spacing:0}
.pack .price{font-family:var(--f-mono);font-size:16px;font-weight:600}
.pack .per{font-size:12.5px;color:var(--muted)}
.pack .save{position:absolute;top:14px;right:14px;font-size:11.5px;font-weight:700;letter-spacing:.04em;padding:3px 8px;border-radius:999px;background:var(--ink);color:var(--surface)}
.pack .btn{margin-top:8px;justify-content:center}
.testnote{margin:16px 0 0;font-size:12.5px;color:var(--muted);padding:10px 12px;border:1px dashed var(--line);border-radius:9px}
.balance{display:flex;justify-content:space-between;align-items:center;padding:12px 14px;background:var(--sunk);border:1px solid var(--line);border-radius:10px;margin-bottom:14px;font-size:14px}
.balance b{font-family:var(--f-mono);font-size:18px}
.cats{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:12px}
.cats label{position:relative}
.cats input{position:absolute;opacity:0;pointer-events:none}
.cats span{display:inline-block;border:1px solid var(--line);border-radius:999px;padding:6px 12px;font-size:13.5px;font-weight:500;cursor:pointer}
.cats input:checked+span{background:var(--acc);color:var(--acc-ink);border-color:var(--acc)}
.cats input:focus-visible+span{outline:2px solid var(--acc);outline-offset:2px}
textarea{width:100%;min-height:110px;border:1px solid var(--line);border-radius:9px;background:var(--surface);padding:10px 12px;resize:vertical;outline:0}
textarea:focus{border-color:var(--acc)}
.ctx{font-size:12.5px;color:var(--muted);margin:10px 0 16px;font-family:var(--f-mono)}
.row-end{display:flex;justify-content:flex-end;gap:8px;flex-wrap:wrap}

/* login */
.login{min-height:calc(100vh - 64px);display:grid;place-items:center;padding-block:32px}
.login-card{width:100%;max-width:420px;background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:26px}
.login-card .brand{margin-bottom:22px}
.login-card h1{font-size:28px;margin:0 0 6px}
.login-card .sub{color:var(--muted);font-size:14px;margin:0 0 20px}
.fld{display:flex;flex-direction:column;gap:5px;margin-bottom:12px}
.fld label{font-size:13px;font-weight:600}
.fld input{height:42px;border:1px solid var(--line);border-radius:9px;background:var(--surface);padding:0 12px;outline:0;min-width:0}
.fld input:focus{border-color:var(--acc)}
.login-actions{display:flex;gap:8px;margin-top:6px}
.login-actions .primary{flex:1;justify-content:center;height:44px}
.err{color:var(--bad);font-size:13.5px;margin:4px 0 0}
.accts{margin-top:22px;border-top:1px solid var(--line);padding-top:16px}
.acct-row{width:100%;display:flex;align-items:center;gap:10px;border:0;background:transparent;padding:8px;border-radius:9px;text-align:left}
.acct-row:hover{background:var(--soft)}
.acct-row .avatar{width:32px;height:32px;font-size:12px;display:grid;place-items:center;flex:none}
.acct-row .info{min-width:0;flex:1}
.acct-row .info b{display:block;font-size:14px}
.acct-row .info span{font-size:12.5px;color:var(--muted);display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.acct-row .c{font-family:var(--f-mono);font-size:12px;color:var(--muted)}

.toast{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(20px + env(safe-area-inset-bottom,0px));z-index:60;background:var(--ink);color:var(--surface);padding:11px 16px;border-radius:10px;font-weight:500;font-size:14px;box-shadow:0 8px 24px rgba(0,0,0,.2);max-width:calc(100% - 32px)}
@media (prefers-reduced-motion:no-preference){.fade{animation:fade .22s ease-out}@keyframes fade{from{opacity:.3;transform:translateY(3px)}to{opacity:1;transform:none}}}

/* svg */
.w{stroke:var(--ink);stroke-width:2;fill:none;stroke-linecap:round;stroke-linejoin:round}
.el{stroke:var(--ink);stroke-width:2;fill:var(--surface)}
.el.tgt{stroke-width:3;fill:var(--hl)}
/* no font-size-adjust on svg text: Chromium applies it in screen space, so labels in a scaled-down figure stop shrinking with it and collide */
.lbl{fill:var(--ink);font-family:var(--f-math);font-size:13px}
/* a label crossed by a line keeps a cut-out in the background colour */
text.halo{paint-order:stroke fill;stroke:var(--sunk);stroke-width:5px;stroke-linejoin:round;stroke-opacity:1}
.lbl.v,.lbl.s{fill:var(--muted)}
.lbl.s{font-size:12px}
.lbl.t{font-weight:700;fill:var(--ink)}
.lbl.k{fill:var(--muted);font-size:11px;letter-spacing:.06em}
.lbl.big{font-size:15px}
.sb{font-size:.72em}
.dot{fill:var(--ink)}
.aw{stroke:var(--ink);stroke-width:2;fill:none;stroke-linecap:round}
.aw.t{stroke-width:2.6}
.aw.m{stroke:var(--muted);stroke-width:1.5}
.ah{fill:var(--ink)}
.ah.m{fill:var(--muted)}
.sgn{fill:var(--ink);font-family:var(--f-math);font-size:15px;font-weight:600}
.dead{stroke:var(--muted);stroke-width:1.5;stroke-dasharray:4 4;fill:none}
.dim{stroke:var(--muted);stroke-width:1}
.dash{stroke:var(--ink);stroke-width:1.6;stroke-dasharray:5 5;fill:none}
.dashm{stroke:var(--muted);stroke-width:1.2;stroke-dasharray:4 4;fill:none}
.hz{stroke:var(--muted);stroke-width:1}
.fluid{fill:var(--fluid)}
.mem{stroke:var(--ink);stroke-width:3.5;stroke-linecap:round}
.mem.t{stroke-width:6.5}
.jt{fill:var(--surface);stroke:var(--ink);stroke-width:2}
.term{fill:var(--surface);stroke:var(--ink);stroke-width:2}
.gate{stroke:var(--ink);stroke-width:7;stroke-linecap:butt}
.press{fill:var(--hl);stroke:var(--muted);stroke-width:1}
.zz{stroke:var(--ink);stroke-width:2;fill:none;stroke-linejoin:round;stroke-linecap:round}
.zz.t{stroke-width:3.4}
.reps{display:flex;flex-direction:column;gap:8px;max-height:46vh;overflow:auto}
.rep{border:1px solid var(--line);border-radius:10px;padding:10px 12px;font-size:13.5px}
.rep b{font-weight:600}
.rep .m{color:var(--muted);font-size:12.5px;font-family:var(--f-mono)}
.rep p{margin:4px 0 0;white-space:pre-wrap;word-break:break-word}
#repsJson{font-family:var(--f-mono);font-size:12px;min-height:140px;margin-top:10px}
.setgrp{display:flex;flex-direction:column;gap:8px;padding:14px 0;border-top:1px solid var(--line)}
.setgrp .cats{margin:0}
.setlbl b{display:block;font-size:14.5px}
.setlbl span{font-size:13px;color:var(--muted)}
.cats input:disabled+span{opacity:.4;cursor:not-allowed}

/* website additions */
html{-webkit-text-size-adjust:100%}
body{margin:0}
img{max-width:100%}
:root{padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px)}
a{color:inherit}
.menu a{display:block;padding:9px 10px;border-radius:8px;font-size:14px;font-weight:500;text-decoration:none}
.menu a:hover{background:var(--soft)}
.tabs{display:grid;grid-template-columns:1fr 1fr;background:var(--sunk);border:1px solid var(--line);border-radius:10px;padding:3px;margin-bottom:14px}
.tabs button{border:0;background:transparent;border-radius:7px;padding:8px;font-weight:600;font-size:14px;color:var(--muted)}
.tabs button[aria-selected="true"]{background:var(--surface);color:var(--ink);box-shadow:0 0 0 1px var(--line)}
.gbtn{width:100%;justify-content:center;height:44px;text-decoration:none;gap:10px}
.or{display:flex;align-items:center;gap:10px;color:var(--muted);font-size:13px;margin:14px 0}
.or::before,.or::after{content:"";flex:1;height:1px;background:var(--line)}
.fld small{font-size:12.5px;color:var(--muted)}
.linkbtn{border:0;background:none;padding:0;margin-top:14px;font-size:13.5px;color:var(--muted);text-decoration:underline;text-underline-offset:2px}
.linkbtn:hover{color:var(--ink)}
.ok{color:var(--good);font-size:14px;background:var(--good-soft);padding:10px 12px;border-radius:9px}
.legal{margin:22px 0 0;font-size:12.5px;color:var(--muted)}
.rail-legal{font-size:12.5px;color:var(--muted);margin:0}
.login-card h1{font-size:24px}
.banner{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px 16px;padding:12px 14px 12px 16px;border:1px solid var(--line);background:var(--surface);border-radius:12px;font-size:14.5px}
.banner b{font-weight:600;word-break:break-all}
.hist{margin-top:18px}
.sheet.wide{max-width:720px}
.plans{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
@media (max-width:640px){.plans{grid-template-columns:minmax(0,1fr)}}
.plan{border:1px solid var(--line);border-radius:12px;padding:18px 16px 16px;display:flex;flex-direction:column;gap:4px;position:relative;background:var(--surface)}
.plan.featured{border:2px solid var(--acc);padding:17px 15px 15px}
.plan .pname{font-weight:700;font-size:15px}
.plan .pprice{font-family:var(--f-display);font-size:30px;font-weight:700;letter-spacing:-.02em;line-height:1.1;margin-top:6px}
.plan .pper{font-size:13px;color:var(--muted)}
.plan .pnote{font-size:13px;margin-top:2px;min-height:1.5em}
.plan .btn{margin-top:auto;justify-content:center}
.plan > :nth-last-child(2){margin-bottom:14px}
.plan .tag{position:absolute;top:-11px;inset-inline-start:14px;font-size:12px;font-weight:700;padding:3px 9px;border-radius:999px;background:var(--acc);color:var(--acc-ink)}
.plan .save{position:static;align-self:flex-start;margin-top:6px;font-size:11.5px;font-weight:700;padding:2px 8px;border-radius:999px;border:1px solid var(--acc-line);color:var(--acc-text)}
.curplan{display:flex;flex-wrap:wrap;gap:10px 16px;justify-content:space-between;align-items:center;padding:14px;background:var(--sunk);border:1px solid var(--line);border-radius:12px;margin-bottom:14px}
.curplan b{display:block}
.curplan span{font-size:13.5px;color:var(--muted)}
.credits .inf{font-size:17px;line-height:1}
.hrow{display:flex;justify-content:space-between;gap:12px;font-size:13.5px;padding:7px 0;border-bottom:1px solid var(--line)}
.hrow span:last-child{color:var(--muted);font-family:var(--f-mono);font-size:12.5px}
.inline{display:flex;gap:8px;flex-wrap:wrap}
.inline input{flex:1 1 200px;min-width:0;height:40px;border:1px solid var(--line);border-radius:9px;background:var(--surface);padding:0 12px;outline:0}
.inline input:focus{border-color:var(--acc)}
.danger{margin-top:6px;font-size:14px}
.danger summary{cursor:pointer;color:var(--bad);font-weight:600;font-size:13.5px}
.danger p{color:var(--muted);font-size:13.5px}
.dangerbtn{color:var(--bad);border-color:var(--bad)}
.login-card .brand-name{display:block}
@media (max-width:880px){.rail .rail-note,.rail .rail-legal{display:none}.rail.open .rail-note,.rail.open .rail-legal{display:block}}
.spinner{width:22px;height:22px;border:2.5px solid var(--line);border-top-color:var(--acc);border-radius:50%;animation:spin .8s linear infinite;margin:40px auto}
/* the app's loading spinner sits 40px down without a top margin: a margin there collapses through <body>, which then
   jumped up when the app replaced the spinner (counted as a layout shift of the whole page) */
#boot.spinner{margin-top:0;position:relative;top:40px}
@keyframes spin{to{transform:rotate(360deg)}}
/* ===================== v2: shared site, app views, i18n ===================== */
::selection{background:var(--acc);color:#fff}
.wrap{max-width:1180px;margin:0 auto}
.muted{color:var(--muted)}
.btn.lg{padding:13px 20px;font-size:15.5px;border-radius:11px}
.btn.block{width:100%;justify-content:center}
a.btn{text-decoration:none}
.link{color:var(--acc-text);text-underline-offset:3px}

/* public navigation */
.nav{position:sticky;top:0;z-index:30;background:color-mix(in srgb,var(--bg) 88%,transparent);backdrop-filter:saturate(1.4) blur(10px);-webkit-backdrop-filter:saturate(1.4) blur(10px);border-bottom:1px solid transparent;transition:border-color .2s}
.nav.scrolled{border-bottom-color:var(--line)}
.nav-in{display:flex;align-items:center;gap:6px;height:64px}
.nav .brand{margin-right:18px;text-decoration:none;color:inherit}
.nav-links{display:flex;gap:2px;margin-right:auto}
.nav-links a{text-decoration:none;font-size:14.5px;font-weight:500;padding:8px 12px;border-radius:8px;color:var(--muted)}
.nav-links a:hover,.nav-links a[aria-current="page"]{color:var(--ink);background:var(--soft)}
.nav-act{display:flex;align-items:center;gap:8px}
@media (max-width:820px){.nav-links{display:none}.nav .brand{margin-right:auto}}
@media (max-width:440px){.nav-act .hide-xs{display:none}}

/* language picker */
.langwrap{position:relative}
.langbtn{height:38px;border-radius:9px;border:1px solid var(--line);background:var(--surface);display:inline-flex;align-items:center;gap:7px;padding:0 11px;font-size:13.5px;font-weight:600}
.langbtn:hover{border-color:var(--muted)}
.langbtn svg{width:16px;height:16px}
.langmenu{position:absolute;right:0;top:46px;z-index:40;width:250px;max-height:min(420px,70vh);overflow:auto;background:var(--surface);border:1px solid var(--line);border-radius:12px;box-shadow:0 16px 40px rgba(0,0,0,.14);padding:6px;display:grid;grid-template-columns:1fr}
.langmenu button{border:0;background:transparent;text-align:start;padding:8px 10px;border-radius:7px;font-size:14px;display:flex;align-items:center;gap:10px}
.langmenu button span{flex:1}
.flag{width:20px;height:15px;border-radius:3px;object-fit:cover;box-shadow:0 0 0 1px rgba(127,127,127,.35);flex:none}
.langmenu button:hover{background:var(--soft)}
.langmenu button[aria-current="true"]{font-weight:700}
.langmenu button[aria-current="true"]::after{content:"✓"}
.langmenu.up{top:auto;bottom:46px}
.langmenu.fixed{position:fixed;right:auto;z-index:300}

/* footer */
.foot{border-top:1px solid var(--line);margin-top:40px;padding-block:36px 44px;font-size:14px;color:var(--muted)}
.foot-in{display:grid;grid-template-columns:1.4fr repeat(3,1fr);gap:28px}
.foot h4,.foot .foot-h{font-size:13.5px;color:var(--ink);margin:0 0 10px;font-weight:600;font-family:inherit;letter-spacing:normal;line-height:inherit}
.foot a{display:block;text-decoration:none;padding:3px 0}
.foot a:hover{color:var(--ink)}
.foot .fine{grid-column:1/-1;display:flex;flex-wrap:wrap;justify-content:space-between;gap:12px;border-top:1px solid var(--line);padding-top:18px;font-size:13px}
@media (max-width:760px){.foot-in{grid-template-columns:1fr 1fr}.foot-in>div:first-child{grid-column:1/-1}}

/* the app's sections (Practice, Exam, Progress, History, People): a quiet row under the site header (sitenav.css) */
/* Progress tabs (Overview · History · Saved · Mistakes) and the exam date on Exams */
.ptabs{display:flex;gap:2px;border-bottom:1px solid var(--line);margin:-4px 0 18px;overflow-x:auto;scrollbar-width:none}
.ptabs::-webkit-scrollbar{display:none}
.ptabs button{border:0;background:transparent;padding:10px 12px;margin-bottom:-1px;border-bottom:2px solid transparent;font-weight:600;font-size:14.5px;color:var(--muted);white-space:nowrap}
.ptabs button:hover{color:var(--ink)}
.ptabs button[aria-selected="true"]{color:var(--ink);border-bottom-color:var(--acc)}
.hfilters{margin-bottom:14px}
.hfilters .sp{flex:1}
.exdate{display:flex;align-items:center;gap:14px;margin:0 0 16px;padding:14px 18px}
.exdate .exd-ic{width:38px;height:38px;border-radius:10px;background:var(--acc-soft);color:var(--acc-text);display:grid;place-items:center;flex:none}
.exdate .exd-ic svg{width:18px;height:18px}
.exdate .exd-t{flex:1;min-width:0}
.exdate .exd-t b{display:block;font-size:15px}
.exdate .exd-t span{display:block;color:var(--muted);font-size:13.5px;margin-top:2px}
@media (max-width:560px){.exdate{flex-wrap:wrap;align-items:flex-start}.exdate .exd-t{flex:1 1 calc(100% - 60px)}.exdate .btn{margin-inline-start:52px}}

/* bookmark */
.iconbtn.ghost{border-color:transparent;background:transparent}
.iconbtn.ghost:hover{background:var(--soft)}
#saveBtn[aria-pressed="true"] svg{fill:currentColor}

/* page heads inside the app */
.vhead{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:flex-end;gap:12px 20px;margin-bottom:18px}
.vhead p{margin:4px 0 0;color:var(--muted);font-size:14.5px}
.vbody{max-width:1100px;margin:0 auto;padding-block:26px 56px}

/* progress */
.kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));border:1px solid var(--line);border-radius:14px;background:var(--surface);overflow:hidden}
.kpi{padding:16px 18px;border-inline-start:1px solid var(--line)}
.kpi:first-child{border-inline-start:0}
.kpi b{display:block;font-family:var(--f-display);font-size:30px;letter-spacing:-.02em;line-height:1.1}
.kpi span{font-size:13.5px;color:var(--muted)}
@media (max-width:640px){.kpis{grid-template-columns:1fr 1fr}.kpi:nth-child(3){border-inline-start:0}.kpi:nth-child(n+3){border-top:1px solid var(--line)}}
.panel{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:18px 20px;margin-top:16px}
.panel h2{font-family:var(--f-display);font-size:19px;margin:0 0 4px;letter-spacing:-.01em}
.panel .sub{color:var(--muted);font-size:13.5px;margin:0 0 14px}
.heat{display:grid;grid-auto-flow:column;grid-template-rows:repeat(7,12px);gap:3px;overflow-x:auto;padding-bottom:4px;direction:ltr}
.heat i,.legend i{width:12px;height:12px;border-radius:3px;background:var(--soft)}
.heat i[data-l="1"],.legend i[data-l="1"]{background:color-mix(in srgb,var(--acc) 25%,var(--soft))}
.heat i[data-l="2"],.legend i[data-l="2"]{background:color-mix(in srgb,var(--acc) 50%,var(--soft))}
.heat i[data-l="3"],.legend i[data-l="3"]{background:color-mix(in srgb,var(--acc) 75%,var(--soft))}
.heat i[data-l="4"],.legend i[data-l="4"]{background:var(--acc)}
.heat i.out{visibility:hidden}
.legend{display:flex;align-items:center;gap:4px;font-size:12px;color:var(--muted);margin-top:8px;justify-content:flex-end}
.legend i{width:11px;height:11px;border-radius:3px;display:inline-block}
.ttable{width:100%;border-collapse:collapse;font-size:14px}
.ttable th{text-align:start;font-weight:600;color:var(--muted);font-size:12.5px;padding:8px 10px;border-bottom:1px solid var(--line)}
.ttable td{padding:10px;border-bottom:1px solid var(--line);vertical-align:middle}
.ttable tr:last-child td{border-bottom:0}
.ttable .num{font-family:var(--f-mono);font-size:13px;text-align:end;white-space:nowrap}
.ttable th.num{text-align:end}
.bar{height:6px;border-radius:99px;background:var(--soft);min-width:70px;overflow:hidden}
.bar i{display:block;height:100%;background:var(--acc);border-radius:99px}
.tname b{display:block;font-weight:600}
.tname small{color:var(--muted);font-size:12.5px}
@media (max-width:640px){.ttable .hide-sm{display:none}}
.weak{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:10px}
.weak button{text-align:start;border:1px solid var(--line);background:var(--sunk);border-radius:11px;padding:12px 14px;display:flex;flex-direction:column;gap:2px}
.weak button:hover{border-color:var(--muted)}
.weak small{color:var(--muted);font-size:12.5px}
.empty{padding:40px 20px;text-align:center;color:var(--muted)}
.empty h3{color:var(--ink);font-family:var(--f-display);font-size:20px;margin:0 0 6px}
.empty .btn{margin-top:14px}

/* history */
.filters{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.filters select{height:36px;border:1px solid var(--line);border-radius:9px;background:var(--surface);padding:0 10px;font:inherit;font-size:14px;color:inherit}
.hlist{display:flex;flex-direction:column;border:1px solid var(--line);border-radius:14px;background:var(--surface);overflow:hidden}
.hitem{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:4px 14px;align-items:center;padding:13px 16px;border-top:1px solid var(--line);text-align:start;border-inline:0;border-bottom:0;background:transparent;width:100%}
.hitem:first-child{border-top:0}
.hitem:hover{background:var(--sunk)}
.hitem .st{width:26px;height:26px;border-radius:50%;display:grid;place-items:center;border:1.5px solid var(--line);grid-row:span 2}
.hitem .st svg{width:14px;height:14px}
.hitem .st.ok{background:var(--good-soft);border-color:transparent;color:var(--good)}
.hitem .st.rv{background:var(--soft);border-color:transparent;color:var(--muted)}
.hitem .t{font-weight:600;font-size:14.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hitem .p{grid-column:2;font-size:13.5px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hitem .m{grid-row:span 2;text-align:end;font-size:12.5px;color:var(--muted);white-space:nowrap}
.hitem .m b{display:block;font-family:var(--f-mono);font-weight:500;color:var(--ink);font-size:12px}
.hitem .star{color:var(--acc-text);font-size:13px}
.more{display:flex;justify-content:center;margin-top:14px}
.backbar{display:flex;align-items:center;gap:10px;font-size:14px;margin-bottom:-4px}

/* onboarding */
.sheet.ob{max-width:640px}
.obsteps{display:flex;gap:6px;margin-bottom:14px}
.obsteps i{height:4px;flex:1;border-radius:99px;background:var(--soft)}
.obsteps i.on{background:var(--acc)}
.picks{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
@media (max-width:480px){.picks{grid-template-columns:1fr}}
.pick{position:relative;border:1.5px solid var(--line);border-radius:12px;padding:14px 14px 14px 46px;text-align:start;background:var(--surface);display:flex;flex-direction:column;gap:2px}
.pick:hover{border-color:var(--muted)}
.pick b{font-size:15px}
.pick small{color:var(--muted);font-size:12.5px}
.pick::before{content:"";position:absolute;inset-inline-start:14px;top:16px;width:18px;height:18px;border-radius:5px;border:1.5px solid var(--muted)}
.pick[aria-pressed="true"]{border-color:var(--acc);box-shadow:0 0 0 1px var(--acc);background:var(--acc-soft)}
.pick[aria-pressed="true"]::before{background:var(--acc) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/14px no-repeat;border-color:var(--acc)}
.tpicks{display:flex;flex-direction:column;gap:14px;max-height:46vh;overflow:auto;padding:2px}
.tpicks h4{margin:0 0 6px;font-size:13px;color:var(--muted);font-weight:600}
.chips{display:flex;flex-wrap:wrap;gap:6px}
.chipbtn{border:1px solid var(--line);background:var(--surface);border-radius:999px;padding:6px 12px;font-size:13.5px;font-weight:500}
.chipbtn[aria-pressed="true"]{background:var(--acc);color:var(--acc-ink);border-color:var(--acc)}
.obfoot{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:18px;flex-wrap:wrap}
.railhead{display:flex;justify-content:space-between;align-items:center;gap:8px}
.focusbar{display:flex;gap:4px;font-size:12.5px}
.focusbar button{border:0;background:transparent;color:var(--muted);font-weight:600;padding:3px 7px;border-radius:6px;font-size:12.5px}
.focusbar button[aria-pressed="true"]{color:var(--ink);background:var(--soft)}
.focusbar button.edit{text-decoration:underline;text-underline-offset:2px}
.skel{background:linear-gradient(90deg,var(--soft),var(--sunk),var(--soft));background-size:200% 100%;border-radius:8px}
@media (prefers-reduced-motion:no-preference){.skel{animation:sk 1.2s linear infinite}@keyframes sk{to{background-position:-200% 0}}}

/* svg (new topics) */
.bore{fill:var(--sunk);stroke:var(--ink);stroke-width:2}
.lay{fill:var(--hl);stroke:var(--ink);stroke-width:2}
.sand{fill:var(--sunk);stroke:none}
.clay{fill:var(--hl);stroke:none}
.grain{fill:var(--muted)}
.water{stroke:var(--ink);stroke-width:1.6;stroke-dasharray:6 4}
.wt{fill:var(--surface);stroke:var(--ink);stroke-width:1.6}
sup{font-size:.72em;line-height:0}

/* right-to-left languages: layout mirrors, but diagrams, maths and values stay left-to-right */
[dir="rtl"] .menu,[dir="rtl"] .langmenu{right:auto;left:0}
[dir="rtl"] .search svg{left:auto;right:11px}
[dir="rtl"] .search kbd{right:auto;left:9px}
[dir="rtl"] .topic,[dir="rtl"] .branch,[dir="rtl"] .menu button,[dir="rtl"] .acct-row{text-align:right}
.diagram,.step-fig,.math,.givens,.chip,.field,.pnum,.sym,.heat{direction:ltr;unicode-bidi:isolate}
[dir="rtl"] .field{flex-direction:row}
[dir="rtl"] .q-text,[dir="rtl"] .hint,[dir="rtl"] .why,[dir="rtl"] .principle{text-align:right}
.heat{grid-auto-columns:12px;justify-content:start}
.ttable th.num{font-family:var(--f-body)}
.rail-label{text-transform:none;letter-spacing:0;font-size:12.5px}
@media (max-width:560px){.bench-head{padding:10px 12px}.bench-head .lvl{display:none}}
@media (max-width:560px){
  .hitem{grid-template-columns:auto minmax(0,1fr)}
  .hitem .st{grid-row:span 3}
  .hitem .m{grid-row:auto;grid-column:2;text-align:start;display:flex;gap:8px;align-items:baseline}
  .hitem .m b{display:inline}
  .filters{width:100%}
  .filters .seg{width:100%;overflow-x:auto}
  .filters .seg button{white-space:nowrap;padding:6px 10px;flex:1}
  .filters select{width:100%}
}

/* ===================== v3: multiple choice, calculator, more fields ===================== */
.bfield{grid-column:1/-1;font-size:11.5px;font-weight:600;color:var(--muted);margin:6px 2px 0}
.bfield:first-child{margin-top:0}
.pfield{grid-column:1/-1;font-size:12.5px;font-weight:700;color:var(--muted);margin:6px 0 -2px;letter-spacing:.02em}
.pfield:first-child{margin-top:0}
.picks{max-height:52vh;overflow:auto;padding:2px}
.topic .mc{font-style:normal;font-size:10.5px;font-weight:600;color:var(--acc-text);border:1px solid var(--acc-line);border-radius:5px;padding:0 5px;margin-inline-start:4px;vertical-align:1px;white-space:nowrap}
.choices{display:grid;gap:8px;max-width:760px}
.choice{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:12px;text-align:start;border:1.5px solid var(--line);background:var(--surface);border-radius:11px;padding:11px 14px;font-size:15px;line-height:1.4;transition:border-color .12s,background .12s}
.choice:hover:not(:disabled){border-color:var(--muted)}
.choice .k{width:28px;height:28px;border-radius:8px;display:grid;place-items:center;font-family:var(--f-mono);font-size:13px;font-weight:600;background:var(--sunk);border:1px solid var(--line);color:var(--muted)}
.choice .mk{width:18px;height:18px}
.choice[aria-checked="true"]{border-color:var(--acc);background:var(--acc-soft)}
.choice[aria-checked="true"] .k{background:var(--acc);border-color:var(--acc);color:var(--acc-ink)}
.choice.good{border-color:var(--good);background:var(--good-soft)}
.choice.good .k{background:var(--good);border-color:var(--good);color:var(--surface)}
.choice.good .mk{background:center/18px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%232E7D4F' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")}
.choice.bad{border-color:var(--bad);background:var(--bad-soft);color:var(--muted)}
.choice.bad .k{background:var(--bad);border-color:var(--bad);color:var(--surface)}
.choice.bad .ct{text-decoration:line-through;text-decoration-color:var(--bad)}
.choice.out{opacity:.38}
.choice.out .ct{text-decoration:line-through}
.choice:disabled{cursor:default}
.choice:disabled:not(.good):not(.bad):not(.out){opacity:.75}
.keyhint{align-self:center;font-size:12.5px;color:var(--muted)}
@media (max-width:560px){.choice{padding:10px 12px;font-size:14.5px;gap:10px}.lbl-md{display:none}}

.calc{position:fixed;z-index:45;right:20px;bottom:20px;width:316px;background:var(--surface);border:1px solid var(--line);border-radius:16px;box-shadow:0 24px 60px rgba(0,0,0,.35);padding:12px;display:flex;flex-direction:column;gap:10px}
.calc-head{display:flex;align-items:center;gap:8px}
.calc-head b{font-size:14px;margin-inline-end:auto}
.calc-head .seg button{padding:4px 9px;font-size:11.5px;font-family:var(--f-mono)}
.calc-head .iconbtn{width:32px;height:32px}
.calc-screen{background:var(--sunk);border:1px solid var(--line);border-radius:10px;padding:8px 10px;direction:ltr}
.calc-prev{font-family:var(--f-mono);font-size:12px;color:var(--muted);text-align:end;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-height:18px}
.calc-screen input{width:100%;border:0;outline:0;background:transparent;font-family:var(--f-mono);font-size:22px;text-align:end;padding:2px 0;color:var(--ink)}
.calc-keys{display:grid;grid-template-columns:repeat(5,1fr);gap:6px;direction:ltr}
.calc-keys button{height:40px;border-radius:9px;border:1px solid var(--line);background:var(--sunk);font-family:var(--f-mono);font-size:13.5px;font-weight:500;padding:0}
.calc-keys button:hover{border-color:var(--muted)}
.calc-keys button.num{background:var(--surface);font-size:16px}
.calc-keys button.op{background:var(--soft);font-size:17px}
.calc-keys button.fn{color:var(--bad)}
.calc-keys button.eq{background:var(--acc);border-color:var(--acc);color:var(--acc-ink);font-size:18px}
.calc-foot{display:flex;align-items:center;gap:8px}
.calc-foot .btn{margin-inline-start:auto}
.calc-err{font-size:12.5px;color:var(--bad)}
[dir="rtl"] .calc{right:auto;left:20px}
@media (max-width:720px){.calc{left:0;right:0;bottom:0;width:auto;border-radius:16px 16px 0 0;padding:12px max(12px,env(safe-area-inset-right,0px)) calc(12px + env(safe-area-inset-bottom,0px)) max(12px,env(safe-area-inset-left,0px))}
  [dir="rtl"] .calc{left:0}.calc-keys button{height:44px}body.calc-open.inapp{padding-bottom:440px}}

/* mock exam */
.exform{padding:6px 20px 20px}
.exform .setgrp.first{border-top:0}
.exform .tpicks{max-height:300px}
.exquick{display:flex;gap:16px}.exquick .linkbtn{margin-top:0}
.exgo{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px;border-top:1px solid var(--line);padding-top:16px;font-size:14px}
.exbar{position:sticky;top:calc(env(safe-area-inset-top,0px) + 64px);z-index:15;display:flex;flex-wrap:wrap;align-items:center;gap:10px 16px;background:color-mix(in srgb,var(--bg) 92%,transparent);backdrop-filter:blur(8px);padding:12px 0;margin-bottom:14px}
.exinfo{display:flex;flex-direction:column;line-height:1.25}.exinfo span{font-size:13px;color:var(--muted)}
.exdots{display:flex;flex-wrap:wrap;gap:4px;flex:1;min-width:0}
.exdots button{width:28px;height:28px;border-radius:7px;border:1px solid var(--line);background:var(--surface);font-family:var(--f-mono);font-size:12px;color:var(--muted);padding:0}
.exdots button.done{background:var(--acc-soft);border-color:var(--acc-line);color:var(--ink)}
.exdots button[aria-current="true"]{border-color:var(--acc);box-shadow:0 0 0 1px var(--acc);color:var(--ink)}
.extimer{font-family:var(--f-mono);font-size:18px;font-weight:600;padding:6px 12px;border-radius:9px;background:var(--surface);border:1px solid var(--line);min-width:84px;text-align:center}
.extimer.low{color:var(--bad);border-color:var(--bad)}
#exRun .bench{margin-bottom:24px}
.hitem .st.bad{background:var(--bad-soft);border-color:transparent;color:var(--bad)}
.hitem .st small{font-family:var(--f-mono);font-size:10px;font-weight:600}
.phead{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;flex-wrap:wrap}
.mlist{display:flex;flex-direction:column;border:1px solid var(--line);border-radius:12px;overflow:hidden}
.mitem{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 14px;padding:11px 14px;border-top:1px solid var(--line)}
.mitem:first-child{border-top:0}
.mi{min-width:0;flex:1 1 280px;display:flex;flex-direction:column}
.mi b{font-size:14.5px}.mi span{font-size:13px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ma{display:flex;gap:6px}
@media (max-width:720px){.exdots button{width:26px;height:26px}}
.exr .m b{display:inline}
.exr .m{max-width:min(420px,40vw);white-space:normal}
.exr .m>span{display:inline-block} /* "Yours: …" and "Answer: …" each stay on one line where they fit */
@media (max-width:560px){.exr .m{display:block;max-width:none}}

/* ---------- topic rail: quiet scrollbar, clear difference between group labels and topics ---------- */
.rail{scrollbar-width:thin;scrollbar-color:transparent transparent;padding-inline-end:8px;margin-inline-end:-8px;transition:scrollbar-color .25s}
.rail:hover,.rail:focus-within{scrollbar-color:color-mix(in srgb,var(--muted) 45%,transparent) transparent}
.rail::-webkit-scrollbar{width:6px}
.rail::-webkit-scrollbar-track{background:transparent}
.rail::-webkit-scrollbar-thumb{background:transparent;border-radius:6px}
.rail:hover::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--muted) 45%,transparent)}
@media (min-width:881px){.rail.fadeend{-webkit-mask-image:linear-gradient(to bottom,#000 calc(100% - 36px),transparent);mask-image:linear-gradient(to bottom,#000 calc(100% - 36px),transparent)}}
.langmenu,.sheet,.menu,.tpicks,.diagram,.step-fig{scrollbar-width:thin;scrollbar-color:color-mix(in srgb,var(--muted) 40%,transparent) transparent}

.tgroup{display:flex;align-items:center;gap:8px;font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);padding:16px 2px 6px;cursor:default;user-select:none}
.tgroup::after{content:"";flex:1;height:1px;background:var(--line)}
.tgroup:first-child{padding-top:2px}
:lang(ar) .tgroup,:lang(zh) .tgroup,:lang(ja) .tgroup,:lang(ko) .tgroup,:lang(hi) .tgroup{text-transform:none;letter-spacing:0;font-size:12px}
.topic{position:relative;padding:7px 28px 7px 24px;transition:background .15s,color .15s}
.topic::before{content:"";position:absolute;inset-inline-start:11px;top:15px;width:5px;height:5px;border-radius:50%;background:var(--muted);opacity:.45;transition:background .15s,opacity .15s,transform .15s}
.topic::after{content:"";position:absolute;inset-inline-end:10px;top:50%;width:7px;height:7px;border-top:1.6px solid currentColor;border-right:1.6px solid currentColor;transform:translate(-4px,-50%) rotate(45deg);opacity:0;transition:opacity .15s,transform .15s}
[dir="rtl"] .topic::after{transform:translate(4px,-50%) rotate(-135deg)}
.topic:hover::before{background:var(--acc);opacity:1}
.topic:hover::after{opacity:.55;transform:translate(0,-50%) rotate(45deg)}
[dir="rtl"] .topic:hover::after{transform:translate(0,-50%) rotate(-135deg)}
.topic[aria-current="true"]::before{background:var(--acc);opacity:1;transform:scale(1.3)}
.topic[aria-current="true"]{box-shadow:none;background:var(--acc-soft);color:var(--ink)}
[dir="rtl"] .topic[aria-current="true"]{box-shadow:none}
#results .topic::before{display:none}
#results .topic{padding-inline-start:10px}

/* note about possible mistakes */
.rail-care{display:flex;gap:8px;font-size:12.5px;color:var(--muted);margin:0;line-height:1.45;background:var(--sunk);border:1px solid var(--line);border-radius:9px;padding:9px 11px}
.rail-care svg{width:15px;height:15px;flex:none;margin-top:1px}
.rail-care .linkbtn{font-size:inherit;padding:0;margin:0}

/* language picker in the app bar */
@media (max-width:420px){.appl .langbtn span{display:none}.appl .langbtn{padding:0 9px}}

/* ---------- odometer digits for counters ---------- */
.odo{display:inline-flex;vertical-align:bottom;overflow:hidden;height:1.25em;line-height:1.25em}
.odo>i{font-style:normal;display:inline-block;height:1.25em;overflow:hidden}
.odo>i>span{display:flex;flex-direction:column;transition:transform .6s cubic-bezier(.2,.8,.2,1)}
.odo>i>span>b,.odo>i>span>span{display:block;height:1.25em;font:inherit;color:inherit}

/* ---------- motion: short and calm, and off for anyone who asks for less motion ---------- */
@media (prefers-reduced-motion:no-preference){
  .btn,.iconbtn,.branch,.choice,.credits,.langbtn,.seg button{transition:background-color .15s,border-color .15s,color .15s,box-shadow .15s,transform .12s}
  .btn:active:not([disabled]),.iconbtn:active,.branch:active,.choice:active:not([disabled]){transform:scale(.97)}
  .seg button{transition:background-color .2s,color .2s,box-shadow .2s}
  .vbody:not([hidden]),#vPractice:not([hidden]){animation:viewIn .28s ease-out}
  @keyframes viewIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
  .modal:not([hidden]){animation:dimIn .2s ease-out}
  .modal:not([hidden]) .sheet{animation:sheetIn .26s cubic-bezier(.2,.9,.3,1.1)}
  @keyframes dimIn{from{background:rgba(10,10,10,0)}}
  @keyframes sheetIn{from{opacity:0;transform:translateY(10px) scale(.98)}to{opacity:1;transform:none}}
  .menu:not([hidden]),.langmenu:not([hidden]){animation:dropIn .16s ease-out;transform-origin:top right}
  .langmenu.up:not([hidden]){transform-origin:bottom right}
  @keyframes dropIn{from{opacity:0;transform:translateY(-4px) scale(.98)}to{opacity:1;transform:none}}
  #probView.enter .diagram{animation:viewIn .35s ease-out both}
  #probView.enter .q>*{animation:viewIn .35s ease-out both}
  #probView.enter .q>:nth-child(2){animation-delay:.04s}
  #probView.enter .q>:nth-child(3){animation-delay:.08s}
  #probView.enter .q>:nth-child(4){animation-delay:.12s}
  #probView.enter .q>:nth-child(n+5){animation-delay:.16s}
  #probView.enter .choice{animation:viewIn .32s ease-out both}
  #probView.enter .choice:nth-child(2){animation-delay:.05s}
  #probView.enter .choice:nth-child(3){animation-delay:.1s}
  #probView.enter .choice:nth-child(4){animation-delay:.15s}
  .start:not([hidden]){animation:viewIn .3s ease-out}
  .choice.good{animation:good .5s ease-out}
  .choice.bad,.feedback.bad{animation:shake .38s ease-in-out}
  .feedback.good{animation:good .45s ease-out}
  @keyframes good{0%{transform:scale(.98)}40%{transform:scale(1.015)}100%{transform:none}}
  @keyframes shake{0%,100%{transform:none}20%{transform:translateX(-5px)}40%{transform:translateX(4px)}60%{transform:translateX(-3px)}80%{transform:translateX(2px)}}
  .solution:not([hidden]){animation:viewIn .3s ease-out}
  .tlist.swap>li{animation:viewIn .25s ease-out both}
  .tlist.swap>li:nth-child(2){animation-delay:.02s}.tlist.swap>li:nth-child(3){animation-delay:.04s}.tlist.swap>li:nth-child(4){animation-delay:.06s}
  .tlist.swap>li:nth-child(5){animation-delay:.08s}.tlist.swap>li:nth-child(6){animation-delay:.1s}.tlist.swap>li:nth-child(n+7){animation-delay:.12s}
  .toast:not([hidden]){animation:toastIn .25s cubic-bezier(.2,.9,.3,1.2)}
  @keyframes toastIn{from{opacity:0;transform:translate(-50%,10px)}to{opacity:1;transform:translate(-50%,0)}}
  .credits b.bump,.stats b.bump{animation:bump .5s ease-out}
  @keyframes bump{40%{color:var(--acc-text)}}
}
@media (prefers-reduced-motion:reduce){.odo>i>span{transition:none}}
.care-m{display:none}
@media (max-width:880px){.rail>.rail-care{display:none}.care-m{display:flex}}
@media (max-width:560px){.bench-head{gap:8px;padding:10px 12px}.bench-head .seg{display:flex;flex:1 1 100%}.bench-head .seg button{padding:6px 8px;flex:1 1 auto}.bench-head .seg button[hidden]{display:none}.bench-head .iconbtn{width:34px;height:34px}}
.topic .mc{display:inline-block}


/* exam countdown */
.examchip{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--acc-line);background:var(--acc-soft);color:var(--ink);border-radius:999px;padding:4px 10px;font-size:13px;font-weight:600}
.examchip svg{width:14px;height:14px;color:var(--acc-text)}
.examchip .eg{font-family:var(--f-mono);font-size:12px;font-weight:500;color:var(--muted);border-inline-start:1px solid var(--acc-line);padding-inline-start:7px}
.examchip .eg.done{color:var(--good)}
.stats{align-items:center;flex-wrap:wrap}
.examrow{flex-wrap:wrap}
.examrow input[type=date],.examrow select{height:38px;border:1px solid var(--line);border-radius:9px;background:var(--surface);padding:0 10px;font:inherit;font-size:14px;color:inherit}

/* redo my mistakes */
.reviewbar{display:flex;align-items:center;gap:10px;border:1px solid var(--acc-line);background:var(--acc-soft);border-radius:11px;padding:6px 6px 6px 14px;font-size:14px;font-weight:600}
.reviewbar svg{width:16px;height:16px;color:var(--acc-text);flex:none}
.reviewbar span{flex:1}
.pbtns{display:flex;gap:8px;flex-wrap:wrap;align-items:center}

/* formula sheet: a side panel, so the problem stays visible */
.modal.side{place-items:stretch end;padding:0;background:rgba(10,10,10,.25)}
.modal.side .sheet{max-width:420px;height:100%;max-height:none;border-radius:0;border-width:0 0 0 1px;padding-top:calc(22px + env(safe-area-inset-top,0px))}
[dir="rtl"] .modal.side{place-items:stretch start}
[dir="rtl"] .modal.side .sheet{border-width:0 1px 0 0}
@media (prefers-reduced-motion:no-preference){.modal.side:not([hidden]) .sheet{animation:sideIn .28s cubic-bezier(.2,.9,.3,1)}@keyframes sideIn{from{transform:translateX(30px);opacity:0}to{transform:none;opacity:1}}}
.fx{margin:0;display:flex;flex-direction:column;gap:8px}
.fx div{border:1px solid var(--line);border-radius:10px;padding:10px 12px;background:var(--sunk)}
.fx dt{font-size:12.5px;color:var(--muted);font-weight:600;margin-bottom:3px}
.fx dd{margin:0;font-family:var(--f-math);font-size-adjust:.5;font-size:14px;line-height:1.55;direction:ltr;unicode-bidi:isolate}
#formulaModal .principle{font-size:14px;margin:0 0 14px}
.rate{display:flex;align-items:center;gap:6px;flex-wrap:wrap;border-top:1px solid var(--line);padding-top:14px;font-size:14px;color:var(--muted)}
.rate .btn.sm{padding:6px 12px;font-size:13px;height:auto;min-height:32px;border-radius:8px}.rate>span{margin-inline-end:6px}

/* formula sheet: a side panel without backdrop, usable together with the calculator */
.modal.fxpanel{background:transparent;pointer-events:none;z-index:44;left:auto;width:min(400px,100%)}
.modal.fxpanel .sheet{pointer-events:auto;box-shadow:-14px 0 40px rgba(0,0,0,.16)}
@media (prefers-reduced-motion:no-preference){.modal.fxpanel:not([hidden]){animation:none}}
[dir="rtl"] .modal.fxpanel{left:0;right:auto}
[dir="rtl"] .modal.fxpanel .sheet{box-shadow:14px 0 40px rgba(0,0,0,.16)}
#fxBtn[aria-pressed="true"]{background:var(--soft);color:var(--ink)}
.streakchip{font-size:12.5px;font-weight:600;color:var(--acc);background:color-mix(in srgb,var(--acc) 10%,transparent);padding:4px 10px;border-radius:999px;white-space:nowrap}
.launch{margin:0 0 16px;padding:12px 16px;border-radius:12px;background:color-mix(in srgb,var(--acc) 9%,var(--surface));border:1px solid color-mix(in srgb,var(--acc) 30%,var(--line));font-size:14px;line-height:1.45}.launch b{color:var(--acc)}
/* under the header menus, the phone Library sheet (24), the tab bar (25) and windows, so it never hides them */
.consent{position:fixed;left:16px;right:16px;bottom:16px;z-index:23;max-width:620px;margin:0 auto;background:var(--surface);border:1px solid var(--line);border-radius:14px;box-shadow:0 18px 50px rgba(0,0,0,.18);padding:14px 16px;display:flex;gap:14px;align-items:center;flex-wrap:wrap;font-size:14px}
.consent p{margin:0;flex:1 1 300px;color:var(--muted);line-height:1.45}.consent a{color:var(--acc)}.consent>div{display:flex;gap:8px}
/* formula sheet as a floating window (like the calculator): nothing is squeezed, and both can be dragged anywhere */
.modal.fxpanel{inset:auto;top:calc(var(--fx-top,61px) + 12px);right:20px;left:auto;bottom:auto;width:380px;max-width:calc(100vw - 32px);display:block;padding:0;pointer-events:auto}
.modal.fxpanel .sheet{height:auto;max-height:calc(100vh - var(--fx-top,61px) - 36px);overflow:auto;border-radius:16px;border-width:1px;padding:16px 18px;box-shadow:0 24px 60px rgba(0,0,0,.25)}
.modal.fxpanel .sheet-head{position:sticky;top:-16px;background:var(--surface);margin:-16px -18px 0;padding:14px 18px 8px;z-index:1;user-select:none}
.modal.fxpanel.moved{right:auto}
[dir="rtl"] .modal.fxpanel{right:auto;left:20px}
@media (max-width:720px){.modal.fxpanel{left:0;right:0;top:auto;bottom:0;width:auto;max-width:none}.modal.fxpanel .sheet{max-height:60vh;border-radius:16px 16px 0 0}}
.calc-head{user-select:none}

/* learn: "Learn from zero" lessons, one calm section at a time */
.modeseg button{padding:5px 14px}
.learntip{margin:-8px 0 0;font-size:14px;color:var(--muted)}
.examask{margin-top:10px;padding:12px 14px;border:1px solid var(--acc-line);background:var(--acc-soft);border-radius:12px;display:flex;flex-direction:column;gap:10px}
.examask .ea-t{display:flex;flex-direction:column;gap:2px;font-size:14px}.examask .ea-t span{color:var(--muted)}
.examask .ea-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.examask input[type=date]{height:34px;padding:0 10px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--ink);font:inherit;font-size:14px}
.examask .linkbtn{font-size:13.5px;color:var(--muted)}
.learntip .linkbtn{margin:0;color:var(--acc-text);font-size:inherit;font-weight:600}
.lhead{display:flex;align-items:center;gap:14px;padding:14px 28px;border-bottom:1px solid var(--line)}
.ldots{display:flex;gap:6px;flex-wrap:wrap}
.ldots span{width:8px;height:8px;border-radius:50%;background:var(--line);transition:background .2s,transform .2s}
.ldots span.done{background:var(--acc-line)}
.ldots span.cur{background:var(--acc);transform:scale(1.25)}
.lpos{margin-inline-start:auto;font-size:13px;color:var(--muted)}
.lprereq{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:16px 28px 0;font-size:13.5px;color:var(--muted)}
.lprereq .lchip{font-family:inherit;font-size:13px;cursor:pointer;color:var(--acc-text);border-color:var(--acc-line);background:var(--acc-soft)}
.lprereq .lchip:hover{border-color:var(--acc)}
.lbody{padding:22px 28px 26px;max-width:760px;font-size:15.5px;line-height:1.65}
.lbody p{margin:0 0 12px}
.lbody ul,.lbody ol{margin:0 0 14px;padding-inline-start:22px;display:grid;gap:6px}
.lbody .lsteps li::marker{color:var(--acc-text);font-weight:700}
.ltitle{font-family:var(--f-display);font-size:24px;letter-spacing:-.01em;margin:0 0 14px;line-height:1.25}
.lbody .m,.seo-learn .m{font-family:var(--f-math);font-size-adjust:.5;white-space:nowrap}
.lbody .eq,.seo-learn .eq{font-family:var(--f-math);font-size-adjust:.5;font-size:16px;background:var(--sunk);border:1px solid var(--line);border-radius:9px;padding:9px 14px;margin:0 0 12px;overflow-x:auto;direction:ltr;unicode-bidi:isolate}
.lfig{background:var(--sunk);border:1px solid var(--line);border-radius:12px;padding:14px 10px;margin:0 0 14px;overflow-x:auto;direction:ltr}
.lfig svg{display:block;margin:0 auto;width:100%;max-width:min(620px,var(--w,620px));min-width:min(420px,var(--w,420px));height:auto}
.lex,.lcheck{border:1px solid var(--line);border-radius:12px;padding:16px 18px;margin:18px 0 4px;display:flex;flex-direction:column;gap:12px;align-items:flex-start}
.lex>*,.lcheck>*{width:100%}
.lex>.btn{width:auto}
.lex-tag{font-size:11.5px;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:var(--acc-text)}
.lex-q p,.lcheck-q{margin:4px 0 0;font-weight:600}
.lex-step{display:grid;grid-template-columns:26px minmax(0,1fr);gap:12px;padding-top:12px;border-top:1px solid var(--line)}
.lex-step .n{width:26px;height:26px;border-radius:50%;display:grid;place-items:center;background:var(--acc-soft);color:var(--acc-text);font-size:12.5px;font-weight:700}
.lex-step h3{margin:2px 0 6px;font-size:15px}
.lex-step p{margin:0 0 8px}
.lex-step .lfig{margin-bottom:10px}
.lex-ans{border-radius:9px;background:var(--good-soft);color:var(--ink);padding:10px 14px;display:flex;flex-wrap:wrap;gap:6px;align-items:baseline}
.lex-ans b{color:var(--good)}
.lex-ans p{margin:0}
.lcheck .choices{max-width:none}
.lcheck .feedback{font-weight:400;color:var(--ink);line-height:1.55}
.lcheck .feedback.good b{color:var(--good)}
.lcheck .feedback.bad b{color:var(--bad)}
.lnav{display:flex;align-items:center;gap:10px;padding:12px 28px;border-top:1px solid var(--line)}
.lnav .sp{flex:1}
.lend{padding:44px 24px;display:flex;flex-direction:column;align-items:center;text-align:center;gap:12px}
.lend h2{font-family:var(--f-display);font-size:24px;margin:0;letter-spacing:-.01em}
.lend p{margin:0;color:var(--muted);max-width:46ch}
.lend-mark{width:46px;height:46px;border-radius:50%;background:var(--good-soft);display:grid;place-items:center}
.lend-mark svg{width:24px;height:24px;fill:none;stroke:var(--good);stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.lend-btns{display:flex;flex-wrap:wrap;justify-content:center;gap:10px;margin-top:6px}
.topic .lrn{width:12px;height:12px;margin-inline-start:6px;vertical-align:-1px;fill:none;stroke:var(--good);stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
@media (max-width:560px){.lbody{padding:18px 16px 22px;font-size:15px}.lhead,.lnav{padding-inline:16px}.lprereq{padding-inline:16px}.ltitle{font-size:21px}.lex,.lcheck{padding:14px}.lfig{padding:10px 4px}}
/* guests: log in / sign up in the app bar, the sign-up sheet and the nudge after the free problem */
.guestbar{display:flex;gap:8px;align-items:center}
.guestbar[hidden],.acct[hidden],.credits[hidden]{display:none}
.wall .wall-list{margin:6px 0 18px;padding:0;list-style:none;display:grid;gap:8px}
.wall .wall-list li{position:relative;padding-left:24px;color:var(--ink)}
.wall .wall-list li::before{content:"";position:absolute;left:4px;top:.45em;width:10px;height:6px;border-left:2px solid var(--good);border-bottom:2px solid var(--good);transform:rotate(-45deg)}
.wall .wall-btns{display:grid;gap:10px}
.wall .wall-btns .btn{justify-content:center;width:100%}
.wall .wall-in{margin:14px 0 0;text-align:center;color:var(--muted)}
.guestnudge{display:flex;gap:12px;align-items:center;justify-content:space-between;flex-wrap:wrap;margin-top:10px;padding:12px 14px;border:1px solid var(--acc-line);background:var(--acc-soft);border-radius:12px}
.guestnudge span{flex:1 1 220px}
/* level nudge: after 4 correct in a row on Easy or Medium (public/app.js levelNudge). Inline, no popup */
.lvnudge{display:flex;gap:10px 12px;align-items:center;flex-wrap:wrap;margin-top:10px;padding:12px 14px;border:1px solid var(--acc-line);background:var(--acc-soft);border-radius:12px;font-size:14px}
.lvnudge p{flex:1 1 200px;margin:0;line-height:1.45}
.lvnudge .btn{padding:6px 14px;font-size:13px;min-height:32px;border-radius:8px}
.seg button.lv-hint{color:var(--acc-text);box-shadow:0 0 0 1.5px var(--acc);animation:lvPulse 1.6s ease-in-out 3}
@keyframes lvPulse{0%,100%{box-shadow:0 0 0 1.5px var(--acc)}50%{box-shadow:0 0 0 4px var(--acc-line)}}
@media (prefers-reduced-motion:reduce){.seg button.lv-hint{animation:none}}
.nc-btns{display:flex;flex-wrap:wrap;gap:8px;justify-content:center}
/* out of today's free problems (public/app.js showWall): today, the next problem, plans inline, the free ways on */
#noCredit.is-wall{padding:28px 20px 32px;text-align:start;align-items:stretch}
#noCredit.is-wall > :not(.pw){display:none}
.pw{width:100%;max-width:660px;margin:0 auto;display:flex;flex-direction:column;gap:14px}
.pw h2{text-align:center}
.pw-today{align-self:center;display:inline-flex;align-items:center;gap:7px;margin:0;padding:5px 12px;border-radius:999px;background:var(--good-soft);color:var(--ink);font-size:13.5px;max-width:100%!important}
.pw-today svg{flex:none;color:var(--good)}
.pw-today .pw-tp{color:var(--muted)}
.pw-today.pw-wait{background:transparent}
.pw p{max-width:none}
.pw-h{margin:6px 0 0;font-family:var(--f-display);font-size:17px;letter-spacing:-.01em}
.pw-gets{list-style:none;margin:-4px 0 0;padding:0;display:flex;flex-wrap:wrap;gap:6px 18px;font-size:14px}
.pw-gets li{display:flex;align-items:center;gap:6px}
.pw-gets svg{flex:none;color:var(--acc-text)}
.pw-plans{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-top:8px}
.pw-plan{position:relative;border:1px solid var(--line);border-radius:12px;background:var(--surface);padding:16px 14px 14px;display:flex;flex-direction:column;gap:3px}
.pw-plan.featured{border:2px solid var(--acc);padding:15px 13px 13px}
.pw-plan .tag{position:absolute;top:-11px;inset-inline-start:12px;font-size:11.5px;font-weight:700;padding:3px 9px;border-radius:999px;background:var(--acc);color:var(--acc-ink);white-space:nowrap}
.pw-pn{font-weight:700;font-size:14.5px;display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.pw-save{font-size:11px;font-weight:700;padding:1px 7px;border-radius:999px;border:1px solid var(--acc-line);color:var(--acc-text)}
.pw-pm{font-size:13px;color:var(--muted)}
.pw-pm b{font-family:var(--f-display);font-size:24px;font-weight:700;color:var(--ink);letter-spacing:-.02em;margin-inline-end:2px}
.pw-pt{font-size:12.5px;color:var(--muted);margin-bottom:10px}
.pw-plan .btn{margin-top:auto;justify-content:center;width:100%}
.pw-note{margin:0;font-size:12.5px;text-align:center}
.pw-exam{margin:-2px 0 0;font-size:14px;color:var(--ink)}
.pw-free{margin:2px 0 0;font-size:13.5px;text-align:center;color:var(--muted)}
@media (max-width:640px){
  #noCredit.is-wall{padding:22px 14px 26px}
  .pw-plans{grid-template-columns:minmax(0,1fr);gap:14px}
  .pw-plan{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"n m" "t b";align-items:center;gap:4px 12px;padding:14px 12px 12px}
  .pw-plan.featured{padding:13px 11px 11px}
  .pw-pn{grid-area:n}.pw-pm{grid-area:m;text-align:end}.pw-pt{grid-area:t;margin:0}
  .pw-pm b{font-size:20px}
  .pw-plan .btn{grid-area:b;width:auto;margin:0;padding:7px 12px;font-size:13.5px;min-height:34px}
  .pw-gets{flex-direction:column;gap:6px}
}

/* interactive diagrams (public/interact.js): click to pick or toggle, drag a handle */
.jt{pointer-events:none}
.hit{fill:transparent;stroke:none}
.hit.ln{stroke:transparent;stroke-width:20;stroke-linecap:round}
.mark{fill:var(--surface);stroke:var(--ink);stroke-width:2}
.tick{stroke:var(--muted);stroke-width:1}
.barrel{fill:color-mix(in srgb,var(--surface) 55%,transparent);stroke:var(--ink);stroke-width:2}
.dose{fill:var(--acc);fill-opacity:.32}
.stopper{fill:var(--ink)}
.rod{fill:var(--soft);stroke:var(--ink);stroke-width:1.5}
.shade{fill:var(--acc);fill-opacity:.3}
.zline{stroke:var(--acc);stroke-width:2;stroke-dasharray:5 4}
.knob{fill:var(--acc);stroke:var(--surface);stroke-width:2.5}
.knob.ghost{fill:var(--acc-line);stroke:none}
svg.ix .pickable{cursor:pointer;outline:none}
svg.ix .pickable .pk{transition:stroke .12s,fill .12s}
svg.ix .pickable:hover .pk{stroke:var(--acc)}
svg.ix .pickable:hover .mem.pk{stroke:var(--acc-text)}
svg.ix .pickable:focus-visible .hit{stroke:var(--acc);stroke-opacity:.35;stroke-width:3}
svg.ix .pickable:focus-visible .hit.ln{stroke-width:16}
svg.ix .pickable:focus-visible rect.pk{stroke:var(--acc);stroke-width:3}
svg.ix .pickable.picked .pk{stroke:var(--acc)}
svg.ix .pickable.picked .mem.pk{stroke:var(--acc);stroke-width:6}
svg.ix .pickable.picked rect.pk,svg.ix .pickable.picked circle.pk{fill:var(--acc-soft);stroke-width:3}
svg.ix .pickable.picked circle.mark{fill:var(--acc);stroke:var(--acc)}
svg.ix .pickable.picked .lbl.t{fill:var(--acc-text)}
svg.ix .pickable.on rect.pk{fill:var(--acc);stroke:var(--acc)}
svg.ix .pickable.on .bitv{fill:var(--acc-ink);font-weight:700}
svg.ix .pickable.good .pk{stroke:var(--good)}
svg.ix .pickable.good rect.pk,svg.ix .pickable.good circle.pk{fill:var(--good-soft);stroke-width:3}
svg.ix .pickable.good circle.mark{fill:var(--good)}
svg.ix .pickable.good .mem.pk{stroke-width:6}
svg.ix .pickable.bad{cursor:not-allowed}
svg.ix .pickable.bad .pk{stroke:var(--bad);stroke-dasharray:6 5}
svg.ix .pickable.bad rect.pk,svg.ix .pickable.bad circle.pk{fill:var(--bad-soft)}
svg.ix [data-handle]{cursor:grab;touch-action:none;outline:none}
svg.ix [data-handle].dragging{cursor:grabbing}
svg.ix [data-handle]:focus-visible .knob{stroke:var(--acc-line);stroke-width:6}
svg.ix [data-track]{cursor:pointer;touch-action:none}
svg.ix.ixlocked .pickable,svg.ix.ixlocked [data-handle],svg.ix.ixlocked [data-track]{cursor:default}
svg.ix.ixslide{touch-action:pan-y}
svg.ix .pickable.good .mem.pk,svg.ix .pickable.good circle.mark{stroke:var(--good)}
svg.ix .pickable.good .lbl.t{fill:var(--good)}

/* safety notices (server/seo.js safetyNote, app problem view) */
.safety{margin:14px 0;padding:12px 14px;border:1px solid var(--line);border-radius:12px;background:var(--surface);font-size:13.5px;line-height:1.5;max-width:80ch}
.safety b{display:block;margin-bottom:3px}
.safety p{margin:0;color:var(--muted)}
.safety.warn{border-color:#e0a106;background:color-mix(in srgb,#e0a106 10%,transparent)}
.safety.warn b::before{content:"⚠ ";color:#b07d00}
@media print{.safety{border:1px solid #999;background:none}}
.safety-line{font-size:12.5px;color:var(--muted);margin:14px 2px 0;line-height:1.45}
.safety-line::before{content:"⚠ ";color:#b07d00}

/* site-wide search (public/common.js siteSearch) */
.ss{position:fixed;inset:0;z-index:200;background:rgba(10,14,20,.45);display:flex;justify-content:center;align-items:flex-start;padding:10vh 16px 16px}
.ss[hidden]{display:none}
.ss-panel{width:100%;max-width:620px;background:var(--surface);border:1px solid var(--line);border-radius:16px;box-shadow:0 30px 70px -30px rgba(0,0,0,.5);overflow:hidden;display:flex;flex-direction:column;max-height:76vh}
.ss-in{display:flex;align-items:center;gap:10px;padding:12px 14px;border-bottom:1px solid var(--line)}
.ss-in svg{width:18px;height:18px;flex:none;color:var(--muted)}
.ss-in input{flex:1;min-width:0;border:0;background:none;font:inherit;font-size:17px;color:inherit;outline:none;padding:4px 0}
.ss-in input::-webkit-search-cancel-button{display:none}
.ss-x{border:1px solid var(--line);background:none;color:var(--muted);border-radius:7px;font-size:12px;padding:3px 7px;cursor:pointer}
.ss-list{overflow:auto;padding:6px}
.ss-g{font-size:11.5px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);padding:10px 10px 4px}
.ss-r{display:flex;justify-content:space-between;align-items:baseline;gap:12px;padding:9px 10px;border-radius:10px;text-decoration:none;color:inherit}
.ss-r b{font-weight:600;min-width:0}
.ss-r span{color:var(--muted);font-size:13px;text-align:end;flex:none;max-width:45%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ss-r.on,.ss-r:hover{background:var(--acc-soft, rgba(0,0,0,.05))}
.ss-empty{color:var(--muted);padding:14px 10px;margin:0;font-size:14px}
html.ss-open{overflow:hidden}
@media (max-width:520px){.ss{padding:8px}.ss-panel{max-height:88vh}.ss-r{flex-direction:column;gap:2px}.ss-r span{max-width:100%;text-align:start}}

/* ===== app pages: Exams, Progress, Friends (public/app.js, profiles.js, together.js)
   One calm layout shared with the Library directories (site.css "library directories"): a page head, a main column
   and a right column on wide screens, one column on phones; the same panels, rows, pills and empty states. ===== */
.vbody{max-width:1212px} /* content as wide as the header and the Library */
#exRun,#exResult{max-width:1100px;margin-inline:auto}
.ap-head{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:flex-end;gap:14px 24px;margin:4px 0 24px}
.ap-head>div:first-child{min-width:0;flex:1 1 380px}
.ap-head h1{margin:0}
.ap-head p{margin:8px 0 0;color:var(--muted);font-size:15px;line-height:1.5;max-width:80ch;text-wrap:pretty}
.ap-head p:empty{display:none}
.ap-acts{display:flex;flex-wrap:wrap;gap:8px}
.ap-acts [hidden]{display:none}
.ap-grid{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:16px 24px;align-items:start}
.ap-main,.ap-side{display:flex;flex-direction:column;gap:16px;min-width:0}
.ap-grid .panel{margin-top:0}
.ap-grid [hidden],#exPast:empty{display:none!important}
.ap-n{flex:none;font-size:12.5px;font-weight:600;color:var(--muted);background:var(--soft);border-radius:999px;padding:2px 8px;font-variant-numeric:tabular-nums;font-family:var(--f-body);letter-spacing:0}
.panel .sub:last-child{margin-bottom:0}
/* search boxes: the Library's, a size smaller */
.ap-q{position:relative;min-width:0}
.ap-q svg{position:absolute;inset-inline-start:11px;top:50%;width:16px;height:16px;margin-top:-8px;color:var(--muted);pointer-events:none}
.ap-q input{width:100%;box-sizing:border-box;height:38px;font:inherit;font-size:14.5px;padding:0 12px;padding-inline-start:34px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink)}
.ap-q input::placeholder{color:var(--muted)}
.ap-q input:focus{outline:2px solid var(--acc);outline-offset:1px;border-color:var(--acc)}
.ap-q input:disabled{opacity:.5}
.ap-ph .sub{margin-bottom:14px}
.ap-tools{display:flex;flex-wrap:wrap;gap:10px 12px;align-items:center;margin:0 0 16px}
.ap-tools .ap-q{flex:1 1 200px;max-width:360px}
.ap-sort{display:inline-flex;align-items:center;gap:8px;font-size:13px;color:var(--muted);margin-inline-start:auto}
.ap-sort select{height:38px;border:1px solid var(--line);border-radius:10px;background:var(--surface);padding:0 10px;font:inherit;font-size:14px;color:var(--ink)}
.ap-none{margin:0;padding:22px 16px;text-align:center;color:var(--muted);border:1px dashed var(--line);border-radius:12px;font-size:14px}
/* rows: title + one muted line, an action at the end (as .dir-list) */
.ap-rows{list-style:none;margin:0;padding:0}
.ap-rows li{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 0;border-top:1px solid var(--line)}
.ap-rows li:first-child{border-top:0;padding-top:2px}
.ap-rows .btn{flex:none}
.ap-rt{min-width:0;flex:1;display:flex;flex-direction:column;gap:2px}
.ap-rt b{font-size:14.5px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ap-rt b .muted{font-weight:500}
.ap-rt small{font-size:12.5px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ap-rlink{border:0;background:none;padding:0;text-align:start;font:inherit;color:inherit;width:100%;cursor:pointer}
.ap-rlink:hover b{color:var(--acc-text)}
.ap-cardbtns{display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-end;margin-top:12px;padding-top:12px;border-top:1px solid var(--line)}
/* empty states: what is missing, and the next step */
.ap-empty{display:flex;flex-direction:column;align-items:center;text-align:center;padding:28px 16px;gap:4px}
.ap-empty-ic{width:44px;height:44px;border-radius:12px;background:var(--acc-soft);color:var(--acc-text);display:grid;place-items:center;margin-bottom:8px;flex:none}
.ap-empty-ic svg{width:22px;height:22px}
.ap-empty h3{margin:0;font-family:var(--f-display);font-size:18px;color:var(--ink);letter-spacing:-.01em}
.ap-empty p{margin:2px 0 0;max-width:48ch;color:var(--muted);font-size:14px;line-height:1.5}
.ap-empty-btns{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:14px}
.ap-empty-sm{padding:12px 8px 6px}
.ap-empty-sm .ap-empty-ic{width:38px;height:38px;border-radius:10px}
.ap-empty-sm .ap-empty-ic svg{width:19px;height:19px}
/* lists of problems and exams inside a panel run edge to edge */
.panel .hlist{border:0;border-radius:0;background:transparent;margin:12px -20px -18px;border-top:1px solid var(--line);overflow:hidden;border-end-start-radius:14px;border-end-end-radius:14px}
.panel .hlist .hitem{padding-inline:20px}
.hitem .t{line-height:1.35}
.hitem .m b{font-family:var(--f-body);font-weight:600;font-size:12.5px;font-variant-numeric:tabular-nums}
.hitem .st.exs{width:auto;min-width:40px;height:26px;padding:0 6px;border-radius:8px}
.hitem .st.exs small{font-size:11px}
.hitem .st:not(.ok):not(.rv):not(.bad):not(.exs){border-style:dashed;border-color:color-mix(in srgb,var(--muted) 55%,transparent)}

/* ---------- Progress ---------- */
#progTabs{gap:4px;border-bottom:0;margin:-8px 0 22px;margin-inline-start:-11px;padding:1px}
#progTabs button{display:inline-flex;align-items:center;gap:6px;padding:6px 12px;margin:0;border:1px solid transparent;border-radius:999px;font-size:14px;font-weight:500;color:var(--muted)}
#progTabs button:hover{color:var(--ink);background:var(--soft)}
#progTabs button[aria-selected="true"]{color:var(--ink);font-weight:600;background:var(--surface);border-color:var(--line)}
#progTabs small{font-size:12px;font-weight:600;color:var(--muted);background:var(--soft);border-radius:999px;padding:1px 7px;font-variant-numeric:tabular-nums}
#progTabs small:empty{display:none}
.ap-tiles{margin-bottom:16px}
.ap-tiles .kpi b small{font-size:.55em;color:var(--muted);font-weight:600;margin-inline-start:2px;letter-spacing:0}
.hfilters{margin-bottom:14px}
.hfilters select{max-width:100%}
/* activity: month names above, weekday names beside, cells that shrink on phones */
.hm{display:flex;flex-direction:column;width:fit-content;max-width:100%}
.hm-grid{display:grid;grid-auto-flow:row;grid-template-columns:auto repeat(26,minmax(0,17px));grid-template-rows:auto;grid-auto-rows:auto;gap:3px;overflow:visible;padding:0;justify-content:start}
.hm-grid i{width:auto;height:auto;aspect-ratio:1;min-width:0}
.hm-m{grid-row:1;min-width:0;font-size:11.5px;line-height:1.2;color:var(--muted);white-space:nowrap;overflow:hidden;padding-bottom:3px}
.hm-d{grid-column:1;font-size:11px;line-height:1;color:var(--muted);white-space:nowrap;align-self:center;padding-inline-end:6px}
.hm .legend{margin-top:12px}
/* by topic, grouped by branch */
.bt-grp+.bt-grp{margin-top:22px}
.bt-gh{display:flex;align-items:center;gap:10px;padding-bottom:8px;border-bottom:1px solid var(--line)}
.bt-gh h3{margin:0;font-family:var(--f-display);font-size:16px;letter-spacing:-.01em}
.bt-list{list-style:none;margin:0;padding:0}
.bt-list li{display:grid;grid-template-columns:minmax(0,1fr) minmax(110px,220px) auto;align-items:center;gap:6px 20px;padding:9px 0;border-bottom:1px solid var(--line)}
.bt-name{min-width:0;display:flex;flex-direction:column;gap:1px}
.bt-link{border:0;background:none;padding:0;text-align:start;font:inherit;font-weight:600;font-size:14.5px;color:var(--ink);cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}
.bt-link:hover{color:var(--acc-text);text-decoration:underline;text-underline-offset:3px;text-decoration-thickness:1px}
.bt-name small{font-size:12.5px;color:var(--muted)}
.bt-bar{display:flex;align-items:center;gap:10px;min-width:0}
.bt-bar .bar{flex:1;min-width:40px}
.bt-pct{flex:none;min-width:4ch;text-align:end;font-size:13px;font-weight:600;font-variant-numeric:tabular-nums;color:var(--muted)}

/* ---------- Exams ---------- */
.ex-grid>.ap-side{position:sticky;top:84px}
.ex-form{padding:0}
.ex-step{padding:20px 22px;border-top:1px solid var(--line)}
.ex-step:first-child{border-top:0}
.ex-sh{display:flex;gap:12px;align-items:flex-start;margin-bottom:14px}
.ex-sh h2,.ex-sum h2,.exdate b{font-family:var(--f-display);font-size:17px;margin:0;letter-spacing:-.01em}
.ex-sh p{margin:3px 0 0;color:var(--muted);font-size:13.5px}
.ex-sh p:empty{display:none}
.ex-sh .ex-n{flex:none;width:26px;height:26px;border-radius:50%;background:var(--acc-soft);color:var(--acc-text);display:grid;place-items:center;font-weight:700;font-size:13px;font-variant-numeric:tabular-nums}
.ex-tools{display:flex;flex-wrap:wrap;align-items:center;gap:10px 14px;margin:0 0 12px}
.ex-tools .ap-q{flex:1 1 200px}
.ex-tools .linkbtn{margin:0;white-space:nowrap}
.ex-tools [hidden]{display:none}
.ex-groups{display:flex;flex-direction:column;border:1px solid var(--line);border-radius:12px;overflow:hidden}
.ex-groups [hidden]{display:none!important}
.exg-field{margin:0;padding:9px 14px 7px;font-size:11.5px;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:var(--muted);background:var(--sunk);border-top:1px solid var(--line)}
.exg-field:first-child{border-top:0}
.exg{border-top:1px solid var(--line)}
.exg:first-child,.exg-field+.exg{border-top-color:var(--line)}
.ex-groups>.exg:first-child{border-top:0}
.exg-h{display:flex;align-items:center;gap:8px;padding-inline-end:14px}
.exg-tog{flex:1;min-width:0;display:flex;align-items:center;gap:10px;border:0;background:transparent;padding:11px 14px;text-align:start;font:inherit;font-weight:600;font-size:14.5px;color:var(--ink);cursor:pointer}
.exg-tog:hover .exg-name{color:var(--acc-text)}
.exg-tog svg{width:14px;height:14px;flex:none;color:var(--muted);transition:transform .15s}
.exg-tog[aria-expanded="true"] svg{transform:rotate(90deg)}
[dir="rtl"] .exg-tog svg{transform:scaleX(-1)}
[dir="rtl"] .exg-tog[aria-expanded="true"] svg{transform:rotate(90deg)}
.exg-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.exg-n{flex:none;font-size:12px;font-weight:600;color:var(--muted);background:var(--soft);border-radius:999px;padding:2px 8px;font-variant-numeric:tabular-nums}
.exg.has .exg-n{background:var(--acc-soft);color:var(--acc-text)}
.exg-all{flex:none;margin:0;font-size:13px;white-space:nowrap}
.exg-body{padding:0 14px 12px;padding-inline-start:38px;columns:220px 3;column-gap:28px}
.exg-sub{break-inside:avoid;padding-bottom:8px}
.exg-sub h4{margin:6px 0 2px;font-size:11px;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:var(--muted)}
.exg-sub ul{list-style:none;margin:0;padding:0}
.exg-t{display:flex;align-items:flex-start;gap:9px;padding:5px 0;font-size:14px;line-height:1.35;cursor:pointer}
.exg-t input{flex:none;width:16px;height:16px;margin:1px 0 0;accent-color:var(--acc)}
.exg-t:hover span{color:var(--acc-text)}
:lang(ar) .exg-field,:lang(ar) .exg-sub h4,:lang(zh) .exg-field,:lang(zh) .exg-sub h4,:lang(ja) .exg-field,:lang(ja) .exg-sub h4,:lang(ko) .exg-field,:lang(ko) .exg-sub h4,:lang(hi) .exg-field,:lang(hi) .exg-sub h4,:lang(th) .exg-field,:lang(th) .exg-sub h4{text-transform:none;letter-spacing:0;font-size:12px}
/* questions, level, time: one row of options */
.ap-opts{display:flex;flex-wrap:wrap;gap:6px}
.ap-opts label{position:relative}
.ap-opts input{position:absolute;opacity:0;pointer-events:none}
.ap-opts span{display:inline-flex;align-items:center;justify-content:center;min-width:46px;height:38px;padding:0 14px;box-sizing:border-box;border:1px solid var(--line);border-radius:10px;background:var(--surface);font-size:14px;font-weight:600;color:var(--ink);cursor:pointer;white-space:nowrap;transition:border-color .15s,background-color .15s}
.ap-opts label:hover span{border-color:var(--muted)}
.ap-opts input:checked+span{background:var(--acc-soft);border-color:var(--acc);color:var(--acc-text);box-shadow:inset 0 0 0 1px var(--acc)}
.ap-opts input:focus-visible+span{outline:2px solid var(--acc);outline-offset:2px}
/* summary and Start */
.ex-sumline{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0 10px;line-height:1.3}
.ex-sumline span{white-space:nowrap;font-size:13.5px;font-weight:600;padding:4px 9px;border-radius:7px;background:var(--soft);color:var(--ink)}
.ex-cost{margin:0 0 14px;font-size:13px;color:var(--muted);line-height:1.45}
.ex-cost:empty{display:none}
.ex-mode{display:flex;width:100%;box-sizing:border-box;margin:12px 0 2px}
.ex-mode button{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ex-sum .tg-plan{margin:12px 0 0}
/* the exam date: a quiet line under the card, not a card of its own */
#exSetup .exdate{display:flex;align-items:center;flex-wrap:wrap;gap:6px 10px;margin:0;padding:2px 4px;background:none;border:0;color:var(--muted);font-size:13px}
#exSetup .exdate .exd-ic{width:auto;height:auto;background:none;color:var(--muted);border-radius:0}
#exSetup .exdate .exd-ic svg{width:15px;height:15px;display:block}
#exSetup .exdate .exd-t{flex:1 1 160px;min-width:0}
#exSetup .exdate .exd-t b{display:inline;font-family:var(--f-body);font-size:13px;font-weight:600;color:var(--ink);letter-spacing:0}
#exSetup .exdate .exd-t span{display:inline;margin:0;font-size:13px}
#exSetup .exdate .exd-t b+span::before{content:" · "}
#exSetup .exdate .btn{margin:0;padding:3px 8px;min-height:0;border-color:transparent;background:none;color:var(--acc-text);font-size:13px;text-decoration:underline;text-underline-offset:3px}
#exSetup .exdate .btn:hover{background:var(--soft)}

/* ---------- Friends ---------- */
.soc-req{border-color:var(--acc-line);background:color-mix(in srgb,var(--acc-soft) 50%,var(--surface))}
.soc-req h2{display:flex;align-items:center;gap:8px}
.soc-req .ap-n{background:var(--acc);color:var(--acc-ink)}
.soc-find .ap-q{margin-top:10px}
.soc-find .ap-q+.soc-list{margin-top:6px}
.soc-people .soc-tabs{display:flex}
.soc-people .soc-tabs button{flex:1}
.soc-act .soc-feed li{border-top:1px solid var(--line)}
.soc-act .soc-feed li:first-child{border-top:0}
.soc-act .soc-day{margin-top:18px}
.soc-act .soc-day:first-of-type{margin-top:4px}

/* wide screens: the side column; narrow ones: one column in a sensible order */
@media (max-width:1100px) and (min-width:960px){.ap-grid{grid-template-columns:minmax(0,1fr) 300px}}
@media (max-width:959.98px){
  .ap-grid{display:flex;flex-direction:column;align-items:stretch;gap:16px}
  .ap-grid>*,.ap-main>*,.ap-side>*{min-width:0}
  .ap-main,.ap-side{display:contents}
  .ex-grid>.ap-side{position:static}
  .ex-form{order:2}#exPast{order:5}#exDate{order:10}
  /* Start stays in reach: a bar that sticks to the bottom (above the tab bar on phones) */
  .ex-sum{order:9;position:sticky;bottom:12px;z-index:20;display:flex;flex-direction:column;gap:8px;padding:12px 14px;box-shadow:0 6px 24px rgba(0,0,0,.12)}
  .ex-sum h2{display:none}
  .ex-mode{margin:0}
  .ex-mode button{padding:5px 10px}
  .ex-sumline{margin:0;gap:4px;flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none}
  .ex-sumline::-webkit-scrollbar{display:none}
  .ex-sumline span{flex:none;font-size:12.5px;padding:3px 7px}
  .ex-cost{margin:0;font-size:12px}
  .ex-sum #exStart{padding:11px 14px;font-size:15px}
  .ex-sum .tg-plan{margin:0}
  .pg-topics{order:1}.pg-next{order:2}.pg-mis{order:3}.pg-act{order:4}.pg-exams{order:5}
  .soc-notice{order:0}.soc-me{order:1}.soc-req{order:2}.tg-panel{order:3}.soc-act{order:4}.soc-find{order:5}.soc-people{order:6}
}
@media (max-width:820px){.ex-sum{bottom:calc(66px + env(safe-area-inset-bottom,0px))}}
@media (max-width:600px){
  .ap-head{margin-bottom:18px}
  .ap-head p{font-size:14.5px}
  .ap-acts{width:100%}
  .ap-acts .btn{flex:1;justify-content:center}
  .ap-q input,.ap-sort select{font-size:16px}
  .ap-sort{margin-inline-start:0}
  .ex-step{padding:18px 16px}
  .exg-body{padding-inline-start:14px;columns:auto 1}
  .exg-h{padding-inline-end:10px}
  .exg-tog{padding:11px 10px 11px 12px}
  .bt-list li{grid-template-columns:minmax(0,1fr) auto;gap:6px 12px}
  .bt-bar{grid-column:1 / -1;grid-row:2}
  .bt-go{grid-column:2;grid-row:1}
  .vbody .panel{padding:16px}
  .vbody .ex-form{padding:0}
  .vbody .panel .hlist{margin:12px -16px -16px}
  .panel .hlist .hitem{padding-inline:16px}
  #progTabs{margin-inline:-16px;padding-inline:5px;flex-wrap:nowrap}
  #progTabs button{flex:none;padding:6px 10px}
  .hm-d{font-size:10px;padding-inline-end:4px}
  .hm-grid{gap:2px}
}

/* Next checked an unchecked answer: the pause before the next problem (public/app.js nextBtn) */
#nextBtn.hold{position:relative;overflow:hidden;opacity:1}
#nextBtn.hold::after{content:"";position:absolute;left:0;bottom:0;height:3px;width:100%;background:var(--acc);transform-origin:left;animation:nextHold 1s linear forwards}
@keyframes nextHold{from{transform:scaleX(0)}to{transform:scaleX(1)}}
@media (prefers-reduced-motion:reduce){#nextBtn.hold::after{animation:none}}
