/* 打单词 - 打字记单词 核心样式系统 */

/* === 自托管字体（latin 子集，替代 Google Fonts，避免大陆网络阻塞首屏） === */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/public/site/fonts/inter-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/public/site/fonts/inter-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/public/site/fonts/inter-latin-700-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('/public/site/fonts/inter-latin-800-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/public/site/fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/public/site/fonts/jetbrains-mono-latin-700-normal.woff2') format('woff2');
}

:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #131927;
  --bg-card: rgba(23, 31, 50, 0.75);
  --bg-card-hover: rgba(30, 41, 66, 0.85);
  --bg-input: #1a2338;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.3);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --accent-glow: rgba(99, 102, 241, 0.25);
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.3);
  --error: #ef4444;
  --error-glow: rgba(239, 68, 68, 0.35);
  --warning: #f59e0b;
  
  --key-bg: #1e293b;
  --key-border: #334155;
  --key-shadow: 0 4px 0 #0f172a;
  --key-active: #6366f1;
  --key-target: #38bdf8;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --bg-input: #e2e8f0;
  
  --border-color: rgba(0, 0, 0, 0.08);
  --border-glow: rgba(99, 102, 241, 0.2);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --key-bg: #ffffff;
  --key-border: #cbd5e1;
  --key-shadow: 0 4px 0 #94a3b8;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  line-height: 1.5;
  user-select: none;
}

/* 通用工具类 */
.hidden { display: none !important; }

/* Background Atmosphere Orbs */
.bg-ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.25;
  animation: orbFloat 20s ease-in-out infinite alternate;
}
.orb-1 { width: 500px; height: 500px; background: #6366f1; top: -150px; left: -100px; }
.orb-2 { width: 450px; height: 450px; background: #a855f7; bottom: -150px; right: -100px; animation-delay: -7s; }
.orb-3 { width: 350px; height: 350px; background: #06b6d4; top: 40%; left: 50%; transform: translate(-50%, -50%); animation-delay: -14s; opacity: 0.15; }

@keyframes orbFloat {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 30px) scale(1.1); }
  100% { transform: translate(-30px, -40px) scale(0.95); }
}

/* Header & Nav */
.header {
  position: relative;
  z-index: 20;
  backdrop-filter: blur(16px);
  background: rgba(11, 15, 25, 0.7);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 24px;
}
.header-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}
.brand-icon {
  width: 40px;
  height: 40px;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 14px var(--accent-glow);
}
.brand-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ===== 打单词页顶栏（一行放全部控件）=====
   品牌即「回主页」，所以没有单独的主页按钮。2026-09-28 用户口径「不需要这个提示，
   最好都放第一行」：① ② ③ 小标签与第二行删掉，词库 / 模式 / 难度全部上收一行。 */
