/* ============================================================
 * Lexi 单词背诵系统 — 样式
 * 移动优先；断点：>=640px 平板，>=1024px 桌面
 * ============================================================ */

/* ---------- 主题变量 ---------- */
:root {
  --bg: #f5f6f8;
  --bg-2: #eceef2;
  --panel: #ffffff;
  --panel-2: #f3f5f8;
  --panel-3: #e9edf3;
  --text: #16191f;
  --text-2: #4b5563;
  --muted: #8b93a1;
  --border: #e3e7ee;
  --border-2: #d3d9e3;
  --accent: #4f46e5;
  --accent-2: #6366f1;
  --accent-soft: #eef0ff;
  --ok: #16a34a;
  --ok-soft: #e8f7ee;
  --warn: #d97706;
  --warn-soft: #fdf3e3;
  --bad: #dc2626;
  --bad-soft: #fdecec;
  /* 助记用的琥珀色：比 --warn 深一档，11–13px 小字在 --warn-soft 上也够对比度 */
  --mn: #b45309;
  --mn-bg: #fdf3e3;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 2px 6px rgba(16, 24, 40, .06), 0 12px 28px -14px rgba(16, 24, 40, .18);
  --shadow-lg: 0 24px 60px -20px rgba(16, 24, 40, .3);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --nav-h: 60px;
  --rail-w: 232px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Source Han Sans SC", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", monospace;
}

[data-theme="dark"] {
  --bg: #0e1014;
  --bg-2: #08090c;
  --panel: #171a20;
  --panel-2: #1d2129;
  --panel-3: #242933;
  --text: #e9ecf1;
  --text-2: #b3bac6;
  --muted: #7d8694;
  --border: #272c35;
  --border-2: #333a45;
  --accent: #7c8cff;
  --accent-2: #8b95ff;
  --accent-soft: #1c2140;
  --ok: #4ade80;
  --ok-soft: #12291c;
  --warn: #fbbf24;
  --warn-soft: #2c2411;
  --bad: #f87171;
  --bad-soft: #2d1618;
  --mn: #fbbf24;
  --mn-bg: #2c2411;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 2px 8px rgba(0, 0, 0, .4), 0 16px 32px -16px rgba(0, 0, 0, .7);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .8);
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* 关键：作者样式里的 display 会盖掉浏览器默认的 [hidden]{display:none}，
   必须显式声明，否则 .modal-mask / .badge 等即使带 hidden 也会显示 */
[hidden] { display: none !important; }

/* SVG 兜底尺寸：任何漏写 width/height 的图标都不会退化成 300×150 的默认尺寸 */
svg { width: 1em; height: 1em; flex: none; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body { overflow: hidden; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--accent); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

.hide { display: none !important; }
.muted { color: var(--muted); }
.c-ok { color: var(--ok); }
.c-warn { color: var(--warn); }
.c-bad { color: var(--bad); }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }

/* ---- 图标垂直居中兜底 ----
   任何「只包一个 svg」的行内元素一律改成居中盒（line-height 归零），
   否则内联 SVG 的基线对齐会让图标比容器中心高 2~3px。 */
span:has(> svg:only-child),
i:has(> svg:only-child),
em:has(> svg:only-child),
b:has(> svg:only-child) {
  display: grid; place-items: center; line-height: 0;
}

/* ============================================================
   布局
   ============================================================ */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* ---- 顶部栏（手机） ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(var(--safe-t) + 10px) 14px 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand-logo {
  width: 30px; height: 30px; flex: none;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px;
  box-shadow: 0 4px 12px -4px var(--accent);
}

.brand-title { font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: var(--muted); margin-top: -3px; }

.icon-btn {
  width: 38px; height: 38px; flex: none;
  border-radius: 10px;
  display: grid; place-items: center;
  color: var(--text-2);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 20px; height: 20px; display: block; }
/* 图标槽必须自己居中并清掉 line-height 的基线留白。
   内联 SVG 默认 vertical-align:baseline，会贴着文字基线坐，
   基线下方还有约 3px 行高留白 → 图标视觉上比容器中心高 3px，
   于是同一行里「直接放 svg 的按钮」和「用 span 包 svg 的按钮」就会错位。 */
.icon-btn > span {
  display: grid; place-items: center; line-height: 0;
}

/* ---- 主区域 ---- */
.main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 12px);
}

.view { display: none; }
.view.active { display: block; animation: fadeUp .22s ease both; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.wrap { padding: 16px 14px 24px; max-width: 1180px; margin: 0 auto; }

.page-head { margin: 4px 0 16px; }
.page-head h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.2px; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; }

/* ---- 底部导航（手机） ---- */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--border);
  z-index: 40;
}

