/* ============================================================
   LexiVerse · 词境 — Design System
   深空极光 × 玻璃拟态 × 动效驱动
   ============================================================ */
:root {
  --bg: #06080f;
  --bg-soft: #0b0f1c;
  --ink: #eef2ff;
  --ink-dim: #a6b0d4;
  --ink-faint: #6b7699;
  --line: rgba(255, 255, 255, .08);
  --glass: rgba(255, 255, 255, .045);
  --glass-hi: rgba(255, 255, 255, .09);
  --acc: #8b5cf6;            /* 当前学段主题色, 由 JS 动态覆盖 */
  --acc-2: #22d3ee;
  --acc-soft: rgba(139, 92, 246, .16);
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 11px;
  --font: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --shadow: 0 18px 50px -18px rgba(0, 0, 0, .65);
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font-family: inherit; }
a { color: inherit; text-decoration: none; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }
::selection { background: var(--acc); color: #fff; }

/* ---------------- 背景: 极光 + 星域 ---------------- */
.cosmos { position: fixed; inset: 0; z-index: 0; overflow: hidden; background:
  radial-gradient(1200px 800px at 85% -10%, rgba(139,92,246,.14), transparent 60%),
  radial-gradient(1000px 700px at -10% 110%, rgba(34,211,238,.10), transparent 60%),
  var(--bg); }
.aurora { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%;
  filter: blur(90px); opacity: .5; mix-blend-mode: screen; will-change: transform; }
.aurora-1 { background: radial-gradient(circle at 30% 30%, rgba(139,92,246,.55), transparent 65%); top: -25vmax; right: -15vmax; }
.aurora-2 { background: radial-gradient(circle at 60% 40%, rgba(34,211,238,.4), transparent 65%); bottom: -30vmax; left: -18vmax; }
.aurora-3 { background: radial-gradient(circle at 50% 50%, rgba(244,114,182,.32), transparent 65%); top: 30vmax; left: 38vmax; }
@keyframes drift1 { to { transform: translate(-9vmax, 7vmax) scale(1.15); } }
@keyframes drift2 { to { transform: translate(10vmax, -6vmax) scale(1.1); } }
@keyframes drift3 { to { transform: translate(-7vmax, -8vmax) scale(.9); } }
@keyframes breath { 50% { opacity: .78; } }
html:not(.no-motion) .aurora-1 { animation: drift1 26s ease-in-out infinite alternate, breath 13s ease-in-out infinite; }
html:not(.no-motion) .aurora-2 { animation: drift2 32s ease-in-out infinite alternate, breath 17s ease-in-out infinite; }
html:not(.no-motion) .aurora-3 { animation: drift3 38s ease-in-out infinite alternate, breath 21s ease-in-out infinite; }
/* 偶发流星 */
.cosmos::after { content: ""; position: absolute; top: 10%; left: -18%; width: 200px; height: 1.5px; opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.85), transparent);
  transform: rotate(-30deg); pointer-events: none; }
html:not(.no-motion) .cosmos::after { animation: shoot 9s ease-in infinite 2.5s; }
@keyframes shoot {
  0%, 91% { opacity: 0; transform: translate(0, 0) rotate(-30deg); }
  92.5% { opacity: 1; }
  100% { opacity: 0; transform: translate(135vw, 62vh) rotate(-30deg); } }
#starfield, #fx { position: absolute; inset: 0; width: 100%; height: 100%; }
#fx { pointer-events: none; }

/* ---------------- 布局骨架 ---------------- */
.shell { position: relative; z-index: 1; display: flex; height: 100%; }
.rail {
  width: 88px; flex: none; display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 18px 10px; border-right: 1px solid var(--line);
  background: rgba(8, 10, 20, .55); backdrop-filter: blur(24px);
}
.rail-logo { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 14px; }
.logo-orb { font-size: 30px; filter: drop-shadow(0 0 14px rgba(139,92,246,.8)); animation: bob 5s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px); } }
.logo-text { font-size: 12px; font-weight: 300; letter-spacing: .06em; color: var(--ink-dim); white-space: nowrap; }
.logo-text b { font-weight: 800; color: var(--ink); }
.rail-nav { display: flex; flex-direction: column; gap: 8px; width: 100%; flex: 1; }
.rail-item {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 4px; border-radius: 14px; color: var(--ink-faint);
  transition: all .25s var(--ease); width: 100%;
}
.rail-item svg { width: 21px; height: 21px; }
.rail-item span { font-size: 10.5px; letter-spacing: .04em; }
.rail-item:hover { color: var(--ink); background: var(--glass); }
.rail-item.active { color: #fff; background: linear-gradient(160deg, var(--acc-soft), transparent);
  box-shadow: inset 0 0 0 1px rgba(139,92,246,.35); }
.rail-item.active::before { content: ""; position: absolute; left: -10px; top: 26%; height: 48%; width: 3px;
  border-radius: 99px; background: var(--acc); box-shadow: 0 0 12px var(--acc); }