.hdr-one-row { padding: 10px 24px; }
.hdr-bar {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.hdr-bar .brand { flex-shrink: 0; }
.hdr-bar .book-widget { min-width: 0; }
/* 模式组和难度组语义不同却长得一样，中间用一道竖线分开，比加文字标签省地方
   （已经没有标签可加了）。只在「确实排在一行」的宽度下画，否则换行后会在行首留一道孤线。 */
@media (min-width: 1120px) {
  .hdr-bar .diff-group {
    padding-left: 12px;
    border-left: 1px solid var(--border-color);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
  }
}
.hdr-bar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
/* 这两个弹层都贴在右侧控件下方、往左长，否则窄屏会顶出视口 */
.hdr-bar-right .profile-panel,
.hdr-bar-right .settings-panel { left: auto; right: 0; }
/* 设置弹层：把原来五个没有名字的图标按钮换成「一行一句话 + 开关」 */
.settings-widget { position: relative; }
.settings-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.settings-btn:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.settings-btn.open {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--accent-glow);
}
.settings-gear { font-size: 15px; }
.settings-panel {
  position: absolute;
  top: calc(100% + 8px);
  z-index: 70;
  width: 236px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  padding: 12px;
  text-align: left;
}
.settings-title {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-muted);
  padding-bottom: 6px;
}
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.set-row + .set-row { border-top: 1px solid var(--border-color); }
.set-switch {
  flex-shrink: 0;
  width: 38px;
  height: 21px;
  padding: 0;
  border-radius: 100px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  position: relative;
  cursor: pointer;
  transition: all 0.18s;
}
.set-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all 0.18s;
}
.set-switch.active { background: var(--accent-glow); border-color: var(--accent-primary); }
.set-switch.active::after { left: 20px; background: var(--accent-primary); }
@media (max-width: 768px) {
  .hdr-one-row { padding: 8px 12px 10px; }
  .hdr-bar { gap: 8px; }
  /* 窄屏一行放不下：第一行只留品牌 + 档案 + 设置，词库 / 模式 / 难度各占一行 */
  .hdr-bar .brand { order: 1; }
  .hdr-bar .hdr-bar-right { order: 2; }
  .hdr-bar .book-widget { order: 3; flex: 1 1 100%; }
  .hdr-bar .book-btn { max-width: none; width: 100%; }
  .hdr-bar .mode-group { order: 4; }
  .hdr-bar .diff-group { order: 5; }
  /* 各占一行时按钮等分铺满，手指点着才一致 */
  .hdr-bar .mode-group, .hdr-bar .diff-group {
    flex: 1 1 100%;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
  }
  /* 两个弹层仍按绝对定位挂在各自按钮下方：仓库里老规则把 .profile-panel 钉成
     fixed + top:110px 全宽，那个位置会盖到控件上。 */
  .hdr-bar-right .profile-panel,
  .hdr-bar-right .settings-panel {
    position: absolute;
    left: auto;
    right: 0;
    width: min(280px, calc(100vw - 24px));
  }
}

/* 返回主页按钮（打单词/拼音/数学/英语等学生端页面统一使用） */
.home-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 100px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.18s ease;
}
.home-pill:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}
.home-pill:active { transform: translateY(0); }
@media (max-width: 768px) {
  .home-pill { padding: 5px 11px; font-size: 12.5px; }
}

/* 词库可搜索弹层（导入 qwerty 词库后词书 370+ 本，长下拉不可用） */
.book-widget { position: relative; }
.book-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  max-width: 210px;
}
.book-btn:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.book-avatar {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}
.book-btn #bookLabel {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.book-count {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}
.book-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 70;
  width: 320px;
  max-width: calc(100vw - 24px);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  padding: 10px;
}
.book-search {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 11px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13.5px;
  outline: none;
}
.book-search:focus { border-color: var(--accent-primary); }
/* 学段标签：把 49 个来源分组并成 小学/初中/高中/… 一层，条目由 app.js 的 renderStageTabs 生成 */
.book-stages {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}
.book-stage {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--bg-primary);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s;
}
.book-stage:hover { color: var(--text-primary); border-color: var(--accent-primary); }
.book-stage.active {
  background: var(--accent-glow);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}