.nav-btn {
  position: relative;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 10.5px;
  transition: color .15s;
}
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn .badge { position: absolute; top: 6px; left: 50%; margin-left: 6px; }
.nav-btn.active { color: var(--accent); }
.nav-btn.active svg { filter: drop-shadow(0 2px 6px color-mix(in srgb, var(--accent) 50%, transparent)); }
.nav-btn:active { transform: scale(.94); }

/* ---- 侧边导航（桌面） ---- */
.rail { display: none; }

/* ============================================================
   通用组件
   ============================================================ */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.card-pad { padding: 16px; }

.card + .card { margin-top: 12px; }

.card-head {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.card-head h2 { font-size: 15px; margin: 0; font-weight: 650; }
.card-head .card-head-sub { font-size: 12px; color: var(--muted); }

.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 650; color: var(--text-2);
  margin: 22px 0 10px;
  letter-spacing: .3px;
}
.section-title:first-child { margin-top: 0; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 42px; padding: 0 16px;
  border-radius: var(--r);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px; font-weight: 550;
  border: 1px solid transparent;
  transition: transform .12s, background .15s, box-shadow .15s, opacity .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:hover { background: var(--panel-3); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn svg { width: 17px; height: 17px; flex: none; }

.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 6px 18px -8px var(--accent);
}
.btn-primary:hover { background: var(--accent-2); }

.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); }

.btn-ok { background: var(--ok-soft); color: var(--ok); }
.btn-ok:hover { background: color-mix(in srgb, var(--ok) 16%, var(--panel)); }
.btn-warn { background: var(--warn-soft); color: var(--warn); }
.btn-bad { background: var(--bad-soft); color: var(--bad); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-block { width: 100%; }
.btn-lg { height: 50px; font-size: 15.5px; border-radius: 14px; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 auto; }

/* 标签 / 徽标 */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px;
  background: var(--bad); color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 1;
}

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 28px; padding: 0 10px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-2);
  white-space: nowrap;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.chip.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--accent); font-weight: 600; }
.chip.tappable { cursor: pointer; }
.chip.tappable { min-height: 36px; padding: 0 13px; font-size: 13px; }
.chip.tappable:active { transform: scale(.96); }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* 输入 */
.input, .select, .textarea {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--r);
  background: var(--panel-2);
  border: 1px solid var(--border);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-size: 14px;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.textarea { height: auto; min-height: 130px; padding: 10px 12px; resize: vertical; line-height: 1.6; font-family: var(--mono); font-size: 13px; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 18px, calc(100% - 11px) 18px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 32px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field label .lb-hint { display: block; font-weight: 400; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; line-height: 1.5; }

/* 发音设置：音源区块的说明文字要跟下一组选项拉开距离 */
.field.tts-engine { margin-bottom: 18px; }
.field.tts-engine .hint { margin-top: 8px; }
.tts-test .btn { flex: 1 1 0; }

.field-row { display: flex; gap: 10px; align-items: center; }
.field-row > .field { flex: 1; margin-bottom: 0; }

/* 开关 */
.switch {
  position: relative;
  width: 44px; height: 26px; flex: none;
  border-radius: 13px;
  background: var(--border-2);
  transition: background .2s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .2s;
}
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(18px); }