.rail-item .badge { position: absolute; top: 4px; right: 14px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 99px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; }
.rail-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  color: var(--ink-dim); transition: all .25s; }
.rail-btn:hover { background: var(--glass-hi); color: #fff; }
.rail-btn svg { width: 19px; height: 19px; }
.rail-foot { margin-top: auto; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  flex: none; display: flex; align-items: center; gap: 14px;
  padding: 14px 26px 10px;
}
.crumb { flex: 1; min-width: 0; font-size: 14px; color: var(--ink-faint); display: flex; align-items: center; gap: 8px; }
.crumb b { color: var(--ink); font-weight: 600; font-size: 15px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.glass-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  color: var(--ink-dim); background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(14px); transition: all .25s var(--ease); }
.glass-icon:hover { color: #fff; background: var(--glass-hi); transform: translateY(-1px); }
.glass-icon svg { width: 17px; height: 17px; }
.pill { display: flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 99px;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(14px);
  font-size: 13px; transition: all .25s; }
.pill:hover { background: var(--glass-hi); }
.pill b { font-weight: 700; font-variant-numeric: tabular-nums; }
.pill-ico svg { width: 15px; height: 15px; }
.streak-pill .pill-ico { color: var(--warn); filter: drop-shadow(0 0 6px rgba(251,191,36,.7)); }
.xp-pill { gap: 9px; }
.xp-pill .pill-ico { color: var(--acc-2); filter: drop-shadow(0 0 6px rgba(34,211,238,.7)); }
.xp-meta { display: flex; flex-direction: column; gap: 3px; }
.xp-meta b { font-size: 12.5px; line-height: 1; }
.xp-bar { width: 74px; height: 4px; border-radius: 99px; background: rgba(255,255,255,.1); overflow: hidden; }
.xp-bar i { display: block; height: 100%; width: 0; border-radius: 99px;
  background: linear-gradient(90deg, var(--acc-2), var(--acc)); transition: width .6s var(--ease); }

.view { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 6px 26px 40px;
  scroll-behavior: smooth; }
.view-inner { max-width: 1180px; margin: 0 auto; }
html:not(.no-motion) .view-inner { animation: viewIn .5s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(16px); } }

/* 移动端底部导航 */
.tabbar { display: none; }

/* ---------------- 通用组件 ---------------- */
.glass { background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(18px);
  border-radius: var(--r-lg); box-shadow: var(--shadow); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 14px; font-size: 14.5px; font-weight: 600;
  transition: all .25s var(--ease); white-space: nowrap; user-select: none; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { color: #fff; background: linear-gradient(135deg, var(--acc), var(--acc-2));
  box-shadow: 0 10px 30px -10px var(--acc), inset 0 1px 0 rgba(255,255,255,.25); }
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.1);
  box-shadow: 0 16px 38px -12px var(--acc), inset 0 1px 0 rgba(255,255,255,.25); }
