/* 观澜 · 设计系统
   纸色底、墨色字、深水青为主色、朱砂红点题；红涨绿跌沿用 A 股习惯。 */
:root {
  --bg: #f5f1e8;
  --bg-2: #ede7da;
  --surface: #fffdf8;
  --surface-2: #f8f4ea;
  --ink: #1c2530;
  --ink-2: #46505c;
  --muted: #858b93;
  --line: #e4dccb;
  --brand: #1f5160;
  --brand-2: #2d7a8a;
  --brand-soft: #dcebec;
  --seal: #c23b2c;
  --gold: #c08a1e;
  --gold-soft: #f6e8c4;
  --up: #d23b3b;
  --down: #1b8a5a;
  --ok: #1d8a6a;
  --ok-soft: #dff2ea;
  --bad: #c2552c;
  --bad-soft: #fbe7dc;
  --locked: #c9c3b6;
  --shadow-sm: 0 1px 2px rgba(28,37,48,.06);
  --shadow: 0 2px 4px rgba(28,37,48,.05), 0 10px 30px rgba(28,37,48,.07);
  --radius: 18px;
  --radius-sm: 12px;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --ease: cubic-bezier(.2,.8,.2,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
  --nav-h: 64px;
  --on-brand: #fff;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10161c; --bg-2: #0c1116; --surface: #182129; --surface-2: #1d2731; --ink: #ebe6db; --ink-2: #b9b6ae;
    --muted: #868d95; --line: #2a3540; --brand: #5fb3c2; --brand-2: #7cc6d3; --brand-soft: #1b3740; --seal: #e0604f;
    --gold: #e0b250; --gold-soft: #3a3020; --up: #f0605c; --down: #3fbf85; --ok: #4cc79b; --ok-soft: #173a30;
    --bad: #f08b5c; --bad-soft: #42261b; --on-brand: #0c1a20; --locked: #3a444e; --shadow: 0 10px 30px rgba(0,0,0,.35); --shadow-sm: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink);
  font: 16px/1.7 var(--sans); letter-spacing: .01em; overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 3px; border-radius: 8px; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.serif { font-family: var(--serif); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.up { color: var(--up); } .down { color: var(--down); }

/* ---------- 外框 ---------- */
#root { min-height: 100dvh; }
.shell { display: grid; grid-template-columns: 1fr; min-height: 100dvh; }
.main { padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); min-width: 0; }
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); display: flex; justify-content: space-around; align-items: stretch;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--muted); font-size: 12px; position: relative; transition: color .2s;
}
.nav a svg { width: 24px; height: 24px; transition: transform .25s var(--ease-out); }
.nav a[aria-current="page"] { color: var(--brand); font-weight: 700; }
.nav a[aria-current="page"] svg { transform: translateY(-2px) scale(1.08); }
.nav .badge { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--seal); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 700; }
.nav .brandmark { display: none; }
@media (min-width: 900px) {
  .shell { grid-template-columns: 232px 1fr; }
  .main { padding-bottom: 40px; }
  .nav {
    position: sticky; top: 0; height: 100dvh; flex-direction: column; justify-content: flex-start; gap: 6px;
    padding: 24px 16px; border-top: 0; border-right: 1px solid var(--line); background: var(--surface);
  }
  .nav a { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 14px; padding: 12px 16px; border-radius: 14px; font-size: 16px; }
  .nav a:hover { background: var(--surface-2); color: var(--ink); }
  .nav a[aria-current="page"] { background: var(--brand-soft); }
  .nav a[aria-current="page"] svg { transform: none; }
  .nav .badge { position: static; margin-left: auto; }
  .nav .brandmark { display: flex; align-items: center; gap: 10px; padding: 4px 12px 22px; text-decoration: none; color: var(--ink); }
}
.brandmark .logo { width: 34px; height: 34px; }
.brandmark b { font-family: var(--serif); font-size: 22px; letter-spacing: .12em; }

.page { max-width: 640px; margin: 0 auto; padding: 20px 16px; }
.page-wide { max-width: 880px; }
.page h1 { font-family: var(--serif); font-size: 26px; margin: 8px 0 4px; letter-spacing: .04em; }
.page .sub { color: var(--muted); margin: 0 0 20px; }

/* 视图切换 */
.view-enter { animation: viewIn .45s var(--ease-out) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- 按钮 ---------- */
.btn {
  --b: var(--brand); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 24px; border-radius: 16px; border: 0; background: var(--b); color: var(--on-brand);
  font-weight: 700; font-size: 17px; letter-spacing: .06em; text-decoration: none;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--b) 70%, #000); transform: translateY(0);
  transition: transform .12s, box-shadow .12s, background .2s, opacity .2s;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--b) 70%, #000); }
.btn:disabled { --b: var(--locked); color: color-mix(in srgb, var(--ink) 45%, transparent); cursor: not-allowed; box-shadow: none; }
.btn.block { width: 100%; }
.btn.ok { --b: var(--ok); }
.btn.bad { --b: var(--bad); }
.btn.gold { --b: var(--gold); }
.btn.ghost { --b: transparent; color: var(--brand); box-shadow: none; border: 2px solid var(--line); }
.btn.ghost:active { transform: translateY(1px); }
.btn.text { background: none; box-shadow: none; color: var(--muted); min-height: 44px; font-weight: 600; letter-spacing: .02em; }
.btn.small { min-height: 40px; padding: 0 16px; font-size: 15px; border-radius: 12px; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border: 0; background: none; border-radius: 12px; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 24px; height: 24px; }