.switch-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.switch-row:last-child { border-bottom: none; }
.switch-row .sr-text { flex: 1; min-width: 0; }
.switch-row .sr-title { font-size: 14px; font-weight: 550; }
.switch-row .sr-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* 统计数字 */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 13px 14px;
  box-shadow: var(--shadow-sm);
}
.stat .num { font-size: 24px; font-weight: 750; letter-spacing: -.5px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat .lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat .sub { font-size: 11px; color: var(--muted); }
.stat.accent .num { color: var(--accent); }
.stat.ok .num { color: var(--ok); }
.stat.warn .num { color: var(--warn); }
.stat.bad .num { color: var(--bad); }

/* 进度条 */
.bar { height: 6px; border-radius: 3px; background: var(--panel-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width .3s; }

/* 空状态 */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
/* 图标用块级 + margin auto 保持水平居中：
   行内 SVG 会因为基线对齐多出约 3px 下行留白，让图标与下方文字的间距虚增。 */
.empty svg { width: 46px; height: 46px; opacity: .35; display: block; margin: 0 auto 10px; }
.empty p { margin: 0 0 14px; font-size: 13.5px; }

/* ============================================================
   今日复习
   ============================================================ */
.hero {
  background: linear-gradient(140deg, var(--accent), #8b5cf6 60%, #d946ef);
  border-radius: var(--r-xl);
  padding: 22px 20px;
  color: #fff;
  box-shadow: 0 18px 40px -20px var(--accent);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -50px; top: -60px;
  width: 190px; height: 190px; border-radius: 50%;
  background: rgba(255,255,255,.13);
}
.hero::before {
  content: ""; position: absolute; right: 30px; bottom: -70px;
  width: 130px; height: 130px; border-radius: 50%;
  background: rgba(255,255,255,.09);
}
.hero h1 { margin: 0 0 4px; font-size: 21px; font-weight: 700; letter-spacing: -.2px; }
.hero .hero-sub { font-size: 13px; opacity: .88; margin-bottom: 18px; }
.hero .hero-nums { display: flex; gap: 22px; margin-bottom: 18px; position: relative; z-index: 1; }
.hero .hero-num b { display: block; font-size: 30px; font-weight: 780; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hero .hero-num span { font-size: 11.5px; opacity: .85; }
.hero .btn { position: relative; z-index: 1; }
/* 手机上 hero 的两个按钮纵向堆叠，避免文字被挤成两行，也更好点 */
.hero .btn-row { flex-direction: column; }
.hero .btn-row .btn { width: 100%; }
.hero .btn-hero {
  background: #fff; color: var(--accent);
  font-weight: 700;
  box-shadow: 0 8px 20px -8px rgba(0,0,0,.4);
}
.hero .btn-hero:hover { background: #fff; }
.hero .btn-hero-ghost {
  background: rgba(255,255,255,.18); color: #fff;
  border: 1px solid rgba(255,255,255,.3);
  backdrop-filter: blur(6px);
}
.hero .btn-hero-ghost:hover { background: rgba(255,255,255,.28); }

/* 快捷入口 */
.mode-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }

.mode-card {
  display: flex; align-items: center; gap: 13px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: transform .12s, border-color .15s, box-shadow .15s;
  width: 100%;
}
.mode-card:active { transform: scale(.985); }
.mode-card:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); box-shadow: var(--shadow); }
.mode-card .mc-icon {
  width: 42px; height: 42px; flex: none;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.mode-card .mc-icon svg { width: 21px; height: 21px; }
.mode-card.ok .mc-icon { background: var(--ok-soft); color: var(--ok); }
.mode-card.warn .mc-icon { background: var(--warn-soft); color: var(--warn); }
.mode-card.bad .mc-icon { background: var(--bad-soft); color: var(--bad); }
.mode-card .mc-text { flex: 1; min-width: 0; }
.mode-card .mc-title { font-weight: 620; font-size: 14.5px; display: flex; align-items: center; gap: 6px; }
.mode-card .mc-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.mode-card .mc-go { color: var(--muted); flex: none; }
.mode-card .mc-go svg { width: 18px; height: 18px; }
.mode-card:disabled { opacity: .5; pointer-events: none; }

/* 说明条 */
.note {
  display: flex; gap: 10px;
  padding: 12px 14px;
  background: var(--panel-2);
  border-radius: var(--r);
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.65;
}
.note svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--accent); }
.note b { color: var(--text); }

/* iOS 静音开关提示条（可关闭）：只在确实有音要走系统语音时出现 */
.note.ios-tip {
  margin: 0 14px 12px;
  align-items: flex-start;
  background: var(--warn-soft);
  color: var(--text-2);
}
.note.ios-tip svg { color: var(--warn); }
.note.ios-tip > div { flex: 1; min-width: 0; }
.note.ios-tip .btn { flex: none; align-self: center; }

.interval-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.interval-list span {
  font-size: 11px; padding: 2px 8px; border-radius: 6px;
  background: var(--panel-3); color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   背诵模式
   ============================================================ */
.study-view { display: flex; flex-direction: column; min-height: 100%; }
.study-top {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px 8px;
}
.study-top .progress-wrap { flex: 1; }
.study-top .st-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; display: flex; justify-content: space-between; }
/* 顶栏的草稿本入口：始终可见，不随工具条横向滚动 */
.study-top .draft-top { position: relative; }
.study-top .draft-top .badge { position: absolute; top: 1px; right: 1px; }

.study-card {
  margin: 0 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  padding: 26px 18px;
  display: flex; flex-direction: column;
  min-height: 340px;
  position: relative;
}

.sc-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }

.sc-word {
  font-size: clamp(34px, 12vw, 52px);
  font-weight: 750;
  letter-spacing: -.5px;
  line-height: 1.15;
  word-break: break-word;
  transition: filter .22s, opacity .22s;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.sc-word .spk {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; flex: none;
}
.sc-word .spk svg { width: 20px; height: 20px; }
.sc-phonetic {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--muted);
  margin-top: 6px;
  letter-spacing: .3px;
}

.sc-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 22px 0 14px;
  color: var(--muted); font-size: 11.5px; letter-spacing: 1px;
}
.sc-divider::before, .sc-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.sc-meaning {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.6;
}
.sc-pos {
  display: inline-block;
  font-size: 12px; font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 5px;
  padding: 1px 6px;
  margin-right: 6px;
  vertical-align: 2px;
}
.sc-example {
  margin-top: 14px;
  padding-left: 12px;
  border-left: 3px solid var(--border-2);
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.7;
}
.sc-example .en { font-style: italic; }
.sc-example .cn { font-size: 13px; color: var(--muted); margin-top: 3px; }

