/* ============================================================
   GiveMeFive — design system v2
   Two themes share one set of semantic tokens:
     · dark  —— 暗色黄铜机身 + 琥珀强调（参考 RadioLing）
     · light —— 原 GiveMeFive 的薰衣草底 + 靛紫强调
   Theme = [data-theme] on <html>; "auto" follows the OS.
   ============================================================ */

:root,
:root[data-theme="dark"] {
  --bg-0: #0f0e0c;
  --bg-1: #171512;
  --surface-1: #1f1b16;
  --surface-2: #2a241d;
  --surface-3: #3d352b;
  --bronze: #8c7a65;
  --edge: rgba(61, 53, 43, .75);
  --edge-soft: rgba(42, 36, 29, .9);

  --accent: #e58a13;
  --accent-bright: #f59e0b;
  --accent-soft: #f5c46a;      /* accent-coloured text on surfaces */
  --accent-ink: #1a1209;       /* text on accent fill */
  --accent-tint: rgba(229, 138, 19, .09);
  --accent-line: rgba(229, 138, 19, .45);
  --glow: 0 0 25px -3px rgba(229, 138, 19, .35);
  --glow-strong: 0 0 30px -4px rgba(245, 158, 11, .7);

  --ink: #ece5d8;
  --ink-2: #d9d2c6;
  --ink-3: #a39887;
  --ink-4: #7c7263;
  --ink-strong: #f4efe6;

  --cue-bg: #1d1913;
  --cue-said: #f4efe6;
  --cue-now: #ffffff;
  --cue-now-glow: 0 0 12px rgba(245, 158, 11, .6);
  --zh: #9b8456;
  --zh-current: #f5c46a;
  --kw: #fcd34d;
  --kw-bg: rgba(245, 158, 11, .12);
  --kw-dim: #b8913f;

  --ok: #34d399;
  --ok-tint: rgba(52, 211, 153, .1);
  --danger: #ef4444;
  --danger-tint: rgba(239, 68, 68, .1);
  --danger-soft: #fca5a5;
  --rec: #dc2626;

  --texture: radial-gradient(rgba(245, 158, 11, .035) 1px, transparent 0);
  --shadow-1: 0 1px 0 rgba(236, 229, 216, .05) inset, 0 8px 26px rgba(0, 0, 0, .45);
  --shadow-pop: 0 20px 50px rgba(0, 0, 0, .6);
  --play-grad: radial-gradient(circle at 35% 30%, #ffc045, #e58a13);
  --gain-glow: 0 0 30px rgba(52, 211, 153, .3);
  --cover-grad: linear-gradient(145deg, #3d2a12, #1f1b16);
  --flash-grad: linear-gradient(160deg, #2a2018, #171512);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg-0: #f4f3fb;
  --bg-1: #ffffff;
  --surface-1: #ffffff;
  --surface-2: #f3f1fb;
  --surface-3: #e4e0f3;
  --bronze: #b5afd1;
  --edge: #e2def2;
  --edge-soft: #ebe8f6;

  --accent: #6c5ce7;
  --accent-bright: #7d6ef0;
  --accent-soft: #5847d8;
  --accent-ink: #ffffff;
  --accent-tint: rgba(108, 92, 231, .08);
  --accent-line: rgba(108, 92, 231, .4);
  --glow: 0 8px 22px -6px rgba(108, 92, 231, .35);
  --glow-strong: 0 10px 26px -4px rgba(108, 92, 231, .5);

  --ink: #26224a;
  --ink-2: #3d3862;
  --ink-3: #7f7a9e;
  --ink-4: #a9a5c2;
  --ink-strong: #1d1940;

  --cue-bg: #ffffff;
  --cue-said: #1d1940;
  --cue-now: #5847d8;
  --cue-now-glow: none;
  --zh: #9a93bd;
  --zh-current: #5847d8;
  --kw: #b26a00;
  --kw-bg: #fff3da;
  --kw-dim: #c08a2b;

  --ok: #1fb57e;
  --ok-tint: #ddf6ec;
  --danger: #ef5d74;
  --danger-tint: #fde8ec;
  --danger-soft: #d9435c;
  --rec: #ef5d74;

  --texture: radial-gradient(rgba(108, 92, 231, .05) 1px, transparent 0);
  --shadow-1: 0 10px 30px rgba(72, 60, 160, .07);
  --shadow-pop: 0 22px 50px rgba(72, 60, 160, .18);
  --play-grad: linear-gradient(135deg, #6c5ce7, #8e7cf3);
  --gain-glow: none;
  --cover-grad: linear-gradient(145deg, #ece9ff, #fff3da);
  --flash-grad: linear-gradient(160deg, #ffffff, #f3f1fb);
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg-0: #f4f3fb; --bg-1: #ffffff; --surface-1: #ffffff; --surface-2: #f3f1fb;
    --surface-3: #e4e0f3; --bronze: #b5afd1; --edge: #e2def2; --edge-soft: #ebe8f6;
    --accent: #6c5ce7; --accent-bright: #7d6ef0; --accent-soft: #5847d8; --accent-ink: #ffffff;
    --accent-tint: rgba(108, 92, 231, .08); --accent-line: rgba(108, 92, 231, .4);
    --glow: 0 8px 22px -6px rgba(108, 92, 231, .35); --glow-strong: 0 10px 26px -4px rgba(108, 92, 231, .5);
    --ink: #26224a; --ink-2: #3d3862; --ink-3: #7f7a9e; --ink-4: #a9a5c2; --ink-strong: #1d1940;
    --cue-bg: #ffffff; --cue-said: #1d1940; --cue-now: #5847d8; --cue-now-glow: none;
    --zh: #9a93bd; --zh-current: #5847d8; --kw: #b26a00; --kw-bg: #fff3da; --kw-dim: #c08a2b;
    --ok: #1fb57e; --ok-tint: #ddf6ec; --danger: #ef5d74; --danger-tint: #fde8ec; --danger-soft: #d9435c;
    --rec: #ef5d74;
    --texture: radial-gradient(rgba(108, 92, 231, .05) 1px, transparent 0);
    --shadow-1: 0 10px 30px rgba(72, 60, 160, .07); --shadow-pop: 0 22px 50px rgba(72, 60, 160, .18);
    --play-grad: linear-gradient(135deg, #6c5ce7, #8e7cf3); --gain-glow: none;
    --cover-grad: linear-gradient(145deg, #ece9ff, #fff3da);
    --flash-grad: linear-gradient(160deg, #ffffff, #f3f1fb);
    color-scheme: light;
  }
}

:root {
  --font-read: "Iowan Old Style", Georgia, "Times New Roman", "Songti SC", "Noto Serif SC", serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  --r-md: 12px;
  --r-lg: 16px;
  --sidebar-w: 232px;
  --console-h: 96px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* ---------------- reset ---------------- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg-0);
  color: var(--ink);
  font: 15px/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent-line); }
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }
:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

.mono { font-family: var(--font-mono); letter-spacing: .03em; }
.caps { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .16em; font-size: 10.5px; color: var(--ink-3); }
.muted { color: var(--ink-3); }
.dim { color: var(--ink-4); }
.accent { color: var(--accent-soft); }
.ok { color: var(--ok); }
.bad { color: var(--danger); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* ---------------- shell ---------------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; }
.sidebar {
  border-right: 1px solid var(--edge-soft); background: var(--bg-1);
  display: flex; flex-direction: column; padding: 22px 14px 16px; min-height: 0; overflow-y: auto;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 22px; }
.brand__dial {
  width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--accent);
  display: grid; place-items: center; font-size: 20px; flex: none;
  box-shadow: var(--glow);
}
.brand__name { font-family: var(--font-mono); font-weight: 700; letter-spacing: .26em; color: var(--accent-bright); font-size: 14px; }
.brand__slogan { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; line-height: 1.4; }
.nav__new {
  margin: 4px 0 14px; height: 44px; border-radius: 12px; background: var(--accent); color: var(--accent-ink);
  font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: var(--glow);
}
.nav__new:hover { background: var(--accent-bright); }
.sidebar { position: relative; }
.nav-menu { left: 14px; right: auto; top: 128px; min-width: 220px; }
@media (max-width: 1180px) { .nav-menu { left: 70px; top: 80px; } }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav__item {
  display: flex; align-items: center; gap: 12px; height: 46px; padding: 0 12px; border-radius: 12px;
  color: var(--ink-2); font-size: 15px; text-align: left; transition: background .2s; width: 100%;
}
.nav__item svg { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.nav__item:hover { background: var(--accent-tint); }
.nav__item.is-active { background: var(--surface-2); color: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.nav__item.is-active svg { color: var(--accent-soft); }
.nav__item:disabled { opacity: .4; }
.nav__badge { margin-left: auto; font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); }
.side-foot { margin-top: auto; border-top: 1px solid var(--edge-soft); padding-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.streak { background: var(--surface-1); border: 1px solid var(--edge-soft); border-radius: 14px; padding: 12px 14px; }
.streak__num { font-family: var(--font-mono); font-size: 24px; font-weight: 700; color: var(--accent-bright); line-height: 1.15; }
.week-dots { display: flex; gap: 5px; margin-top: 8px; }
.week-dots i { flex: 1; height: 5px; border-radius: 3px; background: var(--surface-3); }
.week-dots i.on { background: var(--accent); }
.theme-row { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 0 12px; }

.main { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
  background-color: var(--bg-0); background-image: var(--texture); background-size: 24px 24px; }
.view { flex: 1; min-height: 0; overflow: auto; padding: 30px 44px 48px; }
.view--play { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.view-inner { max-width: 1240px; margin: 0 auto; }
.fade-in { animation: fadeIn .28s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------------- atoms ---------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-title { font-size: 28px; font-weight: 700; letter-spacing: .01em; line-height: 1.3; }
.page-sub { color: var(--ink-3); font-size: 14px; margin-top: 4px; }
.card { background: var(--surface-1); border: 1px solid var(--edge-soft); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.pad { padding: 22px 24px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; border: 1px solid var(--accent-line); color: var(--accent-soft);
  background: var(--accent-tint); white-space: nowrap; flex: none;
}
.badge--live { border-color: rgba(239, 68, 68, .5); color: var(--danger-soft); background: var(--danger-tint); }
.badge--live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.badge--ok { border-color: rgba(52, 211, 153, .4); color: var(--ok); background: var(--ok-tint); }
.badge--mute { border-color: var(--edge); color: var(--ink-3); background: transparent; }
.badge--sm { height: 20px; font-size: 11px; padding: 0 8px; }
.btn {
  height: 42px; padding: 0 20px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; font-weight: 600; font-size: 14.5px; border: 1px solid var(--edge); color: var(--ink);
  transition: background .2s, border-color .2s, transform .12s; white-space: nowrap; background: var(--surface-1);
}
.btn:hover:not(:disabled) { border-color: var(--bronze); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn--primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); box-shadow: var(--glow); }
.btn--primary:hover:not(:disabled) { background: var(--accent-bright); border-color: transparent; }
.btn--soft { border-color: var(--accent-line); color: var(--accent-soft); background: var(--accent-tint); }
.btn--danger { color: var(--danger); }
.btn--sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn-ico { width: 14px; height: 14px; flex: none; margin-right: -2px; }
/* player toggles (循环 / 精听): muted while off, accent (btn--soft) while on */
#loopBtn:not(.btn--soft), #focusBtn:not(.btn--soft) { color: var(--ink-3); border-color: var(--edge-soft); background: transparent; }
#loopBtn:not(.btn--soft):hover, #focusBtn:not(.btn--soft):hover { color: var(--ink-2); border-color: var(--edge); }
.btn--block { width: 100%; }
.chip {
  height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--edge); color: var(--ink-2);
  font-size: 13px; display: inline-flex; align-items: center; gap: 6px; background: var(--surface-1); white-space: nowrap;
}
button.chip:hover { border-color: var(--bronze); }
.chip.is-active { border-color: var(--accent-line); color: var(--accent-soft); background: var(--accent-tint); }
.chip--sm { height: 28px; padding: 0 11px; font-size: 12.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.seg { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--bg-0); border: 1px solid var(--edge-soft); gap: 2px; flex: none; }
.seg__item {
  height: 32px; min-width: 42px; padding: 0 10px; border-radius: 9px; font-size: 13.5px; color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; white-space: nowrap;
}
.seg__item.is-active { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.seg__item.is-locked { color: var(--ink-4); cursor: not-allowed; }
.seg__item.is-locked::after { content: "🔒"; font-size: 10px; opacity: .7; }
.seg--sm .seg__item { height: 26px; min-width: 30px; font-size: 13px; padding: 0 8px; }
.section-label { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.section-label h3 { font-size: 16px; font-weight: 700; flex: none; white-space: nowrap; margin-right: 8px; }
.grid { display: grid; gap: 16px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 60px 20px; color: var(--ink-3); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .big { font-size: 46px; }
.empty b { color: var(--ink); font-size: 17px; }
.kp-list li { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--edge-soft); }
.kp-list li:first-child { border-top: 0; }
.kp-no { font-family: var(--font-mono); color: var(--accent-bright); font-size: 13px; width: 22px; flex: none; padding-top: 1px; }
.kp-en { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.blur { filter: blur(6px); user-select: none; pointer-events: none; }
.locked-note { border: 1px dashed var(--edge); border-radius: 14px; padding: 18px; color: var(--ink-3); font-size: 14px; text-align: center; }

/* toast */
#toast-root { position: fixed; left: 50%; top: 22px; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--surface-1); border: 1px solid var(--edge); color: var(--ink); padding: 10px 18px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow-pop); animation: fadeIn .2s; max-width: 80vw; }
.toast.ok { border-color: rgba(52, 211, 153, .5); }
.toast.err { border-color: rgba(239, 68, 68, .55); color: var(--danger-soft); }

/* ---------------- home ---------------- */
.stats { grid-template-columns: repeat(4, 1fr); margin-bottom: 26px; }
.stat { padding: 18px 20px; }
.stat__num { font-family: var(--font-mono); font-size: 30px; font-weight: 700; line-height: 1.15; margin-top: 6px; }
.stat__num small { font-size: 13px; color: var(--ink-3); font-weight: 500; margin-left: 4px; }
.lessons { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.lesson { padding: 20px; cursor: pointer; transition: border-color .2s, transform .2s; display: flex; flex-direction: column; gap: 14px; text-align: left; width: 100%; }
.lesson:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.lesson__top { display: flex; gap: 14px; align-items: flex-start; }
.lesson__cover { width: 52px; height: 52px; border-radius: 14px; background: var(--cover-grad); border: 1px solid var(--accent-line); display: flex; align-items: flex-end; justify-content: center; gap: 3px; padding: 10px; flex: none; }
.lesson__cover i { width: 4px; border-radius: 2px; background: var(--accent); }
.lesson__title { font-size: 17px; font-weight: 700; line-height: 1.35; word-break: break-word; }
.lesson__meta { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.fingers { display: flex; gap: 6px; }
.finger { flex: 1; height: 44px; border-radius: 10px; background: var(--bg-0); border: 1px solid var(--edge-soft); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 10.5px; color: var(--ink-4); line-height: 1.25; }
.finger b { font-family: var(--font-mono); font-size: 13px; color: var(--ink-3); }
.finger.done { border-color: var(--accent-line); background: var(--accent-tint); color: var(--accent-soft); }
.finger.done b { color: var(--accent-bright); }
.finger.now { border-color: var(--accent); box-shadow: var(--glow); color: var(--ink); }
.lesson__foot { display: flex; justify-content: space-between; align-items: center; font-size: 13px; gap: 10px; }
.gain { font-family: var(--font-mono); font-weight: 700; color: var(--ok); }
.lesson--new { border-style: dashed; align-items: center; justify-content: center; text-align: center; min-height: 212px; color: var(--ink-3); background: transparent; box-shadow: none; }
.lesson--new.is-drag { border-color: var(--accent); background: var(--accent-tint); }
.lesson--new .plus { width: 52px; height: 52px; border-radius: 50%; border: 1px dashed var(--accent); display: grid; place-items: center; color: var(--accent-bright); font-size: 26px; }
.processing-bar { height: 6px; border-radius: 3px; background: var(--bg-0); overflow: hidden; }
.processing-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-bright)); box-shadow: 0 0 10px var(--accent); transition: width .5s; }
.steps-mini { display: flex; gap: 10px; font-size: 11.5px; color: var(--ink-4); flex-wrap: wrap; }
.steps-mini .done { color: var(--accent-soft); }
.steps-mini .now { color: var(--ink); }

/* ---------------- lesson map ---------------- */
.lesson-hero { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 22px; flex-wrap: wrap; }
.lesson-hero h1 { font-size: 30px; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; line-height: 1.3; }
.lesson-hero .meta { color: var(--ink-3); font-size: 14px; margin-top: 6px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.hand { grid-template-columns: repeat(5, 1fr); margin-bottom: 22px; }
.round-card { padding: 18px 18px 16px; position: relative; overflow: hidden; cursor: pointer; transition: .2s; min-height: 178px; display: flex; flex-direction: column; text-align: left; width: 100%; }
.round-card:hover:not(:disabled) { border-color: var(--accent-line); }
.round-card__no { font-family: var(--font-mono); font-size: 44px; font-weight: 700; color: var(--surface-3); line-height: 1; position: absolute; right: 14px; top: 10px; }
.round-card__name { font-size: 16px; font-weight: 700; margin-top: 10px; }
.round-card__desc { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; line-height: 1.5; }
.round-card__score { margin-top: auto; display: flex; align-items: baseline; gap: 6px; padding-top: 12px; font-size: 13px; }
.round-card__score b { font-family: var(--font-mono); font-size: 26px; color: var(--accent-bright); }
.round-card.done { border-color: var(--accent-line); }
.round-card.now { border-color: var(--accent); box-shadow: var(--glow); background: linear-gradient(180deg, var(--accent-tint), var(--surface-1) 70%); }
.round-card.now .round-card__no { color: var(--accent-line); }
.round-card:disabled { opacity: .55; cursor: not-allowed; }
.icon-sub { display: inline-flex; gap: 6px; align-items: center; font-size: 11.5px; color: var(--ink-3); border: 1px solid var(--edge); border-radius: 999px; padding: 2px 9px; width: max-content; }
.map-cols { grid-template-columns: 1.4fr 1fr; align-items: start; }
.hint-bar { border: 1px solid var(--accent-line); background: var(--accent-tint); border-radius: 12px; padding: 12px 18px; font-size: 14px; color: var(--ink-2); margin-bottom: 22px; display: flex; gap: 10px; align-items: center; }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 170px; padding: 6px; border-radius: 12px; background: var(--surface-1); border: 1px solid var(--edge); box-shadow: var(--shadow-pop); display: none; }
.menu.show { display: block; }
.menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px; font-size: 14px; }
.menu button:hover { background: var(--accent-tint); }

/* textbook switcher (home title) */
.book-switch { display: inline-block; max-width: 100%; }
.book-switch__btn { display: inline-flex; align-items: center; gap: 8px; text-align: left; color: inherit; cursor: pointer; border-radius: 10px; }
.book-switch__btn:hover .book-switch__caret { color: var(--accent-bright); }
.book-switch__caret { width: .7em; height: .7em; flex: none; color: var(--ink-3); transition: color .15s; }
.book-switch__menu { left: 0; right: auto; min-width: 260px; max-width: calc(100vw - 32px); }
.book-switch__menu button { display: flex; flex-direction: column; gap: 2px; }
.book-switch__menu button b { font-size: 15px; }
.book-switch__menu button span { font-size: 12px; color: var(--ink-3); }
.book-row { display: flex; align-items: stretch; gap: 2px; border-radius: 8px; }
.book-row > [data-book] { flex: 1; min-width: 0; }
.book-row.is-active { background: var(--accent-tint); }
.book-row.is-active b::after { content: " ✓"; color: var(--accent-bright); }
.book-switch__menu .book-row__more { width: 36px; flex: none; display: grid; place-items: center; padding: 0; font-size: 18px; color: var(--ink-3); }
.book-switch__menu .book-row__more:hover { color: var(--accent-bright); }
.book-form__head { font-size: 13px; font-weight: 600; }
.book-form__ops .book-form__del { margin-right: auto; }
.book-switch__new { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--edge); }
.book-switch__new [hidden] { display: none !important; }
.book-switch__menu .book-switch__add { color: var(--accent-bright); font-weight: 600; }
.book-form { display: grid; gap: 10px; padding: 8px 12px 6px; }
.book-form label { display: grid; gap: 4px; font-size: 12px; color: var(--ink-3); }
.book-form input, .book-form select { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--edge); background: var(--surface-2); font-size: 14px; outline: 0; }
.book-form input:focus, .book-form select:focus { border-color: var(--accent); }
.book-form select:disabled { opacity: .55; }
.book-form__hint { margin-top: -4px; font-size: 11.5px; line-height: 1.5; color: var(--accent-soft); }
.book-form__ops { display: flex; justify-content: flex-end; gap: 8px; }
.book-switch__menu .book-form__ops .btn { display: inline-flex; width: auto; padding: 6px 14px; }
@media (max-width: 680px) { .book-form input, .book-form select { font-size: 16px; } }
.proc { max-width: 560px; margin: 40px auto; padding: 34px; text-align: center; display: flex; flex-direction: column; gap: 16px; align-items: center; }
.proc .spinner { margin: 0; }
.proc-steps { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.proc-step { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 12px; color: var(--ink-4); font-size: 14.5px; }
.proc-step .ic { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--edge); display: grid; place-items: center; font-family: var(--font-mono); font-size: 12px; flex: none; }
.proc-step.done { color: var(--ink-2); }
.proc-step.done .ic { background: var(--accent-tint); border-color: var(--accent-line); color: var(--accent-soft); }
.proc-step.on { color: var(--ink); background: var(--accent-tint); }
.proc-step.on .ic { border-color: var(--accent); color: var(--accent-bright); box-shadow: var(--glow); }

/* ---------------- player ---------------- */
.play-head { padding: 22px 40px 0; flex: none; }
.play-head__row { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.play-title { font-size: 26px; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; line-height: 1.3; }
.play-meta { font-size: 13.5px; color: var(--ink-3); margin-top: 4px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.round-tabs { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.round-tab { height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--edge-soft); font-size: 13.5px; color: var(--ink-3); display: flex; align-items: center; gap: 7px; background: var(--bg-1); }
.round-tab b { font-family: var(--font-mono); font-size: 12px; }
.round-tab.done { color: var(--accent-soft); }
.round-tab.done::after { content: "✓"; font-size: 11px; }
.round-tab.is-active { border-color: var(--accent); color: var(--ink); background: var(--accent-tint); box-shadow: var(--glow); }
.round-tab:disabled::after { content: "🔒"; font-size: 10px; }
.round-tab--review { margin-left: auto; }
.task-bar { margin-top: 14px; border: 1px solid var(--accent-line); background: linear-gradient(90deg, var(--accent-tint), transparent); border-radius: 12px; min-height: 48px; display: flex; align-items: center; gap: 14px; padding: 6px 8px 6px 18px; font-size: 14px; }
.task-bar__label { color: var(--ink-3); font-size: 13px; flex: none; }
.task-bar__text { color: var(--accent-soft); font-weight: 700; }
.task-bar__right { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-3); flex: none; }
.listen-count { display: flex; gap: 4px; }
.listen-count i { width: 18px; height: 6px; border-radius: 3px; background: var(--surface-3); }
.listen-count i.on { background: var(--accent); }
.play-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 350px; margin-top: 14px; }
.stage { position: relative; min-height: 0; display: flex; flex-direction: column; padding: 0 40px; }
.stage__mask { flex: 1; min-height: 0; display: flex; flex-direction: column;
  mask-image: linear-gradient(180deg, transparent 0, #000 70px, #000 calc(100% - 50px), transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 70px, #000 calc(100% - 50px), transparent 100%); }
.cue-list { flex: 1; overflow-y: auto; padding: 90px 4px 180px; display: flex; flex-direction: column; gap: 12px; scrollbar-width: none; }
.cue-list::-webkit-scrollbar { display: none; }
.cue { padding: 4px 22px; border-radius: 18px; border: 1px solid transparent; cursor: pointer; transition: background .24s var(--ease), border-color .24s, padding .24s, opacity .24s; flex: none; }
.cue__t { font-family: var(--font-mono); font-size: 11px; color: var(--ink-4); margin-bottom: 4px; display: none; gap: 10px; align-items: center; }
.cue__en { font-size: 18px; line-height: 1.55; color: var(--ink-4); }
.cue__zh { font-size: 15.5px; line-height: 1.55; color: var(--zh); margin-top: 3px; }
.cue.is-past .cue__en { color: var(--ink-3); }
.cue.is-future { opacity: .6; }
.cue:hover:not(.is-current):not(.is-selected) { background: var(--accent-tint); }
.cue.is-current { padding: 18px 24px; background: var(--cue-bg); border-color: var(--accent-line); box-shadow: var(--glow); opacity: 1; }
.cue.is-current .cue__en { font-size: 28px; font-weight: 500; line-height: 1.42; color: var(--ink-4); }
.cue.is-current .cue__zh { font-size: 21px; color: var(--zh-current); margin-top: 8px; }
.cue.is-current .cue__t, .cue.is-selected .cue__t { display: flex; }
.cue.is-selected:not(.is-current) { padding: 14px 22px; background: var(--cue-bg); border-color: var(--accent-line); opacity: 1; }
.cue.is-selected .cue__en { color: var(--ink); }
.cue.is-selected .cue__zh { color: var(--zh-current); }
.w { border-radius: 5px; transition: color .12s; }
.cue.is-current .w.said { color: var(--cue-said); }
.cue.is-current .w.now { color: var(--cue-now); text-shadow: var(--cue-now-glow); }
.w.kw { color: var(--kw); background: var(--kw-bg); border-bottom: 2px solid var(--accent); padding: 0 3px; }
.cue:not(.is-current):not(.is-selected) .w.kw { background: none; border-bottom: 1px dashed var(--accent-line); padding: 0; color: var(--kw-dim); }
.cue.is-current .w.kw:not(.said):not(.now) { opacity: .6; }
.cue.is-selected .w:hover, .cue.is-current .w:hover { background: var(--kw-bg); cursor: pointer; }
.cue__actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; cursor: default; }
.cue-act { height: 34px; padding: 0 14px; border-radius: 17px; border: 1px solid var(--edge); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; background: var(--surface-1); }
.cue-act:hover { border-color: var(--bronze); }
.cue-act--primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); font-weight: 700; }
.cue-act.is-on { color: var(--accent-soft); border-color: var(--accent-line); background: var(--accent-tint); }
.mode-zh .cue__en { display: none; }
.mode-zh .cue.is-current .cue__zh { font-size: 26px; color: var(--ink-strong); margin-top: 0; }
.mode-zh .cue__zh { font-size: 18px; color: var(--ink-3); margin-top: 0; }
.mode-zh .cue.is-selected .cue__zh { color: var(--ink); }
.mode-zh .cue.peek .cue__en { display: block; margin-top: 8px; }
.mode-zh .cue.peek .cue__en, .mode-zh .cue.is-current.peek .cue__en { font-size: 16px; font-weight: 400; }
.mode-en .cue__zh { display: none; }
.stage__empty { margin: auto; color: var(--ink-3); text-align: center; }
.jump-latest { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 3; }
.blind { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 22px; text-align: center; padding: 40px; }
.blind.show { display: flex; }
.blind__ring { width: 240px; height: 240px; border-radius: 50%; border: 1px solid var(--edge); display: grid; place-items: center; background: radial-gradient(circle, var(--accent-tint), transparent 65%); box-shadow: var(--shadow-1); }
.wave { display: flex; align-items: center; gap: 5px; height: 70px; }
.wave i { width: 5px; border-radius: 3px; background: var(--accent); height: 15%; transition: height .08s; }
/* travelling sound wave: every bar has its own envelope height (--h) and a
   phase offset (--d), so the peak sweeps across instead of all bars pulsing */
.sound-wave { display: flex; align-items: center; justify-content: center; gap: 4px; height: 76px; }
.sound-wave i {
  width: 4px; height: var(--h); border-radius: 3px; flex: none;
  background: linear-gradient(180deg, var(--accent-bright), var(--accent));
  transform: scaleY(.28); transform-origin: center; opacity: .55;
  transition: transform .4s var(--ease), opacity .4s;
}
.is-playing .sound-wave i, .is-playing .eq i {
  animation: wv-a var(--t, 2s) ease-in-out infinite; animation-delay: var(--d, 0s); opacity: 1;
}
.is-playing .sound-wave i.wv2, .is-playing .eq i.wv2 { animation-name: wv-b; }
.is-playing .sound-wave i.wv3, .is-playing .eq i.wv3 { animation-name: wv-c; }
/* three irregular rhythms (uneven peaks / dips), mixed per bar */
@keyframes wv-a { 0%, 100% { transform: scaleY(.25); } 18% { transform: scaleY(.9); } 33% { transform: scaleY(.42); } 52% { transform: scaleY(1); } 74% { transform: scaleY(.3); } 88% { transform: scaleY(.6); } }
@keyframes wv-b { 0%, 100% { transform: scaleY(.45); } 14% { transform: scaleY(.2); } 38% { transform: scaleY(.78); } 57% { transform: scaleY(.34); } 79% { transform: scaleY(.96); } }
@keyframes wv-c { 0%, 100% { transform: scaleY(.62); } 22% { transform: scaleY(1); } 41% { transform: scaleY(.28); } 63% { transform: scaleY(.7); } 84% { transform: scaleY(.18); } }
@keyframes wb { 0%, 100% { height: 15%; } 50% { height: 95%; } }
.blind h2 { font-size: 22px; }
.blind p { color: var(--ink-3); max-width: 42ch; }
.blind__clock { font-family: var(--font-mono); font-size: 15px; color: var(--accent-soft); }

/* AI panel */
.ai { border-left: 1px solid var(--edge-soft); background: var(--bg-1); padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.ai__head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; flex: none; }
.ai__head svg { color: var(--accent-bright); }
.ai__cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex: none; }
.ai-card { padding: 13px 14px; border-radius: 14px; border: 1px solid var(--edge); background: var(--surface-1); text-align: left; transition: .2s; }
.ai-card:hover:not(:disabled), .ai-card.is-active { border-color: var(--accent-line); }
.ai-card b { display: block; font-size: 14.5px; }
.ai-card span { font-size: 12px; color: var(--ink-3); }
.ai__chips { display: flex; flex-wrap: wrap; gap: 8px; flex: none; }
.ai__feed { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-right: 2px; }
.ai-answer { border-radius: 14px; background: var(--bg-0); border: 1px solid var(--edge-soft); padding: 14px 16px; font-size: 13.5px; line-height: 1.75; flex: none; }
.ai-answer__q { font-size: 12px; color: var(--ink-4); margin-bottom: 8px; display: flex; gap: 6px; align-items: flex-start; }
.ai-answer h4 { margin: 12px 0 4px; font-size: 13px; color: var(--accent-soft); }
.ai-answer h4:first-child { margin-top: 0; }
.ai-answer .quote { border-left: 2px solid var(--accent); padding-left: 10px; color: var(--ink); margin: 2px 0 6px; }
.ai-answer .quote small { display: block; color: var(--zh); font-size: 12.5px; }
.ai-answer ul li { padding-left: 14px; position: relative; margin: 3px 0; }
.ai-answer ul li::before { content: ""; position: absolute; left: 2px; top: .78em; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.ai-answer p + p { margin-top: 6px; }
.ai-answer .asr-note { border: 1px dashed var(--accent-line); background: var(--accent-tint); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; }
.phrase { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px dashed var(--edge); align-items: center; }
.phrase:first-child { border-top: 0; }
.phrase b { color: var(--kw); font-weight: 600; }
.phrase .add { font-size: 12px; color: var(--accent-soft); flex: none; }
.ai__ask { display: flex; align-items: center; gap: 8px; height: 52px; border-radius: 26px; border: 1px solid var(--edge); background: var(--bg-0); padding: 0 6px 0 18px; flex: none; }
.ai__ask input { flex: 1; background: none; border: 0; outline: 0; font-size: 14px; min-width: 0; }
.ai__ask button { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; flex: none; }
.ai-locked { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; color: var(--ink-3); border: 1px dashed var(--edge); border-radius: 16px; padding: 24px; font-size: 13.5px; }
.ai-locked .lock { font-size: 30px; opacity: .6; }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

/* word popover */
.wordpop { position: absolute; z-index: 20; width: 310px; padding: 16px; border-radius: 16px; background: var(--surface-1); border: 1px solid var(--accent-line); box-shadow: var(--shadow-pop); }
.wordpop__term { font-size: 21px; font-weight: 700; color: var(--kw); word-break: break-word; }
.wordpop__zh { margin: 6px 0 10px; font-size: 15px; min-height: 24px; }
.wordpop__ctx mark { background: var(--kw-bg); color: var(--kw); border-radius: 3px; padding: 0 2px; }
.wordpop__ctx { font-size: 12.5px; color: var(--ink-3); border-left: 2px solid var(--surface-3); padding-left: 10px; margin-bottom: 12px; }
.wordpop__ops { display: flex; gap: 8px; }

/* console */
.console { flex: none; height: var(--console-h); border-top: 1px solid var(--edge-soft); background: var(--bg-1); display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(max-content, 1fr); align-items: center; gap: 28px; padding: 0 24px; position: relative; }
.prog { position: absolute; left: 0; right: 0; top: -6px; height: 12px; cursor: pointer; }
.prog__track { position: absolute; left: 0; right: 0; top: 5px; height: 4px; background: var(--surface-2); }
.prog__fill { position: absolute; left: 0; top: 5px; height: 4px; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.prog__tick { position: absolute; top: 5px; width: 1px; height: 4px; background: var(--bg-0); opacity: .7; }
.prog__loop { position: absolute; top: 2px; height: 10px; border: 1px solid var(--accent-bright); border-radius: 3px; background: var(--accent-tint); display: none; }
.prog:hover .prog__track, .prog:hover .prog__fill { height: 6px; top: 4px; }
.console__now { display: flex; align-items: center; gap: 14px; min-width: 0; }
.eq { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--edge); display: flex; align-items: center; justify-content: center; gap: 2px; background: var(--surface-1); flex: none; }
.eq i { width: 3px; height: var(--h); border-radius: 2px; background: var(--accent); transform: scaleY(.35); transform-origin: center; opacity: .6; transition: transform .4s var(--ease), opacity .4s; }

.console__lines { min-width: 0; }
.console__name { font-weight: 700; font-size: 14.5px; display: flex; gap: 8px; align-items: center; min-width: 0; }
.console__name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.console__line { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.console__line.zh { color: var(--accent-soft); }
.console__hidden { display: none; font-size: 12.5px; color: var(--ink-4); }
.view--play[data-mode="off"] .console__line { display: none; }
.view--play[data-mode="off"] .console__hidden { display: block; }
.view--play[data-mode="en"] .console__line.zh, .view--play[data-mode="zh"] .console__line.en { display: none; }
.console__center { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.transport { display: flex; align-items: center; gap: 14px; }
.t-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); border: 1px solid var(--edge-soft); font-size: 11px; font-family: var(--font-mono); background: var(--surface-1); }
.t-btn:hover { border-color: var(--bronze); }
.t-btn.is-on { border-color: var(--accent); color: var(--accent-bright); background: var(--accent-tint); }
.play-btn { width: 60px; height: 60px; border-radius: 50%; background: var(--play-grad); color: var(--accent-ink); display: grid; place-items: center; box-shadow: var(--glow-strong); }
.time { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); }
.console__right { display: flex; align-items: center; justify-content: flex-end; gap: 10px; white-space: nowrap; }
.speed { font-family: var(--font-mono); font-size: 12.5px; height: 40px; min-width: 56px; padding: 0 12px; border-radius: 20px; border: 1px solid var(--edge-soft); color: var(--ink-2); background: var(--surface-1); }
.speed:hover { border-color: var(--bronze); }
.speed.is-on, .speed[aria-expanded="true"] { border-color: var(--accent); color: var(--accent-soft); background: var(--accent-tint); }
.speed-wrap { position: relative; }
/* speed sits just right of the transport without widening it, so the play
   button stays on the console's centre line */
.transport { position: relative; }
.transport > .speed-wrap { position: absolute; left: calc(100% + 14px); top: 50%; transform: translateY(-50%); }
.speed-menu {
  position: absolute; bottom: calc(100% + 12px); left: 50%; transform: translateX(-50%); z-index: 40;
  min-width: 132px; padding: 6px; border-radius: 14px; background: var(--surface-1); border: 1px solid var(--edge);
  box-shadow: var(--shadow-pop); display: flex; flex-direction: column; gap: 2px;
}
.speed-menu.hidden { display: none; }
.speed-menu__title { font-size: 11.5px; color: var(--ink-4); padding: 4px 10px 6px; }
.speed-menu__item { display: flex; justify-content: space-between; align-items: center; gap: 12px; height: 36px; padding: 0 12px; border-radius: 9px; font-family: var(--font-mono); font-size: 14px; color: var(--ink-2); text-align: left; }
.speed-menu__item .dim { font-family: var(--font-sans); font-size: 11.5px; }
.speed-menu__item:hover { background: var(--accent-tint); }
.speed-menu__item.is-active { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.speed-menu__item.is-active .dim { color: var(--accent-ink); opacity: .75; }

/* ---------------- quiz ---------------- */
.quiz-wrap { max-width: 840px; margin: 0 auto; }
.quiz-top { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.qdots { display: flex; gap: 6px; margin-left: auto; }
.qdots button { width: 34px; height: 6px; border-radius: 3px; background: var(--surface-3); }
.qdots button.answered { background: var(--accent); }
.qdots button.now { background: var(--accent-soft); box-shadow: 0 0 8px var(--accent); }
.qcard { padding: 30px 32px; }
.qtype { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.qstem { font-size: 23px; font-weight: 600; line-height: 1.5; margin-bottom: 22px; }
.clip { display: inline-flex; align-items: center; gap: 12px; height: 48px; border-radius: 12px; border: 1px solid var(--edge); background: var(--bg-0); padding: 0 14px 0 6px; margin-bottom: 22px; font-size: 13.5px; }
.clip .t-btn { width: 36px; height: 36px; background: var(--accent); color: var(--accent-ink); border: 0; }
.opts { display: grid; gap: 10px; }
.opt { display: flex; align-items: center; gap: 16px; min-height: 60px; padding: 12px 18px; border-radius: 14px; border: 1px solid var(--edge); background: var(--bg-1); text-align: left; font-size: 16.5px; transition: .15s; width: 100%; }
.opt:hover { border-color: var(--bronze); }
.opt__key { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--edge); display: grid; place-items: center; font-family: var(--font-mono); font-size: 13px; color: var(--ink-3); flex: none; }
.opt.is-picked { border-color: var(--accent); background: var(--accent-tint); }
.opt.is-picked .opt__key { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 700; }
.quiz-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; gap: 12px; }

/* ---------------- result ---------------- */
.result-hero { display: grid; grid-template-columns: auto 1fr; gap: 36px; align-items: center; padding: 30px 34px; margin-bottom: 16px; }
.ring { width: 170px; height: 170px; position: relative; flex: none; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring__bg { stroke: var(--surface-2); }
.ring__fg { stroke: var(--accent); transition: stroke-dashoffset 1s var(--ease); }
.ring__fg.good { stroke: var(--ok); }
.ring__fg.low { stroke: var(--danger); }
.ring__num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring__num b { font-family: var(--font-mono); font-size: 46px; line-height: 1; }
.gain-big { font-family: var(--font-mono); font-size: 56px; font-weight: 700; color: var(--ok); line-height: 1; text-shadow: var(--gain-glow); }
.gain-big.neg { color: var(--danger); }
.bars { display: flex; align-items: flex-end; gap: 16px; height: 160px; padding-top: 10px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar__v { font-family: var(--font-mono); font-size: 13px; color: var(--ink-2); }
.bar__col { width: 100%; max-width: 56px; border-radius: 8px 8px 3px 3px; background: var(--surface-3); min-height: 3px; transition: height .8s var(--ease); }
.bar__col.hl { background: linear-gradient(180deg, var(--accent-bright), var(--accent)); box-shadow: var(--glow); }
.bar__col.five { background: linear-gradient(180deg, #6ee7b7, #059669); }
.bar__l { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.review li { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--edge-soft); align-items: flex-start; }
.review li:first-child { border-top: 0; }
.mark { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; flex: none; font-weight: 700; }
.mark.ok { background: var(--ok-tint); color: var(--ok); }
.mark.bad { background: var(--danger-tint); color: var(--danger); }
.review .ans { font-size: 13px; color: var(--ink-3); margin-top: 3px; }
.review .explain { font-size: 13px; color: var(--ink-2); margin-top: 6px; background: var(--bg-0); border-radius: 10px; padding: 8px 12px; }
.jump { font-size: 12.5px; color: var(--accent-soft); margin-left: auto; white-space: nowrap; flex: none; }
.two-col { grid-template-columns: 1fr 1.35fr; align-items: start; }

/* ---------------- retell ---------------- */
.retell { grid-template-columns: 1fr 380px; align-items: start; }
.rec { padding: 34px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.rec__btn { width: 120px; height: 120px; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--edge); display: grid; place-items: center; font-size: 42px; transition: .2s; }
.rec__btn:hover { border-color: var(--rec); }
.rec__btn.is-rec { background: radial-gradient(circle at 35% 30%, #ff7a6b, var(--rec)); border-color: transparent; color: #fff; box-shadow: 0 0 0 10px rgba(239, 68, 68, .1), 0 0 0 22px rgba(239, 68, 68, .05), 0 0 40px rgba(239, 68, 68, .4); }
.rec__time { font-family: var(--font-mono); font-size: 30px; }
.rec .wave i { background: var(--rec); }
.retell-text { width: 100%; min-height: 220px; border-radius: 14px; border: 1px solid var(--edge); background: var(--bg-0); padding: 16px 18px; font-size: 16px; line-height: 1.7; resize: vertical; outline: 0; }
.retell-text:focus { border-color: var(--accent-line); }
.hint-list li { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--edge-soft); font-size: 14px; }
.hint-list li:first-child { border-top: 0; }
.dims { display: grid; gap: 14px; }
.dim__row { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 6px; }
.dim__row b { font-family: var(--font-mono); }
.meter { height: 8px; border-radius: 4px; background: var(--bg-0); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-bright)); transition: width .8s var(--ease); }
.transcript { font-size: 15px; line-height: 1.8; padding: 16px 18px; background: var(--bg-0); border-radius: 12px; border: 1px solid var(--edge-soft); }
.comment { font-size: 15px; line-height: 1.85; color: var(--ink-2); white-space: pre-line; }

/* ---------------- report ---------------- */
.report-hero { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.report-hero .card { padding: 24px; }
.big-num { font-family: var(--font-mono); font-size: 62px; font-weight: 700; line-height: 1; color: var(--accent-bright); margin: 10px 0 8px; }
.big-num small { font-size: 18px; color: var(--ink-3); }
.big-num.ok { color: var(--ok); text-shadow: var(--gain-glow); }
.report-grid { grid-template-columns: 1fr 1fr; align-items: stretch; }
.report-grid .section-label h3 { font-size: 19px; font-weight: 800; color: var(--accent-bright); letter-spacing: .02em; }
/* five-round chart: taller, centred in whatever height the row gives it */
.rep-bars-card { display: flex; flex-direction: column; }
.rep-bars-card .bars { height: 230px; margin: auto 0; }
.bar__col.tier-hi, .tier-legend i.tier-hi { background: linear-gradient(180deg, #6ee7b7, #10b981); }
.bar__col.tier-mid, .tier-legend i.tier-mid { background: linear-gradient(180deg, #fcd34d, #f59e0b); }
.bar__col.tier-lo, .tier-legend i.tier-lo { background: linear-gradient(180deg, #fda4af, #e11d48); }
.tier-legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 18px; margin-top: 14px; font-size: 12px; color: var(--ink-3); }
.tier-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tier-legend i { width: 10px; height: 10px; border-radius: 3px; }
.report-list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

/* ---------------- words ---------------- */
.words-layout { grid-template-columns: 1fr 400px; align-items: start; }
.word-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 16px 18px; border-top: 1px solid var(--edge-soft); }
.word-row:first-child { border-top: 0; }
.word-row__term { font-size: 17px; font-weight: 700; color: var(--kw); word-break: break-word; }
.word-row__term.is-sentence { color: var(--ink); font-weight: 500; font-size: 15.5px; }
.word-row__zh { font-size: 14px; margin-top: 2px; }
.word-row__ctx { font-size: 13px; color: var(--ink-3); margin-top: 6px; }
.word-row__ctx mark { background: none; color: var(--accent-soft); font-weight: 700; }
.word-row.known .word-row__term { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--ink-4); }
.word-ops { display: flex; gap: 6px; align-items: flex-start; }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--edge); display: grid; place-items: center; font-size: 13px; background: var(--surface-1); }
.icon-btn:hover { border-color: var(--bronze); }
.icon-btn.is-on { color: var(--ok); border-color: rgba(52, 211, 153, .45); background: var(--ok-tint); }
.flash { perspective: 1200px; }
.flash__card { height: 300px; border-radius: 22px; position: relative; transform-style: preserve-3d; transition: transform .5s var(--ease); cursor: pointer; }
.flash__card.flipped { transform: rotateY(180deg); }
.flash__face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 22px; border: 1px solid var(--accent-line); background: var(--flash-grad); padding: 28px; display: flex; flex-direction: column; justify-content: center; gap: 12px; box-shadow: var(--glow); overflow: auto; }
.flash__face.back { transform: rotateY(180deg); }
.flash__sent { font-size: 20px; line-height: 1.55; }
.flash__sent mark { color: var(--kw); background: var(--kw-bg); border-bottom: 2px solid var(--accent); padding: 0 3px; border-radius: 4px; }
.flash__term { font-size: 24px; font-weight: 700; color: var(--kw); }
.flash__btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.select { height: 34px; border-radius: 999px; border: 1px solid var(--edge); background: var(--surface-1); padding: 0 12px; font-size: 13px; color: var(--ink-2); outline: 0; max-width: 220px; }

/* ---------------- misc v2.1 components ---------------- */
html, body { height: 100%; }
.app { height: 100vh; height: 100dvh; }
button, a, .cue, .w { touch-action: manipulation; }
.phone-only { display: none !important; }
.view.view--play { padding: 0; }  /* never inherit the responsive page padding */
.nav__new span:first-child { font-size: 18px; line-height: 1; }
.nav__badge--hot { color: var(--accent-ink); background: var(--accent); border-radius: 999px; padding: 0 7px; font-size: 10.5px; line-height: 18px; font-family: var(--font-sans); font-weight: 700; }
.nav__badge--hot:empty { display: none; }
.resume-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -10px auto 20px; max-width: 1240px;
  border: 1px solid var(--accent); background: var(--accent-tint); border-radius: 12px; padding: 10px 16px;
  font-size: 14px; color: var(--ink-2); box-shadow: var(--glow);
}
.resume-bar b { color: var(--ink); }
.resume-bar__go { margin-left: auto; color: var(--accent-soft); font-weight: 700; }
.word-sec { display: flex; align-items: baseline; gap: 10px; padding: 14px 18px 10px; border-top: 1px solid var(--edge-soft); background: var(--accent-tint); }
.word-sec:first-child { border-top: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.word-sec b { font-size: 14px; color: var(--accent-soft); }
.word-row__pos { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); font-weight: 500; margin-left: 4px; }
.vocab-list { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; }
.vocab-list li { display: flex; align-items: baseline; gap: 6px; padding: 7px 0; border-bottom: 1px dashed var(--edge-soft); font-size: 13.5px; min-width: 0; }
.vocab-list li b { color: var(--kw); font-weight: 600; white-space: nowrap; }
.vocab-list li .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: auto; }
.vocab-list li.known b { color: var(--ink-3); text-decoration: line-through; }
.ai-toggle { display: none; }
.ai__quota { font-size: 11.5px; color: var(--ink-4); padding: 2px 2px 0; }
.ai__quota:empty { display: none; }
.ai__quota.is-out { color: var(--danger); }
.ai-toggle svg { width: 15px; height: 15px; }
.ai__close { display: none; margin-left: auto; }
.ai-backdrop { display: none; }
@media (hover: none) { .kbd-hint { display: none !important; } }

/* ---------------- textbook / units ---------------- */
.book-head { display: flex; gap: 22px; align-items: center; margin-bottom: 22px; flex-wrap: wrap; }
.term-dial { width: 104px; height: 104px; position: relative; flex: none; }
.term-dial svg { transform: rotate(-90deg); display: block; width: 100%; height: 100%; }
.term-dial__in { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; }
.term-dial__in b { font-family: var(--font-mono); font-size: 24px; color: var(--accent-bright); }
.term-dial__in span { font-size: 11px; color: var(--ink-3); }
.units { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
/* faint section divider on the home page (fades out at both ends) */
.sec-divider { --line: color-mix(in srgb, var(--ink-3) 35%, transparent); border: 0; height: 1px; margin: 34px 0; background: linear-gradient(90deg, transparent, var(--line) 12%, var(--line) 88%, transparent); }
.unit { padding: 18px; display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: border-color .2s, transform .2s; text-align: left; width: 100%; }
.unit:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.unit__no { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); letter-spacing: .12em; display: flex; justify-content: space-between; align-items: center; }
.unit__title { font-size: 20px; font-weight: 700; line-height: 1.3; }
.unit__title small { font-size: 15px; color: var(--ink-3); font-weight: 500; margin-left: 4px; }
.unit__sub { font-size: 13px; color: var(--ink-3); }
.unit__bar { height: 6px; border-radius: 3px; background: var(--bg-0); overflow: hidden; }
.unit__bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-bright)); }
.unit__secs { display: flex; gap: 4px; }
.unit__secs i { flex: 1; height: 22px; border-radius: 6px; background: var(--bg-0); border: 1px solid var(--edge-soft); font-style: normal; font-size: 10.5px; color: var(--ink-4); display: grid; place-items: center; }
.unit__secs i.done { background: var(--accent-tint); border-color: var(--accent-line); color: var(--accent-soft); }
.unit__secs i.now { border-color: var(--accent); color: var(--ink); }
.unit--empty { border-style: dashed; box-shadow: none; background: transparent; cursor: default; }
.unit--empty:hover { transform: none; border-color: var(--edge-soft); }
.unit--found { border-color: var(--accent-line); border-style: dashed; background: var(--accent-tint); cursor: default; }
.unit--found:hover { transform: none; }
.unit-hero { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; margin-bottom: 22px; }
.unit-hero h1 { font-size: 30px; font-weight: 700; line-height: 1.25; }
.unit-hero h1 small { font-size: 18px; color: var(--ink-3); font-weight: 500; margin-left: 6px; }
.crumb { color: var(--ink-3); }
.crumb:hover { color: var(--accent-soft); }
.hero-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.hstat { padding: 12px 16px; min-width: 118px; }
.hstat b { display: block; font-family: var(--font-mono); font-size: 22px; line-height: 1.2; }
.unit-cols { grid-template-columns: 1fr 360px; align-items: start; }
.route { position: relative; display: flex; flex-direction: column; gap: 12px; }
.route::before { content: ""; position: absolute; left: 27px; top: 30px; bottom: 30px; width: 2px; background: linear-gradient(var(--accent-line), var(--edge-soft)); }
.step { display: grid; grid-template-columns: 56px 1fr; gap: 14px; align-items: stretch; position: relative; }
.step__dot { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-1); border: 2px solid var(--edge); font-size: 22px; z-index: 1; align-self: center; }
.step.done .step__dot { border-color: var(--accent); background: var(--accent-tint); }
.step.now .step__dot { border-color: var(--accent); box-shadow: var(--glow); background: var(--accent); }
.step__card { padding: 16px 18px; display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: center; cursor: pointer; transition: border-color .2s; }
.step__card:hover { border-color: var(--accent-line); }
.step.now .step__card { border-color: var(--accent); box-shadow: var(--glow); }
.step__kicker { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; color: var(--ink-3); text-transform: uppercase; }
.step__title { font-size: 17px; font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.step__desc { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.step__meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.step__side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.mini-fingers { display: flex; gap: 3px; }
.mini-fingers i { width: 16px; height: 6px; border-radius: 3px; background: var(--surface-3); }
.mini-fingers i.done { background: var(--accent); }
.mini-fingers i.now { background: var(--accent-soft); box-shadow: 0 0 6px var(--accent); }
.goal-list li { display: flex; gap: 10px; padding: 8px 0; font-size: 14px; border-top: 1px solid var(--edge-soft); }
.goal-list li:first-child { border-top: 0; }
.plan { display: grid; grid-template-columns: auto repeat(5, 1fr); gap: 6px; align-items: stretch; }
.plan__wk { writing-mode: vertical-rl; font-size: 11px; color: var(--ink-4); display: grid; place-items: center; letter-spacing: .1em; }
.plan div { border-radius: 10px; border: 1px solid var(--edge-soft); background: var(--bg-0); padding: 8px 4px; text-align: center; font-size: 11.5px; color: var(--ink-3); line-height: 1.35; }
.plan div b { display: block; font-size: 12.5px; color: var(--ink-2); }
.plan div.done { border-color: var(--accent-line); background: var(--accent-tint); }
.plan div.today { border-color: var(--accent); box-shadow: var(--glow); }
.vocab-ring { display: flex; gap: 16px; align-items: center; }
.donut { width: 92px; height: 92px; flex: none; position: relative; }
.donut svg { transform: rotate(-90deg); display: block; }
.donut b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-mono); font-size: 18px; }
.sec-chip { font-size: 11px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--edge); color: var(--ink-3); white-space: nowrap; }
.sec-chip.reading { border-color: rgba(59, 130, 246, .45); color: #60a5fa; }
.sec-chip.listening { border-color: rgba(52, 211, 153, .45); color: var(--ok); }
.sec-chip.speaking { border-color: rgba(236, 72, 153, .45); color: #f472b6; }
.sec-chip.culture { border-color: var(--accent-line); color: var(--accent-soft); }
.sec-chip.cross { border-color: rgba(168, 85, 247, .45); color: #c084fc; }
:root[data-theme="light"] .sec-chip.reading { color: #2563eb; } :root[data-theme="light"] .sec-chip.cross { color: #9333ea; } :root[data-theme="light"] .sec-chip.speaking { color: #db2777; }
.vgroup { font-size: 13px; font-weight: 700; color: var(--accent-soft); padding: 14px 18px 8px; display: flex; gap: 8px; align-items: baseline; background: var(--accent-tint); border-top: 1px solid var(--edge-soft); }
.vgroup:first-child { border-top: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.vrow { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--edge-soft); }
.vplay { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-tint); border: 1px solid var(--accent-line); color: var(--accent-soft); display: grid; place-items: center; font-size: 12px; }
.vplay.is-playing { background: var(--accent); color: var(--accent-ink); box-shadow: var(--glow); }
.vrow__term { font-size: 16.5px; font-weight: 700; color: var(--kw); }
.vrow__zh { font-size: 13.5px; color: var(--ink-2); }
.vrow__ex { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.vrow__ex mark { background: none; color: var(--accent-soft); font-weight: 700; }
.vrow.known .vrow__term { color: var(--ink-3); text-decoration: line-through; }
.vrow__ops { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.pv-wrap { max-width: 620px; margin: 0 auto; }
.pv-top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.pv-prog { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.pv-prog i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.pv-card { min-height: 380px; padding: 34px 30px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; }
.pv-term { font-size: 42px; font-weight: 800; color: var(--kw); line-height: 1.15; word-break: break-word; }
.pv-pos { font-family: var(--font-mono); color: var(--ink-3); display: flex; gap: 8px; align-items: center; }
.pv-big-play { width: 76px; height: 76px; border-radius: 50%; background: var(--play-grad); color: var(--accent-ink); display: grid; place-items: center; font-size: 24px; box-shadow: var(--glow-strong); }
.pv-hidden { color: var(--ink-4); border: 1px dashed var(--edge); border-radius: 12px; padding: 12px 18px; cursor: pointer; }
.pv-zh { font-size: 24px; font-weight: 700; }
.pv-ex { font-size: 15.5px; color: var(--ink-2); max-width: 46ch; }
.pv-ex mark { background: var(--kw-bg); color: var(--kw); border-radius: 4px; padding: 0 3px; }
.pv-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.pv-btns__wide { grid-column: 1 / -1; }
.pv-count { min-width: 22px; height: 20px; padding: 0 6px; margin-left: 4px; border-radius: 10px; display: inline-grid; place-items: center; font-family: var(--font-mono); font-size: 12px; font-weight: 700; background: color-mix(in srgb, currentColor 16%, transparent); }
.sec-bars { display: flex; flex-direction: column; gap: 14px; }
.sec-bar__head { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 6px; gap: 8px; }
.sec-bar__track { position: relative; height: 12px; border-radius: 6px; background: var(--bg-0); overflow: hidden; }
.sec-bar__r1 { position: absolute; left: 0; top: 0; bottom: 0; background: var(--surface-3); }
.sec-bar__r4 { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--accent), var(--accent-bright)); opacity: .9; }
/* rubric / narration lines inside the subtitle list */
.cue--inst { opacity: .75; }
.cue--inst .cue__en { font-size: 13.5px !important; font-style: italic; font-weight: 400 !important; color: var(--ink-4) !important; }
.cue--inst .cue__zh { font-size: 12.5px !important; color: var(--ink-4) !important; }
.cue--inst .cue__en::before { content: "旁白 · "; font-style: normal; font-size: 11px; color: var(--ink-4); }
.cue--inst.is-current { padding: 6px 22px; background: transparent; border-color: transparent; box-shadow: none; }
.end-note { text-align: center; color: var(--ink-4); font-size: 12.5px; padding: 18px 0 0; }

@media (max-width: 1024px) { .unit-cols { grid-template-columns: 1fr; } .unit-hero { grid-template-columns: 1fr; } }
@media (max-width: 680px) {
  .unit-hero h1 { font-size: 23px; }
  .hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .hstat { min-width: 0; padding: 10px 12px; } .hstat b { font-size: 19px; }
  .step { grid-template-columns: 40px 1fr; gap: 10px; } .step__dot { width: 40px; height: 40px; font-size: 17px; }
  .route::before { left: 19px; } .step__card { grid-template-columns: 1fr; } .step__side { align-items: flex-start; flex-direction: row; flex-wrap: wrap; }
  .plan div { font-size: 10.5px; padding: 6px 2px; } .pv-term { font-size: 32px; } .pv-card { min-height: 320px; padding: 26px 18px; }
  .vrow { grid-template-columns: 36px 1fr; padding: 12px 14px; } .vrow__ops { grid-column: 2; justify-content: flex-start; }
  .term-dial { width: 68px; height: 68px; } .term-dial__in b { font-size: 16px; } .term-dial__in span { font-size: 9.5px; }
  .book-head { gap: 14px; } .book-head > div:nth-child(2) { min-width: 0 !important; }
  .book-head > .term-dial { order: 1; } .book-head > .hero-actions { order: 2; }
  .units { grid-template-columns: 1fr; }
}

/* ---------------- word book ---------------- */
.wb-books { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.wb-book { padding: 20px; display: flex; flex-direction: column; gap: 16px; transition: border-color .2s, transform .2s; }
.wb-book:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.wb-book__top { display: flex; gap: 14px; align-items: center; }
.wb-cover { width: 56px; height: 64px; border-radius: 8px; background: var(--cover-grad); border: 1px solid var(--accent-line); display: flex; align-items: flex-end; padding: 8px; font-size: 12px; font-weight: 800; color: var(--accent-soft); line-height: 1.25; flex: none; }
.wb-counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.wb-cover__no { font-family: var(--font-mono); font-size: 22px; font-weight: 800; letter-spacing: .02em; }
.wb-book .unit__title small { font-size: 14px; color: var(--ink-3); font-weight: 500; margin-left: 6px; }
.wb-books { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.wb-counts div { background: var(--bg-0); border: 1px solid var(--edge-soft); border-radius: 10px; padding: 8px 6px; text-align: center; }
.wb-counts b { display: block; font-family: var(--font-mono); font-size: 18px; }
.wb-counts span { font-size: 11.5px; color: var(--ink-3); }
.wb-review { display: flex; align-items: center; gap: 18px; }
.wb-ring { display: flex; align-items: center; gap: 10px; }
.wb-ring > div:last-child { display: flex; flex-direction: column; line-height: 1.3; }
.wb-ring b { font-size: 16px; }
.wb-ring span { font-size: 12px; color: var(--ink-3); }
.wb-filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }

/* ---------------- full-screen flashcard review ---------------- */
:root, :root[data-theme="dark"] {
  --rv-back-mark: #f1d38a; --rv-back-mark-ink: #1b2724;
  --rv-bg: #12100d; --rv-paper: #1f1b16; --rv-paper-ink: #f2ece0; --rv-paper-line: rgba(242, 236, 224, .14);
  --rv-back: #f2ece0; --rv-back-ink: #1b2724; --rv-back-sub: #5e6b66; --rv-mark: rgba(245, 197, 106, .32); --rv-mark-ink: #fff3d6;
}
:root[data-theme="light"] {
  --rv-back-mark: #e8ee8a; --rv-back-mark-ink: #1b2724;
  --rv-bg: #f3efe4; --rv-paper: #fffaf1; --rv-paper-ink: #1b2724; --rv-paper-line: #e6e0d2;
  --rv-back: #1b2724; --rv-back-ink: #fbf7ee; --rv-back-sub: #9fb0a9; --rv-mark: #e8ee8a; --rv-mark-ink: #1b2724;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --rv-back-mark: #e8ee8a; --rv-back-mark-ink: #1b2724;
    --rv-bg: #f3efe4; --rv-paper: #fffaf1; --rv-paper-ink: #1b2724; --rv-paper-line: #e6e0d2;
    --rv-back: #1b2724; --rv-back-ink: #fbf7ee; --rv-back-sub: #9fb0a9; --rv-mark: #e8ee8a; --rv-mark-ink: #1b2724;
  }
}
body.in-review .app { grid-template-columns: 1fr; }
body.in-review .sidebar { display: none !important; }
body.in-review .main { background: var(--rv-bg); background-image: none; }
.view.view--review { padding: 18px 32px 28px; display: flex; flex-direction: column; }
.rv-top { display: flex; align-items: center; gap: 16px; max-width: 1040px; width: 100%; margin: 0 auto 18px; }
.rv-title { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.rv-prog { flex: 1; height: 4px; border-radius: 2px; background: var(--rv-paper-line); overflow: hidden; }
.rv-prog i { display: block; height: 100%; background: var(--accent); transition: width .35s var(--ease); }
.rv-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; max-width: 1040px; width: 100%; margin: 0 auto; }
.rv-flip { width: 100%; min-height: min(62vh, 560px); position: relative; perspective: 1800px; cursor: pointer; outline: none; }
.rv-face {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 70px 9% 70px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  transition: transform .6s var(--ease); box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .35); overflow: auto;
}
.rv-face--front { background: var(--rv-paper); color: var(--rv-paper-ink); border: 1px solid var(--rv-paper-line); }
.rv-face--back { background: var(--rv-back); color: var(--rv-back-ink); transform: rotateY(180deg); }
.rv-flip.is-flipped .rv-face--front { transform: rotateY(-180deg); }
.rv-flip.is-flipped .rv-face--back { transform: rotateY(0); }
.rv-corner { position: absolute; width: 34px; height: 34px; border-color: currentColor; border-style: solid; opacity: .85; }
.rv-corner.tl { left: 18px; top: 18px; border-width: 2px 0 0 2px; }
.rv-corner.br { right: 18px; bottom: 18px; border-width: 0 2px 2px 0; }
.rv-say { position: absolute; top: 24px; right: 24px; height: 44px; padding: 0 18px; border-radius: 22px; font-size: 13.5px; font-weight: 600; color: inherit; border: 1px solid currentColor; opacity: .55; }
.rv-say:hover { opacity: .9; }
.rv-cap { font-family: var(--font-sans); font-size: 12px; font-weight: 700; letter-spacing: .28em; opacity: .55; margin-bottom: 28px; }
.rv-sent { font-family: var(--font-read); font-size: clamp(26px, 3.6vw, 46px); line-height: 1.35; max-width: 30ch; }
.rv-sent mark { background: var(--rv-mark); color: var(--rv-mark-ink); padding: 0 .12em; border-radius: 2px; }
.rv-term { font-family: var(--font-read); font-size: clamp(40px, 6vw, 72px); line-height: 1.1; }
.rv-pos { font-family: var(--font-mono); opacity: .6; margin-top: 10px; }
.rv-zh { font-family: "Songti SC", "Noto Serif SC", var(--font-read); font-size: clamp(24px, 3.4vw, 44px); line-height: 1.45; max-width: 24em; font-weight: 600; }
.rv-zh mark { background: var(--rv-back-mark); color: var(--rv-back-mark-ink); padding: 0 .1em; border-radius: 2px; }
.rv-word { margin-top: 28px; font-size: 24px; color: var(--rv-back-sub); }
.rv-word span { font-family: var(--font-mono); font-size: 14px; }
.rv-mean { margin-top: 10px; font-size: 20px; }
.rv-mean.is-big { font-family: "Songti SC", "Noto Serif SC", var(--font-read); font-size: clamp(26px, 3.6vw, 42px); font-weight: 600; }
.rv-tip { position: absolute; bottom: 26px; left: 0; right: 0; font-size: 13px; opacity: .5; }
.rv-detail-link { height: 46px; display: grid; place-items: center; }
.rv-detail-link button { color: var(--danger); font-weight: 700; font-size: 14.5px; }
.rv-detail-link button.is-hidden { visibility: hidden; }
.rv-detail { width: 100%; padding: 16px 20px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.rv-detail__row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.rv-detail__row b { font-size: 18px; color: var(--kw); }
.rv-detail__row .icon-btn { margin-left: auto; }
.rv-detail__ex { font-size: 15px; line-height: 1.6; }
.rv-detail__ex mark { background: var(--kw-bg); color: var(--kw); border-radius: 3px; padding: 0 2px; }
.rv-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; width: 72%; }
.rv-btn { position: relative; height: 84px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 1px solid; transition: transform .12s, filter .2s; }
.rv-btn:active { transform: scale(.98); }
.rv-btn span { font-size: 13px; opacity: .65; color: var(--ink-2); }
.rv-btn b { font-size: 24px; letter-spacing: .04em; }
.rv-count { position: absolute; right: 12px; top: 10px; min-width: 26px; height: 22px; padding: 0 7px; border-radius: 11px; font-style: normal;
  font-family: var(--font-mono); font-size: 12.5px; font-weight: 700; line-height: 22px; background: currentColor; transition: transform .2s; }
.rv-btn--no .rv-count { color: var(--danger); } .rv-btn--yes .rv-count { color: var(--ok); }
.rv-count { -webkit-text-fill-color: var(--bg-0); }
.rv-count.is-zero { opacity: .25; }
.rv-btn--no { background: var(--danger-tint); border-color: rgba(239, 93, 116, .55); color: var(--danger); }
.rv-btn--yes { background: var(--ok-tint); border-color: rgba(31, 181, 126, .5); color: var(--ok); }
.rv-btn:hover { filter: brightness(1.04); }
.rv-hint { margin-top: 16px; font-size: 13px; color: var(--ink-3); text-align: center; }
.rv-done { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 40px 20px; }
.rv-done__big { font-family: var(--font-mono); font-size: 72px; font-weight: 700; color: var(--accent-bright); line-height: 1.1; }
.rv-done__big small { font-size: 28px; color: var(--ink-3); }
@media (max-width: 1024px) {
  .rv-btns { width: 100%; }
  .wb-books { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .view.view--review { padding: max(12px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom)); }
  .rv-top { gap: 10px; margin-bottom: 12px; }
  .rv-title { display: none; }
  .rv-flip { min-height: 58vh; }
  .rv-face { padding: 64px 22px 56px; }
  .rv-say { top: 16px; right: 16px; height: 36px; padding: 0 14px; }
  .rv-corner { width: 24px; height: 24px; } .rv-corner.tl { left: 12px; top: 12px; } .rv-corner.br { right: 12px; bottom: 12px; }
  .rv-cap { margin-bottom: 18px; letter-spacing: .2em; }
  .rv-btns { gap: 12px; } .rv-btn { height: 72px; } .rv-btn b { font-size: 21px; }
  .wb-counts b { font-size: 16px; }
}

/* ============================================================
   iPad landscape / small laptop (≤1180px)
   sidebar → icon rail, AI panel → slide-over drawer
   ============================================================ */
@media (max-width: 1180px) {
  :root { --sidebar-w: 76px; }
  .sidebar { padding: 18px 10px 14px; align-items: center; }
  .brand { padding: 0 0 18px; }
  .brand > div:last-child, .nav__label, .streak, .theme-row > span { display: none; }
  .nav__new { width: 48px; height: 48px; border-radius: 14px; margin: 0 0 14px; }
  .nav { align-items: center; }
  .nav__item { width: 52px; height: 52px; justify-content: center; padding: 0; position: relative; }
  .nav__item svg { width: 21px; height: 21px; }
  .nav__item.is-active { box-shadow: inset 0 -2px 0 var(--accent); }
  .nav__badge { position: absolute; top: 4px; right: 2px; margin: 0; font-size: 9.5px; }
  .nav__badge--hot { right: -4px; padding: 0 5px; line-height: 16px; }
  .side-foot { width: 100%; align-items: center; }
  .theme-row { padding: 0; }
  .theme-row .seg { flex-direction: column; }

  .play-body { grid-template-columns: 1fr; }
  .ai-toggle { display: inline-flex; }
  .ai__close { display: grid; }
  .ai {
    position: fixed; z-index: 60; top: 0; right: 0; bottom: 0; width: min(400px, 92vw);
    transform: translateX(105%); transition: transform .3s var(--ease); box-shadow: var(--shadow-pop);
    padding-top: max(20px, env(safe-area-inset-top)); padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
  .ai-open .ai { transform: none; }
  .ai-backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .35); }
  .ai-open .ai-backdrop { display: block; }
  .console { gap: 18px; padding: 0 18px; }
  .round-card__desc { display: none; }
  .round-card { min-height: 150px; }
}

/* ============================================================
   iPad portrait (≤1024px)
   ============================================================ */
@media (max-width: 1024px) {
  .view { padding: 24px 26px 40px; }
  .play-head { padding: 18px 24px 0; }
  .stage { padding: 0 18px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .map-cols, .two-col, .report-grid, .retell, .words-layout { grid-template-columns: 1fr; }
  .words-layout #flashBox { order: -1; }
  .report-hero { grid-template-columns: repeat(3, 1fr); }
  .big-num { font-size: 50px; }
  .console { height: auto; grid-template-columns: 1fr; gap: 10px; padding: 14px 18px max(12px, env(safe-area-inset-bottom)); }
  .console__now { display: none; }
  .console__center { flex-direction: row-reverse; justify-content: center; gap: 14px; }
  .console__center .time { position: absolute; left: 18px; top: 22px; }
  .console__right { justify-content: center; flex-wrap: wrap; }
  .hand .icon-sub { display: none; }
  .cue.is-current .cue__en { font-size: 25px; }
  .cue.is-current .cue__zh { font-size: 19px; }
  .hand .round-card__no { font-size: 34px; }
}

/* ============================================================
   iPhone (≤680px)
   sidebar → bottom tab bar; player gets a two-row console
   ============================================================ */
@media (max-width: 680px) {
  body { font-size: 14.5px; }
  .phone-only { display: inline-flex !important; }
  .app { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .main { grid-row: 1; }
  .sidebar {
    grid-row: 2; flex-direction: row; padding: 0 6px env(safe-area-inset-bottom); border-right: 0;
    border-top: 1px solid var(--edge-soft); overflow: visible; align-items: stretch;
  }
  .brand, .nav__new, .side-foot { display: none; }
  .nav { flex-direction: row; width: 100%; gap: 0; }
  .nav__item {
    flex: 1; width: auto; height: 58px; flex-direction: column; gap: 3px; border-radius: 0; font-size: 11px;
    background: none !important; box-shadow: none !important; color: var(--ink-3);
  }
  .nav__item .nav__label { display: block; }
  .nav__item.is-active { color: var(--accent-soft); }
  .nav__badge { top: 4px; left: calc(50% + 13px); right: auto; } /* grows rightwards, clear of the icon */
  body.in-player .sidebar { display: none; }

  .view { padding: max(16px, env(safe-area-inset-top)) 16px 28px; }
  .page-head { margin-bottom: 16px; gap: 12px; align-items: flex-start; }
  .page-title { font-size: 23px; }
  #themeSegPhone { display: flex !important; width: max-content; margin: 0 0 10px auto; }
  .view { position: relative; }
  .page-head .chips { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; scrollbar-width: none; }
  .page-head .chips::-webkit-scrollbar { display: none; }
  .resume-bar { margin: 0 0 14px; font-size: 13px; }
  .stats { gap: 10px; margin-bottom: 18px; }
  .sec-divider { margin: 24px 0; }
  .stat { padding: 14px; }
  .stat__num { font-size: 24px; }
  .lessons { grid-template-columns: 1fr; }
  .lesson--new { min-height: 170px; }
  .pad { padding: 18px; }
  .hint-bar { flex-wrap: wrap; font-size: 13px; }

  /* lesson map */
  .lesson-hero h1 { font-size: 22px; }
  .hero-actions { width: 100%; }
  .hero-actions > .btn--primary { flex: 1; }
  .hand { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; margin: 0 -16px 18px; padding: 2px 16px; scrollbar-width: none; }
  .hand::-webkit-scrollbar { display: none; }
  .hand .round-card { flex: 0 0 136px; scroll-snap-align: start; min-height: 140px; }
  .vocab-list { grid-template-columns: 1fr; }

  /* player */
  .play-head { padding: max(10px, env(safe-area-inset-top)) 14px 0; }
  .play-title { font-size: 18px; }
  .play-title .badge { display: none; }
  .play-meta { font-size: 12px; }
  .play-head__row .btn { height: 32px; padding: 0 12px; font-size: 12.5px; }
  .round-tabs { flex-wrap: nowrap; overflow-x: auto; margin: 10px -14px 0; padding: 0 14px 2px; scrollbar-width: none; }
  .round-tabs::-webkit-scrollbar { display: none; }
  .round-tab { flex: none; height: 32px; padding: 0 11px; font-size: 12.5px; }
  .round-tab--review { margin-left: 0; }
  .task-bar { flex-wrap: wrap; padding: 8px 10px 8px 12px; gap: 6px 10px; margin-top: 10px; }
  .task-bar__label { display: none; }
  .task-bar__text { font-size: 12.5px; flex: 1 1 100%; }
  .task-bar__right { margin-left: 0; width: 100%; }
  .task-bar__right .btn { margin-left: auto; }
  .play-body { margin-top: 6px; }
  .stage { padding: 0 6px; }
  .cue-list { padding: 50px 0 140px; gap: 8px; }
  .cue { padding: 4px 12px; }
  .cue__en { font-size: 16px; }
  .cue__zh { font-size: 14px; }
  .cue.is-current, .cue.is-selected:not(.is-current) { padding: 14px 14px; }
  .cue.is-current .cue__en { font-size: 21px; }
  .cue.is-current .cue__zh { font-size: 16px; }
  .mode-zh .cue.is-current .cue__zh { font-size: 20px; }
  .cue__actions { gap: 6px; }
  .cue-act { height: 32px; padding: 0 11px; font-size: 12.5px; }
  .cue__actions .dim { display: none; }
  .blind__ring { width: 170px; height: 170px; }
  .blind h2 { font-size: 19px; }
  .console {
    height: auto; grid-template-columns: 1fr; gap: 8px; padding: 12px 12px max(10px, env(safe-area-inset-bottom));
  }
  .console__now { display: none; }
  .console__center { flex-direction: column; gap: 2px; }
  .console__center .time { position: static; font-size: 10.5px; }
  .transport { gap: 10px; }
  .t-btn { width: 38px; height: 38px; }
  .play-btn { width: 54px; height: 54px; }
  .speed { height: 38px; min-width: 48px; padding: 0 8px; }
  .speed-menu { left: auto; right: -4px; transform: none; }
  .console__right { justify-content: center; gap: 8px; flex-wrap: wrap; }
  .console__right .seg__item { min-width: 34px; padding: 0 7px; font-size: 13px; }
  .console__right .seg__item.is-locked::after { content: none; }
  .console__right .seg__item.is-locked { opacity: .45; }
  .console__right .btn--sm { height: 34px; padding: 0 9px; gap: 4px; }
  .console__right .t-btn { width: 34px; height: 34px; }
  .ai {
    top: auto; left: 0; width: 100%; height: 78dvh; border-left: 0; border-radius: 20px 20px 0 0;
    transform: translateY(105%); border-top: 1px solid var(--edge);
  }
  .ai-open .ai { transform: none; }
  .ai__ask input { font-size: 16px; }
  .wordpop { position: fixed; left: 12px !important; right: 12px; top: auto !important; bottom: calc(150px + env(safe-area-inset-bottom)); width: auto; z-index: 50; }

  /* quiz / result */
  .quiz-top { flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
  .qdots { order: 3; width: 100%; margin-left: 0; }
  .qdots button { flex: 1; }
  .qcard { padding: 20px 18px; }
  .qstem { font-size: 19px; margin-bottom: 16px; }
  .opt { min-height: 54px; padding: 10px 14px; font-size: 15.5px; gap: 12px; }
  .quiz-foot { position: sticky; bottom: 0; background: var(--bg-0); padding: 10px 0 4px; margin-top: 14px; }
  .result-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 18px; padding: 24px 18px; }
  .result-hero > div:last-child > div { justify-content: center; }
  .gain-big { font-size: 46px; }
  .bars { gap: 8px; height: 140px; } .rep-bars-card .bars { height: 190px; }
  .review .jump { display: none; }

  /* retell / report / words */
  .rec { padding: 24px 16px; }
  .rec__btn { width: 100px; height: 100px; font-size: 36px; }
  .rec > div:last-child { flex-wrap: wrap; justify-content: center; }
  .report-hero { grid-template-columns: 1fr; gap: 10px; }
  .report-hero .card { padding: 18px; }
  .big-num { font-size: 44px; margin: 6px 0; }
  .word-row { padding: 14px; grid-template-columns: 1fr; }
  .word-ops { justify-content: flex-end; }
  .flash__card { height: 260px; }
  .flash__face { padding: 20px; }
  .flash__sent { font-size: 18px; }
  .select { font-size: 16px; }
  #toast-root { top: max(14px, env(safe-area-inset-top)); }
}

/* With the play button on the centre line and the speed button beside it,
   one console row needs ~1460 px; narrower (down to the 1024 px phone/tablet
   layout) the controls go on a second row instead of overlapping. */
@media (min-width: 1025px) and (max-width: 1459px) {
  .console { height: auto; grid-template-columns: 1fr; gap: 10px; padding: 14px 18px 12px; }
  .console__now { display: none; }
  .console__right { justify-content: center; }
}

/* login · profiles · offline */
.auth { max-width: 520px; margin: 8vh auto 0; padding: 0 16px; display: grid; gap: 18px; }
.auth__card { padding: 28px 24px; display: grid; gap: 10px; }
.who-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.who-card { display: grid; justify-items: center; gap: 6px; padding: 18px 10px; border-radius: var(--r-lg); border: 1px solid var(--edge-soft); background: var(--surface-1); }
.who-card.is-active { border-color: var(--accent); background: var(--accent-tint); }
.who-card__av { font-size: 40px; line-height: 1; }
.who-card__lock { font-size: 11.5px; color: var(--ink-3); }
.who-pin { max-width: 280px; margin: 0 auto; }
.who-foot { display: flex; justify-content: center; gap: 10px; }
.who { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 0 0 12px; border-radius: 12px; color: var(--ink-2); }
.who:hover { background: var(--accent-tint); }
.who__av { font-size: 22px; }
.who--phone { display: inline-flex; margin: 0; font-size: 13px; }
/* on phones the sidebar becomes the bottom tab bar: switch from the home page instead */
@media (max-width: 680px) { .sidebar .who { display: none; } }
.auth [hidden] { display: none !important; } /* .book-form { display: grid } would otherwise override [hidden] */

.role-child .parent-only { display: none !important; }
.fam-list { display: grid; gap: 10px; margin-bottom: 10px; }
.fam-row { display: flex; align-items: center; gap: 10px; padding: 12px 16px; flex-wrap: wrap; }
.fam-row input, .fam-row select { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--edge); background: var(--surface-2); font-size: 14px; }
.fam-row input { flex: 1; min-width: 120px; }
@media (max-width: 680px) { .fam-row input, .fam-row select { font-size: 16px; } }