/* ---------- 学习路线 ---------- */
.hud { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.hud.scrolled { border-bottom-color: var(--line); }
.hud-inner { max-width: 640px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 10px; }
.hud .lvl { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.seal { width: 38px; height: 38px; border-radius: 10px; background: var(--seal); color: #fff; display: grid; place-items: center; font-family: var(--serif); font-weight: 700; font-size: 18px; flex: none; box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.lvl-name { font-family: var(--serif); font-weight: 700; font-size: 15px; line-height: 1.2; }
.bar { height: 8px; border-radius: 4px; background: var(--bg-2); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--brand-2), var(--brand)); transition: width .8s var(--ease-out); }
.hud .bar { margin-top: 5px; max-width: 160px; }
.stat { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 15px; color: var(--ink-2); padding: 6px 8px; border-radius: 10px; }
.stat svg { width: 22px; height: 22px; }
.stat.fire { color: #e0762b; }
.stat.xp { color: var(--gold); }

.unit { margin: 26px 0 8px; }
.unit-head {
  position: relative; overflow: hidden; border-radius: var(--radius); padding: 18px 20px; color: #fff;
  background: linear-gradient(135deg, var(--u1, #1f5160), var(--u2, #2d7a8a)); box-shadow: var(--shadow);
}
.unit-head .k { font-size: 13px; opacity: .85; letter-spacing: .12em; }
.unit-head h2 { font-family: var(--serif); font-size: 22px; margin: 2px 0 4px; letter-spacing: .06em; }
.unit-head p { margin: 0; font-size: 14px; opacity: .9; max-width: 30em; }
.unit-head .waves { position: absolute; right: -10px; bottom: -6px; width: 180px; opacity: .22; pointer-events: none; }
.unit-head .skip { margin-top: 12px; background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 10px; padding: 6px 12px; font-size: 13px; font-weight: 600; }
.unit-head .skip:hover { background: rgba(255,255,255,.28); }
.unit.compact { margin: 12px 0; }
.unit.compact .unit-head { padding: 14px 16px; }
.unit.compact h2 { font-size: 18px; margin: 0; }
.unit.locked .unit-head { background: var(--surface); color: var(--muted); border: 2px dashed var(--line); box-shadow: none; }
.unit.locked .unit-head .k { opacity: 1; }
.unit.locked .skip { background: var(--surface-2); color: var(--brand); border-color: var(--line); }
.unit.finished .unit-head { padding: 0; }
.row-head { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: none; border: 0; color: inherit; padding: 0; }
.unit-toggle { padding: 14px 16px; border-radius: inherit; }
.row-head > div { flex: 1; min-width: 0; }
.lock-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.18); flex: none; }
.unit.locked .lock-ic { background: var(--surface-2); }
.lock-ic svg { width: 20px; height: 20px; }
.chev { font-size: 13px; font-weight: 700; opacity: .9; padding: 4px 10px; border-radius: 8px; background: rgba(255,255,255,.18); }

.trail { position: relative; padding: 26px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 40px; }
.node-wrap { position: relative; display: flex; flex-direction: column; align-items: center; transform: translateX(var(--x, 0)); }
.node {
  --c: var(--brand); position: relative; width: 76px; height: 70px; border-radius: 50%; border: 0; background: var(--c); color: var(--on-brand);
  box-shadow: 0 7px 0 color-mix(in srgb, var(--c) 65%, #000); display: grid; place-items: center;
  transition: transform .12s, box-shadow .12s;
}
.node svg { width: 34px; height: 34px; }
.node:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 2px 0 color-mix(in srgb, var(--c) 65%, #000); }
.node.done { --c: var(--gold); }
.node.locked { --c: var(--locked); color: color-mix(in srgb, var(--ink) 40%, transparent); cursor: not-allowed; }
.node.practice { width: 88px; height: 80px; border-radius: 26px; }
.node.current::before {
  content: ""; position: absolute; inset: -10px; border-radius: inherit; border: 4px solid color-mix(in srgb, var(--c) 35%, transparent);
  animation: ring 2s var(--ease) infinite;
}
@keyframes ring { 0% { transform: scale(.92); opacity: 1; } 70%,100% { transform: scale(1.18); opacity: 0; } }
.node-label { margin-top: 12px; font-size: 13px; color: var(--ink-2); text-align: center; max-width: 9em; line-height: 1.35; }
.node.locked + .node-label { color: var(--muted); }
.bubble {
  position: absolute; bottom: calc(100% + 14px); left: 50%; transform: translateX(-50%); white-space: nowrap; z-index: 2;
  background: var(--surface); color: var(--brand); border: 2px solid var(--line); border-radius: 12px; padding: 6px 14px;
  font-weight: 800; letter-spacing: .1em; font-size: 14px; animation: bob 1.8s var(--ease) infinite; box-shadow: var(--shadow-sm);
}
.bubble::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -7px; border: 7px solid transparent; border-top-color: var(--line); }
@keyframes bob { 0%,100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -5px); } }

/* 课程预览弹层 */
.pop-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(16,22,28,.42); display: grid; place-items: end center; animation: fade .2s both; }
@media (min-width: 640px) { .pop-backdrop { place-items: center; } }
.pop {
  width: min(520px, 100%); background: var(--surface); border-radius: 24px 24px 0 0; padding: 24px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow); animation: sheetUp .38s var(--ease-out) both;
}
@media (min-width: 640px) { .pop { border-radius: 24px; animation-name: popIn; } }
.pop h3 { font-family: var(--serif); font-size: 22px; margin: 0 0 6px; letter-spacing: .04em; }
.pop .meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: 13px; }
.chip svg { width: 15px; height: 15px; }
.pop .actions { display: grid; gap: 10px; }
@keyframes fade { from { opacity: 0; } }
@keyframes sheetUp { from { transform: translateY(100%); } }
@keyframes popIn { from { transform: scale(.94); opacity: 0; } }