/* ---------- 助记 ----------
   记忆钩子（谐音 / 词根词缀 / 联想）。它常常直接点破词义，
   所以在背诵页跟释义一起揭晓、一起被遮罩；列表里则常驻可见。 */
.sc-mnemonic {
  display: flex; gap: 8px; align-items: flex-start;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--mn-bg);
  border-radius: var(--r-sm);
  font-size: 13.5px; line-height: 1.65;
  color: var(--text-2);
  text-align: left;
}
.sc-mnemonic .mn-tag {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  margin-top: 1px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  color: var(--mn);
}
.sc-mnemonic .mn-tag svg { width: 14px; height: 14px; }
.sc-mnemonic .mn-text { min-width: 0; word-break: break-word; }

/* 列表 / 草稿 / 错题本里的助记：内联一行，颜色一致 */
.wr-mn,
.dr-mn {
  display: flex; gap: 4px; align-items: flex-start;
  margin-top: 3px;
  font-size: 12px; line-height: 1.5;
  color: var(--mn);
}
.wr-mn svg,
.dr-mn svg { width: 13px; height: 13px; margin-top: 2px; }
.wr-mn > span,
.dr-mn > span { min-width: 0; word-break: break-word; }
/* 浏览列表里助记最多占两行，别把列表撑长（错题本行短，不限制） */
.wrow .wr-mn > span {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.import-preview .ip-mn {
  display: inline-flex; align-items: center; gap: 3px;
  margin-left: 6px; vertical-align: -2px;
  color: var(--mn);
}
.import-preview .ip-mn svg { width: 12px; height: 12px; }

/* 遮蔽 */
.masked {
  filter: blur(13px);
  user-select: none;
  pointer-events: none;
  opacity: .55;
}
.mask-hint {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 74px;
  border: 1px dashed var(--border-2);
  border-radius: var(--r);
  color: var(--muted);
  font-size: 13px;
  background: var(--panel-2);
  cursor: pointer;
}
.mask-hint:active { background: var(--panel-3); }
.mask-hint svg { width: 17px; height: 17px; }

.sc-body { flex: 1; }
.sc-foot { margin-top: auto; padding-top: 20px; }

/* 跟读结果 */
.asr-box {
  margin-top: 14px;
  padding: 13px;
  border-radius: var(--r);
  background: var(--panel-2);
  border: 1px solid var(--border);
  animation: fadeUp .2s ease both;
}
.asr-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.asr-score {
  width: 46px; height: 46px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 16px; font-weight: 780;
  font-variant-numeric: tabular-nums;
}
.asr-score.ok { background: var(--ok-soft); color: var(--ok); }
.asr-score.warn { background: var(--warn-soft); color: var(--warn); }
.asr-score.bad { background: var(--bad-soft); color: var(--bad); }
.asr-heard { font-size: 13px; color: var(--text-2); }
.asr-heard b { font-family: var(--mono); font-size: 14px; color: var(--text); }
.asr-diff { display: flex; flex-wrap: wrap; gap: 2px; font-family: var(--mono); font-size: 16px; letter-spacing: 1px; margin-top: 6px; }
.asr-diff span { padding: 0 1px; border-radius: 3px; }
.asr-diff .ok { color: var(--ok); }
.asr-diff .sub { color: var(--bad); background: var(--bad-soft); text-decoration: underline wavy; }
.asr-diff .del { color: var(--bad); background: var(--bad-soft); opacity: .7; }
.asr-diff .ins { color: var(--warn); background: var(--warn-soft); }

/* 评分按钮 */
.rate-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.rate-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  height: 62px;
  border-radius: 14px;
  font-weight: 650;
  font-size: 14.5px;
  border: 1px solid transparent;
  transition: transform .12s, background .15s;
}
.rate-btn:active { transform: scale(.96); }
.rate-btn .rb-sub { font-size: 10.5px; font-weight: 500; opacity: .75; }
.rate-btn .kbd { display: none; }
.rate-btn.known { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.rate-btn.fuzzy { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.rate-btn.unknown { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.rate-btn.flash { animation: flash .3s ease; }

@keyframes flash {
  0% { transform: scale(1); }
  45% { transform: scale(.93); }
  100% { transform: scale(1); }
}

.study-tools {
  display: flex; align-items: center; gap: 7px;
  padding: 12px 14px 0;
  /* 手机上按钮多，横向滑动比换行更紧凑；能放进一行时不会出现滚动 */
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.study-tools::-webkit-scrollbar { display: none; }
.study-tools .tool-btn { flex: none; }
.tool-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 12px;
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text-2);
  font-size: 13px;
  border: 1px solid transparent;
}
.tool-btn svg { width: 16px; height: 16px; }
.tool-btn:active { transform: scale(.96); }
.tool-btn.off { opacity: .5; text-decoration: line-through; }
.tool-btn.listening { background: var(--bad-soft); color: var(--bad); animation: pulse 1.1s infinite; }
.tool-btn.good { background: var(--ok-soft); color: var(--ok); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}

.kbd-hint {
  display: none;
  font-size: 11px; color: var(--muted);
  gap: 10px; flex-wrap: wrap;
}
.kbd-hint kbd {
  display: inline-block;
  padding: 1px 5px; border-radius: 5px;
  background: var(--panel-3);
  border: 1px solid var(--border-2);
  font-family: var(--mono); font-size: 10.5px;
  margin-right: 3px;
}

/* 小结 */
.summary { text-align: center; padding: 26px 16px; }
.summary .sum-emoji { font-size: 46px; line-height: 1; margin-bottom: 12px; }
.summary h2 { margin: 0 0 6px; font-size: 21px; }
.summary p { color: var(--muted); font-size: 13.5px; margin: 0 0 20px; }
.sum-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 20px; }

/* ============================================================
   词库浏览
   ============================================================ */
.browse-bar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.search-wrap .input { padding-left: 36px; padding-right: 34px; }
.search-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }

.filter-scroll { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: none; }
.filter-scroll::-webkit-scrollbar { display: none; }

.word-list { display: flex; flex-direction: column; gap: 8px; }

/* 手机：单词行纵向堆叠，避免右侧信息被挤成一团 */
.wrow {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 13px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s;
}
.wrow:hover { border-color: var(--border-2); }
.wrow .wr-main { flex: none; min-width: 0; }
.wrow .wr-word {
  font-size: 17px; font-weight: 700;
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  word-break: break-word;
}
.wrow .wr-ph { font-family: var(--mono); font-size: 12px; color: var(--muted); font-weight: 400; }
.wrow .wr-meaning { font-size: 13.5px; color: var(--text-2); margin-top: 3px; word-break: break-word; }
.wrow .wr-ex { font-size: 12px; color: var(--muted); margin-top: 5px; font-style: italic; }
.wrow .wr-side { display: flex; flex-direction: row; align-items: center; gap: 10px; }
.wrow .wr-acts { display: flex; gap: 2px; margin-left: auto; }

.lvl-wrap { display: flex; align-items: center; gap: 6px; }
.lvl-tag { font-size: 10.5px; font-weight: 650; padding: 1px 6px; border-radius: 5px; white-space: nowrap; }
.lvl-tag.new { background: var(--panel-3); color: var(--muted); }
.lvl-tag.learning { background: var(--warn-soft); color: var(--warn); }
.lvl-tag.consolidating { background: var(--accent-soft); color: var(--accent); }
.lvl-tag.mastered { background: var(--ok-soft); color: var(--ok); }
.wr-due { font-size: 11px; color: var(--muted); white-space: nowrap; }

.mini-bar { width: 46px; height: 4px; border-radius: 2px; background: var(--panel-3); overflow: hidden; flex: none; }
.mini-bar > i { display: block; height: 100%; border-radius: 2px; }

.list-foot { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 18px 0 6px; }
.list-foot .lf-info { font-size: 12.5px; color: var(--muted); }

/* ============================================================
   错题本
   ============================================================ */
.wrong-row { display: flex; align-items: center; gap: 12px; padding: 13px 14px; }
.wrong-row .wr-main { flex: 1; min-width: 0; }
.wrong-count {
  font-size: 11px; font-weight: 700;
  color: var(--bad); background: var(--bad-soft);
  padding: 2px 7px; border-radius: 6px; flex: none;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   统计
   ============================================================ */
.dist-row { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--panel-3); }
.dist-row > i { display: block; height: 100%; transition: width .4s; }