.book-stage-count { font-size: 10px; font-weight: 800; opacity: 0.75; }
.book-list {
  margin-top: 8px;
  max-height: 330px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.book-group {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 6px 4px;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}
/* 第二层「教材版本」小标题：不吸顶，否则和上面那条来源分组标题叠在同一个 top:0 上 */
.book-group-sub {
  position: static;
  padding: 5px 4px 2px 10px;
  font-size: 11px;
  border-bottom: none;
  opacity: 0.85;
}
.book-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  padding: 7px 9px;
  margin-top: 2px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.book-item:hover { background: var(--bg-primary); border-color: var(--border-color); }
.book-item.active {
  background: var(--accent-glow);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}
.book-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.book-item-count {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}
.book-empty {
  padding: 16px 6px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
}
@media (max-width: 768px) {
  .book-btn { padding: 5px 9px; font-size: 12.5px; max-width: 140px; }
  .book-panel { width: min(320px, calc(100vw - 16px)); }
}

/* Custom Select Dropdown */
.select-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.select-input {
  appearance: none;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 8px 36px 8px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
  max-width: 300px;
}
.select-input:hover, .select-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.select-icon {
  position: absolute;
  right: 12px;
  pointer-events: none;
  color: var(--text-secondary);
  font-size: 12px;
}

/* Mode Buttons Pill Group */
.mode-group {
  display: flex;
  background: var(--bg-secondary);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}
.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.mode-btn:hover {
  color: var(--text-primary);
}
.mode-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* 僵尸难度：与模式组同款外壳，选中用草地绿（和跑道对得上），字号小一档省地方 */
.diff-group {
  display: flex;
  background: var(--bg-secondary);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}
.diff-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.diff-btn:hover {
  color: var(--text-primary);
}
.diff-btn.active {
  background: #4c9a2a;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(76, 154, 42, 0.45);
}

/* Icon Action Buttons */
.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
}
.btn-icon:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}
.btn-icon.active {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  background: var(--accent-glow);
}
/* 打单词页顶栏的一组开关：整组一起换行，别被 nav-controls 拆成半排 */
.icon-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Learner Profile Widget (练习者档案/多人切换) */
.profile-widget {
  position: relative;
}
.profile-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  max-width: 170px;
}
.profile-btn:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.profile-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}
.profile-btn #profileName {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-caret {
  font-size: 10px;
  color: var(--text-muted);
}
.profile-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 60;
  width: 280px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  padding: 12px;
  text-align: left;
}
.profile-panel-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 2px 6px 10px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 8px;
}
.profile-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: 10px;
}
.profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}
.profile-row:hover {
  background: var(--bg-input);
}
.profile-row.active {
  background: var(--accent-glow);
  border-color: var(--accent-primary);
}
.profile-info {
  min-width: 0;
  flex: 1;
}
.profile-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-row.active .profile-name::after {
  content: ' · 当前';
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-primary);
}
.profile-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.profile-del {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 7px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.profile-del:hover {
  color: var(--error);
  border-color: var(--error);
  background: var(--error-glow);
}
.profile-del.armed {
  width: auto;
  padding: 0 8px;
  background: var(--error);
  border-color: var(--error);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.profile-add {
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
}
.profile-input {
  flex: 1;
  min-width: 0;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
  transition: all 0.2s;
}
.profile-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.profile-add-btn {
  padding: 8px 16px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.profile-add-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--accent-glow);
}

/* App Main Layout */
.app-container {
  position: relative;
  z-index: 10;
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  /* 底部 padding 给固定的统计条让位，别盖住键盘 */
  padding: 24px 20px 92px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Stats Bar —— 收成屏幕最底下的一条，练习时不用盯着看 */
.stats-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-color);
}
.stat-card {
  display: flex;
  flex: 0 0 auto;
  background: none;
  backdrop-filter: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  flex-direction: row;
  align-items: baseline;
  gap: 6px;
  transition: none;
}
.stat-card:hover {
  transform: none;
  border-color: transparent;
}
.stat-card.clickable {
  cursor: pointer;
}
.stat-card.clickable:hover {
  border-color: transparent;
  box-shadow: none;
  color: var(--accent-primary);
}
.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-value {
  font-size: 16px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1.2;
}
.stat-value.highlight {
  color: var(--accent-primary);
}
.stat-value.success {
  color: var(--success);
}
.stat-value.warning {
  color: var(--warning);
}
.stat-unit {
  display: none;
}