/* ---------- 学习播放器 ---------- */
.player { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: flex; flex-direction: column; animation: playerIn .4s var(--ease-out) both; }
@keyframes playerIn { from { opacity: 0; transform: scale(.985); } }
.player-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; max-width: 720px; width: 100%; margin: 0 auto; }
.player-top .bar { flex: 1; height: 14px; border-radius: 7px; }
.player-top .bar > i { background: linear-gradient(90deg, var(--ok), color-mix(in srgb, var(--ok) 70%, #7be0b8)); position: relative; }
.player-top .bar > i::after { content: ""; position: absolute; left: 8px; right: 8px; top: 3px; height: 3px; border-radius: 2px; background: rgba(255,255,255,.35); }
.player-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.stage { max-width: 600px; margin: 0 auto; padding: 8px 20px 24px; min-height: 100%; display: flex; flex-direction: column; }
.step { animation: stepIn .45s var(--ease-out) both; }
.step.leaving { animation: stepOut .22s ease-in both; }
@keyframes stepIn { from { opacity: 0; transform: translateX(36px); } }
@keyframes stepOut { to { opacity: 0; transform: translateX(-36px); } }
.kicker { font-size: 13px; font-weight: 800; letter-spacing: .14em; color: var(--brand-2); margin: 12px 0 4px; }
.kicker.review { color: var(--seal); }
.step h2 { font-family: var(--serif); font-size: clamp(22px, 5.6vw, 27px); line-height: 1.4; margin: 0 0 14px; letter-spacing: .03em; }
.step .lead { font-size: 18px; line-height: 1.85; color: var(--ink-2); margin: 0 0 12px; }
.step .lead b, .step .lead strong { color: var(--ink); }
.visual { margin: 18px 0 8px; display: flex; justify-content: center; }
.visual svg { max-width: 100%; height: auto; }

.options { display: grid; gap: 12px; margin-top: 10px; }
.opt {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 14px 16px; min-height: 60px;
  border-radius: 16px; border: 2px solid var(--line); background: var(--surface); box-shadow: 0 3px 0 var(--line);
  font-size: 17px; line-height: 1.5; transition: border-color .15s, background .15s, transform .1s, box-shadow .1s;
}
.opt:hover:not(:disabled) { border-color: color-mix(in srgb, var(--brand-2) 45%, var(--line)); }
.opt:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.opt .key { flex: none; width: 30px; height: 30px; border-radius: 9px; border: 2px solid var(--line); display: grid; place-items: center; font-size: 13px; font-weight: 800; color: var(--muted); }
.opt[aria-pressed="true"] { border-color: var(--brand-2); background: var(--brand-soft); box-shadow: 0 3px 0 var(--brand-2); }
.opt[aria-pressed="true"] .key { border-color: var(--brand-2); color: var(--brand); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); box-shadow: 0 3px 0 var(--ok); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); box-shadow: 0 3px 0 var(--bad); animation: shake .4s; }
.opt:disabled { cursor: default; }
@keyframes shake { 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }
.tf { grid-template-columns: 1fr 1fr; }
.tf .opt { justify-content: center; font-weight: 800; font-size: 19px; letter-spacing: .2em; min-height: 76px; }

.num-input { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.num-input input {
  flex: 1; min-width: 0; height: 64px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); padding: 0 18px;
  font: 700 26px/1 var(--mono); text-align: right; transition: border-color .2s;
}
.num-input input:focus { outline: none; border-color: var(--brand-2); }
.num-input .unit { font-weight: 700; color: var(--ink-2); font-size: 18px; }
.num-input.right input { border-color: var(--ok); background: var(--ok-soft); }
.num-input.wrong input { border-color: var(--bad); background: var(--bad-soft); animation: shake .4s; }
.hint { font-size: 14px; color: var(--muted); margin-top: 10px; }

.classify .card-stack { position: relative; min-height: 120px; margin: 10px 0 18px; }
.classify .item {
  border-radius: 18px; background: var(--surface); border: 2px solid var(--line); box-shadow: var(--shadow); padding: 20px;
  font-size: 18px; font-weight: 600; line-height: 1.6; text-align: center; animation: cardIn .4s var(--ease-out) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(.97); } }
.classify .item.fly-ok { animation: flyOk .5s var(--ease) forwards; }
@keyframes flyOk { to { opacity: 0; transform: translateY(40px) scale(.9); } }
.buckets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.bucket { border-radius: 16px; border: 2px solid var(--line); background: var(--surface); box-shadow: 0 3px 0 var(--line); padding: 12px 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 92px; justify-content: center; transition: transform .1s, border-color .15s; }
.bucket b { font-size: 16px; }
.bucket small { color: var(--muted); font-size: 12px; line-height: 1.3; text-align: center; }
.bucket .cnt { font-family: var(--mono); font-size: 12px; color: var(--brand-2); min-height: 16px; }
.bucket:active:not(:disabled) { transform: translateY(2px); }
.bucket.flash-ok { border-color: var(--ok); background: var(--ok-soft); }
.bucket.flash-bad { border-color: var(--bad); background: var(--bad-soft); animation: shake .4s; }
.mini-fb { font-size: 15px; margin-top: 12px; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); color: var(--ink-2); animation: cardIn .3s both; }

.seq-slots { display: grid; gap: 8px; margin: 12px 0 16px; }
.seq-slot { min-height: 52px; border-radius: 14px; border: 2px dashed var(--line); display: flex; align-items: center; gap: 12px; padding: 8px 14px; color: var(--muted); }
.seq-slot.filled { border-style: solid; border-color: var(--brand-2); background: var(--brand-soft); color: var(--ink); animation: cardIn .3s both; }
.seq-slot .n { width: 26px; height: 26px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 800; font-size: 13px; color: var(--brand); flex: none; }
.seq-pool { display: flex; flex-wrap: wrap; gap: 10px; }
.seq-pool .opt { width: auto; min-height: 48px; padding: 8px 14px; font-size: 16px; }
.seq-pool .opt.used { visibility: hidden; }

