/* Meridian — restrained pixel UI: Geist Pixel / Fusion Pixel for display and labels, Geist + LXGW WenKai for reading. Light paper + night sky. No italics anywhere (dyslexia-friendly). */
:root {
  --bg: #F3F0E8; --surface: #FAF8F3; --raised: #FFFFFF; --sunk: #ECE8DE;
  --ink: #1B1A17; --ink-2: #57534B; --ink-3: #8E897E; --line: #E1DCCF; --line-2: #D2CCBE;
  --accent: #BF5B37; --accent-ink: #9E4526; --accent-soft: #F2E0D4;
  --green: #3D6A57; --green-soft: #DCE8E0; --gold: #B0873A; --gold-soft: #F1E6CC; --blue: #2F4C6E; --blue-soft: #DDE4EE;
  --red: #B2433A; --red-soft: #F4DAD5;
  --night: #0E1119; --night-2: #161B27; --star: #F5E9C8;
  --px: 'Geist Pixel', 'Fusion Pixel', 'LXGW WenKai', ui-monospace, monospace;
  --serif: 'Geist', 'LXGW WenKai', -apple-system, 'PingFang SC', 'Helvetica Neue', sans-serif;
  --sans: 'Geist', 'LXGW WenKai', -apple-system, 'PingFang SC', 'Helvetica Neue', sans-serif;
  --mono: 'Geist Pixel', 'Fusion Pixel', 'Geist Mono', ui-monospace, monospace;
  --code: 'Geist Mono', 'Geist', ui-monospace, monospace;
  --zh: 'LXGW WenKai', 'PingFang SC', sans-serif;
  --stamp: var(--px);
  --r: 0px; --r-sm: 0px; --u: 2px; --shadow: 0 1px 2px rgba(30,25,15,.05), 0 8px 28px -12px rgba(30,25,15,.16);
  --ease: cubic-bezier(.2,.8,.2,1); --spring: cubic-bezier(.34,1.56,.64,1);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #12120F; --surface: #191916; --raised: #211F1C; --sunk: #0D0D0B;
  --ink: #ECE7DC; --ink-2: #B4AEA2; --ink-3: #7E796F; --line: #2C2A26; --line-2: #3A3732;
  --accent: #E0794F; --accent-ink: #F09A74; --accent-soft: #3A2419;
  --green: #79AE95; --green-soft: #1C2D25; --gold: #D6AE5E; --gold-soft: #33291A; --blue: #8AA8CF; --blue-soft: #1A2333;
  --red: #E07A6F; --red-soft: #3A1E1A; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -12px rgba(0,0,0,.6);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12120F; --surface: #191916; --raised: #211F1C; --sunk: #0D0D0B;
    --ink: #ECE7DC; --ink-2: #B4AEA2; --ink-3: #7E796F; --line: #2C2A26; --line-2: #3A3732;
    --accent: #E0794F; --accent-ink: #F09A74; --accent-soft: #3A2419;
    --green: #79AE95; --green-soft: #1C2D25; --gold: #D6AE5E; --gold-soft: #33291A; --blue: #8AA8CF; --blue-soft: #1A2333;
    --red: #E07A6F; --red-soft: #3A1E1A; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -12px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
em, i, cite, address, dfn, var { font-style: normal; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: hidden; }
:lang(zh-CN) body, html[lang="zh-CN"] body { line-height: 1.75; }
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); }
strong.kp { font-weight: 600; color: var(--ink); }
html[lang="zh-CN"] strong.kp { font-family: 'LXGW WenKai Bold', var(--zh); font-weight: 700; }
.zh { font-family: var(--zh); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 28px 18px 20px; display: flex; flex-direction: column; gap: 6px; border-right: 1px solid var(--line); background: var(--bg); z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; text-decoration: none; }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand b { font: 500 23px/1 var(--serif); letter-spacing: -.01em; }
.brand small { display: block; font: 500 10.5px/1.3 var(--mono); color: var(--ink-3); letter-spacing: .08em; text-transform: uppercase; margin-top: 4px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-weight: 500; font-size: 14.5px; transition: background .2s, color .2s; position: relative; }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.nav a:hover { background: var(--sunk); color: var(--ink); }
.nav a.on { background: var(--raised); color: var(--ink); box-shadow: var(--shadow); }
.nav a .badge { margin-left: auto; font: 600 11px/1 var(--mono); background: var(--accent); color: var(--on-accent, #fff); padding: 4px 6px; border-radius: 99px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 0 6px; }
.target-pill { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; width: 100%; }
.target-pill b { font-weight: 600; font-size: 13.5px; display: block; }
.target-pill small { color: var(--ink-3); font-size: 11.5px; }
.target-pill .chev { margin-left: auto; color: var(--ink-3); }
.toggles { display: flex; gap: 6px; }
.seg { display: inline-flex; background: var(--sunk); border-radius: 99px; padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 11px; border-radius: 99px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); cursor: pointer; }
.seg button.on { background: var(--raised); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.iconbtn { border: 1px solid var(--line); background: var(--surface); width: 34px; height: 34px; border-radius: 99px; display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.iconbtn:hover { color: var(--ink); border-color: var(--line-2); }
.iconbtn svg { width: 16px; height: 16px; }

main#main { padding: 48px clamp(18px, 5vw, 72px) 120px; max-width: 1180px; width: 100%; }
main.enter > * { animation: rise .6s var(--ease) both; }
main.enter > *:nth-child(2) { animation-delay: .05s; } main.enter > *:nth-child(3) { animation-delay: .1s; } main.enter > *:nth-child(4) { animation-delay: .15s; } main.enter > *:nth-child(n+5) { animation-delay: .2s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

.topbar, .tabbar { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 20; align-items: center; gap: 10px; padding: 12px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
  .topbar .brand { padding: 0; }
  .topbar .brand b { font-size: 20px; }
  .topbar .sp { flex: 1; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 600; text-decoration: none; color: var(--ink-3); padding: 4px 0; }
  .tabbar a svg { width: 21px; height: 21px; }
  .tabbar a.on { color: var(--accent); }
  main#main { padding: 26px 16px 110px; }
}

/* ---------- type ---------- */
.kicker { font: 500 11.5px/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.kicker .dot { width: 6px; height: 6px; border-radius: 99px; background: var(--accent); }
h1, h2, h3, h4 { font-weight: 400; margin: 0; }
.display { font: 400 clamp(36px, 5.2vw, 62px)/1.04 var(--serif); letter-spacing: -.022em; margin: 14px 0 14px; text-wrap: balance; }
html[lang="zh-CN"] .display { font-family: var(--zh); letter-spacing: 0; line-height: 1.2; }
.h2 { font: 400 clamp(26px, 3vw, 34px)/1.15 var(--serif); letter-spacing: -.015em; text-wrap: balance; }
.h3 { font: 500 20px/1.3 var(--serif); letter-spacing: -.005em; }
html[lang="zh-CN"] .h2, html[lang="zh-CN"] .h3 { font-family: var(--zh); letter-spacing: 0; }
.lede { font: 400 19px/1.55 var(--serif); color: var(--ink-2); max-width: 62ch; text-wrap: pretty; }
html[lang="zh-CN"] .lede { font-family: var(--zh); font-size: 17.5px; }
.muted { color: var(--ink-3); }
.small { font-size: 13.5px; }
.prose { max-width: 68ch; }
.prose p { margin: 0 0 1em; text-wrap: pretty; }
.serif { font-family: var(--serif); }
.mono { font-family: var(--mono); }
.section { margin-top: 56px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.rule { height: 1px; background: var(--line); margin: 40px 0; border: 0; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; position: relative; }
.card.raised { background: var(--raised); box-shadow: var(--shadow); border-color: transparent; }
.card.link { cursor: pointer; transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s; text-decoration: none; display: block; }
.card.link:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-2); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 980px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.spacer { flex: 1; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 99px; padding: 11px 20px; font-weight: 600; font-size: 14.5px; cursor: pointer; text-decoration: none; transition: transform .2s var(--ease), background .2s, box-shadow .2s, opacity .2s; white-space: nowrap; user-select: none; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.primary:hover { box-shadow: 0 6px 18px -8px rgba(0,0,0,.45); }
.btn.accent { background: var(--accent); color: var(--on-accent, #fff); }
.btn.ghost { background: transparent; border-color: var(--line-2); color: var(--ink); }
.btn.ghost:hover { background: var(--sunk); }
.btn.quiet { background: transparent; color: var(--ink-2); padding: 8px 12px; }
.btn.quiet:hover { color: var(--ink); background: var(--sunk); }
.btn.sm { padding: 7px 13px; font-size: 13px; }
.btn[disabled] { opacity: .35; pointer-events: none; }
.btn svg { width: 16px; height: 16px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; background: var(--sunk); color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.chip.accent { background: var(--accent-soft); color: var(--accent-ink); }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.gold { background: var(--gold-soft); color: var(--gold); }
.chip.blue { background: var(--blue-soft); color: var(--blue); }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.line { background: transparent; border: 1px solid var(--line-2); }
input[type=text], textarea, select { font: inherit; color: var(--ink); background: var(--raised); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 11px 13px; width: 100%; outline: none; transition: border-color .2s, box-shadow .2s; }
input[type=text]:focus, textarea:focus, select:focus { border-color: var(--ink-3); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent); }
textarea { resize: vertical; line-height: 1.65; min-height: 220px; }
.writing { font: 400 17px/1.7 var(--serif); }
label.field { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }

/* ---------- meters ---------- */
.meter { height: 6px; border-radius: 99px; background: var(--sunk); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--ink); transition: width .8s var(--ease); }
.meter.accent i { background: var(--accent); } .meter.green i { background: var(--green); } .meter.gold i { background: var(--gold); }
.ring { --p: 0; --c: var(--accent); width: 64px; height: 64px; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--sunk) 0); display: grid; place-items: center; flex: none; }
.ring::before { content: ''; width: 76%; height: 76%; border-radius: 50%; background: var(--surface); grid-area: 1/1; }
.ring span { grid-area: 1/1; font: 600 13px var(--mono); position: relative; }
.bignum { font: 400 54px/1 var(--serif); letter-spacing: -.03em; }
.bignum small { font: 500 14px var(--mono); color: var(--ink-3); letter-spacing: 0; margin-left: 6px; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 20px); opacity: 0; background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 99px; font-weight: 600; font-size: 14px; z-index: 100; transition: all .4s var(--spring); box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); pointer-events: none; }
.toast.in { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 860px) { .toast { bottom: 92px; } }

/* ---------- modal / sheet ---------- */
.veil { position: fixed; inset: 0; background: rgba(15,14,12,.42); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 50; display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .3s; }
.veil.in { opacity: 1; }
.sheet { background: var(--surface); border-radius: 20px; width: min(560px, 100%); max-height: 88vh; overflow: auto; padding: 28px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); transform: translateY(16px) scale(.98); transition: transform .45s var(--spring); }
.veil.in .sheet { transform: none; }
.sheet.wide { width: min(860px, 100%); }

/* ---------- Today ---------- */
.hero { display: grid; grid-template-columns: 1.35fr 1fr; gap: 28px; align-items: stretch; }
@media (max-width: 980px) { .hero { grid-template-columns: 1fr; } }
.plan { display: flex; flex-direction: column; gap: 10px; }
.step { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; text-decoration: none; transition: all .3s var(--ease); }
.step:hover { border-color: var(--line-2); transform: translateX(3px); }
.step .n { width: 30px; height: 30px; border-radius: 99px; border: 1px solid var(--line-2); display: grid; place-items: center; font: 600 12.5px var(--mono); color: var(--ink-3); flex: none; }
.step.done .n { background: var(--green); border-color: var(--green); color: var(--on-accent, #fff); }
.step.next { border-color: var(--ink); background: var(--raised); box-shadow: var(--shadow); }
.step.next .n { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.step .tt { font-weight: 600; }
.step .sub { color: var(--ink-3); font-size: 13.5px; }
.step .go { margin-left: auto; color: var(--ink-3); }
.vision { font: 400 21px/1.45 var(--serif); color: var(--ink); }
html[lang="zh-CN"] .vision { font-family: var(--zh); }
.weave { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.weave .d { aspect-ratio: 1; border-radius: 8px; background: var(--sunk); position: relative; overflow: hidden; display: grid; place-items: center; font: 500 10.5px var(--mono); color: var(--ink-3); }
.weave .d.on { background: var(--accent-soft); color: var(--accent-ink); }
.weave .d.on::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(45deg, transparent 0 5px, color-mix(in srgb, var(--accent) 22%, transparent) 5px 6px); }
.weave .d.today { outline: 1.5px solid var(--ink); outline-offset: 1px; }

/* ---------- Sky ---------- */
.sky { position: relative; background: radial-gradient(120% 90% at 50% 0%, #1D2333 0%, var(--night) 62%); border-radius: 22px; overflow: hidden; color: #E9E4D6; min-height: 540px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.04); }
.sky canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.sky .sky-ui { position: relative; z-index: 2; padding: 22px 24px; pointer-events: none; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.sky .sky-ui > * { pointer-events: auto; }
.sky .kicker { color: rgba(233,228,214,.55); }
.sky .h2 { color: #F3EEDF; }
.sky-tip { position: absolute; z-index: 3; pointer-events: none; background: rgba(14,17,25,.88); border: 1px solid rgba(255,255,255,.12); padding: 10px 13px; border-radius: 12px; font-size: 13px; color: #EEE8D8; transform: translate(-50%, calc(-100% - 14px)); white-space: nowrap; backdrop-filter: blur(6px); opacity: 0; transition: opacity .15s; }
.sky-tip b { font: 500 17px var(--serif); display: block; }
.sky-legend { position: absolute; z-index: 2; left: 24px; bottom: 18px; display: flex; gap: 16px; font-size: 12px; color: rgba(233,228,214,.6); flex-wrap: wrap; }
.sky-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sky-legend i { width: 8px; height: 8px; border-radius: 99px; background: #F5E9C8; display: inline-block; }
.cons-card { cursor: pointer; }
.cons-card .glyph { width: 100%; height: 86px; display: block; margin-bottom: 10px; }

/* ---------- drill (word practice) ---------- */
.drill { max-width: 720px; margin: 0 auto; }
.drill-top { display: flex; align-items: center; gap: 14px; margin-bottom: 30px; }
.drill-top .meter { flex: 1; }
.wordcard { text-align: center; padding: 44px 28px 34px; }
.wordcard .hw { font: 400 clamp(46px, 7vw, 72px)/1 var(--serif); letter-spacing: -.02em; }
.wordcard .ipa { font: 400 16px var(--mono); color: var(--ink-3); margin-top: 12px; }
.wordcard .gloss { font: 400 22px/1.4 var(--zh); margin-top: 22px; }
.wordcard .def { color: var(--ink-2); margin-top: 6px; }
.example { font: 400 20px/1.55 var(--serif); text-align: left; padding: 18px 20px; border-left: 2px solid var(--accent); background: var(--sunk); border-radius: 0 12px 12px 0; margin-top: 24px; }
.example .hl { background: linear-gradient(transparent 62%, var(--gold-soft) 62%); font-weight: 500; }
.example .tr { display: block; font: 400 15px/1.6 var(--zh); color: var(--ink-3); margin-top: 8px; }
.collos { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.prompt { font: 400 26px/1.4 var(--serif); text-align: center; margin: 6px 0 26px; text-wrap: balance; }
html[lang="zh-CN"] .prompt.zhp { font-family: var(--zh); }
.opts { display: grid; gap: 10px; }
.opt { text-align: left; border: 1px solid var(--line-2); background: var(--raised); border-radius: 13px; padding: 14px 16px 14px 48px; cursor: pointer; position: relative; font-size: 15.5px; line-height: 1.45; transition: all .25s var(--ease); }
.opt::before { content: attr(data-k); position: absolute; left: 14px; top: 13px; width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line-2); font: 600 11px/20px var(--mono); text-align: center; color: var(--ink-3); }
.opt:hover { border-color: var(--ink-3); transform: translateY(-1px); }
.opt.sel { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.opt.right { border-color: var(--green); background: var(--green-soft); box-shadow: 0 0 0 1px var(--green); animation: pop .5s var(--spring); }
.opt.wrong { border-color: var(--red); background: var(--red-soft); animation: shake .45s; }
.opt.dim { opacity: .45; }
.opts.locked .opt { pointer-events: none; }
@keyframes pop { 50% { transform: scale(1.02); } }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.feedback { margin-top: 20px; padding: 16px 18px; border-radius: 13px; background: var(--sunk); display: none; }
.feedback.show { display: block; animation: rise .45s var(--ease); }
.feedback.good { background: var(--green-soft); } .feedback.bad { background: var(--red-soft); }
.feedback .fh { font-weight: 700; margin-bottom: 4px; }
.drill-actions { display: flex; justify-content: center; gap: 10px; margin-top: 26px; }
.keyhint { font: 500 11px var(--mono); color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 5px; }

/* C-test letters: the "Complete the Words" mechanic */
.ctext { font: 400 21px/2.05 var(--serif); text-wrap: pretty; }
.ctext .cw { white-space: nowrap; display: inline; }
.ctext .cw .given { color: var(--ink); }
.ctext input.cl { width: .78em; border: 0; border-bottom: 1.5px solid var(--ink-3); background: transparent; font: inherit; text-align: center; padding: 0; margin: 0 1px; color: var(--accent-ink); border-radius: 0; outline: none; transition: border-color .2s, background .2s; caret-color: var(--accent); }
.ctext input.cl:focus { border-bottom-color: var(--accent); background: var(--accent-soft); border-radius: 3px 3px 0 0; }
.ctext .cw.ok input.cl { color: var(--green); border-bottom-color: var(--green); }
.ctext .cw.no input.cl { color: var(--red); border-bottom-color: var(--red); }
.ctext .cw.ok { animation: pop .5s var(--spring); }
.ctext .fix { font: 600 13px var(--mono); color: var(--green); margin-left: 3px; vertical-align: super; }
.typein { font: 400 34px/1.2 var(--serif); text-align: center; border: 0; border-bottom: 2px solid var(--line-2); background: transparent; border-radius: 0; padding: 8px; }
.typein:focus { box-shadow: none; border-bottom-color: var(--accent); }

/* Build a sentence tiles */
.slots { min-height: 64px; display: flex; flex-wrap: wrap; gap: 8px; padding: 14px; border: 1.5px dashed var(--line-2); border-radius: 14px; align-items: center; transition: border-color .3s, background .3s; }
.slots.ok { border-color: var(--green); border-style: solid; background: var(--green-soft); }
.slots.no { border-color: var(--red); }
.tray { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; justify-content: center; min-height: 48px; }
.tile { border: 1px solid var(--line-2); background: var(--raised); border-radius: 10px; padding: 9px 14px; font: 400 18px var(--serif); cursor: pointer; box-shadow: 0 1px 0 var(--line-2); transition: transform .35s var(--spring), opacity .2s; user-select: none; }
.tile:hover { transform: translateY(-2px); }
.tile.fixed { background: transparent; border-style: dashed; cursor: default; color: var(--ink-2); box-shadow: none; }
.tile.fixed:hover { transform: none; }
.tile.land { animation: land .4s var(--spring); }
@keyframes land { from { transform: scale(.8) translateY(8px); opacity: .3; } }

/* ---------- campus ---------- */
.term { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
@media (max-width: 760px) { .term { grid-template-columns: repeat(3, 1fr); } }
.week { border-radius: 14px; padding: 14px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; min-height: 116px; display: flex; flex-direction: column; transition: all .3s var(--ease); text-decoration: none; }
.week:hover { border-color: var(--line-2); transform: translateY(-2px); }
.week .wn { font: 500 11px var(--mono); color: var(--ink-3); letter-spacing: .08em; }
.week .wt { font: 400 17px/1.25 var(--serif); margin-top: 6px; }
html[lang="zh-CN"] .week .wt { font-family: var(--zh); }
.week .wp { margin-top: auto; padding-top: 10px; }
.week.cur { border-color: var(--ink); background: var(--raised); box-shadow: var(--shadow); }
.week.locked { opacity: .5; }
.task-row { display: flex; gap: 14px; align-items: center; padding: 16px 0; border-top: 1px solid var(--line); cursor: pointer; text-decoration: none; }
.task-row:hover .tt { color: var(--accent-ink); }
.task-row .ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--sunk); }
.task-row .ico svg { width: 20px; height: 20px; }
.task-row .tt { font-weight: 600; transition: color .2s; }
.task-row .sub { font-size: 13.5px; color: var(--ink-3); }
.task-row .state { margin-left: auto; flex: none; }
.ico.reading { background: var(--blue-soft); color: var(--blue); } .ico.listening { background: var(--gold-soft); color: var(--gold); }
.ico.writing { background: var(--accent-soft); color: var(--accent-ink); } .ico.speaking { background: var(--green-soft); color: var(--green); }

/* ---------- task player ---------- */
.task { max-width: 820px; margin: 0 auto; }
.task-head { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; flex-wrap: wrap; }
.timer { font: 500 14px var(--mono); padding: 6px 12px; border-radius: 99px; background: var(--sunk); }
.timer.low { background: var(--red-soft); color: var(--red); }
.doc { background: var(--raised); border: 1px solid var(--line); border-radius: 16px; padding: 26px 28px; box-shadow: var(--shadow); font: 400 17.5px/1.7 var(--serif); }
.doc h4 { font: 600 13px var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin-bottom: 10px; }
.doc .doc-title { font: 500 24px/1.25 var(--serif); margin-bottom: 14px; }
.doc p { margin: 0 0 .9em; }
.doc.notice { border-top: 4px solid var(--accent); }
.doc.email { font-family: var(--sans); font-size: 15.5px; }
.doc.email .hdr { font-size: 13.5px; color: var(--ink-3); border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 14px; }
.doc .para-hl { background: var(--gold-soft); border-radius: 4px; }
.split { display: grid; grid-template-columns: 1.15fr 1fr; gap: 26px; align-items: start; }
.split > .sticky { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow: auto; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } .split > .sticky { position: static; max-height: none; } }
.qnum { font: 500 12px var(--mono); color: var(--ink-3); margin-bottom: 8px; }
.qtext { font: 500 18px/1.45 var(--serif); margin-bottom: 14px; }
html[lang="zh-CN"] .qtext { font-family: var(--serif); }
.audio-stage { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 40px 20px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); text-align: center; }
.wave { display: flex; align-items: center; gap: 3px; height: 46px; }
.wave i { width: 3px; border-radius: 3px; background: var(--ink-3); height: 6px; transition: height .15s; }
.wave.on i { background: var(--accent); animation: wv 1s ease-in-out infinite; }
@keyframes wv { 0%, 100% { height: 6px; } 50% { height: var(--h, 30px); } }
.playbtn { width: 74px; height: 74px; border-radius: 99px; border: 0; background: var(--ink); color: var(--bg); cursor: pointer; display: grid; place-items: center; transition: transform .3s var(--spring); }
.playbtn:hover { transform: scale(1.05); }
.playbtn svg { width: 26px; height: 26px; }
.speaker { font: 600 12px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.transcript { font: 400 16px/1.7 var(--serif); }
.transcript .ln { padding: 6px 0; } .transcript .who { font: 600 12px var(--mono); color: var(--ink-3); margin-right: 8px; text-transform: uppercase; }
.recbtn { width: 84px; height: 84px; border-radius: 99px; border: 0; background: var(--accent); color: var(--on-accent, #fff); cursor: pointer; display: grid; place-items: center; position: relative; }
.recbtn svg { width: 28px; height: 28px; }
.recbtn.on::before { content: ''; position: absolute; inset: -8px; border-radius: 99px; border: 2px solid var(--accent); animation: pulse 1.4s ease-out infinite; }
@keyframes pulse { from { transform: scale(.9); opacity: 1; } to { transform: scale(1.25); opacity: 0; } }
.diff .ok { color: var(--green); } .diff .miss { color: var(--red); text-decoration: underline wavy; text-underline-offset: 4px; } .diff .extra { color: var(--ink-3); text-decoration: line-through; }
.rubric { display: grid; gap: 8px; }
.rubric .lv { display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: all .2s; font-size: 14px; }
.rubric .lv:hover { border-color: var(--ink-3); }
.rubric .lv.sel { border-color: var(--ink); background: var(--raised); box-shadow: 0 0 0 1px var(--ink); }
.rubric .lv b { font: 500 22px/1 var(--serif); }
.ai-box { border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; background: linear-gradient(180deg, var(--surface), var(--raised)); }
.ai-box .ai-head { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 10px; }
.ai-box .ai-text { white-space: pre-wrap; font-size: 15px; line-height: 1.7; }
.wc { font: 500 12.5px var(--mono); color: var(--ink-3); }
.result-hero { text-align: center; padding: 30px 10px 10px; }
.stamp { width: 132px; height: 132px; margin: 0 auto 16px; display: block; }

/* ---------- compass / progress ---------- */
.bandbar { position: relative; height: 40px; }
.bandbar .track { position: absolute; left: 0; right: 0; top: 18px; height: 4px; background: var(--sunk); border-radius: 99px; }
.bandbar .fill { position: absolute; left: 0; top: 18px; height: 4px; background: var(--ink); border-radius: 99px; transition: width 1s var(--ease); }
.bandbar .goal { position: absolute; top: 8px; width: 2px; height: 24px; background: var(--accent); }
.bandbar .ticks { position: absolute; left: 0; right: 0; top: 28px; display: flex; justify-content: space-between; font: 500 10.5px var(--mono); color: var(--ink-3); }
.postcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.postcard { aspect-ratio: 3/4; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.postcard.locked { opacity: .45; filter: grayscale(1); }
.postcard svg { width: 82%; height: auto; }
.postcard b { font: 400 14.5px/1.25 var(--stamp); letter-spacing: .02em; }
.postcard small { font-size: 11.5px; color: var(--ink-3); line-height: 1.4; }

/* ---------- library ---------- */
.principle { display: grid; grid-template-columns: 54px 1fr; gap: 18px; padding: 24px 0; border-top: 1px solid var(--line); }
.principle .no { font: 400 34px/1 var(--serif); color: var(--accent); }
.principle h3 { font: 500 21px/1.3 var(--serif); margin-bottom: 8px; }
html[lang="zh-CN"] .principle h3 { font-family: var(--zh); }
.principle .where { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.refs { font-size: 13.5px; color: var(--ink-2); }
.refs li { margin-bottom: 7px; }
.refs a { color: var(--ink-2); text-underline-offset: 3px; }

/* ---------- onboarding ---------- */
.onb { max-width: 680px; margin: 6vh auto 0; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.choice { border: 1px solid var(--line-2); background: var(--raised); border-radius: 14px; padding: 16px; cursor: pointer; text-align: left; transition: all .25s var(--ease); }
.choice:hover { border-color: var(--ink-3); }
.choice.sel { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.choice b { display: block; font-weight: 600; }
.choice small { color: var(--ink-3); }
.lexcard { text-align: center; padding: 50px 20px; }
.lexcard .hw { font: 400 54px/1 var(--serif); letter-spacing: -.02em; }
.yn { display: flex; gap: 12px; justify-content: center; margin-top: 30px; }
.yn .btn { min-width: 140px; }

/* ---------- sound lab ---------- */
.pairs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pairbtn { padding: 26px 10px; border-radius: 16px; border: 1px solid var(--line-2); background: var(--raised); font: 400 30px var(--serif); cursor: pointer; transition: all .25s var(--ease); }
.pairbtn:hover { border-color: var(--ink-3); transform: translateY(-2px); }
.pairbtn.right { border-color: var(--green); background: var(--green-soft); }
.pairbtn.wrong { border-color: var(--red); background: var(--red-soft); }

.fade-in { animation: rise .5s var(--ease) both; }
.hidden { display: none !important; }
.center { text-align: center; }
hr.thin { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
kbd { font: 500 11px var(--mono); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 5px; color: var(--ink-3); }
.foot { margin-top: 80px; padding-top: 22px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); }
.lw { cursor: pointer; border-radius: 3px; transition: background .15s; }
.lw:hover { background: var(--gold-soft); }
.lw.para-hl { background: var(--gold-soft); box-shadow: 0 0 0 2px var(--gold-soft); }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: '+ '; color: var(--ink-3); }
details[open] > summary::before { content: '– '; }
table th { color: var(--ink-3); font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; }
.kicker.nocase { text-transform: none; letter-spacing: .04em; }
.ai-head svg { width: 18px; height: 18px; color: var(--accent); }
.ico svg { width: 62%; height: 62%; }
.kicker svg { width: 14px; height: 14px; }
@media (max-width: 440px) { .topbar .btn.ghost.sm { display: none; } .topbar { gap: 8px; } }
.field-art { width: 100%; height: auto; display: block; }
.week .field-art { width: 64px; margin: 4px 0 2px -4px; }
.week-hero { display: grid; grid-template-columns: 1fr 220px; gap: 32px; align-items: end; }
.week-hero .field-art { max-width: 220px; }
@media (max-width: 760px) { .week-hero { grid-template-columns: 1fr; } .week-hero .field-art { max-width: 140px; } }
.mini-sky { position: relative; height: 170px; border-radius: var(--r); overflow: hidden; background: radial-gradient(120% 120% at 30% 0%, #1D2333 0%, var(--night) 70%); display: block; text-decoration: none; }
.mini-sky .lbl { position: absolute; left: 18px; top: 14px; z-index: 2; color: rgba(233,228,214,.6); }
.mini-sky .big { position: absolute; left: 18px; bottom: 14px; z-index: 2; color: #F3EEDF; font: 400 22px var(--serif); }
.mini-sky canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.grid > *, .split > *, .hero > * { min-width: 0; }

/* =====================================================================
   PIXEL LAYER. Square geometry, 2px strokes, stepped corners, keycap
   buttons, segmented meters. Pixel faces for display and labels only;
   long reading text stays in Geist / LXGW WenKai for legibility.
   ===================================================================== */
:root { --n: 2px; --shadow: none;
  --clip: polygon(0 var(--n), var(--n) var(--n), var(--n) 0, calc(100% - var(--n)) 0, calc(100% - var(--n)) var(--n), 100% var(--n), 100% calc(100% - var(--n)), calc(100% - var(--n)) calc(100% - var(--n)), calc(100% - var(--n)) 100%, var(--n) 100%, var(--n) calc(100% - var(--n)), 0 calc(100% - var(--n))); }
*, *::before, *::after { border-radius: 0 !important; }
body { font-synthesis: none;
  background-color: var(--bg);
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 9%, transparent) 1px, transparent 1.2px);
  background-size: 16px 16px; background-position: 7px 7px; }
::selection { background: var(--ink); color: var(--bg); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
main.enter > * { animation: rise .32s steps(4, end) both; }

/* type */
.display, .h2, .h3, .brand b, .bignum, .wordcard .hw, .lexcard .hw, .week .wt, .principle .no, .principle h3,
.rubric .lv b, .doc .doc-title, .pairbtn, .mini-sky .big, .sky-tip b, .postcard b, .typein, .vision, .prompt, .qtext,
.nav a, .tabbar a, .btn, .chip, .seg button, .kicker, .timer, .step .tt, .task-row .tt, .choice b, .target-pill b,
.feedback .fh, .ai-box .ai-head, .speaker, .qnum, .wc, .week .wn, .step .n, .ring span, .toast, .opt::before, kbd, .keyhint,
table th, .bandbar .ticks, .weave .d, .transcript .who, .ctext .fix, label.field, .doc h4, .sky-legend {
  font-family: var(--px) !important; font-weight: 400 !important; letter-spacing: 0; }
html[lang="zh-CN"] .display, html[lang="zh-CN"] .h2, html[lang="zh-CN"] .h3, html[lang="zh-CN"] .week .wt,
html[lang="zh-CN"] .principle h3, html[lang="zh-CN"] .vision, html[lang="zh-CN"] .prompt.zhp { font-family: var(--px) !important; letter-spacing: 0; }
.display { font-size: clamp(36px, 5vw, 60px); line-height: 1.08; letter-spacing: -.01em; }
html[lang="zh-CN"] .display { font-size: clamp(36px, 4.4vw, 48px); line-height: 1.25; }
.h2 { font-size: clamp(24px, 2.7vw, 32px); line-height: 1.2; }
html[lang="zh-CN"] .h2 { font-size: 24px; line-height: 1.4; }
.h3 { font-size: 20px; } html[lang="zh-CN"] .h3 { font-size: 18px; }
.vision { font-size: 19px; line-height: 1.5; }
.kicker { font-size: 12px; letter-spacing: .06em; }
.kicker .dot { width: 6px; height: 6px; }
.wordcard .hw { font-size: clamp(44px, 6.4vw, 68px); letter-spacing: -.01em; }
.wordcard .ipa, .ipa { font-family: var(--code); }
.bignum { font-size: 52px; letter-spacing: -.01em; }
.lede { font-family: var(--read, var(--sans)); font-size: 18px; }
.btn, .nav a, .chip, .tabbar a { font-size: 14px; }
.btn.sm { font-size: 13px; }

/* stepped-corner surfaces */
.card, .step, .opt, .week, .doc, .sheet, .tile, .choice, .pairbtn, .postcard, .rubric .lv, .ai-box, .feedback, .audio-stage,
.target-pill, .iconbtn, .seg, .nav a, .timer, .sky, .mini-sky, .task-row .ico, .playbtn, .step .n, input[type=text], textarea, select,
.toast, .slots, .btn, .chip, .example, .weave .d, .sky-tip, .lexcard, .wordcard { clip-path: var(--clip); }
.card, .step, .week, .doc, .choice, .postcard, .ai-box, .audio-stage, .target-pill, .rubric .lv { border-width: 2px; }
.card { border: 2px solid var(--line); }
.card.raised { border: 2px solid var(--ink); box-shadow: none; }
.card.link:hover, .step:hover, .week:hover, .pairbtn:hover, .choice:hover, .tile:hover, .opt:hover { transform: translateY(-2px); box-shadow: none; transition: transform .12s steps(2); }
.step { border: 2px solid var(--line); }
.step:hover { transform: translateX(2px); }
.step.next { border-color: var(--ink); box-shadow: none; border-bottom-width: 4px; }
.step .n { border: 2px solid var(--line-2); }
.week { border: 2px solid var(--line); }
.week.cur { border-color: var(--ink); border-bottom-width: 4px; box-shadow: none; }
.doc { border: 2px solid var(--line); box-shadow: none; }
.doc.notice { border-top: 6px solid var(--accent); }
.sheet { border: 2px solid var(--ink); box-shadow: 8px 8px 0 color-mix(in srgb, var(--ink) 30%, transparent); clip-path: none; }
.veil { backdrop-filter: none; -webkit-backdrop-filter: none; background: color-mix(in srgb, var(--night) 55%, transparent); }
.veil .sheet { transition: transform .2s steps(3); }

/* keycap buttons: press down 2px */
.btn { border: 2px solid transparent; padding: 10px 18px 9px; transition: transform .08s steps(1), background .15s, color .15s; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--bg) 22%, var(--ink)); }
.btn.primary:hover { box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--bg) 22%, var(--ink)); background: color-mix(in srgb, var(--ink) 88%, var(--accent)); }
.btn.accent { border-color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent-ink); }
.btn.ghost { border-color: var(--ink); box-shadow: inset 0 -3px 0 var(--line-2); }
.btn.quiet { border-color: transparent; }
.btn:active { transform: translateY(2px); box-shadow: none !important; }
.btn svg { width: 16px; height: 16px; }
.iconbtn { border: 2px solid var(--line-2); }
.iconbtn:hover { border-color: var(--ink); }
.seg { padding: 2px; }
.seg button.on { box-shadow: none; background: var(--ink); color: var(--bg); }
.chip { padding: 4px 8px 3px; }
.chip.line { border: 2px solid var(--line-2); }
.nav a { border: 2px solid transparent; }
.nav a.on { background: var(--raised); border-color: var(--ink); box-shadow: none; }
.nav a.on::before { content: ''; position: absolute; left: -14px; top: 50%; width: 6px; height: 6px; margin-top: -3px; background: var(--accent); }
.nav a .badge { font-family: var(--px); font-weight: 400; }
.target-pill { border: 2px solid var(--line); }
.side { border-right: 2px solid var(--line); }
@media (max-width: 860px) {
  .topbar { border-bottom: 2px solid var(--line); backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  .tabbar { border-top: 2px solid var(--line); backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface); }
  .tabbar a.on { color: var(--ink); }
  .tabbar a.on svg { color: var(--accent); }
}

/* inputs */
input[type=text], textarea, select { border: 2px solid var(--line-2); }
input[type=text]:focus, textarea:focus, select:focus { border-color: var(--ink); box-shadow: none; }
.typein { clip-path: none; border-bottom: 4px solid var(--line-2); }
.typein:focus { border-bottom-color: var(--accent); }
.ctext input.cl { border-bottom: 2px solid var(--ink-3); }
.ctext input.cl:focus { border-bottom-color: var(--accent); }

/* options */
.opt { border: 2px solid var(--line-2); }
.opt::before { border: 2px solid var(--line-2); line-height: 18px; }
.opt.sel { border-color: var(--ink); box-shadow: none; }
.opt.right { border-color: var(--green); box-shadow: none; animation: pop .3s steps(3); }
.opt.wrong { animation: shake .3s steps(4); }
@keyframes pop { 50% { transform: translateY(-3px); } }
@keyframes shake { 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
.rubric .lv { border: 2px solid var(--line); }
.rubric .lv.sel { border-color: var(--ink); box-shadow: none; }
.choice { border: 2px solid var(--line-2); }
.choice.sel { border-color: var(--ink); box-shadow: none; background: var(--raised); border-bottom-width: 4px; }
.pairbtn { border: 2px solid var(--line-2); font-size: 28px; }
.tile { border: 2px solid var(--line-2); box-shadow: inset 0 -3px 0 var(--line); font-family: var(--serif); }
.tile.fixed { border-style: dashed; box-shadow: none; }
.slots { border: 2px dashed var(--line-2); }
.feedback.show { animation: rise .25s steps(3) both; }
.example { border-left: 4px solid var(--accent); }
.example .hl { background: linear-gradient(transparent 60%, var(--gold-soft) 60%); }

/* meters: segmented blocks */
.meter { height: 8px; background: repeating-linear-gradient(90deg, var(--sunk) 0 6px, transparent 6px 8px); }
.meter i { background: repeating-linear-gradient(90deg, var(--ink) 0 6px, transparent 6px 8px) !important; transition: width .5s steps(8); }
.meter.accent i { background: repeating-linear-gradient(90deg, var(--accent) 0 6px, transparent 6px 8px) !important; }
.meter.green i { background: repeating-linear-gradient(90deg, var(--green) 0 6px, transparent 6px 8px) !important; }
.meter.gold i { background: repeating-linear-gradient(90deg, var(--gold) 0 6px, transparent 6px 8px) !important; }
.bandbar .track { height: 6px; top: 17px; background: repeating-linear-gradient(90deg, var(--sunk) 0 6px, transparent 6px 8px); }
.bandbar .fill { height: 6px; top: 17px; background: repeating-linear-gradient(90deg, var(--ink) 0 6px, transparent 6px 8px); transition: width .6s steps(10); }
.bandbar .goal { width: 4px; }
.ring { width: 64px; height: 64px; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--sunk) 0); clip-path: var(--clip); }
.ring::before { background: var(--surface); width: calc(100% - 12px); height: calc(100% - 12px); }

/* week rhythm: dithered days */
.weave { gap: 4px; }
.weave .d { font-size: 11px; }
.weave .d.on { background: var(--accent-soft); }
.weave .d.on::after { background: conic-gradient(color-mix(in srgb, var(--accent) 30%, transparent) 25%, transparent 0 50%, color-mix(in srgb, var(--accent) 30%, transparent) 0 75%, transparent 0) 0 0 / 4px 4px; }
.weave .d.today { outline: 2px solid var(--ink); outline-offset: 0; clip-path: none; }

/* audio + recording */
.playbtn { width: 72px; height: 72px; box-shadow: inset 0 -4px 0 color-mix(in srgb, var(--bg) 22%, var(--ink)); }
.playbtn:hover { transform: translateY(-2px); }
.playbtn:active { transform: translateY(2px); box-shadow: none; }
.recbtn { width: 80px; height: 80px; box-shadow: inset 0 -4px 0 var(--accent-ink); }
.recbtn.on::before { inset: -8px; border: 2px solid var(--accent); animation: pulse 1s steps(4) infinite; }
.wave { gap: 2px; }
.wave i { width: 4px; }
.wave.on i { animation: wv .8s steps(4) infinite; }
.timer { border: 2px solid transparent; }
.timer.low { border-color: var(--red); }

/* sky */
.sky { box-shadow: none; background: var(--night); }
.mini-sky { background: var(--night); }
.sky-tip { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--night); border: 2px solid rgba(255,255,255,.35); }
.sky-legend i { width: 6px; height: 6px; }
.toast { border: 2px solid var(--ink); box-shadow: 4px 4px 0 color-mix(in srgb, var(--ink) 25%, transparent); clip-path: none; transition: transform .2s steps(3), opacity .2s steps(2); }

/* misc */
.postcard { border: 2px solid var(--line); }
.postcard.locked { filter: grayscale(1); }
.postcard b { font-size: 14px; }
.task-row { border-top: 2px solid var(--line); }
.principle { border-top: 2px solid var(--line); }
.rule, hr.thin { height: 0; background: none; border: 0; border-top: 2px dashed var(--line); }
.foot { border-top: 2px solid var(--line); }
.doc.email .hdr { border-bottom: 2px solid var(--line); }
.lw:hover, .lw.para-hl { box-shadow: none; }
svg.pi { shape-rendering: crispEdges; }
.field-art { image-rendering: pixelated; }
.week .field-art { width: 72px; margin: 6px 0 2px; }
details > summary::before { font-family: var(--px); }
.nav a { clip-path: none; }
.nav a.on::before { left: -12px; }
/* pixel icons render at whole multiples of their 16px grid */
svg.pi { width: 16px !important; height: 16px !important; }
.brand svg.pi.logo { width: 32px !important; height: 32px !important; }
.topbar .brand svg.pi.logo { width: 32px !important; height: 32px !important; }
.playbtn svg.pi, .recbtn svg.pi { width: 32px !important; height: 32px !important; }
/* sky text follows tokens */
.sky, .sky .h2, .mini-sky .big, .sky-tip { color: var(--sky-text); }
.sky .kicker, .mini-sky .lbl, .sky-legend { color: color-mix(in srgb, var(--sky-text) 62%, transparent); }
.sky-tip { border-color: color-mix(in srgb, var(--sky-text) 35%, transparent); }
.sky-legend i { background: var(--star); }

/* =====================================================================
   PALETTE "LAPIS" (research/color_design.md). Calm cool reading surface,
   navy ink, cobalt for interaction; warm marigold only for game moments.
   Right/wrong = blue/orange plus a glyph (colour-blind safe).
   ===================================================================== */
:root, :root[data-theme="light"] {
  --bg: #F6F6F1; --surface: #FBFBF8; --raised: #FFFFFF; --sunk: #ECEDE6;
  --ink: #161B33; --ink-2: #3B4260; --ink-3: #5C6380; --line: #DADCD3; --line-2: #BEC2B7;
  --accent: #2D48C0; --accent-ink: #22389A; --accent-soft: #DADEEA; --on-accent: #FFFFFF;
  --sk-read: #12594A; --sk-read-soft: #D6E0DA; --sk-listen: #3088D4; --sk-listen-soft: #DAE7ED;
  --sk-write: #A62F8A; --sk-write-soft: #EBDAE3; --sk-speak: #A97B1F; --sk-speak-soft: #EBE5D4;
  --ok: #1565C0; --ok-soft: #DCE6F3; --bad: #B4500A; --bad-soft: #F3E2D5;
  --reward: #E8B321; --reward-soft: #F8EBC4;
  --green: #12594A; --green-soft: #D6E0DA; --blue: #3088D4; --blue-soft: #DAE7ED; --gold: #A97B1F; --gold-soft: #F8EBC4; --red: #B4500A; --red-soft: #F3E2D5;
  --night: #111833; --night-2: #18213F; --star: #F2F0E6; --star-2: #F2C94C; --star-due: #FF9F5A; --star-dim: #7C86A8; --sky-text: #E6E8EF; --sky-ink: #C9CEDD;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #12151F; --surface: #181C29; --raised: #202536; --sunk: #0C0E16;
  --ink: #E6E8EF; --ink-2: #B8BDCC; --ink-3: #8C92A6; --line: #2A3042; --line-2: #3A4157;
  --accent: #8EA2FF; --accent-ink: #AEBCFF; --accent-soft: #303755; --on-accent: #12151F;
  --sk-read: #10A97A; --sk-read-soft: #123935; --sk-listen: #5DCEF1; --sk-listen-soft: #244151;
  --sk-write: #C376C9; --sk-write-soft: #3C2C48; --sk-speak: #E6C07A; --sk-speak-soft: #453E35;
  --ok: #7FB0FF; --ok-soft: #22304D; --bad: #FF9F5A; --bad-soft: #43301F;
  --reward: #F2C94C; --reward-soft: #4A3F1F;
  --green: #10A97A; --green-soft: #123935; --blue: #5DCEF1; --blue-soft: #244151; --gold: #E6C07A; --gold-soft: #4A3F1F; --red: #FF9F5A; --red-soft: #43301F;
  --night: #070A18; --night-2: #0E1426; --star: #F2F0E6; --star-2: #F2C94C; --star-due: #FF9F5A; --star-dim: #6A7396; --sky-text: #E6E8EF; --sky-ink: #C9CEDD;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151F; --surface: #181C29; --raised: #202536; --sunk: #0C0E16;
    --ink: #E6E8EF; --ink-2: #B8BDCC; --ink-3: #8C92A6; --line: #2A3042; --line-2: #3A4157;
    --accent: #8EA2FF; --accent-ink: #AEBCFF; --accent-soft: #303755; --on-accent: #12151F;
    --sk-read: #10A97A; --sk-read-soft: #123935; --sk-listen: #5DCEF1; --sk-listen-soft: #244151;
    --sk-write: #C376C9; --sk-write-soft: #3C2C48; --sk-speak: #E6C07A; --sk-speak-soft: #453E35;
    --ok: #7FB0FF; --ok-soft: #22304D; --bad: #FF9F5A; --bad-soft: #43301F;
    --reward: #F2C94C; --reward-soft: #4A3F1F;
    --green: #10A97A; --green-soft: #123935; --blue: #5DCEF1; --blue-soft: #244151; --gold: #E6C07A; --gold-soft: #4A3F1F; --red: #FF9F5A; --red-soft: #43301F;
    --night: #070A18; --night-2: #0E1426; --star: #F2F0E6; --star-2: #F2C94C; --star-due: #FF9F5A; --star-dim: #6A7396; --sky-text: #E6E8EF; --sky-ink: #C9CEDD;
    color-scheme: dark;
  }
}
/* reading paper: a per-learner page tint (Rello & Bigham 2017: warm pale tints read fastest) */
:root[data-paper="peach"]:not([data-theme="dark"]) { --bg: #FFF1E8; --surface: #FFF7F1; --sunk: #F5E6DB; }
:root[data-paper="butter"]:not([data-theme="dark"]) { --bg: #FBF3D5; --surface: #FDF8E6; --sunk: #F0E7C6; }
@media (prefers-color-scheme: dark) {
  :root[data-paper="peach"]:not([data-theme="light"]), :root[data-paper="butter"]:not([data-theme="light"]) { --bg: #12151F; --surface: #181C29; --sunk: #0C0E16; }
}

/* skills */
.ico.reading { background: var(--sk-read-soft); color: var(--sk-read); } .ico.listening { background: var(--sk-listen-soft); color: var(--sk-listen); }
.ico.writing { background: var(--sk-write-soft); color: var(--sk-write); } .ico.speaking { background: var(--sk-speak-soft); color: var(--sk-speak); }
/* right / wrong: colour + glyph, never colour alone */
.opt.right, .pairbtn.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong, .pairbtn.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.right::after, .opt.wrong::after { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font: 400 16px var(--px); }
.opt.right::after { content: '✓'; color: var(--ok); } .opt.wrong::after { content: '✗'; color: var(--bad); }
.feedback.good { background: var(--ok-soft); } .feedback.bad { background: var(--bad-soft); }
.feedback.good .fh { color: var(--ok); } .feedback.bad .fh { color: var(--bad); }
.step.done .n { background: var(--ok); border-color: var(--ok); }
.slots.ok { border-color: var(--ok); background: var(--ok-soft); } .slots.no { border-color: var(--bad); }
.ctext .cw.ok input.cl { color: var(--ok); border-bottom-color: var(--ok); } .ctext .cw.no input.cl { color: var(--bad); border-bottom-color: var(--bad); }
.ctext .fix { color: var(--ok); }
.diff .ok { color: var(--ok); } .diff .miss { color: var(--bad); }
.chip.green { background: var(--ok-soft); color: var(--ok); } .chip.red { background: var(--bad-soft); color: var(--bad); }
.chip.gold { background: var(--reward-soft); color: var(--ink); }
.timer.low { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
/* one highlight colour: marigold, the game-layer warmth */
.example .hl { background: linear-gradient(transparent 58%, var(--reward-soft) 58%); }
.lw:hover, .lw.para-hl, .doc .para-hl { background: var(--reward-soft); }
.weave .d.on { background: var(--accent-soft); color: var(--accent-ink); }
.weave .d.on::after { background: conic-gradient(color-mix(in srgb, var(--accent) 28%, transparent) 25%, transparent 0 50%, color-mix(in srgb, var(--accent) 28%, transparent) 0 75%, transparent 0) 0 0 / 4px 4px; }
.kicker .dot { background: var(--accent); }
.nav a.on::before { background: var(--accent); }
.btn.primary { background: var(--ink); }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: inset 0 -3px 0 var(--accent-ink); }
.bandbar .goal { background: var(--reward); }
/* cobalt carries interaction */
.btn.primary, .playbtn { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: inset 0 -3px 0 var(--accent-ink); }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.step.next { border-color: var(--accent); }
.step.next .n { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.seg button.on { background: var(--accent); color: var(--on-accent); }
:root[data-theme="dark"] .btn.primary:hover { background: var(--accent-ink); }
