/* Path Mandarin design system v2 (2026-10): premium editorial, mobile-first.
   Direction: Japanese editorial layout + Apple restraint. Huge TW-Kai characters are the visual objects,
   supporting information is small (pinyin, English, small-caps labels). Paper, ink and one seal red.
   No gamification chrome: no pill badges everywhere, no rainbow, no giant XP numbers.
   Colour: ink is the primary action colour; red (#C8102E, the Path Academy red) only marks "now" and the seal.
   Shape rule: 6px for every control, tile and card; sheets 14px; circles only for avatars and audio buttons.
   Lines over boxes: sections are separated by 1px hairlines and whitespace, cards only where a thing is tappable.
   Motion rule: transform and opacity only, one ease-out curve, 160-480ms, all collapsed under reduced motion.
   Layout: phone < 768 (top bar + bottom tab bar), tablet 768-1023 (same bars, wider grids), >= 1024 sidebar. */
@import url("../fonts/fonts.css");
@font-face { font-family: "TWKaiMS"; src: url("../fonts/twkai-ms.woff2") format("woff2"); font-display: swap; }

:root {
  /* Taipei retro palette (chosen 2026-10-07): paper + ink for text, colour only for surfaces and accents.
     Path crimson #C8102E = the accent, shared with pathacademy.id (2026-10-16); #B00D29 wherever it carries small text (WCAG AA).
     Darlington #ACCAB2 = calm colour blocks. Beeswax #E9A752 = highlights. Cafe Latte #78614D = quiet labels. */
  --bg: #F6F5F1; --surface: #FFFFFF; --surface-2: #EFEDE7; --surface-3: #E2DED5;
  --ink: #17181A; --ink-2: #3A3936; --muted: #6B5A4B; --faint: #9A8F84;
  --line: #E5E1D8; --line-strong: #CEC7BA;
  --accent: #C8102E; --accent-ink: #B00D29; --accent-soft: #FBE8EB; --accent-line: #EEB4BE; --on-accent: #FFFFFF;
  --accent-glow: rgba(200, 16, 46, .3); --seal: #B00D29;
  --mint: #ACCAB2; --mint-2: #C9DDCD; --mint-soft: #E3EEE6; --mint-ink: #2C5A44;
  --amber: #E9A752; --amber-soft: #FBEBD2; --amber-ink: #87580F;
  --latte: #78614D;
  --earned: #17181A; --earned-soft: rgba(23, 24, 26, .3);
  --ok: #2C6B4C; --ok-soft: #E1EEE5; --warn: #87580F; --warn-soft: #FBEBD2; --bad: #B00D29; --bad-soft: #FBE8EB;
  --t1: #C2401C; --t2: #A06A12; --t3: #2E7552; --t4: #2E5C8A; --t0: #7A6E64;
  --band: #17181A; --band-ink: #FFFFFF; --band-muted: rgba(255, 255, 255, .7);
  --font-ui: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --font-display: "Hanken Grotesk", "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --font-py: "PinyinMS", "Source Sans 3", "Segoe UI", Arial, sans-serif;
  --font-zh: "TWKaiMS", "TW-Kai", "DFKai-SB", "BiauKai", "Microsoft JhengHei", serif;
  --r-s: 4px; --r: 6px; --r-l: 6px; --r-xl: 14px;
  --sh-1: none;
  --sh-2: 0 18px 40px -22px rgba(40, 30, 20, .3), 0 0 0 1px rgba(40, 30, 20, .05);
  --sh-3: 0 32px 80px -24px rgba(40, 30, 20, .38), 0 0 0 1px rgba(40, 30, 20, .06);
  --ease: cubic-bezier(.16, 1, .3, 1); --spring: cubic-bezier(.34, 1.4, .64, 1);
  --snap: 160ms; --reveal: 260ms; --page: 460ms;
  --side-w: 260px; --tab-h: 64px; --gutter: 20px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #111212; --surface: #18191A; --surface-2: #202122; --surface-3: #2C2D2E;
  --ink: #F2EFE9; --ink-2: rgba(242, 239, 233, .84); --muted: #B8A898; --faint: rgba(242, 239, 233, .42);
  --line: rgba(255, 255, 255, .09); --line-strong: rgba(255, 255, 255, .18);
  --accent: #EE4A62; --accent-ink: #F57A8C; --accent-soft: rgba(238, 74, 98, .15); --accent-line: rgba(238, 74, 98, .42);
  --accent-glow: rgba(238, 74, 98, .4); --seal: #C8102E;
  --mint: #4F6F59; --mint-2: #3D5746; --mint-soft: rgba(172, 202, 178, .12); --mint-ink: #A9CDB2;
  --amber: #E9A752; --amber-soft: rgba(233, 167, 82, .14); --amber-ink: #EDB66B;
  --latte: #5E4B3C;
  --earned: rgba(242, 239, 233, .94); --earned-soft: rgba(242, 239, 233, .38);
  --ok: #8DC4A0; --ok-soft: rgba(141, 196, 160, .14); --warn: #EDB66B; --warn-soft: rgba(233, 167, 82, .14); --bad: #F57A8C; --bad-soft: rgba(238, 74, 98, .16);
  --t1: #FF8A66; --t2: #F0B44E; --t3: #8DC4A0; --t4: #8FB4E8; --t0: rgba(255, 255, 255, .6);
  --band: #000000;
  --sh-2: 0 18px 40px -20px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .07); --sh-3: 0 30px 80px -16px rgba(0, 0, 0, .85), 0 0 0 1px rgba(255, 255, 255, .08);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink); font-family: var(--font-ui); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--on-accent); }