/* 底部操作栏与反馈面板 */
.player-foot { border-top: 2px solid var(--line); background: var(--surface); transition: background .25s, border-color .25s; }
.player-foot-inner { max-width: 600px; margin: 0 auto; padding: 16px 20px calc(16px + env(safe-area-inset-bottom)); }
.player-foot.ok { background: var(--ok-soft); border-color: transparent; }
.player-foot.bad { background: var(--bad-soft); border-color: transparent; }
.fb { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; animation: fbIn .35s var(--ease-out) both; }
@keyframes fbIn { from { opacity: 0; transform: translateY(16px); } }
.fb .icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface); }
.fb .icon svg { width: 26px; height: 26px; }
.fb h3 { margin: 0 0 2px; font-size: 20px; letter-spacing: .06em; }
.fb p { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.7; }
.player-foot.ok .fb h3, .player-foot.ok .fb .icon { color: var(--ok); }
.player-foot.bad .fb h3, .player-foot.bad .fb .icon { color: var(--bad); }

/* 完成页 */
.done-screen { text-align: center; padding-top: 6vh; }
.done-screen h2 { font-family: var(--serif); font-size: 30px; margin: 18px 0 6px; letter-spacing: .08em; }
.done-art { width: 160px; height: 160px; margin: 0 auto; }
.done-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 26px 0; }
.done-stats div { border-radius: 16px; border: 2px solid var(--line); padding: 10px 6px; background: var(--surface); animation: cardIn .5s var(--ease-out) both; }
.done-stats div:nth-child(2) { animation-delay: .1s; } .done-stats div:nth-child(3) { animation-delay: .2s; }
.done-stats small { display: block; color: var(--muted); font-size: 12px; letter-spacing: .1em; }
.done-stats b { font-size: 22px; }
.newcards { text-align: left; margin: 10px 0 0; }
.newcards h4 { margin: 0 0 8px; font-size: 14px; color: var(--muted); letter-spacing: .12em; }
.term-chip { display: inline-block; margin: 0 6px 6px 0; padding: 6px 12px; border-radius: 10px; background: var(--gold-soft); color: var(--ink); font-weight: 700; animation: flipIn .5s var(--ease-out) both; }
@keyframes flipIn { from { opacity: 0; transform: rotateX(80deg); } }

.ripple { transform-origin: center; animation: ripple 2.4s var(--ease) infinite; }
.ripple.d2 { animation-delay: .8s; } .ripple.d3 { animation-delay: 1.6s; }
@keyframes ripple { 0% { transform: scale(.5); opacity: .9; } 100% { transform: scale(1.25); opacity: 0; } }
.stamp { animation: stamp .6s var(--ease-out) .15s both; transform-origin: center; }
@keyframes stamp { 0% { transform: scale(2.2) rotate(-12deg); opacity: 0; } 60% { transform: scale(.94) rotate(-4deg); opacity: 1; } 100% { transform: scale(1) rotate(-4deg); } }

/* 升级层 */
.levelup { position: fixed; inset: 0; z-index: 60; background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--brand) 92%, #000), var(--brand)); color: #fff; display: grid; place-items: center; text-align: center; padding: 24px; animation: fade .3s both; }
.levelup h2 { font-family: var(--serif); font-size: 40px; letter-spacing: .3em; margin: 16px 0 8px; }
.levelup p { opacity: .9; max-width: 24em; margin: 0 auto 28px; }
.levelup .seal { width: 96px; height: 96px; font-size: 44px; border-radius: 22px; margin: 0 auto; animation: stamp .7s var(--ease-out) both; }

/* ---------- 通用卡片 ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 14px; }
.card h3 { margin: 0 0 6px; font-size: 17px; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.empty svg { width: 120px; height: 120px; display: block; margin: 0 auto 10px; }

.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 14px 0; }
.stats-grid .card { margin: 0; padding: 14px 16px; }
.stats-grid b { display: block; font-size: 24px; }
.stats-grid small { color: var(--muted); }

/* 词卡 */
.search { width: 100%; height: 48px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); padding: 0 16px; margin-bottom: 16px; }
.search:focus { outline: none; border-color: var(--brand-2); }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tcard { perspective: 900px; height: 160px; border: 0; padding: 0; background: none; text-align: left; }
.tcard .inner { position: relative; width: 100%; height: 100%; transition: transform .55s var(--ease-out); transform-style: preserve-3d; }
.tcard.flipped .inner { transform: rotateY(180deg); }
.tcard .face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 16px; padding: 14px; display: flex; flex-direction: column; border: 2px solid var(--line); background: var(--surface); box-shadow: 0 3px 0 var(--line); overflow: hidden; }
.tcard .front { justify-content: space-between; }
.tcard .front b { font-family: var(--serif); font-size: 22px; letter-spacing: .04em; }
.tcard .front small { color: var(--muted); font-size: 12px; }
.tcard .back { transform: rotateY(180deg); font-size: 14px; line-height: 1.6; color: var(--ink-2); background: var(--brand-soft); }
.tcard.locked .face { background: var(--surface-2); border-style: dashed; box-shadow: none; color: var(--muted); align-items: center; justify-content: center; }

/* 欢迎页 */
.welcome { min-height: 100dvh; display: flex; flex-direction: column; max-width: 520px; margin: 0 auto; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); }
.welcome .grow { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.welcome h1 { font-family: var(--serif); font-size: 46px; letter-spacing: .4em; margin: 18px 0 4px; text-align: center; padding-left: .4em; }
.welcome .tagline { text-align: center; color: var(--ink-2); font-size: 18px; margin: 0 0 6px; }
.welcome .quote { text-align: center; color: var(--muted); font-family: var(--serif); font-size: 14px; letter-spacing: .2em; }
.welcome .hero-art { width: 200px; margin: 0 auto; }
.welcome .actions { display: grid; gap: 12px; }
.welcome h2 { font-family: var(--serif); font-size: 26px; margin: 0 0 18px; line-height: 1.45; }
.dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 18px; }
.dots i { width: 8px; height: 8px; border-radius: 4px; background: var(--line); transition: width .3s, background .3s; }
.dots i.on { width: 22px; background: var(--brand); }