/* Progress Line Bar —— 也压进底部那条 */
.progress-container {
  display: flex;
  align-items: center;
  background: none;
  border: 0;
  padding: 0;
  gap: 8px;
  min-width: 190px;
}
.progress-bar-bg {
  flex: 1;
  height: 5px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-text {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  font-weight: 600;
  min-width: 0;
  text-align: right;
  white-space: nowrap;
}

/* ── 战斗跑道：打对一个字母，豌豆射手就发一颗豌豆 ──
   草坪 / 路沿用《植物大战僵尸》原素材，尺寸比例和首页 PvZ 皮肤一致。 */
.battle-lane {
  position: relative;
  flex: 0 0 auto;
  height: 164px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  background: #6fae3f url('/public/site/img/pvz/lawn.webp') left bottom / auto 100% repeat-x;
}
/* 角色脚下的水泥路沿 */
.battle-lane::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 20px;
  z-index: 1;
  background: url('/public/site/img/pvz/walk.webp') left bottom / auto 100% repeat-x;
  border-top: 2px solid rgba(60, 45, 20, 0.28);
}
.battle-lane > * {
  position: absolute;
  line-height: 1;
}
.bl-danger {
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, rgba(220, 38, 38, 0.5), rgba(220, 38, 38, 0) 42%);
  transition: opacity 0.2s;
}
/* HUD 放左上角：放右边的话，僵尸刚刷新时头顶那条血条会被 chip 压住 */
.bl-hud {
  left: 12px;
  top: 10px;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.bl-hud span {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  background: rgba(0, 0, 0, 0.42);
  border-radius: 999px;
  padding: 4px 10px;
}

/* 豌豆射手：只用 background 长写法，简写在更高 specificity 的规则里会把
   background-image 悄悄重置成 none（首页 PvZ 皮肤踩过这个坑）
   background-image / filter 由 app.js 按手速档位换（普通→双发→加特林），这里只是初值 */
.bl-shooter {
  left: 14px;
  bottom: 18px;
  z-index: 3;
  width: 86px;
  height: 86px;
  background-position: bottom center;
  background-size: contain;
  background-repeat: no-repeat;
  background-image: url('/public/site/img/pvz/peashooter.webp');
  filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.35));
  transform-origin: 50% 96%;
  animation: bl-sway 4.6s ease-in-out infinite;
}
.bl-shooter.firing {
  animation: bl-recoil 220ms ease-out;
}
@keyframes bl-sway {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(4deg); }
}
@keyframes bl-recoil {
  0% { transform: translateX(0) scale(1); }
  30% { transform: translateX(-6px) scale(0.93, 1.06); }
  100% { transform: translateX(0) scale(1); }
}

/* 僵尸：外层 left 由 JS 逐帧推进，内层管一摇一晃。
   宽高不在这里写死 —— 每种立绘比例不同、且要随跑道高度缩放，由 app.js 的 battle.sizeTo() 现算 */