.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.legend .lg { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.legend .lg i { width: 9px; height: 9px; border-radius: 3px; }

.forecast { display: flex; align-items: flex-end; gap: 5px; height: 110px; margin-top: 6px; max-width: 560px; }
.fc-col { flex: 1 1 0; max-width: 64px; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.fc-bar { width: 100%; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 45%, var(--panel))); min-height: 3px; transition: height .4s; }
.fc-num { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fc-lbl { font-size: 10px; color: var(--muted); }

.heat { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; max-width: 360px; }
.heat i { aspect-ratio: 1; border-radius: 4px; background: var(--panel-3); }
.heat i[data-l="1"] { background: color-mix(in srgb, var(--accent) 25%, var(--panel-3)); }
.heat i[data-l="2"] { background: color-mix(in srgb, var(--accent) 45%, var(--panel-3)); }
.heat i[data-l="3"] { background: color-mix(in srgb, var(--accent) 70%, var(--panel-3)); }
.heat i[data-l="4"] { background: var(--accent); }
.heat i.today { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ============================================================
   词库管理
   ============================================================ */
.bank-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.bank-card .bc-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.bank-card .bc-body { flex: 1; min-width: 0; }
.bank-card .bc-name { font-weight: 620; font-size: 14.5px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.bank-card .bc-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.bank-card .bc-acts { display: flex; gap: 3px; flex: none; }

.import-preview { max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--r); }
.import-preview .ip-row { display: flex; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.import-preview .ip-row:last-child { border-bottom: none; }
.import-preview .ip-w { font-weight: 650; min-width: 90px; word-break: break-word; }
.import-preview .ip-m { color: var(--text-2); flex: 1; min-width: 0; word-break: break-word; }

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--panel-2); border-radius: var(--r); margin-bottom: 14px; }
.tabs button {
  flex: 1; height: 36px; border-radius: 9px;
  font-size: 13.5px; font-weight: 550; color: var(--muted);
  transition: background .15s, color .15s;
}
.tabs button.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 650; }

/* ============================================================
   弹层
   ============================================================ */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 12, 16, .5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn .18s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%;
  max-height: 90dvh;
  background: var(--panel);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 8px 16px calc(20px + var(--safe-b));
  overflow-y: auto;
  animation: sheetUp .26s cubic-bezier(.22, .9, .3, 1) both;
  box-shadow: var(--shadow-lg);
}
@keyframes sheetUp { from { transform: translateY(16px); opacity: .6; } to { transform: none; opacity: 1; } }

.sheet-grip { width: 38px; height: 4px; border-radius: 2px; background: var(--border-2); margin: 6px auto 14px; }
.modal h2 { margin: 0 0 16px; font-size: 17px; }
.modal-foot { display: flex; gap: 9px; margin-top: 18px; }
.modal-foot .btn { flex: 1; }