/* ---------- 实战 ---------- */
.sim-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sim-day { font-family: var(--serif); font-size: 24px; font-weight: 700; letter-spacing: .06em; }
.quote-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 4px 0 10px; }
.quote-row .px { font: 700 34px/1 var(--mono); }
.quote-row .chg { font: 700 17px/1 var(--mono); }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-weight: 700; letter-spacing: .06em; }
.tag.syn { background: var(--gold-soft); color: var(--gold); }
.tag.lock { background: var(--bad-soft); color: var(--bad); }
.chart-box { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 10px 8px 4px; }
.chart-box svg { width: 100%; height: auto; display: block; }
.c-up { fill: var(--up); stroke: var(--up); } .c-down { fill: var(--down); stroke: var(--down); } .c-flat { fill: var(--muted); stroke: var(--muted); }
.c-axis { fill: var(--muted); font: 10px var(--mono); }
.c-grid { stroke: var(--line); }
.c-new { animation: candleIn .7s var(--ease-out) both; transform-box: fill-box; transform-origin: bottom; }
@keyframes candleIn { from { opacity: 0; transform: scaleY(.2); } }
.news { margin-top: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--gold); padding: 14px 16px; animation: cardIn .45s var(--ease-out) both; }
.news h3 { font-family: var(--serif); font-size: 18px; margin: 4px 0 6px; line-height: 1.45; }
.news p { margin: 0; font-size: 15.5px; color: var(--ink-2); line-height: 1.8; }
.acct { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.acct div { background: var(--surface-2); border-radius: 12px; padding: 8px 10px; }
.acct small { display: block; color: var(--muted); font-size: 12px; }
.acct b { font: 700 15px/1.3 var(--mono); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 12px; }
.seg button { min-height: 48px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); font-weight: 800; letter-spacing: .1em; box-shadow: 0 3px 0 var(--line); transition: all .15s; }
.seg button[aria-pressed="true"] { border-color: var(--brand-2); background: var(--brand-soft); color: var(--brand); box-shadow: 0 3px 0 var(--brand-2); }
.seg button[data-side="buy"][aria-pressed="true"] { border-color: var(--up); color: var(--up); background: color-mix(in srgb, var(--up) 10%, var(--surface)); box-shadow: 0 3px 0 var(--up); }
.seg button[data-side="sell"][aria-pressed="true"] { border-color: var(--down); color: var(--down); background: color-mix(in srgb, var(--down) 10%, var(--surface)); box-shadow: 0 3px 0 var(--down); }
.qty-row { display: flex; align-items: center; gap: 8px; }
.qty-row .step-btn { width: 48px; height: 48px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); font-size: 22px; font-weight: 700; }
.qty-row output { flex: 1; text-align: center; font: 700 24px/48px var(--mono); border-radius: 14px; background: var(--surface-2); }
.presets { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.presets button { border: 2px solid var(--line); background: var(--surface); border-radius: 10px; padding: 6px 12px; font-weight: 700; font-size: 14px; }
.est { font-size: 14px; color: var(--ink-2); background: var(--surface-2); border-radius: 12px; padding: 10px 12px; line-height: 1.7; }
.est .warn { color: var(--bad); font-weight: 700; }
.night { position: fixed; inset: 0; z-index: 70; background: linear-gradient(180deg, #0d1620, #1f3b4a); color: #e8eef0; display: grid; place-items: center; text-align: center; animation: night 1.5s ease both; pointer-events: none; }
.night b { font-family: var(--serif); font-size: 30px; letter-spacing: .3em; display: block; }
.night small { opacity: .7; letter-spacing: .2em; }
@keyframes night { 0% { opacity: 0; } 25%,70% { opacity: 1; } 100% { opacity: 0; } }
.fill { margin-top: 14px; border-radius: 16px; padding: 14px 16px; border: 2px solid var(--ok); background: var(--ok-soft); animation: cardIn .45s var(--ease-out) both; }
.fill.rej { border-color: var(--bad); background: var(--bad-soft); }
.fill h3 { margin: 0 0 4px; font-size: 17px; }
.fill p { margin: 0; font-size: 14.5px; color: var(--ink-2); line-height: 1.7; }
.goal-list { list-style: none; padding: 0; margin: 10px 0 0; }
.goal-list li { display: flex; gap: 10px; align-items: center; padding: 6px 0; color: var(--ink-2); }
.goal-list li i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; flex: none; font-style: normal; font-size: 13px; }
.goal-list li.ok i { background: var(--ok); border-color: var(--ok); color: #fff; }
.goal-list li.ok { color: var(--ink); }
details.more { margin-top: 12px; }
details.more summary { cursor: pointer; color: var(--brand); font-weight: 700; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "＋ "; }
details.more[open] summary::before { content: "－ "; }
details.more .body { margin-top: 8px; color: var(--ink-2); font-size: 15px; line-height: 1.8; }

/* 弹窗与提示 */
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(16,22,28,.5); display: grid; place-items: center; padding: 20px; animation: fade .2s both; }
.modal .box { width: min(420px, 100%); background: var(--surface); border-radius: 22px; padding: 24px 20px 18px; box-shadow: var(--shadow); animation: popIn .3s var(--ease-out) both; text-align: center; }
.modal h3 { font-family: var(--serif); font-size: 21px; margin: 0 0 8px; }
.modal p { color: var(--ink-2); margin: 0 0 20px; }
.modal .row { display: grid; gap: 10px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 18px); z-index: 90; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; animation: toast 2.4s var(--ease-out) both; white-space: nowrap; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 12px); } 12%,85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