.bl-zombie {
  left: 0;
  bottom: 18px;
  z-index: 3;
  width: 74px;
  height: 118px;
}
.bl-zombie > i {
  position: absolute;
  inset: 0;
  display: block;
  background-position: bottom center;
  background-size: contain;
  background-repeat: no-repeat;
  background-image: url('/public/site/img/pvz/zombie.webp');
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.35));
  transform-origin: 50% 96%;
  animation: bl-shamble var(--zombie-skin-dur, 1.1s) ease-in-out infinite;
}
.bl-zombie > i.hurt {
  filter: drop-shadow(0 0 5px #fffbe0) brightness(1.55) saturate(0.6);
}
.bl-zombie.dying > i {
  animation: bl-ko 700ms ease-in forwards;
}
@keyframes bl-shamble {
  0%, 100% { transform: rotate(-4deg) translateY(0); }
  50% { transform: rotate(5deg) translateY(-4px); }
}
@keyframes bl-ko {
  0% { transform: rotate(0) translateY(0); opacity: 1; }
  25% { transform: rotate(-16deg) translateY(-3px); opacity: 1; }
  100% { transform: rotate(-78deg) translateY(18px); opacity: 0; }
}

/* 僵尸血条：7 发豌豆 = 7 格。
   注意 .bl-hp 不是 .battle-lane 的直接子元素，拿不到那条 `> *` 的 absolute，必须自己写 */
.bl-hp {
  position: absolute;
  left: 0;
  right: 0;
  top: -13px;
  z-index: 5;
  height: 9px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.bl-hp-fill {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(180deg, #a3e635, #4d7c0f);
  transition: width 0.12s linear;
}

.bl-pea {
  width: 16px;
  height: 16px;
  left: 0;
  bottom: 64px;
  z-index: 5;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #d9f778, #7ec420 55%, #3f7d10 100%);
  box-shadow: inset -2px -2px 3px rgba(28, 62, 6, 0.5), 0 2px 4px rgba(0, 0, 0, 0.3);
}
.bl-splat {
  width: 18px;
  height: 18px;
  left: 0;
  bottom: 62px;
  z-index: 5;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #eaff9a, #8fd42a 60%, rgba(63, 125, 16, 0) 100%);
  animation: bl-splat 240ms ease-out forwards;
}
@keyframes bl-splat {
  from { transform: scale(0.5); opacity: 0.95; }
  to { transform: scale(2.2); opacity: 0; }
}

/* ── 僵王博士（boss）──
   它站着不走，所以不能套 bl-shamble（那是"往前走"的一摇一晃，原地播像抽搐），
   换成上下悬停。:not(.dying) 是必须的：.bl-zombie.dying > i 的 specificity 和
   .bl-zombie.boss > i 一样是 (0,2,1)，谁在后面谁赢，不加 :not 的话 boss 倒下时
   会一直播悬停、bl-ko 那 700ms 根本放不出来。 */
.bl-zombie.boss:not(.dying) > i {
  animation: bl-boss-hover 2.4s ease-in-out infinite;
}
@keyframes bl-boss-hover {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-6px) rotate(1.5deg); }
}
/* 冰球 / 火球 / 小鬼 */
.bl-ice,
.bl-fire {
  left: 0;
  bottom: 58px;
  z-index: 5;
  border-radius: 50%;
}
.bl-ice {
  width: 26px;
  height: 26px;
  background: radial-gradient(circle at 38% 32%, #ffffff, #a5f3fc 42%, #0891b2 78%, #0e5f78 100%);
  box-shadow: 0 0 12px rgba(103, 232, 249, 0.85), inset -3px -3px 5px rgba(14, 95, 120, 0.6);
  animation: bl-spin 1.1s linear infinite;
}
.bl-fire {
  width: 24px;
  height: 24px;
  background: radial-gradient(circle at 38% 32%, #fff7ae, #fbbf24 40%, #ef4444 76%, #7f1d1d 100%);
  box-shadow: 0 0 14px rgba(251, 146, 60, 0.9), inset -3px -3px 5px rgba(127, 29, 29, 0.6);
  animation: bl-flare 260ms ease-in-out infinite alternate;
}
/* 拖尾在右边：这俩是往左飞的，尾巴要留在身后 */
.bl-ice::after,
.bl-fire::after {
  content: '';
  position: absolute;
  left: 100%;
  top: 20%;
  width: 26px;
  height: 60%;
  border-radius: 999px;
  opacity: 0.55;
  filter: blur(2px);
}
.bl-ice::after {
  background: linear-gradient(90deg, rgba(165, 243, 252, 0.9), rgba(165, 243, 252, 0));
}
.bl-fire::after {
  background: linear-gradient(90deg, rgba(251, 146, 60, 0.95), rgba(239, 68, 68, 0));
}
@keyframes bl-spin {
  to { transform: rotate(360deg); }
}
@keyframes bl-flare {
  from { transform: scale(1); }
  to { transform: scale(1.16); }
}

/* 小鬼：boss 扔出来的小兵，会自己走到豌豆脚下。宽高比按 imp.webp 实测 0.739，
   用 aspect-ratio 而不是写死两个数，换窄屏只改高度就不会变形。
   背景一律长写法 —— 简写在更高 specificity 的规则里会把 background-image 抹掉 */
.bl-imp {
  left: 0;
  bottom: 18px;
  z-index: 4;
  height: 62px;
  aspect-ratio: 0.739;
  background-position: bottom center;
  background-size: contain;
  background-repeat: no-repeat;
  background-image: url('/public/site/img/pvz/imp.webp');
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.35));
  transform-origin: 50% 96%;
  animation: bl-shamble 0.8s ease-in-out infinite;
}
.bl-imp.hurt {
  filter: drop-shadow(0 0 5px #fffbe0) brightness(1.55) saturate(0.6);
}

/* 打掉它扔的东西时的那一团爆开 */
.bl-boom {
  width: 40px;
  height: 40px;
  left: 0;
  bottom: 52px;
  z-index: 6;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.2) 45%, rgba(255, 255, 255, 0) 72%);
  animation: bl-boom 320ms ease-out forwards;
}
.bl-boom.ice {
  background: radial-gradient(circle, #ecfeff, rgba(103, 232, 249, 0.5) 45%, rgba(103, 232, 249, 0) 72%);
}
.bl-boom.fire {
  background: radial-gradient(circle, #fff7ed, rgba(251, 146, 60, 0.6) 45%, rgba(239, 68, 68, 0) 72%);
}
.bl-boom.imp {
  background: radial-gradient(circle, #f0fdf4, rgba(132, 204, 22, 0.55) 45%, rgba(132, 204, 22, 0) 72%);
}
@keyframes bl-boom {
  from { transform: scale(0.4); opacity: 1; }
  to { transform: scale(2); opacity: 0; }
}

/* Typing Card (Word Display Area) */
.typing-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 32px 30px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
}
.typing-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
}

/* 听写模式：隐藏例句与配图，防止目标词泄题 */
.typing-card.dictation .word-example,
.typing-card.dictation .word-figure {
  display: none;
}

/* 单词配图：只在词库里真有图时出现，白底承托透明 webp */
.word-figure {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}
.word-figure img {
  max-height: 148px;
  max-width: min(260px, 68vw);
  object-fit: contain;
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 6px;
}

/* Phonetic & Audio */
.word-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.phonetic {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--accent-secondary);
  background: rgba(139, 92, 246, 0.1);
  padding: 4px 14px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(139, 92, 246, 0.2);
}
.audio-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}
.audio-btn:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  transform: scale(1.1);
}