/* ---------- 确认 / 输入弹层（替代浏览器原生 confirm / prompt） ---------- */
/* 用 .ask-mask 前缀提高优先级，避免被下方媒体查询里的 .modal 规则改成底部抽屉 */
.ask-mask { z-index: 150; align-items: center; padding: 18px; }
.ask-mask .ask-modal {
  width: 100%; max-width: 420px; margin-bottom: 0;
  border-radius: var(--r-xl);
  padding: 22px 20px calc(18px + var(--safe-b));
  animation: askPop .2s cubic-bezier(.22, .9, .3, 1) both;
}
@keyframes askPop { from { transform: scale(.96) translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.ask-icon {
  display: grid; place-items: center;
  width: 40px; height: 40px; margin-bottom: 13px;
  border-radius: 13px;
  background: var(--accent-soft); color: var(--accent);
}
.ask-icon svg { width: 21px; height: 21px; }
.ask-icon.bad { background: var(--bad-soft); color: var(--bad); }

.ask-mask .ask-modal h2.ask-title {
  margin: 0 0 9px; font-size: 16.5px; font-weight: 650; line-height: 1.45;
}
.ask-body { color: var(--text-2); font-size: 13.8px; line-height: 1.68; }
.ask-body p { margin: 0 0 8px; }
.ask-body p:last-child { margin-bottom: 0; }
.ask-body b { color: var(--text); }
.ask-body .ask-sub {
  margin-top: 10px; padding: 9px 11px;
  border-radius: 10px; background: var(--panel-2);
  font-size: 12.8px; line-height: 1.6;
}
.ask-mask .ask-modal .field { margin-top: 15px; margin-bottom: 0; }
.ask-foot { display: flex; gap: 9px; margin-top: 20px; }
.ask-foot .btn { flex: 1; }

.btn-danger { background: var(--bad); color: #fff; box-shadow: 0 6px 18px -8px var(--bad); }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 88%, #000); }

/* toast */
.toast-wrap {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  transform: translateX(-50%);
  z-index: 200;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
  width: max-content; max-width: 90vw;
}
.toast {
  padding: 10px 16px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 92%, transparent);
  color: var(--bg);
  font-size: 13.5px;
  box-shadow: var(--shadow);
  animation: toastIn .24s cubic-bezier(.22,.9,.3,1) both;
  display: flex; align-items: center; gap: 7px;
}
.toast svg { width: 16px; height: 16px; }
.toast span { white-space: nowrap; }
.toast.out { animation: toastOut .2s ease both; }
.toast.err { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
@keyframes toastIn { from { transform: translateY(12px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { to { transform: translateY(8px); opacity: 0; } }

/* ============================================================
   作答反馈 + 「下一个」
   ============================================================ */
.judged {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 13px;
  margin-bottom: 10px;
  border-radius: var(--r);
  font-size: 13px;
  animation: fadeUp .2s ease both;
}
.judged.ok   { background: var(--ok-soft);   color: var(--ok); }
.judged.warn { background: var(--warn-soft); color: var(--warn); }
.judged.bad  { background: var(--bad-soft);  color: var(--bad); }
.judged .jn-tag {
  flex: none;
  font-weight: 700; font-size: 12px;
  padding: 2px 8px; border-radius: 6px;
}
.judged.ok   .jn-tag { background: color-mix(in srgb, var(--ok) 18%, transparent); }
.judged.warn .jn-tag { background: color-mix(in srgb, var(--warn) 18%, transparent); }
.judged.bad  .jn-tag { background: color-mix(in srgb, var(--bad) 18%, transparent); }
.judged .jn-text { color: var(--text-2); line-height: 1.45; }

.next-btn { gap: 8px; }
.next-btn svg { width: 19px; height: 19px; }

/* 工具条上的数量角标（草稿本） */
.tool-btn .tb-count {
  font-size: 10.5px; font-weight: 700; line-height: 1;
  padding: 2px 5px; border-radius: 999px;
  background: var(--accent); color: #fff;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   草稿本
   ============================================================ */
.modal .sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.modal .sheet-head h2 { margin: 0; flex: 1; display: flex; align-items: center; gap: 8px; }
.draft-count {
  font-size: 11.5px; font-weight: 700; line-height: 1.4;
  padding: 1px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.draft-tip { margin: 0 0 14px; font-size: 12px; color: var(--muted); line-height: 1.55; }

.draft-cur {
  display: flex; align-items: center; gap: 7px;
  width: 100%; margin-bottom: 10px;
  padding: 11px 12px;
  border-radius: var(--r);
  background: var(--panel-2);
  color: var(--accent);
  font-size: 13.5px; font-weight: 600;
  border: 1px dashed color-mix(in srgb, var(--accent) 40%, transparent);
  text-align: left;
}
.draft-cur:active { transform: scale(.99); }
.draft-cur svg { width: 16px; height: 16px; }

.draft-add { display: flex; gap: 8px; }
.draft-add .input { flex: 1; min-width: 0; }
.draft-add .btn { flex: none; }

.link-btn {
  display: block; margin-top: 10px;
  font-size: 12.5px; color: var(--accent);
  text-align: left; padding: 2px 0;
}
.draft-bulk { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.draft-bulk .textarea { min-height: 92px; }
.draft-bulk .btn { align-self: flex-end; }

.draft-list {
  margin-top: 14px;
  display: flex; flex-direction: column; gap: 7px;
  max-height: 40dvh; overflow-y: auto;
}
.draft-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.draft-row .dr-main { flex: 1; min-width: 0; }
.draft-row .dr-word {
  font-weight: 650; font-size: 14.5px;
  display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap;
  word-break: break-word;
}
.draft-row .dr-ph { font-family: var(--mono); font-size: 11.5px; color: var(--muted); font-weight: 400; }
.draft-row .dr-tag {
  font-size: 10px; font-weight: 650;
  padding: 1px 5px; border-radius: 5px;
  background: var(--warn-soft); color: var(--warn);
}
.draft-row .dr-mean { font-size: 12.5px; color: var(--text-2); margin-top: 2px; word-break: break-word; }
.draft-row .dr-acts { display: flex; gap: 2px; flex: none; }

.icon-btn.sm { width: 32px; height: 32px; border-radius: 8px; }
.icon-btn.sm svg { width: 17px; height: 17px; }
.icon-btn.dim { opacity: .38; }

.draft-empty {
  padding: 18px 14px; text-align: center;
  font-size: 12.5px; color: var(--muted); line-height: 1.6;
  border: 1px dashed var(--border-2); border-radius: var(--r);
}

/* 词库管理页的草稿本入口 */
.draft-entry { display: flex; align-items: center; gap: 12px; }
.draft-entry .de-body { flex: 1; min-width: 0; }
.draft-entry .de-title { display: flex; align-items: center; gap: 7px; font-weight: 650; font-size: 14.5px; }
.draft-entry .de-title svg { width: 17px; height: 17px; color: var(--accent); }
.draft-entry .de-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.draft-entry .btn { flex: none; }

/* ============================================================
   手机 <640px：横向滚动条的“右边还有内容”提示
   工具条与筛选条的滚动条是隐藏的，窄屏下最后一个按钮会贴着
   右边缘被切掉，看起来像坏了。用一层右侧渐隐告诉用户“可以滑”，
   并补一段右内边距，滑到底时最后一项不会被渐隐盖住。
   ============================================================ */
@media (max-width: 639px) {
  .study-tools, .filter-scroll {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent 100%);
    mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent 100%);
  }
  .study-tools { padding-right: 26px; scroll-padding-right: 26px; }
  .filter-scroll { padding-right: 26px; scroll-padding-right: 26px; }
}

/* ============================================================
   平板 >=640px
   ============================================================ */
@media (min-width: 640px) {
  body { font-size: 15.5px; }
  .wrap { padding: 20px 20px 30px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .mode-grid { grid-template-columns: repeat(2, 1fr); }
  .study-card { margin: 0 20px; padding: 34px 30px; min-height: 400px; }
  .study-top { padding: 16px 20px 10px; }
  .study-tools { padding: 14px 20px 0; }
  .rate-btn { height: 66px; font-size: 15px; }
  .next-btn { height: 56px; font-size: 16px; }
  .draft-list { max-height: 46dvh; }
  .draft-row { padding: 11px 14px; }
  .browse-bar { flex-direction: row; align-items: center; }
  .search-wrap { flex: 1; max-width: 320px; }
  .modal { max-width: 560px; border-radius: var(--r-xl); margin-bottom: 6vh; }
  .modal-mask { align-items: center; padding: 20px; }
  .modal { animation: popIn .22s cubic-bezier(.22,.9,.3,1) both; }
  @keyframes popIn { from { transform: scale(.96) translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
  .toast-wrap { bottom: calc(var(--nav-h) + var(--safe-b) + 22px); }
  .word-list { gap: 9px; }
  /* 平板起：单词行恢复左右两栏 */
  .wrow { flex-direction: row; align-items: flex-start; gap: 12px; }
  .wrow .wr-main { flex: 1; }
  .wrow .wr-side { flex-direction: column; align-items: flex-end; gap: 7px; flex: none; }
  .wrow .wr-acts { margin-left: 0; }
  .sum-grid { max-width: 440px; margin-left: auto; margin-right: auto; }
  .page-head h1 { font-size: 25px; }
  .hero { padding: 28px 26px; }
  .hero h1 { font-size: 24px; }
  .hero .btn-row { flex-direction: row; }
  .hero .btn-row .btn { width: auto; flex: 1 1 0; min-width: 0; }
}

/* ============================================================
   桌面 >=1024px
   ============================================================ */
@media (min-width: 1024px) {
  .app { flex-direction: row; }
  .topbar { display: none; }
  .bottom-nav { display: none; }

  .rail {
    display: flex;
    flex-direction: column;
    width: var(--rail-w);
    flex: none;
    background: var(--panel);
    border-right: 1px solid var(--border);
    padding: 18px 12px 14px;
    gap: 4px;
  }

  .rail .brand { padding: 0 8px 16px; }

  .rail-sec { font-size: 10.5px; font-weight: 700; color: var(--muted); letter-spacing: 1px; padding: 14px 10px 6px; text-transform: uppercase; }

  .rail-btn {
    display: flex; align-items: center; gap: 10px;
    height: 40px; padding: 0 11px;
    border-radius: 10px;
    color: var(--text-2);
    font-size: 14px;
    font-weight: 520;
    transition: background .14s, color .14s;
    text-align: left;
    width: 100%;
  }
  .rail-btn svg { width: 18px; height: 18px; flex: none; }
  .rail-btn:hover { background: var(--panel-2); color: var(--text); }
  .rail-btn.active { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
  .rail-btn .badge { margin-left: auto; }

  .rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }

  .main { padding-bottom: 24px; }
  .wrap { padding: 28px 32px 40px; }
  .page-head h1 { font-size: 28px; }
  .mode-grid { grid-template-columns: repeat(3, 1fr); }
  .stat-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .study-card { width: 100%; max-width: 780px; margin: 0 auto; padding: 44px 52px; min-height: 440px; }
  .study-top { max-width: 780px; margin: 0 auto; width: 100%; padding: 20px 0 12px; }
  .study-tools { max-width: 780px; margin: 0 auto; width: 100%; padding: 16px 0 0; }
  .rate-btn { height: 72px; }
  .rate-row { max-width: 780px; margin: 0 auto; width: 100%; grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .study-view > .wrap { max-width: 900px; }
  .kbd-hint { display: flex; }
  .rate-btn .kbd {
    display: flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 5px;
    background: rgba(0,0,0,.08); font-size: 10.5px; font-weight: 700;
    position: absolute; top: 8px; right: 8px;
  }
  [data-theme="dark"] .rate-btn .kbd { background: rgba(255,255,255,.1); }
  .rate-btn { position: relative; }
  .toast-wrap { bottom: 28px; }
  .hero { padding: 30px 32px; }
  .hero h1 { font-size: 26px; }
  .hero .hero-num b { font-size: 34px; }
  .word-list { gap: 10px; }
  .wrong-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

@media (min-width: 1280px) {
  .mode-grid { grid-template-columns: repeat(3, 1fr); }
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