.btn-primary:active { transform: translateY(0) scale(.98); }
.btn-ghost { color: var(--ink-dim); background: var(--glass); border: 1px solid var(--line); }
.btn-ghost:hover { color: #fff; background: var(--glass-hi); }
.btn-danger { color: #fff; background: linear-gradient(135deg, #fb7185, #f43f5e); }
.btn-ok { color: #052e21; background: linear-gradient(135deg, #34d399, #10b981); }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 11px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 99px;
  font-size: 12px; font-weight: 600; background: var(--acc-soft); color: var(--acc);
  border: 1px solid rgba(139,92,246,.3); }
.chip.lv { background: rgba(251,191,36,.12); color: var(--warn); border-color: rgba(251,191,36,.3); }

.stars { display: inline-flex; gap: 2px; }
.stars svg { width: 13px; height: 13px; }
.stars .on { color: var(--warn); fill: var(--warn); }
.stars .off { color: rgba(255,255,255,.16); fill: rgba(255,255,255,.16); }

.sec-title { display: flex; align-items: baseline; gap: 12px; margin: 30px 0 16px; }
.sec-title h2 { font-size: 21px; font-weight: 800; letter-spacing: .01em; }
.sec-title .sub { font-size: 13px; color: var(--ink-faint); }
.sec-title .more { margin-left: auto; font-size: 13px; color: var(--acc-2); display: inline-flex; align-items: center; gap: 4px; }
.sec-title .more:hover { text-decoration: underline; }

/* 进度环 */
.ring { position: relative; width: 54px; height: 54px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .bg { stroke: rgba(255,255,255,.09); }
.ring .fg { stroke: url(#ringGrad); stroke-linecap: round; transition: stroke-dashoffset .8s var(--ease); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 700; }

/* ---------------- 首页 ---------------- */
.hero { position: relative; padding: 34px 34px 30px; border-radius: 26px; overflow: hidden;
  background: linear-gradient(140deg, rgba(139,92,246,.22), rgba(34,211,238,.1) 55%, rgba(255,255,255,.03));
  border: 1px solid rgba(139,92,246,.28); backdrop-filter: blur(18px); }
.hero::after { content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%;
  right: -140px; top: -180px; background: radial-gradient(circle, rgba(139,92,246,.35), transparent 70%);
  filter: blur(10px); }
.hero-hi { font-size: 15px; color: var(--ink-dim); letter-spacing: .02em; }
.hero h1 { font-size: clamp(26px, 4vw, 40px); font-weight: 900; letter-spacing: .01em; margin: 6px 0 10px;
  background: linear-gradient(100deg, #fff 20%, var(--acc-2) 60%, var(--acc));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { font-size: 14.5px; color: var(--ink-dim); max-width: 560px; line-height: 1.7; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.hero-stat { display: flex; align-items: center; gap: 11px; padding: 11px 18px; border-radius: 16px;
  background: rgba(255,255,255,.05); border: 1px solid var(--line); }
.hero-stat .num { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hero-stat .lbl { font-size: 12px; color: var(--ink-faint); }
.hero-stat svg { width: 20px; height: 20px; color: var(--acc-2); }
.hero-cta { position: relative; z-index: 2; display: flex; gap: 12px; margin-top: 24px; }

.goal-strip { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding: 13px 18px;
  border-radius: 16px; background: rgba(255,255,255,.04); border: 1px solid var(--line); font-size: 13px; }
.goal-strip .bar { flex: 1; height: 8px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.goal-strip .bar i { display: block; height: 100%; border-radius: 99px; width: 0;
  background: linear-gradient(90deg, var(--warn), var(--ok)); transition: width .8s var(--ease); }
.goal-strip b { font-variant-numeric: tabular-nums; }

.stage-tabs { display: flex; gap: 9px; flex-wrap: wrap; }
.stage-tab { display: flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 14px;
  font-size: 14px; font-weight: 600; color: var(--ink-dim); background: var(--glass);
  border: 1px solid var(--line); transition: all .25s var(--ease); }
.stage-tab .em { font-size: 16px; }
.stage-tab .n { font-size: 11px; color: var(--ink-faint); font-weight: 500; }
.stage-tab:hover { color: var(--ink); transform: translateY(-2px); }
.stage-tab.active { color: #fff; border-color: transparent;
  background: linear-gradient(135deg, var(--sc, var(--acc)), color-mix(in srgb, var(--sc, var(--acc)) 55%, #000));
  box-shadow: 0 10px 26px -10px var(--sc, var(--acc)); }
.stage-tab.active .n { color: rgba(255,255,255,.75); }

.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 16px; }
.book-card { position: relative; padding: 20px; border-radius: var(--r-lg); overflow: hidden;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(16px);
  transition: all .3s var(--ease); cursor: pointer; }
.book-card::before { content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity .3s;
  background: radial-gradient(340px 200px at 20% 0%, var(--bc, var(--acc-soft)), transparent 70%); }
.book-card:hover { transform: translateY(-5px); border-color: color-mix(in srgb, var(--bc, var(--acc)) 45%, transparent);
  box-shadow: 0 22px 44px -18px color-mix(in srgb, var(--bc, var(--acc)) 55%, transparent), var(--shadow); }
.book-card:hover::before { opacity: 1; }
.book-top { display: flex; gap: 14px; align-items: flex-start; position: relative; }
.book-em { width: 46px; height: 46px; flex: none; display: grid; place-items: center; font-size: 23px;
  border-radius: 14px; background: color-mix(in srgb, var(--bc, var(--acc)) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--bc, var(--acc)) 35%, transparent); }
.book-title { font-size: 15.5px; font-weight: 700; line-height: 1.4; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.8em; }
.book-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; font-size: 12px; color: var(--ink-faint);
  position: relative; }
.book-meta .pub { color: var(--ink-dim); }
.book-foot { display: flex; align-items: center; gap: 8px; margin-top: 15px; position: relative; }
.book-foot .spacer { flex: 1; }
.book-go { padding: 8px 16px; border-radius: 11px; font-size: 13px; font-weight: 700; color: #fff;
  background: color-mix(in srgb, var(--bc, var(--acc)) 75%, #000);
  transition: all .25s var(--ease); }
.book-go:hover { filter: brightness(1.2); transform: translateX(2px); }
.book-mini { display: flex; gap: 5px; }
.book-mini button { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  color: var(--ink-dim); background: rgba(255,255,255,.05); border: 1px solid var(--line); transition: all .2s; }
.book-mini button:hover { color: #fff; border-color: var(--bc, var(--acc)); }
.book-mini svg { width: 15px; height: 15px; }

.resume-card { display: flex; align-items: center; gap: 18px; margin-top: 14px; padding: 18px 22px;
  border-radius: 18px; background: var(--glass); border: 1px solid var(--line); cursor: pointer;
  transition: all .3s var(--ease); }
.resume-card:hover { transform: translateY(-3px); background: var(--glass-hi); }
.resume-card .info { flex: 1; min-width: 0; }
.resume-card .rt { font-size: 15px; font-weight: 700; }
.resume-card .rd { font-size: 12.5px; color: var(--ink-faint); margin-top: 3px; }
.resume-bar { height: 6px; border-radius: 99px; background: rgba(255,255,255,.08); margin-top: 10px; overflow: hidden; }
.resume-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--acc-2), var(--acc)); }

/* ---------------- 学词(闪卡) ---------------- */
.study-wrap { max-width: 860px; margin: 0 auto; }
.study-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.study-head .bk { font-size: 15px; font-weight: 700; }
.study-head .cnt { font-size: 13px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.study-progress { flex: 1; height: 7px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.study-progress i { display: block; height: 100%; width: 0; border-radius: 99px;
  background: linear-gradient(90deg, var(--acc-2), var(--acc)); transition: width .45s var(--ease);
  box-shadow: 0 0 14px var(--acc); }
.mode-seg { display: inline-flex; padding: 4px; gap: 2px; border-radius: 12px; background: var(--glass); border: 1px solid var(--line); }
.mode-seg button { padding: 7px 14px; border-radius: 9px; font-size: 12.5px; font-weight: 600; color: var(--ink-faint); transition: all .2s; }
.mode-seg button.active { color: #fff; background: var(--acc-soft); box-shadow: inset 0 0 0 1px rgba(139,92,246,.4); }

.flash-stage { perspective: 1600px; margin: 8px 0 20px; }
.flash-card { position: relative; min-height: 380px; border-radius: 26px; cursor: pointer;
  transform-style: preserve-3d; transition: transform .65s var(--ease); }
.flash-card.flipped { transform: rotateX(180deg); }
.flash-face { position: absolute; inset: 0; border-radius: 26px; backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 36px; text-align: center; }
.flash-face.front { background: linear-gradient(155deg, rgba(255,255,255,.075), rgba(255,255,255,.025));
  border: 1px solid var(--line); backdrop-filter: blur(20px); box-shadow: var(--shadow); }
.flash-face.back { transform: rotateX(180deg); background: linear-gradient(155deg, rgba(139,92,246,.16), rgba(34,211,238,.07));
  border: 1px solid rgba(139,92,246,.35); backdrop-filter: blur(20px); box-shadow: var(--shadow);
  justify-content: flex-start; padding-top: 44px; overflow-y: auto; }
.flash-word { font-size: clamp(34px, 6vw, 56px); font-weight: 800; letter-spacing: .01em; line-height: 1.1;
  text-shadow: 0 0 40px color-mix(in srgb, var(--acc) 45%, transparent); }
.flash-hint { margin-top: 14px; font-size: 13px; color: var(--ink-faint); display: flex; align-items: center; gap: 6px; }
kbd { padding: 2px 7px; border-radius: 6px; font-size: 11px; font-family: inherit; color: var(--ink-dim);
  background: rgba(255,255,255,.07); border: 1px solid var(--line); border-bottom-width: 2px; }
.flash-phon { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.flash-phon .ph { font-size: 16px; color: var(--acc-2); font-weight: 500; }
.speak-btn { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  color: var(--ink-dim); background: rgba(255,255,255,.06); border: 1px solid var(--line); transition: all .2s; }
.speak-btn:hover { color: var(--acc-2); border-color: var(--acc-2); box-shadow: 0 0 16px rgba(34,211,238,.35); }
.speak-btn svg { width: 15px; height: 15px; }
.speak-btn b { font-size: 10px; margin-left: 3px; font-weight: 600; }
.flash-pos { font-size: 13px; color: var(--acc-2); font-style: italic; font-weight: 600; margin-right: 6px; }
.flash-mean { font-size: clamp(18px, 2.6vw, 24px); font-weight: 700; line-height: 1.55; }
.flash-def-en { margin-top: 14px; font-size: 14px; color: var(--ink-dim); line-height: 1.6; font-style: italic; max-width: 520px; }
.flash-tags { position: absolute; top: 18px; left: 20px; display: flex; gap: 8px; }
.flash-diff { position: absolute; top: 18px; right: 20px; }

.grade-row { display: flex; gap: 12px; justify-content: center; margin-bottom: 22px; }
.grade-btn { flex: 1; max-width: 210px; padding: 15px 10px; border-radius: 16px; text-align: center;
  background: var(--glass); border: 1px solid var(--line); transition: all .22s var(--ease); }
.grade-btn .g { font-size: 15px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 7px; }
.grade-btn .k { margin-top: 5px; font-size: 11px; color: var(--ink-faint); }
.grade-btn svg { width: 16px; height: 16px; }
.grade-btn.bad:hover { background: rgba(251,113,133,.14); border-color: var(--bad); color: var(--bad); transform: translateY(-3px); }
.grade-btn.mid:hover { background: rgba(251,191,36,.12); border-color: var(--warn); color: var(--warn); transform: translateY(-3px); }
.grade-btn.good:hover { background: rgba(52,211,153,.13); border-color: var(--ok); color: var(--ok); transform: translateY(-3px); }

/* 词条详情面板 */
.detail-acc { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.acc-item { border-radius: var(--r-md); background: var(--glass); border: 1px solid var(--line); overflow: hidden; }
.acc-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 14px 18px;
  font-size: 14px; font-weight: 600; color: var(--ink-dim); transition: all .2s; }
.acc-head:hover { color: var(--ink); }
.acc-head .cnt { margin-left: auto; font-size: 11.5px; color: var(--ink-faint); font-weight: 500; }
.acc-head svg { width: 15px; height: 15px; transition: transform .3s var(--ease); }
.acc-item.open .acc-head svg { transform: rotate(180deg); }
.acc-body { max-height: 0; overflow: hidden; transition: max-height .4s var(--ease); }
.acc-item.open .acc-body { max-height: 1200px; }
.acc-inner { padding: 2px 18px 16px; display: flex; flex-direction: column; gap: 12px; }
.sent-row { padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.035); border: 1px solid var(--line); }
.sent-en { font-size: 14.5px; line-height: 1.65; }
.sent-en b { color: var(--acc-2); font-weight: 700; }
.sent-cn { margin-top: 6px; font-size: 13px; color: var(--ink-dim); line-height: 1.6; }
.sent-src { display: inline-block; margin-top: 7px; font-size: 11px; color: var(--warn);
  background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.25); padding: 2px 8px; border-radius: 99px; }
.phrase-row { display: flex; flex-direction: column; gap: 4px; padding: 10px 14px; border-radius: 12px;
  background: rgba(255,255,255,.035); border: 1px solid var(--line); }
.phrase-en { font-size: 14px; font-weight: 600; }
.phrase-cn { font-size: 12.5px; color: var(--ink-dim); }
.relator { display: flex; flex-wrap: wrap; gap: 8px; }
.rel-chip { padding: 6px 12px; border-radius: 10px; font-size: 12.5px; background: rgba(255,255,255,.045);
  border: 1px solid var(--line); cursor: pointer; transition: all .2s; }
.rel-chip:hover { border-color: var(--acc-2); color: var(--acc-2); }
.rel-chip small { color: var(--ink-faint); margin-left: 5px; }
.pos-tag { display: inline-block; padding: 2px 8px; margin-right: 8px; border-radius: 7px; font-size: 11.5px;
  font-style: italic; font-weight: 700; color: var(--acc-2); background: rgba(34,211,238,.1);
  border: 1px solid rgba(34,211,238,.25); }
.memo-box { padding: 14px 16px; border-radius: 12px; font-size: 14px; line-height: 1.8;
  background: linear-gradient(120deg, rgba(251,191,36,.09), rgba(52,211,153,.07));
  border: 1px solid rgba(251,191,36,.25); }

/* ---------------- 测试 ---------------- */
.quiz-setup { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 15px; }
.mode-card { position: relative; padding: 24px 22px; border-radius: 20px; cursor: pointer;
  background: var(--glass); border: 1px solid var(--line); transition: all .3s var(--ease); overflow: hidden; }
.mode-card:hover { transform: translateY(-5px); border-color: color-mix(in srgb, var(--mc) 55%, transparent);
  box-shadow: 0 20px 40px -16px color-mix(in srgb, var(--mc) 60%, transparent); }
.mode-card .mi { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  color: var(--mc); background: color-mix(in srgb, var(--mc) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--mc) 35%, transparent); margin-bottom: 14px; }
.mode-card .mi svg { width: 22px; height: 22px; }
.mode-card h3 { font-size: 16.5px; font-weight: 800; }
.mode-card p { margin-top: 6px; font-size: 12.5px; color: var(--ink-faint); line-height: 1.6; }
.nseg { display: flex; gap: 8px; margin: 26px 0 8px; }
.nseg button { padding: 9px 18px; border-radius: 12px; font-size: 13.5px; font-weight: 600; color: var(--ink-dim);
  background: var(--glass); border: 1px solid var(--line); transition: all .2s; }
.nseg button.active { color: #fff; background: var(--acc-soft); border-color: rgba(139,92,246,.45); }

.quiz-hud { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.lives { display: flex; gap: 4px; }
.lives svg { width: 19px; height: 19px; color: var(--bad); fill: var(--bad); }
.lives .dead { color: rgba(255,255,255,.14); fill: rgba(255,255,255,.14); }
.combo-meter { display: flex; align-items: center; gap: 7px; font-weight: 800; font-size: 15px; color: var(--warn);
  opacity: 0; transform: scale(.6); transition: all .3s var(--ease); }
.combo-meter.show { opacity: 1; transform: scale(1); }
.combo-meter.hot { animation: comboPulse .5s var(--ease); }
@keyframes comboPulse { 40% { transform: scale(1.35); text-shadow: 0 0 20px var(--warn); } }
.quiz-score { margin-left: auto; font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.quiz-timer { font-variant-numeric: tabular-nums; color: var(--ink-dim); font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.quiz-timer svg { width: 14px; height: 14px; }

.q-card { padding: 34px 30px; text-align: center; position: relative; overflow: hidden; }
.q-label { font-size: 12.5px; letter-spacing: .14em; color: var(--ink-faint); text-transform: uppercase; }
.q-word { margin-top: 14px; font-size: clamp(28px, 5vw, 46px); font-weight: 800; line-height: 1.15; }
.q-meaning { margin-top: 14px; font-size: clamp(17px, 2.4vw, 22px); font-weight: 600; line-height: 1.6; }
.q-phon { margin-top: 10px; color: var(--acc-2); font-size: 15px; }
.q-speak { margin: 18px auto 0; width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; background: linear-gradient(135deg, var(--acc), var(--acc-2));
  box-shadow: 0 14px 34px -10px var(--acc); transition: all .25s; }
.q-speak:hover { transform: scale(1.08); }
.q-speak svg { width: 26px; height: 26px; }
.q-speak.pulse { animation: speakPulse 1.2s ease-out infinite; }
@keyframes speakPulse { 0% { box-shadow: 0 0 0 0 rgba(139,92,246,.5); } 100% { box-shadow: 0 0 0 22px rgba(139,92,246,0); } }

.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.opt { padding: 17px 18px; border-radius: 15px; text-align: left; font-size: 15px; font-weight: 600;
  background: var(--glass); border: 1px solid var(--line); transition: all .2s var(--ease);
  display: flex; align-items: center; gap: 12px; line-height: 1.45; }
.opt .idx { flex: none; width: 27px; height: 27px; border-radius: 9px; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 700; color: var(--ink-faint); background: rgba(255,255,255,.06);
  border: 1px solid var(--line); }
.opt:hover { border-color: rgba(139,92,246,.5); background: var(--glass-hi); transform: translateY(-2px); }
.opt.correct { background: rgba(52,211,153,.16); border-color: var(--ok); color: var(--ok); }
.opt.correct .idx { background: var(--ok); color: #052e21; border-color: var(--ok); }
.opt.wrong { background: rgba(251,113,133,.13); border-color: var(--bad); color: var(--bad);
  animation: shake .4s ease; }
.opt.wrong .idx { background: var(--bad); color: #fff; border-color: var(--bad); }
.opt.dim { opacity: .4; pointer-events: none; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.q-explain { margin-top: 16px; padding: 14px 16px; border-radius: 13px; font-size: 13.5px; line-height: 1.7;
  color: var(--ink-dim); background: rgba(255,255,255,.04); border: 1px solid var(--line); text-align: left;
  animation: viewIn .35s var(--ease); }
.q-explain b { color: var(--ink); }

/* 连线配对 */
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.match-col { display: flex; flex-direction: column; gap: 10px; }
.match-item { padding: 15px 16px; border-radius: 13px; font-size: 14.5px; font-weight: 600; text-align: center;
  background: var(--glass); border: 1px solid var(--line); transition: all .2s; }
.match-item:hover { border-color: rgba(139,92,246,.5); }
.match-item.sel { border-color: var(--acc-2); color: var(--acc-2); background: rgba(34,211,238,.09); box-shadow: 0 0 18px rgba(34,211,238,.2); }
.match-item.done { opacity: .35; pointer-events: none; border-color: var(--ok); color: var(--ok); }
.match-item.err { animation: shake .4s ease; border-color: var(--bad); color: var(--bad); }

/* 结果页 */
.result-wrap { max-width: 560px; margin: 40px auto; text-align: center; }
.result-ring { position: relative; width: 190px; height: 190px; margin: 0 auto; }
.result-ring svg { transform: rotate(-90deg); }
.result-ring .fg { stroke-linecap: round; }
.result-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 42px; font-weight: 900; }
.result-ring b small { display: block; font-size: 12px; font-weight: 500; color: var(--ink-faint); margin-top: 2px; }
.result-title { margin-top: 18px; font-size: 25px; font-weight: 900; }
.result-sub { margin-top: 6px; color: var(--ink-dim); font-size: 14px; }
.result-stats { display: flex; justify-content: center; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.wrong-list { margin-top: 26px; text-align: left; display: flex; flex-direction: column; gap: 9px; }
.wrong-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 13px;
  background: rgba(251,113,133,.06); border: 1px solid rgba(251,113,133,.22); font-size: 14px; }
.wrong-row .w { font-weight: 700; color: var(--bad); }
.wrong-row .m { flex: 1; color: var(--ink-dim); font-size: 13px; }
.wrong-row button { flex: none; }

/* ---------------- 拼写 ---------------- */
.spell-hintbox { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.spell-def { font-size: 15.5px; color: var(--ink-dim); line-height: 1.7; max-width: 480px; }
.spell-boxes { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 26px; }
.letter-box { width: 46px; height: 54px; border-radius: 12px; display: grid; place-items: center;
  font-size: 24px; font-weight: 800; text-transform: uppercase;
  background: rgba(255,255,255,.06); border: 1.5px solid var(--line); transition: all .18s;
  caret-color: transparent; }
.letter-box.focus { border-color: var(--acc-2); box-shadow: 0 0 0 3px rgba(34,211,238,.18); transform: translateY(-3px); }
.letter-box.ok { border-color: var(--ok); color: var(--ok); background: rgba(52,211,153,.1); }
.letter-box.bad { border-color: var(--bad); color: var(--bad); background: rgba(251,113,133,.1); animation: shake .35s; }
.letter-box.hinted { border-style: dashed; color: var(--warn); }
.letter-box.space { width: 20px; border: 0; background: none; }
.spell-actions { display: flex; gap: 10px; justify-content: center; margin-top: 28px; flex-wrap: wrap; }

/* ---------------- 复习/统计 ---------------- */
.due-hero { display: flex; align-items: center; gap: 20px; padding: 26px 28px; }
.due-hero .big { font-size: 44px; font-weight: 900; font-variant-numeric: tabular-nums; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; }
.stat-card { padding: 22px; border-radius: var(--r-lg); background: var(--glass); border: 1px solid var(--line); }
.stat-card .lbl { font-size: 12.5px; color: var(--ink-faint); display: flex; align-items: center; gap: 7px; }
.stat-card .lbl svg { width: 15px; height: 15px; }
.stat-card .val { margin-top: 9px; font-size: 30px; font-weight: 900; font-variant-numeric: tabular-nums; }
.stat-card .sub { margin-top: 4px; font-size: 12px; color: var(--ink-faint); }
.stat-card .val em { font-style: normal; font-size: 14px; color: var(--ink-faint); font-weight: 600; }

.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 12px); gap: 3.5px; overflow-x: auto; padding-bottom: 6px; }
.heat i { width: 12px; height: 12px; border-radius: 3.5px; background: rgba(255,255,255,.06); }
.heat i.l1 { background: rgba(139,92,246,.3); }
.heat i.l2 { background: rgba(139,92,246,.55); }
.heat i.l3 { background: rgba(139,92,246,.8); }
.heat i.l4 { background: var(--acc); box-shadow: 0 0 8px rgba(139,92,246,.7); }

.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 13px; }
.ach-card { display: flex; gap: 13px; align-items: center; padding: 16px; border-radius: 16px;
  background: var(--glass); border: 1px solid var(--line); transition: all .25s; }
.ach-card .ai { flex: none; width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
  font-size: 21px; background: rgba(255,255,255,.05); border: 1px solid var(--line); filter: grayscale(1); opacity: .45; }
.ach-card.on .ai { filter: none; opacity: 1; background: linear-gradient(135deg, rgba(251,191,36,.25), rgba(139,92,246,.25));
  border-color: rgba(251,191,36,.5); box-shadow: 0 0 18px rgba(251,191,36,.25); }
.ach-card .at { font-size: 13.5px; font-weight: 700; }
.ach-card.on .at { color: var(--warn); }
.ach-card .ad { font-size: 11.5px; color: var(--ink-faint); margin-top: 3px; line-height: 1.5; }

.legend { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink-faint); }
.legend i { width: 11px; height: 11px; border-radius: 3px; }

/* ---------------- 搜索面板 ---------------- */
.search-layer { position: fixed; inset: 0; z-index: 60; display: grid; place-items: start center;
  padding-top: 12vh; background: rgba(4, 6, 12, .6); backdrop-filter: blur(6px); }
.search-panel { width: min(640px, 92vw); max-height: 68vh; display: flex; flex-direction: column;
  border-radius: 20px; overflow: hidden; animation: panelIn .3s var(--ease); }
@keyframes panelIn { from { opacity: 0; transform: translateY(-14px) scale(.98); } }
.search-head { display: flex; align-items: center; gap: 12px; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.search-head svg { width: 18px; height: 18px; color: var(--ink-faint); }
.search-head input { flex: 1; background: none; border: 0; outline: 0; color: var(--ink); font-size: 16.5px; }
.search-head input::placeholder { color: var(--ink-faint); }
.search-body { overflow-y: auto; padding: 10px; }
.sr-group { padding: 9px 12px 4px; font-size: 11px; letter-spacing: .12em; color: var(--ink-faint); text-transform: uppercase; }
.sr-row { display: flex; align-items: center; gap: 13px; width: 100%; text-align: left; padding: 11px 13px;
  border-radius: 12px; transition: background .15s; }
.sr-row:hover, .sr-row.sel { background: var(--glass-hi); }
.sr-row .w { font-size: 15.5px; font-weight: 700; min-width: 120px; }
.sr-row .w mark { background: none; color: var(--acc-2); }
.sr-row .m { flex: 1; font-size: 13px; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-row .bks { display: flex; gap: 4px; flex: none; }
.sr-empty { padding: 44px 0; text-align: center; color: var(--ink-faint); font-size: 14px; }

/* ---------------- 弹窗 ---------------- */
.modal-layer[hidden], .search-layer[hidden] { display: none !important; }
.modal-layer { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center;
  background: rgba(4, 6, 12, .65); backdrop-filter: blur(8px); padding: 20px; }
.modal-card { width: min(620px, 94vw); max-height: 84vh; overflow-y: auto; border-radius: 24px; padding: 30px;
  background: rgba(13, 16, 30, .92); border: 1px solid rgba(255,255,255,.1); box-shadow: var(--shadow);
  animation: panelIn .32s var(--ease); position: relative; }
.modal-close { position: absolute; top: 16px; right: 16px; }
.modal-title { font-size: 20px; font-weight: 800; margin-bottom: 18px; }

/* 词条弹窗 */
.wm-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.wm-word { font-size: 34px; font-weight: 800; }
.wm-phon { display: flex; align-items: center; gap: 12px; margin-top: 8px; color: var(--acc-2); font-size: 14.5px; }
.wm-trans { margin-top: 16px; display: flex; flex-direction: column; gap: 7px; font-size: 15px; line-height: 1.55; }
.wm-foot { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }

/* 设置 */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.set-row .sl { font-size: 14.5px; font-weight: 600; }
.set-row .sd { font-size: 12px; color: var(--ink-faint); margin-top: 3px; }
.seg { display: inline-flex; padding: 4px; gap: 2px; border-radius: 11px; background: rgba(255,255,255,.05); border: 1px solid var(--line); }
.seg button { padding: 7px 13px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-faint); }
.seg button.active { color: #fff; background: var(--acc-soft); box-shadow: inset 0 0 0 1px rgba(139,92,246,.4); }

/* Toast */
.toasts { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 90;
  display: flex; flex-direction: column; gap: 9px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-radius: 14px;
  background: rgba(15, 19, 36, .94); border: 1px solid rgba(255,255,255,.12); font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow); animation: toastIn .35s var(--ease); backdrop-filter: blur(14px); }
.toast svg { width: 16px; height: 16px; }
.toast.ok svg { color: var(--ok); }
.toast.ach { border-color: rgba(251,191,36,.55); }
.toast.ach .em { font-size: 21px; }
.toast.out { animation: toastOut .3s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.92); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.94); } }

/* 骨架 & 空状态 */
.skeleton { border-radius: var(--r-lg); min-height: 320px; background:
  linear-gradient(100deg, rgba(255,255,255,.04) 40%, rgba(255,255,255,.09) 50%, rgba(255,255,255,.04) 60%);
  background-size: 300% 100%; animation: shimmer 1.4s infinite; display: grid; place-items: center;
  color: var(--ink-faint); font-size: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty-state { text-align: center; padding: 70px 20px; color: var(--ink-faint); }
.empty-state .em { font-size: 52px; display: block; margin-bottom: 16px; filter: saturate(.8); }
.empty-state h3 { color: var(--ink-dim); font-size: 18px; margin-bottom: 8px; }
.empty-state p { font-size: 13.5px; line-height: 1.7; }

/* ---------------- 微动效系统 ---------------- */
/* 按钮按压回弹 */
.btn:active, .stage-tab:active, .glass-icon:active, .opt:active, .match-item:active,
.grade-btn:active, .book-go:active, .mode-card:active, .book-mini button:active, .rel-chip:active { transform: scale(.965); }
.speak-btn:active, .q-speak:active { transform: scale(.88); }
/* 主按钮光泽扫过 */
.btn-primary { position: relative; overflow: hidden; }
html:not(.no-motion) .btn-primary::after { content: ""; position: absolute; top: -25%; bottom: -25%; left: -75%; width: 34%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.33), transparent);
  transform: skewX(-22deg); transition: left .55s var(--ease); pointer-events: none; }
html:not(.no-motion) .btn-primary:hover::after { left: 155%; }
/* 词书卡边缘流光 + 3D 倾斜配合 */
.book-card { will-change: transform; }
html:not(.no-motion) .book-card::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.15) 50%, transparent 66%);
  background-size: 260% 100%; background-position: 135% 0; opacity: 0; transition: opacity .3s; }
html:not(.no-motion) .book-card:hover::after { opacity: 1; animation: sheen 1.1s var(--ease) .05s; }
@keyframes sheen { from { background-position: 135% 0; } to { background-position: -70% 0; } }
/* 页面内区块逐层入场 */
html:not(.no-motion) .view-inner > * { animation: viewIn .5s var(--ease) backwards; }
html:not(.no-motion) .view-inner > :nth-child(2) { animation-delay: .05s; }
html:not(.no-motion) .view-inner > :nth-child(3) { animation-delay: .1s; }
html:not(.no-motion) .view-inner > :nth-child(4) { animation-delay: .15s; }
html:not(.no-motion) .view-inner > :nth-child(5) { animation-delay: .2s; }
html:not(.no-motion) .view-inner > :nth-child(6) { animation-delay: .25s; }
html:not(.no-motion) .view-inner > :nth-child(n+7) { animation-delay: .3s; }
/* 卡片列表 stagger 入场 */
html:not(.no-motion) :is(.book-grid, .stat-grid, .ach-grid, .stage-tabs, .quiz-setup) > * { animation: cardIn .45s var(--ease) backwards; }
html:not(.no-motion) :is(.book-grid, .stat-grid, .ach-grid, .stage-tabs, .quiz-setup) > :nth-child(1) { animation-delay: .06s; }
html:not(.no-motion) :is(.book-grid, .stat-grid, .ach-grid, .stage-tabs, .quiz-setup) > :nth-child(2) { animation-delay: .11s; }
html:not(.no-motion) :is(.book-grid, .stat-grid, .ach-grid, .stage-tabs, .quiz-setup) > :nth-child(3) { animation-delay: .16s; }
html:not(.no-motion) :is(.book-grid, .stat-grid, .ach-grid, .stage-tabs, .quiz-setup) > :nth-child(4) { animation-delay: .21s; }
html:not(.no-motion) :is(.book-grid, .stat-grid, .ach-grid, .stage-tabs, .quiz-setup) > :nth-child(5) { animation-delay: .26s; }
html:not(.no-motion) :is(.book-grid, .stat-grid, .ach-grid, .stage-tabs, .quiz-setup) > :nth-child(6) { animation-delay: .31s; }
html:not(.no-motion) :is(.book-grid, .stat-grid, .ach-grid, .stage-tabs, .quiz-setup) > :nth-child(7) { animation-delay: .36s; }
html:not(.no-motion) :is(.book-grid, .stat-grid, .ach-grid, .stage-tabs, .quiz-setup) > :nth-child(8) { animation-delay: .4s; }
html:not(.no-motion) :is(.book-grid, .stat-grid, .ach-grid, .stage-tabs, .quiz-setup) > :nth-child(n+9) { animation-delay: .44s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(.985); } }
/* 进度条首次填充 */
html:not(.no-motion) :is(.goal-strip .bar i, .resume-bar i, .xp-bar i) { animation: fillIn .9s var(--ease) backwards; }
@keyframes fillIn { from { width: 0; } }
/* 进度环浮现 */
html:not(.no-motion) .ring { animation: viewIn .55s var(--ease) backwards; }
/* 热力图逐格点亮 (延迟由 JS 设置) */
.heat-in { animation: heatIn .5s var(--ease) backwards; }
@keyframes heatIn { from { opacity: 0; transform: scale(.4); } }
/* 动效关闭时彻底静止 */
.no-motion .aurora, .no-motion .logo-orb { animation: none !important; }
.no-motion .cosmos::after { display: none; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 920px) {
  .rail { display: none; }
  .shell { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
  .tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; display: flex;
    background: rgba(8, 10, 20, .88); backdrop-filter: blur(22px); border-top: 1px solid var(--line);
    padding: 4px 10px calc(6px + env(safe-area-inset-bottom)); }
  .tab-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0;
    color: var(--ink-faint); border-radius: 12px; font-size: 10.5px; position: relative; min-height: 46px; }
  .tab-item svg { width: 21px; height: 21px; }
  .tab-item.active { color: var(--acc-2); }
  .tab-item .badge { position: absolute; top: 0; right: 22%; min-width: 15px; height: 15px; padding: 0 4px;
    border-radius: 99px; background: var(--bad); color: #fff; font-size: 9.5px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; }
  .view { padding: 4px 14px 40px; }
  .topbar { padding: 10px 14px 6px; gap: 8px; }
  .top-actions { gap: 7px; }
  .pill { padding: 7px 11px; font-size: 12.5px; }
  .glass-icon { width: 36px; height: 36px; }
  .hero { padding: 22px 18px; border-radius: 20px; }
  .hero h1 { font-size: 25px; }
  .hero p { font-size: 13.5px; }
  .hero-stats { gap: 9px; margin-top: 16px; }
  .hero-stat { padding: 9px 13px; border-radius: 13px; }
  .hero-stat .num { font-size: 18px; }
  .hero-cta { flex-direction: column; align-items: stretch; }
  .hero-cta .btn { justify-content: center; }
  .stage-tabs { gap: 7px; }
  .stage-tab { padding: 9px 14px; font-size: 13px; }
  .book-grid { grid-template-columns: 1fr; gap: 12px; }
  .book-card { padding: 16px; }
  .opt-grid { grid-template-columns: 1fr; }
  .opt { padding: 15px 16px; font-size: 15px; min-height: 52px; }
  .opt .idx { width: 30px; height: 30px; }
  .xp-pill .xp-meta { display: none; }
  .letter-box { width: 34px; height: 44px; font-size: 19px; border-radius: 10px; }
  .flash-card { min-height: 300px; }
  .flash-face { padding: 26px 18px; }
  .flash-word { font-size: clamp(30px, 9vw, 44px); }
  .flash-mean { font-size: 17px; }
  .grade-row { flex-direction: column; align-items: stretch; gap: 9px; }
  .grade-btn { max-width: none; padding: 13px 10px; }
  .grade-btn .g { font-size: 15px; }
  .study-head { flex-wrap: wrap; gap: 8px; }
  .mode-seg { margin-left: auto; }
  .quiz-setup { grid-template-columns: 1fr; }
  .mode-card { padding: 18px; }
  .nseg { flex-wrap: wrap; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 15px; }
  .stat-card .val { font-size: 23px; }
  .ach-grid { grid-template-columns: 1fr; }
  .due-hero { flex-direction: column; text-align: center; gap: 12px; padding: 20px; }
  .due-hero .big { font-size: 36px; }
  .q-card { padding: 24px 16px; border-radius: 18px; }
  .q-word { font-size: clamp(26px, 8vw, 36px); }
  .q-meaning { font-size: 17px; }
  .q-speak { width: 58px; height: 58px; }
  .result-ring { width: 160px; height: 160px; }
  .result-ring b { font-size: 36px; }
  .search-panel { width: 94vw; }
  .sr-row .w { min-width: 90px; font-size: 14.5px; }
  .modal-card { padding: 22px 16px; border-radius: 20px; }
  .wm-word { font-size: 28px; }
  .goal-strip { flex-wrap: wrap; font-size: 12.5px; }
  .resume-card { padding: 14px 16px; }
  .sec-title { margin: 22px 0 13px; }
  .sec-title h2 { font-size: 18px; }
  .match-grid { gap: 9px; }
  .match-item { padding: 13px 12px; font-size: 13.5px; }
  .wrong-list { max-width: none; }
  .crumb { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* 触控目标 ≥ 44px */
  .speak-btn { width: 40px; height: 40px; }
  .book-mini button { width: 40px; height: 40px; }
  .book-go { padding: 10px 16px; }
  .btn { padding: 13px 18px; }
  .btn-sm { padding: 10px 14px; }
  /* 刘海屏安全区: standalone 模式下状态栏透明, 内容会顶进刘海 */
  .topbar { padding-top: calc(10px + env(safe-area-inset-top)); }
  .tabbar { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
  /* Toast 悬浮在底部导航之上, 不遮内容 */
  .toasts { bottom: calc(76px + env(safe-area-inset-bottom)); max-width: 92vw; }
  /* 搜索面板改为贴顶下拉, 腾出键盘空间 */
  .search-layer { padding: calc(6px + env(safe-area-inset-top)) 0 0; }
  .search-panel { width: 100vw; max-height: 78dvh; border-radius: 0 0 22px 22px; border-left: 0; border-right: 0; border-top: 0; }
  /* 弹窗改为底部抽屉, 单手更易触达 */
  .modal-layer { padding: 0; place-items: end center; }
  .modal-card { width: 100vw; max-width: none; max-height: 88dvh;
    border-radius: 24px 24px 0 0; border-left: 0; border-right: 0; border-bottom: 0;
    padding-bottom: calc(30px + env(safe-area-inset-bottom));
    animation: sheetUp .38s var(--ease); }
  @keyframes sheetUp { from { transform: translateY(56px); opacity: 0; } }
  /* 热力图缩小格径, 小屏可见更多周 */
  .heat { grid-template-rows: repeat(7, 10px); gap: 3px; }
  .heat i { width: 10px; height: 10px; border-radius: 3px; }
}
@media (max-width: 760px) {
  .two-col { grid-template-columns: 1fr !important; }
  .opt { font-size: 14.5px; }
  .letter-box { width: min(9vw, 38px); height: 44px; }
  .spell-boxes { gap: 5px; }
}
@media (max-width: 400px) {
  .letter-box { width: 8.5vw; height: 40px; font-size: 17px; }
  .pill { padding: 6px 9px; }
  .stage-tab { padding: 8px 11px; font-size: 12px; }
  .flash-phon .ph { font-size: 13.5px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-stat { padding: 8px 10px; }
  .hero-stat .num { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .15s !important; }
}
/* ---------- 移动端专项优化 ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overscroll-behavior-y: none; }
.view { -webkit-overflow-scrolling: touch; }
button, .opt, .grade-btn, .match-item, .tab-item, .rail-item { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
input { font-size: 16px; }  /* 防止 iOS 聚焦自动放大 */
a { touch-action: manipulation; }  /* 链接禁用双击缩放延迟 */
/* 触屏设备隐藏键盘快捷键提示 (kbd 由 JS 文案配合) */
@media (pointer: coarse) {
  kbd { display: none; }
  .quiz-timer kbd { display: none; }
}
/* 软键盘弹起时布局稳定: 用 visual viewport 撑高 */
@supports (height: 100dvh) {
  body, .shell { height: 100dvh; }
}
/* 横屏平板优化 */
@media (min-width: 921px) and (max-width: 1180px) {
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}