/* Word Letters Display Box */
.word-box {
  display: flex;
  gap: 8px;
  margin: 10px 0 24px;
  flex-wrap: wrap;
  justify-content: center;
  min-height: 64px;
}
/* 单词与朗读按钮同一行：按钮置于单词右侧 */
.word-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 10px 0 24px;
}
.word-row .word-box {
  margin: 0;
}
.letter-box {
  width: 52px;
  height: 64px;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  color: var(--text-secondary);
  position: relative;
  transition: all 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.letter-box.correct {
  background: var(--success-glow);
  border-color: var(--success);
  color: var(--success);
  transform: scale(1.05);
  box-shadow: 0 0 15px var(--success-glow);
}
.letter-box.wrong {
  background: var(--error-glow);
  border-color: var(--error);
  color: var(--error);
  animation: shake 0.3s ease-in-out;
  box-shadow: 0 0 15px var(--error-glow);
}
.letter-box.current {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 0 20px var(--accent-glow);
  transform: translateY(-4px);
  color: var(--text-primary);
}
.letter-box.current::after {
  content: '';
  position: absolute;
  bottom: 6px;
  width: 16px;
  height: 3px;
  background: var(--accent-primary);
  border-radius: var(--radius-full);
  animation: pulse 1s infinite;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* 移动端隐藏输入框：承接系统键盘输入（视觉上不可见但可聚焦） */
.hidden-input {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 2px;
  height: 2px;
  opacity: 0.01;
  border: none;
  background: transparent;
  font-size: 16px; /* 防止 iOS 聚焦时页面缩放 */
  z-index: 1;
}

/* Word Definition & Example */
.word-meaning {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.word-example {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 680px;
  line-height: 1.6;
  background: rgba(0, 0, 0, 0.15);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent-primary);
}
.word-example-cn {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}
/* 例句英文：调大字号，提升可读性 */
.word-example #exampleText {
  font-size: 26px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.highlight-term {
  color: var(--accent-primary);
  font-weight: 700;
}

/* 跳过当前词按钮 */
.skip-btn {
  margin-top: 18px;
  padding: 8px 20px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.skip-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
  background: var(--accent-glow);
}
.skip-btn kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 7px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-bottom-width: 2px;
  border-radius: 5px;
  color: var(--text-muted);
}

/* Keyboard Container */
.keyboard-section {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 16px 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.keyboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 6px;
}

/* Key Button Style */
.key {
  height: 48px;
  min-width: 44px;
  padding: 0 12px;
  background: var(--key-bg);
  border: 1px solid var(--key-border);
  border-radius: 8px;
  box-shadow: var(--key-shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  position: relative;
  transition: all 0.08s ease;
  cursor: pointer;
}

/* Finger Color Hint Borders */
.key[data-finger="left-pinky"] { border-top: 3px solid #ec4899; }
.key[data-finger="left-ring"] { border-top: 3px solid #8b5cf6; }
.key[data-finger="left-middle"] { border-top: 3px solid #3b82f6; }
.key[data-finger="left-index"] { border-top: 3px solid #10b981; }
.key[data-finger="right-index"] { border-top: 3px solid #eab308; }
.key[data-finger="right-middle"] { border-top: 3px solid #f97316; }
.key[data-finger="right-ring"] { border-top: 3px solid #ef4444; }
.key[data-finger="right-pinky"] { border-top: 3px solid #d946ef; }
.key[data-finger="thumb"] { border-top: 3px solid #6366f1; }

.key-wide { min-width: 72px; font-size: 13px; font-weight: 500; }
.key-space { width: 280px; }

/* Active & Target Key Animations */
.key.active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #0f172a;
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
}

.key.target {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--key-target);
  color: var(--key-target);
  animation: keyGlow 1.2s infinite alternate;
}

@keyframes keyGlow {
  0% { box-shadow: 0 4px 0 #0f172a, 0 0 5px rgba(56, 189, 248, 0.3); }
  100% { box-shadow: 0 4px 0 #0f172a, 0 0 18px rgba(56, 189, 248, 0.8); }
}

/* Finger Legend / Guide Bar */
.finger-guide {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.finger-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.finger-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* 居中极简指法提示胶囊 */
.finger-hint-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: -8px auto 16px;
  padding: 4px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
}

#currentFingerText {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-primary);
  text-align: center;
  letter-spacing: 0.5px;
}

/* Result Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
}
.modal-backdrop.show .modal-content {
  transform: scale(1);
}
.modal-wide {
  max-width: 620px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: all 0.2s;
}
.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-input);
}

.modal-title {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 8px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.modal-count {
  font-size: 16px;
  font-weight: 700;
  -webkit-text-fill-color: var(--text-secondary);
}
.modal-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}
.modal-best {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  color: var(--warning);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 5px 16px;
  border-radius: var(--radius-full);
  margin-bottom: 20px;
}

.modal-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.modal-stat-box {
  background: var(--bg-input);
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}
.modal-stat-label {
  font-size: 12px;
  color: var(--text-muted);
}
.modal-stat-value {
  font-size: 28px;
  font-weight: 800;
  font-family: var(--font-mono);
  line-height: 1.3;
}
.modal-stat-unit {
  font-size: 11px;
  color: var(--text-secondary);
}
.modal-stat-box.accent .modal-stat-value { color: var(--accent-primary); }
.modal-stat-box.success .modal-stat-value { color: var(--success); }
.modal-stat-box.warning .modal-stat-value { color: var(--warning); }
.modal-stat-box.danger .modal-stat-value { color: var(--error); }

/* 结算弹窗：本次错词回顾 */
.modal-errors-section {
  text-align: left;
  margin-bottom: 20px;
}
.modal-errors-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.modal-error-list {
  max-height: 160px;
  overflow-y: auto;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.modal-error-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 6px 10px;
  border-radius: 8px;
}
.modal-error-row:nth-child(odd) {
  background: rgba(255, 255, 255, 0.03);
}
.modal-error-word {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--error);
  min-width: 110px;
}
.modal-error-meaning {
  font-size: 13px;
  color: var(--text-secondary);
}

/* 错词本面板 */
.errorbook-list {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
  text-align: left;
}
.errorbook-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  transition: border-color 0.2s;
}
.errorbook-row:hover {
  border-color: var(--border-glow);
}
.errorbook-info {
  min-width: 0;
  flex: 1;
}
.errorbook-word {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.errorbook-phonetic {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent-secondary);
}
.errorbook-meaning {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.errorbook-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.errorbook-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--error);
  background: var(--error-glow);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.errorbook-del {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}
.errorbook-del:hover {
  color: var(--error);
  border-color: var(--error);
  background: var(--error-glow);
}
.errorbook-empty {
  color: var(--text-muted);
  font-size: 14px;
  padding: 32px 16px;
  margin-bottom: 20px;
}

/* 弹窗操作按钮组 */
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  width: 100%;
  flex-wrap: wrap;
  margin-top: 8px;
}
.modal-actions > button {
  flex: 1;
  min-width: 140px;
}

.btn-primary-lg {
  width: 100%;
  padding: 14px;
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 8px 20px var(--accent-glow);
}
.btn-primary-lg:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px var(--accent-glow);
}
.btn-primary-lg:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-accent-lg {
  padding: 14px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-accent-lg:hover {
  background: rgba(16, 185, 129, 0.25);
  transform: translateY(-2px);
}

.btn-ghost-lg {
  padding: 14px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-ghost-lg:hover {
  border-color: var(--text-muted);
  transform: translateY(-2px);
}

.btn-danger-lg {
  padding: 14px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: transparent;
  color: var(--error);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-danger-lg:hover {
  background: var(--error-glow);
}
.btn-danger-lg.armed {
  background: var(--error);
  border-color: var(--error);
  color: #fff;
  animation: pulse 0.8s infinite;
}

/* Toast 提示 */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translate(-50%, 20px);
  z-index: 2000;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-glow);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 90vw;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* 无障碍/省电：尊重系统减弱动态效果设置 */
@media (prefers-reduced-motion: reduce) {
  .ambient-orb,
  .letter-box.current::after,
  .key.target,
  .btn-danger-lg.armed,
  /* 只关角色原地的摇摆/中弹/倒下动效；僵尸走路是 JS 逐帧推进的游戏判定，
     关掉等于没有游戏，所以留着 */
  .bl-shooter,
  .bl-shooter.firing,
  .bl-zombie > i,
  .bl-zombie.boss:not(.dying) > i,
  .bl-imp,
  .bl-ice,
  .bl-fire,
  .bl-boom,
  .bl-splat {
    animation: none;
  }
  .ambient-orb {
    opacity: 0.12;
  }
  * {
    transition-duration: 0.01ms !important;
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    align-items: stretch;
  }
  .nav-controls {
    justify-content: space-between;
  }
  .select-input {
    max-width: none;
    flex: 1;
  }
  .mode-btn {
    padding: 6px 8px;
    font-size: 12px;
  }
  .diff-btn {
    padding: 5px 6px;
    font-size: 11px;
  }
  .typing-card {
    padding: 24px 16px 20px;
  }
  .battle-lane {
    height: 128px;
    border-radius: var(--radius-md);
  }
  .bl-shooter { width: 62px; height: 62px; bottom: 14px; }
  .bl-zombie { bottom: 14px; }
  .bl-pea { bottom: 46px; }
  .bl-splat { bottom: 44px; }
  /* 窄屏跑道只有 128px 高，飞行线整体往下挪，否则冰球火球会飞出跑道上边界 */
  .bl-ice, .bl-fire { bottom: 44px; }
  .bl-imp { bottom: 14px; height: 46px; }
  .bl-boom { bottom: 40px; width: 32px; height: 32px; }
  .battle-lane::after { height: 16px; }
  .letter-box {
    width: 42px;
    height: 52px;
    font-size: 24px;
  }
  .word-box {
    min-height: 52px;
  }
  .key {
    height: 40px;
    min-width: 32px;
    padding: 0 6px;
    font-size: 13px;
  }
  .key-space {
    width: 160px;
  }
  .finger-guide {
    display: none;
  }
  .modal-content {
    padding: 24px 18px;
  }
  .modal-stat-value {
    font-size: 22px;
  }
  .profile-panel {
    position: fixed;
    left: 12px;
    right: 12px;
    top: 110px;
    width: auto;
  }
}