a { color: var(--ink); text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
@media (hover: hover) { a:hover { text-decoration-color: var(--ink); } }
button { font: inherit; color: inherit; }
img, svg { max-width: 100%; }
svg { flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[tabindex="-1"]:focus { outline: none; }   /* headings focused by the router for screen readers */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -80px; z-index: 1000; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--r); text-decoration: none; font-weight: 700; }
.skip:focus { top: 12px; }

/* ---------- type ---------- */
.zh { font-family: var(--font-zh); font-weight: 400; letter-spacing: .02em; }
.py { font-family: var(--font-py); letter-spacing: .01em; }
h1, h2, h3, .display { font-family: var(--font-display); margin: 0; color: var(--ink); text-wrap: balance; }
h1 { font-size: clamp(30px, 4.6vw, 44px); font-weight: 700; letter-spacing: -.035em; line-height: 1.06; }
h2 { font-size: 19px; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; }
h3 { font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; }
p { margin: 0 0 12px; }
.eyebrow, .label-caps { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.eyebrow.now, .label-caps.now { color: var(--accent-ink); }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.small { font-size: 14px; } .tiny { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.measure { max-width: 62ch; }
.tc .tone-1 { color: var(--t1); } .tc .tone-2 { color: var(--t2); } .tc .tone-3 { color: var(--t3); } .tc .tone-4 { color: var(--t4); } .tc .tone-0, .tc .tone-5 { color: var(--t0); }

/* editorial masthead: a huge character as the visual object, small supporting lines beside it */
.mast { display: flex; align-items: flex-end; gap: 14px; margin: 0 0 14px; }
.mast-hz { font-family: var(--font-zh); font-size: clamp(64px, 17vw, 96px); line-height: .92; letter-spacing: .01em; color: var(--ink); }
.mast-cap { display: grid; gap: 2px; padding-bottom: 6px; line-height: 1.2; }
.mast-cap .py { font-size: 15px; color: var(--ink-2); }
.mast-cap .lbl { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.rule { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---------- app shell ---------- */
.mark { width: 30px; height: 30px; border-radius: var(--r); flex: none; display: block; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand .prod { line-height: 1.1; min-width: 0; }
.brand .prod b { font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: -.02em; display: block; white-space: nowrap; }
.brand .prod small { font-size: 10.5px; color: var(--muted); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; }

.top { position: sticky; top: 0; z-index: 40; padding-top: env(safe-area-inset-top, 0px); background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(18px); backdrop-filter: saturate(160%) blur(18px); border-bottom: 1px solid var(--line); }
@supports (animation-timeline: scroll()) {
  .top { border-bottom-color: transparent; animation: topline linear both; animation-timeline: scroll(root); animation-range: 0 48px; }
  @keyframes topline { to { border-bottom-color: var(--line); } }
}
.top .in { height: 56px; padding: 0 var(--gutter); display: flex; align-items: center; gap: 10px; max-width: 1180px; margin: 0 auto; }
.tools { display: flex; gap: 2px; align-items: center; margin-left: auto; flex: none; }
.search-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; }
.search-btn svg { width: 21px; height: 21px; }
@media (hover: hover) { .search-btn:hover { background: var(--surface-2); } }
.main { min-width: 0; padding: 18px var(--gutter) calc(var(--tab-h) + 40px + env(safe-area-inset-bottom, 0px)); }
.page { max-width: 1080px; margin: 0 auto; }
.page.narrow { max-width: 720px; } .page.read { max-width: 900px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 4px 0 28px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.page-head p { margin: 10px 0 0; color: var(--muted); max-width: 58ch; }

/* bottom tab bar (phone + tablet); the active tab is marked by a red hairline that slides */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr));
  padding: 0 8px env(safe-area-inset-bottom, 0px); background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(22px); backdrop-filter: saturate(160%) blur(22px); border-top: 1px solid var(--line); }
.tabbar a { position: relative; z-index: 1; display: grid; justify-items: center; align-content: center; gap: 4px; min-height: var(--tab-h); text-decoration: none; color: var(--faint); font-size: 11px; font-weight: 600; letter-spacing: .02em; touch-action: manipulation; transition: color var(--snap) var(--ease); }
.tabbar a svg { width: 22px; height: 22px; stroke-width: 1.75; transition: transform var(--reveal) var(--spring); }
.tabbar a[aria-current="page"] { color: var(--ink); }
.tabbar a:active svg { transform: scale(.88); }
.tb-ind { position: absolute; top: -1px; left: 8px; height: 2px; width: calc((100% - 16px) / var(--n, 3)); transform: translateX(calc(100% * var(--i, 0))); transition: transform 460ms var(--ease), opacity var(--snap) var(--ease); pointer-events: none; }
.tb-ind i { display: block; width: 28px; height: 2px; margin: 0 auto; background: var(--accent); }
.tabbar:not(.has-active) .tb-ind { opacity: 0; }
.tabbar .count { position: absolute; top: 9px; left: calc(50% + 7px); font-size: 10px; font-weight: 700; background: var(--accent-ink); color: #fff; border-radius: 99px; padding: 0 4px; line-height: 16px; min-width: 16px; text-align: center; font-variant-numeric: tabular-nums; }
.tabbar .count.zero { background: var(--surface-3); color: var(--muted); }

/* sidebar (iPad landscape, laptop) */
.side { display: none; }
.side-nav { display: grid; gap: 1px; }
.side-nav a { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: var(--r); color: var(--ink-2); font-weight: 600; font-size: 15px; text-decoration: none; position: relative; transition: background var(--snap) var(--ease), color var(--snap) var(--ease); }
.side-nav a svg { width: 19px; height: 19px; stroke-width: 1.75; color: var(--muted); }
@media (hover: hover) { .side-nav a:hover { background: var(--surface-2); color: var(--ink); } }
.side-nav a[aria-current="page"] { color: var(--ink); font-weight: 700; background: var(--surface-2); }
.side-nav a[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 11px; bottom: 11px; width: 2px; background: var(--accent); }
.side-nav a[aria-current="page"] svg { color: var(--ink); }
.side-nav .count { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.side-nav .count.zero { color: var(--faint); }
.side-label { font-size: 10.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); padding: 22px 12px 8px; }
.side-search { display: flex; align-items: center; gap: 10px; width: 100%; height: 42px; padding: 0 12px; margin: 4px 0 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 500; font-size: 14.5px; cursor: pointer; text-align: left; }
.side-search svg { width: 17px; height: 17px; }
.side-search kbd { margin-left: auto; }
.acct-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 0 10px; margin-top: auto; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; cursor: pointer; text-align: left; }
@media (hover: hover) { .acct-row:hover { background: var(--surface-2); } }
.acct-row .who { min-width: 0; line-height: 1.25; flex: 1; }
.acct-row .who b { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-row .who span { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (min-width: 768px) {
  :root { --gutter: 36px; --tab-h: 68px; }
  .main { padding-top: 26px; }
  .tabbar { padding-inline: max(8px, calc((100% - 620px) / 2)); }
  .tb-ind { left: max(8px, calc((100% - 620px) / 2)); width: calc((100% - 2 * max(8px, calc((100% - 620px) / 2))) / var(--n, 3)); }
  .tabbar a { font-size: 11.5px; }
  .mast-hz { font-size: 104px; }
}
@media (min-width: 1024px) {
  :root { --gutter: 52px; }
  .top, .tabbar { display: none; }
  .side { display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 30; width: var(--side-w); padding: 22px 14px 0; background: var(--bg); border-right: 1px solid var(--line); overflow-y: auto; }
  .side .brand { padding: 0 8px 16px; }
  .main { margin-left: var(--side-w); padding: 44px var(--gutter) 80px; }
}

/* focus session: no chrome */
body.session { background: var(--surface); }
body.session .top, body.session .tabbar, body.session .side { display: none; }
body.session .main { margin-left: 0; padding: 0 var(--gutter); }
.session-bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: calc(8px + env(safe-area-inset-top, 0px)) 0 8px; background: var(--surface); }
.session-bar .bar { flex: 1; height: 3px; }
.session-bar .meta { font-size: 12.5px; color: var(--muted); font-weight: 600; letter-spacing: .04em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stage { max-width: 680px; margin: 0 auto; }

/* ---------- buttons ---------- */
.btn { --b: var(--surface); --c: var(--ink); --l: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: var(--r);
  background: var(--b); color: var(--c); border: 1px solid var(--l); font-weight: 600; font-size: 15px; letter-spacing: -.005em; cursor: pointer; text-decoration: none;
  transition: background var(--snap) var(--ease), border-color var(--snap) var(--ease), transform var(--snap) var(--ease), opacity var(--snap) var(--ease); touch-action: manipulation; white-space: nowrap; user-select: none; }
@media (hover: hover) { .btn:hover { background: var(--surface-2); } }
.btn:active { transform: scale(.975); }
.btn svg { width: 18px; height: 18px; }
.btn.primary, .btn.accent { --b: var(--accent); --c: #fff; --l: var(--accent); }
@media (hover: hover) { .btn.primary:hover, .btn.accent:hover { background: color-mix(in srgb, var(--accent) 86%, #000); } }
.btn.dark { --b: var(--ink); --c: var(--bg); --l: var(--ink); }
:root[data-theme="dark"] .btn.primary, :root[data-theme="dark"] .btn.accent, :root[data-theme="dark"] .play.lg.cta { --c: #17181A; color: #17181A; }
@media (hover: hover) { .btn.dark:hover { background: var(--ink-2); } }
.btn.white { --b: #FFFFFF; --c: #111113; --l: #FFFFFF; }
.btn.ghost { --b: transparent; --l: transparent; }
.btn.soft { --b: var(--surface-2); --l: transparent; }
.btn.danger { --b: var(--bad-soft); --c: var(--bad); --l: transparent; }
.btn.lg { min-height: 56px; padding: 0 24px; font-size: 16px; }
.btn.sm { min-height: 38px; padding: 0 13px; font-size: 14px; }
.btn.pill { border-radius: var(--r); }
.btn.block { width: 100%; }
.btn .arrow { margin-left: auto; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; transform: none; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 50%; border: 0; background: transparent; cursor: pointer; color: var(--ink-2); transition: background var(--snap) var(--ease), transform var(--snap) var(--ease); text-decoration: none; }
@media (hover: hover) { .icon-btn:hover { background: var(--surface-2); } }
.icon-btn:active { transform: scale(.9); }
.icon-btn svg { width: 20px; height: 20px; stroke-width: 1.75; }
.play { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); display: inline-grid; place-items: center; cursor: pointer; flex: none; transition: background var(--snap) var(--ease), color var(--snap) var(--ease), transform var(--snap) var(--ease); }
@media (hover: hover) { .play:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); } }
.play.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.play:active { transform: scale(.9); }
.play svg { width: 18px; height: 18px; }
.play.sm { width: 34px; height: 34px; } .play.sm svg { width: 15px; height: 15px; }
.play.lg { width: 84px; height: 84px; } .play.lg svg { width: 32px; height: 32px; }
.play.lg.cta { background: var(--accent); color: #fff; border-color: var(--accent); }
.play.on.cta { background: var(--ink); border-color: var(--ink); }
kbd { font-family: var(--font-ui); font-size: 11px; font-weight: 600; color: var(--muted); background: transparent; border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 5px; min-width: 20px; display: inline-block; text-align: center; line-height: 18px; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 20px; min-width: 0; }
.card.pad-s { padding: 14px 16px; }
.card.link { text-decoration: none; color: inherit; display: block; transition: border-color var(--reveal) var(--ease), transform var(--reveal) var(--ease); }
@media (hover: hover) { .card.link:hover { border-color: var(--ink); } }
.card.link:active { transform: scale(.99); }
.icon-tile { width: 42px; height: 42px; border-radius: var(--r); display: grid; place-items: center; background: transparent; border: 1px solid var(--line-strong); color: var(--ink); margin-bottom: 14px; flex: none; }
.icon-tile svg { width: 20px; height: 20px; stroke-width: 1.75; }
.hero-card { background: var(--band); color: var(--band-ink); border-radius: var(--r-l); padding: clamp(22px, 4vw, 34px); position: relative; overflow: hidden; }
.hero-card h1, .hero-card h2, .hero-card h3 { color: var(--band-ink); }
.hero-card .muted { color: var(--band-muted); }
.hero-card .eyebrow { color: var(--band-muted); }
.hero-card .btn:not(.accent):not(.white) { --b: rgba(255, 255, 255, .08); --c: #fff; --l: rgba(255, 255, 255, .2); }
.hero-card .btn.primary { --b: #fff; --c: #111113; --l: #fff; }
.hero-card .bar { background: rgba(255, 255, 255, .16); } .hero-card .bar > i { background: #fff; }
.panel { background: var(--surface-2); border-radius: var(--r-l); padding: 18px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.nowrap { flex-wrap: nowrap; }
.stack { display: grid; gap: 12px; }
.divider { height: 1px; background: var(--line); margin: 20px 0; border: 0; }
.section { margin-top: 40px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head a { font-size: 13px; font-weight: 600; text-decoration: none; color: var(--muted); white-space: nowrap; }
@media (min-width: 768px) { .card { padding: 24px; } .section { margin-top: 52px; } .grid { gap: 16px; } }

/* ---------- labels, segmented, switch ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: var(--r-s); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; background: transparent; color: var(--muted); border: 1px solid var(--line-strong); white-space: nowrap; }
.chip svg { width: 13px; height: 13px; }
.chip.now { color: var(--accent-ink); border-color: var(--accent-line); }
.chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.chip.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.chip.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.chip.ink { background: var(--ink); color: var(--bg); border-color: var(--ink); }
button.chip { cursor: pointer; height: 32px; padding: 0 12px; }
button.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; }
.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: var(--r); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 4px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; min-height: 38px; transition: background var(--snap) var(--ease), color var(--snap) var(--ease), box-shadow var(--snap) var(--ease); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(17, 17, 19, .1), 0 0 0 1px rgba(17, 17, 19, .05); }
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; font-size: 15px; }
.switch input { appearance: none; width: 48px; height: 28px; border-radius: 99px; background: var(--surface-3); position: relative; cursor: pointer; transition: background var(--reveal) var(--ease); flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform var(--reveal) var(--spring); }
.switch input:checked { background: var(--mint-ink); }
.switch input:checked::after { transform: translateX(20px); }

/* ---------- forms ---------- */
.field { display: grid; gap: 8px; }
.field > label, .field .label { font-weight: 600; font-size: 13.5px; }
.field .help { font-size: 13px; color: var(--muted); }
.input, select.input, textarea.input { font: inherit; font-size: 16px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); padding: 12px 14px; min-height: 52px; width: 100%;
  transition: border-color var(--snap) var(--ease), box-shadow var(--snap) var(--ease); }
.input::placeholder { color: var(--muted); opacity: 1; }
@media (hover: hover) { .input:hover { border-color: var(--muted); } }
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 9%, transparent); }
textarea.input { min-height: 150px; resize: vertical; line-height: 1.7; }
.answer-input { font-family: var(--font-py); font-size: 24px; text-align: center; min-height: 62px; }
.answer-input.zhin { font-family: var(--font-zh); }
.answer-input.ok { border-color: var(--ok); background: var(--ok-soft); }
.answer-input.bad { border-color: var(--bad); background: var(--bad-soft); }

/* ---------- progress ---------- */
.bar { height: 3px; background: var(--surface-3); border-radius: 0; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--earned); transition: width var(--page) var(--ease); transform-origin: left center; }
.bar.now > i { background: var(--accent); }
.ring circle { fill: none; }
.ring .bg { stroke: var(--surface-3); }
.ring .fg { stroke: var(--earned); stroke-linecap: butt; transition: stroke-dashoffset .9s var(--ease); }
.ring.now .fg { stroke: var(--accent); }
.hero-card .ring .bg { stroke: rgba(255, 255, 255, .16); } .hero-card .ring .fg { stroke: #fff; } .hero-card .ring.now .fg { stroke: #FF7088; }

/* ---------- stats: numbers on hairlines, not in boxes ---------- */
.stat { border-top: 1px solid var(--ink); padding: 12px 0 4px; min-width: 0; }
.stat .label { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .label svg { display: none; }
.stat .value { font-family: var(--font-display); font-size: 34px; font-weight: 600; letter-spacing: -.04em; font-variant-numeric: tabular-nums; margin-top: 6px; line-height: 1.05; }
.stat .sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* ---------- lists ---------- */
.list { display: grid; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); min-width: 0; }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
a.list-row { text-decoration: none; color: inherit; padding-inline: 8px; transition: background var(--snap) var(--ease); }
@media (hover: hover) { a.list-row:hover { background: var(--surface-2); } }
a.list-row:active { background: var(--surface-2); }

/* ---------- reading ---------- */
.ruby-line { font-family: var(--font-zh); font-size: 27px; line-height: 2.3; }
.ruby-line ruby { ruby-position: over; }
.ruby-line rt { font-family: var(--font-py); font-size: 12.5px; line-height: 1; letter-spacing: 0; color: var(--muted); }
.ruby-line.zy rt { font-family: var(--font-zh); font-size: 11px; }
.ruby-off rt { visibility: hidden; }
.w-tap { cursor: pointer; border-radius: 3px; transition: background var(--snap) var(--ease); }
@media (hover: hover) { .w-tap:hover { background: var(--surface-3); } }
.w-new { box-shadow: inset 0 -2px 0 var(--accent-line); }
.w-learning { background: var(--amber-soft); }

/* ---------- overlays ---------- */
.scrim { position: fixed; inset: 0; z-index: 90; background: rgba(12, 12, 14, .38); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: fade var(--reveal) var(--ease); }
.modal { width: min(560px, 100%); max-height: min(88dvh, 840px); overflow: auto; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--sh-3); padding: 26px; animation: pop var(--page) var(--ease); }
.modal.wide { width: min(880px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
@media (max-width: 767px) {
  .scrim { place-items: end stretch; padding: 0; }
  .modal { width: 100%; max-height: 90dvh; border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 22px var(--gutter) calc(22px + env(safe-area-inset-bottom, 0px)); animation: sheetUp var(--page) var(--ease); }
  .modal::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 9px; background: var(--surface-3); margin: -10px auto 16px; }
  .modal.cmdk { border-radius: 0 0 var(--r-xl) var(--r-xl); align-self: start; margin-top: 0 !important; padding: env(safe-area-inset-top, 0px) 0 0; animation: sheetDown var(--page) var(--ease); }
  .modal.cmdk::before { display: none; }
}
.pop { position: fixed; z-index: 95; width: min(340px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--sh-3); padding: 16px 18px; animation: pop var(--reveal) var(--ease); }
.toasts { position: fixed; z-index: 120; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: grid; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: var(--r); font-weight: 600; font-size: 14px; box-shadow: var(--sh-2); animation: toastIn var(--page) var(--ease); }
@media (max-width: 1023px) { .toasts { bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom, 0px)); } body.session .toasts { bottom: calc(120px + env(safe-area-inset-bottom, 0px)); } }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty svg { width: 36px; height: 36px; stroke-width: 1.5; color: var(--faint); margin-bottom: 12px; }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

/* ---------- study card ---------- */
.flash { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: clamp(22px, 4vw, 40px); text-align: center; min-height: 360px; display: grid; align-content: start; gap: 12px; }
.flash .kind { justify-self: center; }
.flash .big-hz { font-family: var(--font-zh); font-size: clamp(96px, 30vw, 168px); line-height: 1.05; }
.flash .big-py { font-family: var(--font-py); font-size: 30px; font-weight: 500; }
.flash .gloss { font-size: 18px; color: var(--ink-2); }
.flash .ex { text-align: left; border-top: 1px solid var(--line); padding: 16px 0 0; margin-top: 10px; }
.flash .ex .zh { font-size: 23px; }
.rate { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.rate button { display: grid; justify-items: center; align-content: center; gap: 1px; padding: 8px 4px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-weight: 700; font-size: 15px; min-height: 64px; transition: transform var(--snap) var(--ease), background var(--snap) var(--ease); touch-action: manipulation; }
.rate button:active { transform: scale(.95); }
.rate button small { font-weight: 500; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.rate button kbd { display: none; }
@media (hover: hover) and (pointer: fine) { .rate button kbd { display: inline-block; margin-top: 3px; } }
@media (hover: hover) { .rate button:hover { background: var(--surface-2); } }
.rate [data-g="1"] { color: var(--accent-ink); }
.rate .good { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.rate .good small { color: color-mix(in srgb, var(--bg) 62%, transparent); }
@media (hover: hover) { .rate .good:hover { background: var(--ink-2); } }
.choices { display: grid; gap: 8px; margin-top: 16px; }
.choice { text-align: left; padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-size: 16px; display: flex; gap: 14px; align-items: center; min-height: 58px; transition: border-color var(--snap) var(--ease), background var(--snap) var(--ease), transform var(--snap) var(--ease); }
@media (hover: hover) { .choice:hover { border-color: var(--ink); } }
.choice:active { transform: scale(.985); }
.choice kbd { flex: none; }
.choice.right { border-color: var(--ok); background: var(--ok-soft); }
.choice.wrong { border-color: var(--bad); background: var(--bad-soft); animation: shake .32s var(--ease); }
.choice .zh { font-size: 23px; }
.tray { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 62px; padding: 10px; border: 1px dashed var(--line-strong); border-radius: var(--r); }
.tile { font-family: var(--font-zh); font-size: 23px; padding: 6px 13px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; transition: transform var(--snap) var(--ease); }
.tile:active { transform: scale(.94); }
.tile.used { opacity: .25; pointer-events: none; }
.tzg { position: relative; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); }
.tzg::before, .tzg::after { content: ""; position: absolute; pointer-events: none; border-color: var(--line-strong); border-style: dashed; opacity: .7; }
.tzg::before { left: 50%; top: 0; bottom: 0; border-width: 0 0 0 1px; }
.tzg::after { top: 50%; left: 0; right: 0; border-width: 1px 0 0 0; }
.tzg > * { position: relative; z-index: 1; }

/* ---------- course path: rows on hairlines, the lesson's first character as its mark ---------- */
.unit { margin-top: 36px; }
.unit-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.path { display: grid; border-top: 1px solid var(--line); }
.lesson-card { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 16px 6px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; position: relative; transition: background var(--snap) var(--ease); }
@media (hover: hover) { .lesson-card:hover { background: var(--surface-2); } }
.lesson-card:active { background: var(--surface-2); }
.lesson-card .badge-id { width: 56px; height: 56px; display: grid; place-items: center; font-family: var(--font-zh); font-size: 38px; line-height: 1; color: var(--ink); position: relative; }
.lesson-card .badge-id small { position: absolute; left: 0; top: -2px; font-family: var(--font-ui); font-size: 9.5px; font-weight: 700; letter-spacing: .1em; color: var(--faint); }
.lesson-card .badge-id svg { width: 26px; height: 26px; stroke-width: 1.5; }
.lesson-card.current::before { content: ""; position: absolute; left: -1px; top: 14px; bottom: 14px; width: 2px; background: var(--accent); }
.lesson-card.current .badge-id { color: var(--accent-ink); }
.lesson-card.done .badge-id { color: var(--faint); }
.lesson-card .sub { color: var(--muted); font-size: 13.5px; }
.lesson-card .bar { max-width: 220px; }
@media (max-width: 480px) { .lesson-card .sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; } }

/* ---------- heatmap + charts ---------- */
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 11px); gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.heat i { width: 11px; height: 11px; border-radius: 2px; background: var(--surface-3); }
.heat i.l1 { background: var(--mint-2); }
.heat i.l2 { background: var(--mint); }
.heat i.l3 { background: color-mix(in srgb, var(--mint-ink) 70%, var(--mint)); }
.heat i.l4 { background: var(--mint-ink); }
.heat i.today { outline: 1.5px solid var(--accent); outline-offset: 1px; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--font-ui); font-size: 11px; fill: var(--muted); }
.chart .gl { stroke: var(--line); }
.chart .b1 { fill: var(--ink); } .chart .b2 { fill: var(--earned-soft); } .chart .b3 { fill: var(--surface-3); }
.chart .bnow { fill: var(--accent); }

/* ---------- misc ---------- */
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r); background: var(--surface-2); }
.callout svg { width: 19px; height: 19px; stroke-width: 1.75; color: var(--ink); flex: none; margin-top: 2px; }
.callout.now { background: var(--accent-soft); } .callout.now svg { color: var(--accent); }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--ink); }
table.t { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.t th { text-align: left; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 12px 10px; border-bottom: 1px solid var(--line); font-weight: 600; }
table.t td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.cmdk { width: min(680px, 100%); align-self: start; margin-top: 10vh; padding: 0; overflow: hidden; }
.cmdk .input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; font-size: 18px; padding: 18px 20px; min-height: 62px; box-shadow: none; }
.cmdk .results { max-height: 62dvh; overflow: auto; padding: 8px; }
.cmdk .res { display: grid; grid-template-columns: minmax(64px, auto) minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 12px; border-radius: var(--r); cursor: pointer; }
.cmdk .res[aria-selected="true"] { background: var(--surface-2); }
@media (hover: hover) { .cmdk .res:hover { background: var(--surface-2); } }
.cmdk .res .zh { font-size: 26px; }
.seal { display: inline-grid; place-items: center; width: 76px; height: 76px; border-radius: var(--r); background: var(--seal); color: #fff; font-family: var(--font-zh); font-size: 40px; transform: rotate(-4deg); animation: stamp .55s var(--spring) both; }
.mic-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display: inline-block; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.kbd-hint { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 14px; font-size: 12.5px; color: var(--muted); }
@media (hover: none), (pointer: coarse) { .kbd-hint, .choice kbd { display: none; } }
.foot { border-top: 1px solid var(--line); margin-top: 64px; padding-top: 22px; color: var(--muted); font-size: 13px; }
.foot a { color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-weight: 700; font-size: 14px; font-family: var(--font-display); flex: none; }

/* ---------- skeleton ---------- */
.skel { background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%); background-size: 200% 100%; border-radius: var(--r); animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------- motion ---------- */
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
@keyframes stamp { from { transform: rotate(-18deg) scale(1.6); opacity: 0; } }
@keyframes sheetUp { from { transform: translateY(100%); } }
@keyframes sheetDown { from { transform: translateY(-100%); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
@keyframes slideL { from { opacity: 0; transform: translateX(32px); } }
@keyframes slideR { from { opacity: 0; transform: translateX(-32px); } }
@keyframes growY { from { transform: scaleY(0); } }
@keyframes growX { from { transform: scaleX(0); } }
@keyframes draw { from { stroke-dashoffset: var(--len, 1000); } }
@keyframes ringIn { from { stroke-dashoffset: var(--c); } }
@keyframes ink { from { clip-path: inset(0 100% 0 0); opacity: .2; } to { clip-path: inset(0 0 0 0); opacity: 1; } }
@keyframes inkUp { from { clip-path: inset(100% 0 0 0); transform: translateY(8px); } to { clip-path: inset(0 0 0 0); transform: none; } }
.view { animation: viewIn var(--page) var(--ease) backwards; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } }
.stagger > * { animation: rise .6s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 60ms); }
.ink-in { animation: ink 1s var(--ease) both; }
.ring .fg { animation: ringIn 1.1s var(--ease) both; animation-delay: .15s; }
.bar > i { animation: growX 1s var(--ease) both; animation-delay: .12s; }
.chart .grow { transform-box: fill-box; transform-origin: 50% 100%; animation: growY .8s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms + .1s); }
.chart .line { stroke-dasharray: var(--len, 1000); animation: draw 1.6s var(--ease) both; animation-delay: .2s; }
.chart .area { animation: fade 1.2s var(--ease) both; animation-delay: .6s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}
/* the Today badge is a dot, not a count */
.count.dot-only, .tabbar .count.dot-only { min-width: 0; width: 8px; height: 8px; padding: 0; border-radius: 50%; background: var(--accent); }
.tabbar .count.dot-only { top: 12px; left: calc(50% + 9px); }