/* 小部件 */
.w-ticker { width: min(360px, 100%); border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 16px 18px; }
.w-ticker .name { font-weight: 700; } .w-ticker .code { color: var(--muted); font-size: 13px; margin-left: 6px; }
.w-ticker .px { font: 700 40px/1.2 var(--mono); margin-top: 6px; }
.w-ticker .row { display: flex; gap: 14px; font: 600 15px var(--mono); }
.w-ticker .rows { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--muted); }
.w-ticker .rows b { color: var(--ink); font-family: var(--mono); float: right; }
.w-formula { width: min(420px, 100%); border-radius: 18px; background: var(--brand-soft); padding: 16px 18px; text-align: center; }
.w-formula .f { font-family: var(--serif); font-size: 19px; font-weight: 700; }
.w-formula .eg { margin-top: 8px; font-family: var(--mono); color: var(--ink-2); font-size: 15px; }
.w-flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; width: 100%; }
.w-flow div { position: relative; text-align: center; padding: 12px 4px; border-radius: 14px; background: var(--surface); border: 2px solid var(--line); font-size: 14px; font-weight: 700; animation: cardIn .4s var(--ease-out) both; }
.w-flow div small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; line-height: 1.3; margin-top: 2px; }
.w-flow div:nth-child(2) { animation-delay: .15s; } .w-flow div:nth-child(3) { animation-delay: .3s; } .w-flow div:nth-child(4) { animation-delay: .45s; border-color: var(--ok); }
.w-fees { width: min(420px, 100%); display: grid; gap: 10px; }
.w-fees .r { display: grid; grid-template-columns: 76px 1fr; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; animation: cardIn .4s var(--ease-out) both; }
.w-fees .r:nth-child(2) { animation-delay: .12s; } .w-fees .r:nth-child(3) { animation-delay: .24s; }
.w-fees b { font-family: var(--serif); font-size: 17px; }
.w-fees small { color: var(--ink-2); font-size: 13.5px; line-height: 1.5; }
.w-hours { width: 100%; }
.w-badges { display: flex; gap: 14px; justify-content: center; }
.w-badges div { width: 130px; border-radius: 18px; padding: 16px 10px; text-align: center; color: #fff; animation: cardIn .45s var(--ease-out) both; }
.w-badges div:nth-child(2) { animation-delay: .12s; }
.w-badges b { display: block; font-family: var(--serif); font-size: 34px; }
.w-badges small { opacity: .9; font-size: 12.5px; line-height: 1.4; display: block; }
.w-buckets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.w-buckets div { border-radius: 14px; padding: 12px 8px; text-align: center; background: var(--surface); border: 2px solid var(--line); animation: cardIn .4s var(--ease-out) both; }
.w-buckets div:nth-child(2) { animation-delay: .12s; } .w-buckets div:nth-child(3) { animation-delay: .24s; }
.w-buckets b { display: block; font-family: var(--serif); font-size: 19px; }
.w-buckets small { color: var(--muted); font-size: 12px; line-height: 1.4; display: block; }
.w-grid2 { display: grid; grid-template-columns: auto 1fr 1fr; gap: 6px; width: min(420px, 100%); font-size: 13.5px; text-align: center; }
.w-grid2 > div { border-radius: 12px; padding: 10px 6px; background: var(--surface); border: 1px solid var(--line); }
.w-grid2 .h { background: none; border: 0; font-weight: 700; color: var(--muted); display: grid; place-items: center; }
.w-grid2 .g { background: var(--ok-soft); } .w-grid2 .b { background: var(--bad-soft); } .w-grid2 .m { background: var(--gold-soft); }
.grow-bar { transform-box: fill-box; transform-origin: bottom; animation: growUp .9s var(--ease-out) both; }
@keyframes growUp { from { transform: scaleY(0); } }
.tilt { transform-origin: 160px 64px; animation: tilt 2.6s var(--ease) infinite alternate; }
@keyframes tilt { from { transform: rotate(-9deg); } to { transform: rotate(-3deg); } }
.pulse { transform-box: fill-box; transform-origin: center; animation: pulse 1.6s var(--ease) infinite; }
@keyframes pulse { 50% { transform: scale(1.18); } }
.tap-zone { cursor: pointer; }
.tap-zone:hover .hl, .tap-zone:focus .hl { opacity: .18; }
.hl { fill: var(--brand-2); opacity: 0; transition: opacity .15s; }
.tap-zone.picked .hl { opacity: .3; }
.tap-zone.right .hl { fill: var(--ok); opacity: .35; }
.tap-zone.wrong .hl { fill: var(--bad); opacity: .35; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ===================== v2.1 视觉升级：玻璃质感、渐变、平滑过渡 ===================== */
:root {
  --glass: color-mix(in srgb, var(--surface) 78%, transparent);
  --glass-line: color-mix(in srgb, var(--line) 75%, transparent);
  --radius: 22px;
  --grad-brand: linear-gradient(135deg, #1b4a58 0%, #2b7486 55%, #3a8d88 100%);
  --grad-warm: linear-gradient(135deg, #c23b2c, #e0763b);
  --hi: rgba(255,255,255,.55);
}
@media (prefers-color-scheme: dark) {
  :root { --grad-brand: linear-gradient(135deg, #133b46 0%, #1f5f6d 55%, #276f6c 100%); --hi: rgba(255,255,255,.05); }
}
body {
  background:
    radial-gradient(900px 520px at 0% -8%, color-mix(in srgb, var(--brand-2) 20%, transparent), transparent 70%),
    radial-gradient(760px 480px at 110% 4%, color-mix(in srgb, var(--seal) 12%, transparent), transparent 70%),
    radial-gradient(900px 600px at 50% 120%, color-mix(in srgb, var(--gold) 12%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
.card { background: var(--glass); -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%); border-color: var(--glass-line); border-radius: var(--radius); box-shadow: inset 0 1px 0 var(--hi), var(--shadow); }
.btn { background: linear-gradient(180deg, color-mix(in srgb, var(--b) 80%, #fff) 0%, var(--b) 62%); box-shadow: 0 4px 0 color-mix(in srgb, var(--b) 62%, #000), 0 12px 24px -12px color-mix(in srgb, var(--b) 70%, transparent); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.text { background: none; box-shadow: none; }
.btn:disabled { background: var(--locked); box-shadow: none; }

/* 头部栏 */
.hud { background: color-mix(in srgb, var(--bg) 70%, transparent); -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%); }

/* 手机底部：悬浮玻璃导航 + 滑动指示 */
.nav-pill { display: none; }
@media (max-width: 899px) {
  .nav {
    left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); height: var(--nav-h); padding: 0 6px;
    border-radius: 24px; border: 1px solid var(--glass-line); background: var(--glass);
    -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
    box-shadow: inset 0 1px 0 var(--hi), 0 14px 34px -12px rgba(16,22,28,.4);
  }
  .nav-pill { display: block; position: absolute; top: 7px; bottom: 7px; left: 6px; width: calc((100% - 12px) / var(--n)); border-radius: 17px; background: var(--brand-soft); transform: translateX(calc(var(--i) * 100%)); transition: transform .5s var(--ease-out); }
  .nav a { z-index: 1; }
  .nav .badge { top: 6px; }
  .main { padding-bottom: calc(var(--nav-h) + 44px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(var(--nav-h) + 30px); }
}

/* 首页顶部卡片 */
.hero-card {
  position: relative; overflow: hidden; isolation: isolate; border-radius: 28px; padding: 18px 18px 16px; color: #fff;
  background: var(--grad-brand); box-shadow: 0 22px 44px -22px rgba(27,74,88,.75); margin: 4px 0 10px; animation: heroIn .7s var(--ease-out) both;
}
@keyframes heroIn { from { opacity: 0; transform: translateY(16px) scale(.98); } }
.hero-card::before { content: ""; position: absolute; top: -90px; right: -60px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.24), transparent 65%); z-index: -1; }
.hero-card::after { content: ""; position: absolute; bottom: -70px; left: -50px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, rgba(224,118,59,.35), transparent 65%); z-index: -1; }
.hero-waves { position: absolute; left: 0; bottom: -4px; width: 200%; height: 66px; display: flex; opacity: .2; z-index: -1; animation: drift 16s linear infinite; }
.hero-waves .waves { position: static; width: 50%; height: 66px; opacity: 1; animation: none; }
@keyframes drift { to { transform: translateX(-50%); } }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.greet { font-family: var(--serif); font-size: 16px; letter-spacing: .14em; }
.hero-stats { display: flex; gap: 8px; }
.hero-stats span { display: inline-flex; align-items: center; gap: 4px; background: rgba(255,255,255,.15); padding: 3px 10px; border-radius: 999px; font-size: 13px; }
.hero-stats svg { width: 15px; height: 15px; }
.hero-main { display: flex; align-items: center; gap: 14px; margin: 14px 0 16px; color: inherit; text-decoration: none; }
.hero-main small { opacity: .8; font-size: 12px; letter-spacing: .14em; }
.hero-main b { display: block; font-size: 30px; letter-spacing: .16em; line-height: 1.2; }
.hero-main p { margin: 3px 0 0; font-size: 13px; opacity: .9; line-height: 1.5; }
.ring { width: 84px; height: 84px; flex: none; }
.ring-bg { fill: rgba(255,255,255,.1); stroke: rgba(255,255,255,.22); stroke-width: 7; }
.ring-fg { fill: none; stroke: #ffd27a; stroke-width: 7; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 42px 42px; animation: ringIn 1.3s var(--ease-out) .2s both; }
@keyframes ringIn { from { stroke-dashoffset: var(--c); } }
.ring text { fill: #fff; font: 700 26px var(--serif); }
.btn.hero-go { --b: #ffffff; background: #fff; color: #17505d; justify-content: flex-start; gap: 10px; font-size: 16px; letter-spacing: .04em; box-shadow: 0 4px 0 rgba(0,0,0,.2), 0 14px 26px -12px rgba(0,0,0,.45); }
.hero-go svg { width: 14px; height: 14px; padding: 6px; border-radius: 50%; background: var(--seal); color: #fff; box-sizing: content-box; flex: none; }
.hero-go span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 单元与节点 */
.unit-head { border-radius: 24px; box-shadow: 0 16px 32px -18px color-mix(in srgb, var(--u1, #1f5160) 85%, transparent); }
.unit-head .waves { animation: waveMove 7s ease-in-out infinite alternate; }
@keyframes waveMove { to { transform: translateX(-26px); } }
.unit.locked .unit-head { background: var(--glass); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.unit { animation: cardIn .5s var(--ease-out) both; }
.node { background: radial-gradient(circle at 32% 26%, color-mix(in srgb, var(--c) 52%, #fff) 0%, var(--c) 56%, color-mix(in srgb, var(--c) 82%, #000) 100%); transition: transform .18s var(--ease-out), box-shadow .18s; }
.node:hover:not(.locked) { transform: translateY(-3px); }
.node-wrap { animation: nodeIn .55s var(--ease-out) both; animation-delay: calc(var(--k, 0) * 70ms + .15s); }
@keyframes nodeIn { from { opacity: 0; transform: translateX(var(--x, 0)) scale(.5); } }
.bubble { background: var(--glass); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }

/* 学习播放器 */
.options .opt { animation: optIn .45s var(--ease-out) both; }
.options .opt.wrong { animation: shake .4s; }
@keyframes optIn { from { opacity: 0; transform: translateY(12px); } }
.opt { background: var(--glass); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.opt:hover:not(:disabled) { transform: translateY(-1px); }
@keyframes stepIn { from { opacity: 0; transform: translateX(44px) scale(.985); filter: blur(3px); } }
@keyframes stepOut { to { opacity: 0; transform: translateX(-44px) scale(.985); filter: blur(3px); } }
.player { background: var(--bg); background-image: radial-gradient(700px 400px at 100% 0%, color-mix(in srgb, var(--brand-2) 14%, transparent), transparent 70%); }
.player.closing { animation: playerOut .24s ease-in both; }
@keyframes playerOut { to { opacity: 0; transform: scale(.985) translateY(10px); } }
.player-foot { background: var(--glass); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.player-foot.ok, .player-foot.bad { animation: footUp .35s var(--ease-out) both; }
@keyframes footUp { from { transform: translateY(24px); } }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 13px; border-radius: 3px; opacity: 0; animation: fall var(--d) cubic-bezier(.2,.6,.4,1) var(--t) forwards; }
@keyframes fall { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 100% { opacity: 0; transform: translate(var(--dx), 78vh) rotate(var(--r)); } }
.done-screen { position: relative; z-index: 1; }
.pop { background: var(--surface); }
.pop::before { content: ""; display: block; width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: -10px auto 16px; }
@media (min-width: 640px) { .pop::before { display: none; } }

/* 欢迎页 */
.welcome h1 { background: linear-gradient(120deg, var(--brand), var(--seal)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* 往事 */
.chart-hero { padding: 12px 10px 10px; }
.draw-line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: drawLine 2.4s var(--ease-out) .2s forwards; }
@keyframes drawLine { to { stroke-dashoffset: 0; } }
.area-in { animation: fade 1.6s .9s both; }
.chapters { list-style: none; padding: 0; margin: 22px 0; position: relative; }
.chapters::before { content: ""; position: absolute; left: 21px; top: 10px; bottom: 10px; width: 2px; background: linear-gradient(var(--seal), var(--brand-2)); opacity: .35; }
.chapter { position: relative; display: grid; grid-template-columns: 44px 1fr; gap: 12px; margin-bottom: 16px; animation: cardIn .55s var(--ease-out) both; }
.chapter .dot { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--grad-warm); color: #fff; box-shadow: 0 10px 20px -10px rgba(194,59,44,.8); z-index: 1; }
.chapter .dot svg { width: 20px; height: 20px; }
.chapter .dot b { font: 700 18px var(--serif); }
.chapter.done .dot { background: linear-gradient(135deg, #c08a1e, #e0b250); }
.chapter.locked .dot { background: var(--locked); box-shadow: none; color: color-mix(in srgb, var(--ink) 45%, transparent); }
.chapter-body { background: var(--glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border: 1px solid var(--glass-line); border-radius: 20px; padding: 14px 16px; box-shadow: inset 0 1px 0 var(--hi), var(--shadow); }
.chapter.locked .chapter-body { opacity: .65; }
.chapter-body small { color: var(--muted); letter-spacing: .08em; font-size: 12px; }
.chapter-body h3 { font-family: var(--serif); font-size: 19px; margin: 2px 0 4px; letter-spacing: .04em; }
.chapter-body > p { margin: 0 0 10px; color: var(--ink-2); font-size: 14.5px; }
.events { margin-top: 14px; display: grid; gap: 8px; }
.evt { display: grid; grid-template-columns: 76px 1fr; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); animation: cardIn .4s var(--ease-out) both; }
.evt .y { color: var(--seal); font-weight: 700; font-size: 12.5px; padding-top: 2px; }
.evt b { font-size: 15px; }
.evt p { margin: 2px 0 0; font-size: 13.5px; line-height: 1.65; color: var(--ink-2); }

/* 底部反馈 */
.site-foot { text-align: center; font-size: 12px; color: var(--muted); padding: 22px 16px 10px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px; opacity: .85; }
.site-foot svg { width: 14px; height: 14px; margin-left: 6px; }
.site-foot a { color: var(--muted); text-underline-offset: 3px; }

/* 页面切换：View Transitions（不支持的浏览器直接切换） */
#view { view-transition-name: page; }
.nav { view-transition-name: nav; }
::view-transition-group(page) { animation-duration: .42s; }
html[data-vt="fwd"]::view-transition-old(page) { animation: vtOutL .26s ease-in both; }
html[data-vt="fwd"]::view-transition-new(page) { animation: vtInR .44s var(--ease-out) both; }
html[data-vt="back"]::view-transition-old(page) { animation: vtOutR .26s ease-in both; }
html[data-vt="back"]::view-transition-new(page) { animation: vtInL .44s var(--ease-out) both; }
@keyframes vtOutL { to { opacity: 0; transform: translateX(-40px); } }
@keyframes vtInR { from { opacity: 0; transform: translateX(40px); } }
@keyframes vtOutR { to { opacity: 0; transform: translateX(40px); } }
@keyframes vtInL { from { opacity: 0; transform: translateX(-40px); } }

@media (prefers-reduced-motion: reduce) {
  .hero-waves, .unit-head .waves { animation: none !important; }
  .draw-line { stroke-dashoffset: 0; }
}.player.closing { pointer-events: none; }
.node-wrap:has(.bubble) { margin-top: 30px; }
:root { --grad-brand: linear-gradient(135deg, #1d2a48 0%, #22506a 52%, #2b7a86 100%); }
@media (prefers-color-scheme: dark) { :root { --grad-brand: linear-gradient(135deg, #151e36 0%, #1a3f53 55%, #1f5f68 100%); } }
