/* ============================================================
   TypingMaster — 英文打字练习
   配色体系对齐 crabapplelab.com（米黄纸感 + 焦糖棕）
   设计语言 v10：光学质感 —— 光晕层级 / 玻璃边缘 / 掠光镀膜
   支持明 / 暗双主题，通过 data-theme 切换
   ============================================================ */

/* ---------- 亮色主题（默认） ---------- */
:root,
[data-theme="light"] {
  /* 品牌色 —— 焦糖棕系（保留原色，仅扩展光学层次） */
  --accent: #C18A4A;
  --accent-deep: #9C6A33;
  --accent-warm: #D9A368;
  --accent-soft: #E5BC8C;
  --accent-light: rgba(193, 138, 74, 0.10);
  --accent-glow: rgba(193, 138, 74, 0.28);

  /* 背景层 */
  --bg: #FBF6EB;
  --bg-deep: #F5EEDF;
  --canvas: #F2E8D5;
  --nav-bg: rgba(251, 246, 235, 0.72);
  --card: #FFFCF5;
  --card-alt: #FDF9F0;

  /* 文字 */
  --text: #2A2620;
  --text-light: #5C5448;
  --text-muted: #8E8472;
  --text-faint: #B8AE99;

  /* 边框与阴影 */
  --border: rgba(74, 56, 32, 0.09);
  --border-strong: rgba(74, 56, 32, 0.16);

  /* ---------- 光学系统：光晕 / 玻璃 / 掠光 ---------- */
  /* 柔和光晕阴影（替代生硬投影，带暖色调） */
  --glow-sm: 0 1px 2px rgba(74, 56, 32, 0.03),
             0 4px 14px -4px rgba(140, 100, 50, 0.10),
             0 12px 32px -12px rgba(140, 100, 50, 0.10);
  --glow-md: 0 2px 6px rgba(74, 56, 32, 0.04),
             0 10px 28px -8px rgba(140, 100, 50, 0.16),
             0 28px 60px -22px rgba(140, 100, 50, 0.16);
  --glow-lg: 0 4px 12px rgba(74, 56, 32, 0.06),
             0 20px 48px -12px rgba(140, 100, 50, 0.22),
             0 48px 96px -32px rgba(140, 100, 50, 0.22);

  /* 兼容旧命名 */
  --shadow-sm: var(--glow-sm);
  --shadow-md: var(--glow-md);
  --shadow-lg: var(--glow-lg);

  /* 玻璃面：半透明卡片底 + 顶部内高光边 */
  --glass: rgba(255, 252, 245, 0.72);
  --glass-strong: rgba(255, 252, 245, 0.88);
  --glass-blur: 22px;
  /* 顶部内高光（模拟光从上方打在玻璃边缘） */
  --edge-hi: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  --edge-hi-soft: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  /* 焦散光圈：卡片 hover 时的外发光 */
  --halo: 0 0 0 1px rgba(193, 138, 74, 0.16),
          0 0 24px -4px rgba(193, 138, 74, 0.22),
          0 0 60px -12px rgba(193, 138, 74, 0.18);
  /* 掠光带颜色（sheen 扫过时的高光） */
  --sheen: rgba(255, 255, 255, 0.55);
  --sheen-mid: rgba(229, 188, 140, 0.30);

  /* 标签 */
  --tag-bg: #EFDFC3;
  --tag-text: #8A6332;

  /* 语义色 */
  --danger: #D75757;
  --danger-soft: rgba(215, 87, 87, 0.10);
  --success: #4F9F7A;
  --success-soft: rgba(79, 159, 122, 0.10);
  --warn: #C99A3E;
  --warn-soft: rgba(201, 154, 62, 0.11);

  /* 打字字符状态 */
  --char-pending: #B8AE99;
  --char-correct: #2A2620;
  --char-wrong: #C24A3F;
  --char-wrong-bg: rgba(194, 74, 63, 0.10);
  --char-current-bg: rgba(193, 138, 74, 0.13);
  --word-pending: #A29884;
  --nl-color: #B08A5C;
  --echo-pending: #CFC6B2;
  --echo-bg: #FBF7ED;
  --echo-bg-active: #FFFDF8;

  /* 输入区 */
  --stage-bg: rgba(255, 252, 245, 0.80);
  --stage-ring: rgba(193, 138, 74, 0.28);

  --grid-line: rgba(74, 56, 32, 0.032);
  --blob-a: #EBD9B8;
  --blob-b: #E0C9A2;
  --blob-c: #F2E6CE;
  --blob-opacity: 0.62;
}

/* ---------- 暗色主题 ---------- */
[data-theme="dark"] {
  --accent: #C18A4A;
  --accent-deep: #D9A368;
  --accent-warm: #D9A368;
  --accent-soft: #6B4F2E;
  --accent-light: rgba(193, 138, 74, 0.16);
  --accent-glow: rgba(193, 138, 74, 0.35);

  --bg: #15120E;
  --bg-deep: #1B1812;
  --canvas: #1F1B14;
  --nav-bg: rgba(21, 18, 14, 0.72);
  --card: #1F1B14;
  --card-alt: #221E16;

  --text: #F0E8D6;
  --text-light: #B8AE99;
  --text-muted: #847A66;
  --text-faint: #665E4E;

  --border: rgba(245, 238, 223, 0.07);
  --border-strong: rgba(245, 238, 223, 0.13);

  /* 暗色下光晕改为「暖光透出」而非阴影 */
  --glow-sm: 0 1px 2px rgba(0, 0, 0, 0.4),
             0 4px 16px -6px rgba(0, 0, 0, 0.5),
             0 0 24px -10px rgba(193, 138, 74, 0.14);
  --glow-md: 0 2px 8px rgba(0, 0, 0, 0.45),
             0 12px 32px -10px rgba(0, 0, 0, 0.6),
             0 0 42px -14px rgba(193, 138, 74, 0.2);
  --glow-lg: 0 4px 14px rgba(0, 0, 0, 0.5),
             0 24px 56px -14px rgba(0, 0, 0, 0.7),
             0 0 72px -18px rgba(193, 138, 74, 0.26);

  --shadow-sm: var(--glow-sm);
  --shadow-md: var(--glow-md);
  --shadow-lg: var(--glow-lg);

  --glass: rgba(31, 27, 20, 0.66);
  --glass-strong: rgba(31, 27, 20, 0.86);
  --glass-blur: 22px;
  --edge-hi: inset 0 1px 0 rgba(245, 238, 223, 0.09);
  --edge-hi-soft: inset 0 1px 0 rgba(245, 238, 223, 0.05);
  --halo: 0 0 0 1px rgba(193, 138, 74, 0.24),
          0 0 28px -6px rgba(193, 138, 74, 0.28),
          0 0 72px -16px rgba(193, 138, 74, 0.22);
  --sheen: rgba(245, 238, 223, 0.14);
  --sheen-mid: rgba(193, 138, 74, 0.22);

  --tag-bg: #3A2F1E;
  --tag-text: #D9A368;

  --danger: #E07A6E;
  --danger-soft: rgba(224, 122, 110, 0.14);
  --success: #6FB894;
  --success-soft: rgba(111, 184, 148, 0.13);
  --warn: #D9A368;
  --warn-soft: rgba(217, 163, 104, 0.13);

  --char-pending: #665E4E;
  --char-correct: #F0E8D6;
  --char-wrong: #E07A6E;
  --char-wrong-bg: rgba(224, 122, 110, 0.16);
  --char-current-bg: rgba(193, 138, 74, 0.22);
  --word-pending: #7A7060;
  --nl-color: #B08A5C;
  --echo-pending: #4A4438;
  --echo-bg: #26221A;
  --echo-bg-active: #2C271D;

  --stage-bg: rgba(34, 30, 22, 0.72);
  --stage-ring: rgba(193, 138, 74, 0.34);

  --grid-line: rgba(245, 238, 223, 0.026);
  --blob-a: #4A3C24;
  --blob-b: #33291A;
  --blob-c: #574227;
  --blob-opacity: 0.55;
}

/* ---------- 尺寸与动效 ---------- */
:root {
  --radius-sm: 7px;
  --radius-md: 13px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --radius-pill: 100px;
  /* 统一缓动：更顺滑的「缓出」曲线 */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 0.18s;
  --dur: 0.32s;
  --dur-slow: 0.6s;
  --font-body: "Inter", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Noto Serif SC", sans-serif;
  --font-display: "Noto Serif SC", "Inter", serif;
  --font-mono: "JetBrains Mono", "Fira Code", Consolas, monospace;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }

/* ============================================================
   动态背景 —— 光学氛围层
   三层光：空中光斑（缓慢漂移）+ 顶光轴（垂直光柱）+ 细网格
   ============================================================ */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* 光斑：更大的模糊半径，更慢的漂移，营造「光在流动」 */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: var(--blob-opacity);
  will-change: transform;
  transition: background 0.8s var(--ease-soft);
}

.blob-1 {
  width: 760px; height: 760px;
  background: radial-gradient(circle at 38% 38%, var(--blob-a), transparent 68%);
  top: -300px; left: -220px;
  animation: floatBlob1 34s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
.blob-2 {
  width: 680px; height: 680px;
  background: radial-gradient(circle at 62% 42%, var(--blob-b), transparent 68%);
  top: 8%; right: -240px;
  animation: floatBlob2 40s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
.blob-3 {
  width: 620px; height: 620px;
  background: radial-gradient(circle at 50% 50%, var(--blob-c), transparent 68%);
  bottom: -260px; left: 26%;
  animation: floatBlob3 46s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

/* 漂移幅度加大、路径更圆润，视觉上像光斑在缓慢游动 */
@keyframes floatBlob1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  30%      { transform: translate(110px, 70px) scale(1.1); }
  60%      { transform: translate(60px, 160px) scale(0.94); }
  80%      { transform: translate(-40px, 90px) scale(1.04); }
}
@keyframes floatBlob2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  35%      { transform: translate(-120px, 100px) scale(1.14); }
  70%      { transform: translate(-60px, 190px) scale(0.92); }
}
@keyframes floatBlob3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  40%      { transform: translate(130px, -90px) scale(1.12); }
  75%      { transform: translate(-70px, -40px) scale(0.93); }
}

/* 顶光轴：自顶部泻下的柔光，让页面「有光源」 */
.bg-layer::before {
  content: '';
  position: absolute;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 130%;
  height: 78%;
  background: radial-gradient(
    ellipse 46% 100% at 50% 0%,
    rgba(255, 246, 228, 0.82) 0%,
    rgba(255, 244, 222, 0.34) 34%,
    transparent 72%
  );
  animation: lightShaft 12s ease-in-out infinite;
}
[data-theme="dark"] .bg-layer::before {
  background: radial-gradient(
    ellipse 46% 100% at 50% 0%,
    rgba(193, 138, 74, 0.16) 0%,
    rgba(193, 138, 74, 0.06) 34%,
    transparent 72%
  );
}
@keyframes lightShaft {
  0%, 100% { opacity: 0.85; }
  50%      { opacity: 1; }
}

/* 细网格：径向遮罩，向外淡出 */
.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 82% 62% at 50% 26%, #000 22%, transparent 74%);
  -webkit-mask-image: radial-gradient(ellipse 82% 62% at 50% 26%, #000 22%, transparent 74%);
}

/* ============================================================
   顶部导航 —— 磨砂玻璃 + 底部光边
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 13px 34px;
  background: var(--nav-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: background 0.5s var(--ease-soft), border-color 0.5s var(--ease-soft),
              box-shadow 0.5s var(--ease-soft);
}
[data-theme="dark"] .topbar { box-shadow: 0 1px 0 rgba(245, 238, 223, 0.03); }

/* 滚动后顶栏浮起，出现光晕（由 JS 加 .scrolled） */
.topbar.scrolled { box-shadow: 0 6px 24px -12px rgba(140, 100, 50, 0.28); }

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  position: relative;
  width: 42px; height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-warm), var(--accent) 45%, var(--accent-deep));
  color: #FFFCF5;
  box-shadow: 0 6px 20px -6px var(--accent-glow), var(--edge-hi-soft);
  transition: transform 0.6s var(--ease-out), box-shadow 0.5s var(--ease-soft);
  overflow: hidden;
}
.brand-mark svg { width: 23px; height: 23px; position: relative; z-index: 1; }
/* 徽标上的掠光 */
.brand-mark::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.42) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.8s var(--ease-out);
}
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.06); box-shadow: 0 10px 28px -6px var(--accent-glow), var(--edge-hi-soft); }
.brand:hover .brand-mark::after { transform: translateX(120%); }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.brand-sub { font-size: 11px; color: var(--text-muted); font-weight: 500; letter-spacing: 0.03em; }

.nav-tabs { display: flex; gap: 3px; margin-left: 10px; }

.nav-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-light);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.nav-tab svg { width: 16px; height: 16px; transition: transform 0.45s var(--ease-out); }
.nav-tab:hover { color: var(--accent); background: var(--accent-light); }
.nav-tab:hover svg { transform: translateY(-1.5px) scale(1.08); }
.nav-tab.active { color: var(--accent); }

/* 激活态：柔光底 + 底部光条（光条带发光） */
.nav-tab.active {
  background: linear-gradient(180deg, rgba(193, 138, 74, 0.10), rgba(193, 138, 74, 0.045));
  box-shadow: var(--edge-hi-soft);
}
.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: -14px; left: 50%;
  transform: translateX(-50%);
  width: 22px; height: 2.5px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-warm), var(--accent), var(--accent-warm));
  box-shadow: 0 0 10px 1px var(--accent-glow), 0 0 20px var(--accent-glow);
  animation: tabUnderline 0.5s var(--ease-out);
}
@keyframes tabUnderline {
  from { width: 0; opacity: 0; }
  to { width: 22px; opacity: 1; }
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 9px; }

.streak-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-deep);
  background: linear-gradient(135deg, rgba(193, 138, 74, 0.13), rgba(217, 163, 104, 0.09));
  border: 1px solid rgba(193, 138, 74, 0.20);
  box-shadow: var(--edge-hi-soft);
  transition: all var(--dur) var(--ease);
}
.streak-pill svg { width: 15px; height: 15px; color: var(--accent); }
.streak-pill:hover {
  background: linear-gradient(135deg, rgba(193, 138, 74, 0.20), rgba(217, 163, 104, 0.14));
  box-shadow: var(--halo);
}

/* 图标按钮：玻璃面 + 光晕 hover */
.icon-btn,
.theme-toggle {
  position: relative;
  width: 38px; height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--text-light);
  border: 1px solid var(--border);
  background: var(--glass-strong);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--edge-hi-soft);
  overflow: hidden;
  transition: all var(--dur) var(--ease);
}
.icon-btn svg,
.theme-toggle svg { width: 17px; height: 17px; position: relative; z-index: 1; transition: transform 0.5s var(--ease-out); }
.icon-btn:hover,
.theme-toggle:hover {
  color: var(--accent);
  border-color: rgba(193, 138, 74, 0.30);
  box-shadow: var(--halo), var(--edge-hi);
  transform: translateY(-1px);
}
.icon-btn:active,
.theme-toggle:active { transform: translateY(0) scale(0.96); }
.theme-toggle:hover { transform: translateY(-1px) rotate(18deg); }

/* 图标按钮的掠光 */
.icon-btn::before,
.theme-toggle::before {
  content: '';
  position: absolute;
  top: 0; left: -60%;
  width: 45%; height: 100%;
  background: linear-gradient(100deg, transparent, var(--sheen), transparent);
  transform: skewX(-18deg);
  opacity: 0;
  transition: none;
}
.icon-btn:hover::before,
.theme-toggle:hover::before {
  animation: iconSheen 0.75s var(--ease-out);
}
@keyframes iconSheen {
  0%   { left: -60%; opacity: 0.9; }
  100% { left: 130%; opacity: 0; }
}

.typing-embed .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .typing-embed .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .typing-embed .theme-toggle .icon-moon { display: block; }

/* 音效开关 */
.icon-btn .icon-sound-off { display: none; }
.icon-btn.muted { color: var(--text-faint); }
.icon-btn.muted .icon-sound-on { display: none; }
.icon-btn.muted .icon-sound-off { display: block; }

/* 退格开关（复用 icon-btn 结构） */
.icon-btn .icon-backspace-off { display: none; }
.icon-btn.muted .icon-backspace-on { display: none; }
.icon-btn.muted .icon-backspace-off { display: block; }

/* 控制区里的显示模式按钮（激活态） */
.btn-ghost.btn-small.active {
  color: #FFFCF5;
  background: linear-gradient(135deg, var(--accent-warm), var(--accent) 50%, var(--accent-deep));
  border-color: transparent;
  box-shadow: 0 6px 18px -6px var(--accent-glow), var(--edge-hi-soft);
}
.btn-ghost.btn-small.active:hover { color: #FFFCF5; box-shadow: 0 8px 24px -6px var(--accent-glow), var(--edge-hi-soft); }

/* ============================================================
   主容器
   ============================================================ */
.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 44px 34px 96px;
}

.view { display: none; }
.view.active { display: block; }

/* 视图入场：淡入 + 微升起 + 轻微缩放，纯 opacity/transform 保证 60fps */
.view.active > * { animation: viewIn 0.62s var(--ease-out) both; }
.view.active > *:nth-child(1) { animation-delay: 0ms; }
.view.active > *:nth-child(2) { animation-delay: 55ms; }
.view.active > *:nth-child(3) { animation-delay: 110ms; }
.view.active > *:nth-child(4) { animation-delay: 165ms; }
.view.active > *:nth-child(5) { animation-delay: 220ms; }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(18px) scale(0.994); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* 面板：玻璃质感 + 边缘高光 + 柔光晕 */
.panel {
  position: relative;
  background: var(--glass-strong);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--glow-sm), var(--edge-hi);
  transition: background 0.5s var(--ease-soft), border-color 0.5s var(--ease-soft),
              box-shadow var(--dur) var(--ease);
}

/* ============================================================
   选文面板
   ============================================================ */
.panel-picker { padding: 36px 36px 40px; }

.picker-head { margin-bottom: 28px; text-align: center; }
.picker-head h2 {
  font-family: var(--font-display);
  font-size: 29px;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: 9px;
  color: var(--text);
}
.picker-head h2 em {
  font-style: normal;
  color: var(--accent);
  /* 标题关键词的柔光 */
  text-shadow: 0 0 26px var(--accent-glow);
}
.picker-head p { font-size: 14px; color: var(--text-light); }

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 20px;
}

/* 卡片：玻璃面 + 掠光 + 光晕 hover */
.article-card {
  position: relative;
  padding: 24px 24px 20px;
  border-radius: var(--radius-lg);
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  box-shadow: var(--glow-sm), var(--edge-hi-soft);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.45s var(--ease-out), box-shadow 0.45s var(--ease-out),
              border-color 0.35s var(--ease), background 0.35s var(--ease);
  animation: cardIn 0.66s var(--ease-out) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(22px) scale(0.972); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* 顶部光条：hover 时从左侧点亮 */
.article-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-warm), var(--accent), transparent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s var(--ease-out);
  filter: blur(0.4px);
}
.article-card:hover::after { transform: scaleX(1); }

/* 掠光带：hover 时斜向扫过整张卡片 */
.article-card::before {
  content: '';
  position: absolute;
  top: -50%; left: -75%;
  width: 50%; height: 200%;
  background: linear-gradient(
    100deg,
    transparent 0%,
    var(--sheen) 35%,
    var(--sheen-mid) 50%,
    var(--sheen) 65%,
    transparent 100%
  );
  transform: skewX(-20deg) translateX(0);
  opacity: 0;
  pointer-events: none;
}
.article-card:hover::before {
  animation: cardSheen 0.95s var(--ease-out);
}
@keyframes cardSheen {
  0%   { opacity: 0; transform: skewX(-20deg) translateX(0); }
  12%  { opacity: 0.85; }
  100% { opacity: 0; transform: skewX(-20deg) translateX(320%); }
}

.article-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--glow-md), var(--halo), var(--edge-hi);
  border-color: rgba(193, 138, 74, 0.26);
  background: var(--glass-strong);
}

.ac-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }

.ac-icon {
  width: 44px; height: 44px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  font-size: 21px;
  background: linear-gradient(135deg, rgba(193, 138, 74, 0.14), rgba(217, 163, 104, 0.08));
  border: 1px solid rgba(193, 138, 74, 0.18);
  box-shadow: var(--edge-hi-soft);
  transition: transform 0.55s var(--ease-out), background 0.4s var(--ease),
              box-shadow 0.4s var(--ease);
}
.article-card:hover .ac-icon {
  transform: rotate(-6deg) scale(1.07);
  background: linear-gradient(135deg, rgba(193, 138, 74, 0.22), rgba(217, 163, 104, 0.14));
  box-shadow: 0 0 20px -4px var(--accent-glow), var(--edge-hi-soft);
}

.ac-level {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: var(--tag-bg);
  color: var(--tag-text);
  transition: background 0.45s var(--ease-soft), color 0.45s var(--ease-soft);
}

/* 卡片右上角徽标组 */
.ac-badges { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }

/* 篇幅徽标：短文 / 长文 */
.ac-size {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.ac-size-short {
  background: rgba(79, 159, 122, 0.12);
  color: var(--success);
}
.ac-size-long {
  background: rgba(139, 92, 246, 0.12);
  color: #8b5cf6;
}
[data-theme="dark"] .ac-size-long { background: rgba(139, 92, 246, 0.2); color: #B49BFF; }

/* 选文面板的篇幅筛选 */
.size-filter { justify-content: center; margin-bottom: 24px; }

.ac-title {
  font-family: var(--font-display);
  font-size: 18.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: 4px;
}
.ac-subtitle { font-size: 12.5px; color: var(--text-muted); margin-bottom: 10px; }
.ac-desc {
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.65;
  margin-bottom: 17px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ac-meta { display: flex; align-items: center; gap: 18px; padding-top: 15px; border-top: 1px solid var(--border); }
.ac-meta-item { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.ac-meta-item svg { width: 14px; height: 14px; }

.ac-go {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  transition: gap 0.4s var(--ease-out);
}
.ac-go svg { width: 15px; height: 15px; transition: transform 0.45s var(--ease-out); }
.article-card:hover .ac-go { gap: 11px; }
.article-card:hover .ac-go svg { transform: translateX(3px); }

/* ============================================================
   打字练习面板
   ============================================================ */
.panel-typing { padding: 30px 38px 34px; }

.typing-head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  transition: all 0.25s var(--ease);
}
.btn-ghost svg { width: 16px; height: 16px; transition: transform 0.35s var(--ease); }
.btn-ghost:hover { color: var(--accent); background: var(--accent-light); }
.btn-ghost:hover svg { transform: translateX(-3px); }
.btn-small { padding: 6px 11px; font-size: 12.5px; }

.typing-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.01em;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.typing-badges { display: flex; gap: 8px; }
.badge {
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--tag-bg);
  color: var(--tag-text);
  white-space: nowrap;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}
.badge-muted { background: rgba(142, 132, 114, 0.13); color: var(--text-muted); }
[data-theme="dark"] .badge-muted { background: rgba(245, 238, 223, 0.07); }

/* ============================================================
   模式切换（文章 / 单词 / 句子）—— 光斑滑块
   ============================================================ */
.mode-switch-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
  margin-bottom: 26px;
}

.mode-switch {
  position: relative;
  display: inline-flex;
  padding: 5px;
  border-radius: var(--radius-pill);
  background: var(--glass-strong);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border: 1px solid var(--border);
  box-shadow: var(--glow-sm), var(--edge-hi);
}

/* 滑块：液态光斑，带内高光与外发光 */
.ms-indicator {
  position: absolute;
  top: 5px;
  left: 5px;
  height: calc(100% - 10px);
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--accent-warm), var(--accent) 48%, var(--accent-deep));
  box-shadow: 0 4px 16px -4px var(--accent-glow),
              0 0 24px -6px var(--accent-glow),
              inset 0 1px 0 rgba(255, 255, 255, 0.42);
  transition: transform 0.55s var(--ease-out), width 0.55s var(--ease-out);
  pointer-events: none;
  overflow: hidden;
}
/* 滑块内部的流动光 */
.ms-indicator::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.30) 50%, transparent 80%);
  transform: translateX(-100%);
  animation: sliderGlint 3.2s var(--ease-soft) infinite;
}
@keyframes sliderGlint {
  0%, 62%  { transform: translateX(-100%); }
  88%, 100% { transform: translateX(100%); }
}

.ms-btn {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 24px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-light);
  white-space: nowrap;
  transition: color 0.4s var(--ease);
}
.ms-btn svg { width: 16px; height: 16px; transition: transform 0.45s var(--ease-out); }
.ms-btn:hover { color: var(--accent); }
.ms-btn:hover svg { transform: scale(1.1); }
.ms-btn.active { color: #FFFCF5; }
.ms-btn.active svg { transform: scale(1.04); }

.mode-hint {
  font-size: 12.5px;
  color: var(--text-muted);
  min-height: 18px;
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}
.mode-hint.swap { animation: hintSwap 0.5s var(--ease-out); }
@keyframes hintSwap {
  0%   { opacity: 0; transform: translateY(-6px); filter: blur(2px); }
  100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* ============================================================
   开局设置面板（单词 / 句子共用）
   ============================================================ */
.panel-word-setup { padding: 36px 40px 38px; }

.setup-group { margin-bottom: 26px; }
.setup-label {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 13px;
}
.setup-label span { font-size: 14px; font-weight: 600; }
.setup-label small { font-size: 12px; color: var(--text-muted); }

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

/* Chip：玻璃面 → 选中时变为发光实心 */
.chip {
  position: relative;
  padding: 11px 21px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-light);
  background: var(--glass);
  border: 1px solid var(--border);
  box-shadow: var(--edge-hi-soft);
  overflow: hidden;
  transition: transform var(--dur) var(--ease-out), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease), background var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.chip:hover {
  transform: translateY(-2px);
  border-color: rgba(193, 138, 74, 0.32);
  color: var(--accent);
  box-shadow: var(--halo), var(--edge-hi);
}
.chip:active { transform: translateY(0) scale(0.975); }
.chip.active {
  color: #FFFCF5;
  background: linear-gradient(135deg, var(--accent-warm), var(--accent) 48%, var(--accent-deep));
  border-color: transparent;
  box-shadow: 0 6px 20px -6px var(--accent-glow),
              0 0 28px -8px var(--accent-glow),
              inset 0 1px 0 rgba(255, 255, 255, 0.36);
}

.setup-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 20px;
  margin-bottom: 24px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(193, 138, 74, 0.07), rgba(217, 163, 104, 0.035));
  border: 1px dashed rgba(193, 138, 74, 0.26);
  box-shadow: var(--edge-hi-soft);
}
.sp-label { font-size: 12.5px; color: var(--text-muted); }
.sp-value { font-size: 14px; color: var(--text-light); }
.sp-value strong {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow);
}
.sp-value em { font-style: normal; font-weight: 600; color: var(--accent); }

.btn-start { width: 100%; padding: 15px; font-size: 15px; }

/* ============================================================
   单词模式：一列三行（上一个 / 当前 / 下一个）
   ============================================================ */
.word-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  max-height: 58vh;
  padding: 30px 34px;
  overflow: hidden;
}

.word-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  font-family: var(--font-mono);
}

/* 每一行：内部垂直居中，行高足够容纳回显 */
.word-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 74px;
  width: 100%;
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease), filter 0.4s var(--ease);
}
.word-row .word-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
}

/* 上一个已打单词：变灰、缩小 */
.word-row-prev { opacity: 0.4; transform: scale(0.78); }
.word-row-prev .word.done { color: var(--success); }
.word-row-prev .word .ch { color: var(--text-muted); }

/* 当前单词：最醒目 */
.word-row-cur { min-height: 108px; }

/* 下一个待打单词：淡一些，起预告作用 */
.word-row-next { opacity: 0.34; transform: scale(0.86); }
.word-row-next .word .ch { color: var(--text-muted); }

/* 空槽位（开头没有上一个 / 结尾没有下一个）*/
.word-row:not(.word-filled) { opacity: 0.14; }
.word-row:not(.word-filled)::after {
  content: '· · ·';
  font-size: 15px;
  letter-spacing: 0.3em;
  color: var(--text-faint);
}

.word {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 38px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--word-pending, var(--text-faint));
  background: transparent;
  transition: color 0.3s var(--ease), background 0.3s var(--ease),
              transform 0.4s var(--ease), opacity 0.4s var(--ease);
}

/* 当前正在输入的单词 */
.word.active {
  color: var(--text);
  background: var(--accent-light);
  box-shadow: 0 0 0 1px rgba(193, 138, 74, 0.25), 0 6px 20px -8px var(--accent-glow);
}
.word.done { color: var(--success); }

/* 单词内字符着色 */
.word .ch { transition: color 0.14s var(--ease), background 0.14s var(--ease); border-radius: 3px; }
.word.active .ch { color: var(--char-pending); }
.word.active .ch.correct { color: var(--char-correct); }
.word.active .ch.wrong {
  color: var(--char-wrong);
  background: var(--char-wrong-bg);
  text-decoration: underline wavy var(--char-wrong) 1.2px;
  text-underline-offset: 6px;
}
.word.active .ch.wrong.fresh { animation: wrongPop 0.5s var(--ease); }
.word.active .ch.current { background: var(--char-current-bg); }

/* 当前单词下方的回显行（真正的输入区） */
.word-row-cur .word-echo-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  width: 100%;
  margin-top: 8px;
}
.word-echo {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--echo-bg);
  border: 1px solid var(--border);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.02em;
  white-space: pre;
  pointer-events: none;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}
.word-row-cur .word-echo { border-color: var(--stage-ring); background: var(--echo-bg-active); }

.word-echo .ec {
  min-width: 1ch;
  text-align: center;
  border-radius: 4px;
  transition: color 0.14s var(--ease), background 0.14s var(--ease);
}
.word-echo .ec.pending { color: var(--echo-pending); }
.word-echo .ec.ok { color: var(--char-correct); }
.word-echo .ec.bad {
  color: var(--char-wrong);
  background: var(--char-wrong-bg);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}
.word-echo .ec.cur {
  background: var(--char-current-bg);
  box-shadow: inset 0 0 0 1.5px var(--stage-ring);
  border-radius: 5px;
}
.word-echo .ec.fresh { animation: echoIn 0.25s var(--ease); }
.word-echo .ec.fresh-bad { animation: echoBad 0.5s var(--ease); }

/* 换词提示（可退格模式下，打完词需按空格） */
.word-next-hint {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 12.5px;
  color: var(--text-light);
  background: var(--card-alt);
  border: 1px solid var(--border-strong);
  box-shadow: var(--glow-sm), var(--edge-hi-soft);
  animation: hintIn 0.34s var(--ease-out);
}
.word-next-hint .wnh-key {
  padding: 2px 9px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: #FFFCF5;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  box-shadow: 0 0 14px -5px var(--accent-glow), var(--edge-hi-soft);
  animation: hintPulse 1.5s var(--ease-soft) infinite;
}
@keyframes hintIn {
  0% { opacity: 0; transform: translateX(-50%) translateY(6px); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes hintPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.word-stage::-webkit-scrollbar { width: 8px; }
.word-stage::-webkit-scrollbar-thumb { background: rgba(142, 132, 114, 0.25); border-radius: 100px; }
[data-theme="dark"] .word-stage::-webkit-scrollbar-thumb { background: rgba(245, 238, 223, 0.12); }
.word-stage.blurred .word-col { filter: blur(7px); opacity: 0.5; pointer-events: none; }

/* ============================================================
   逐行输入回显（显示在原文每一行正下方）
   回显行由 JS 插入到每个视觉换行点之后，
   字号 / 字距与原文一致，保证逐字符对齐。
   回显行同时也是「真正的输入区」：光标与当前字符高亮都在这里。
   ============================================================ */
.line-echo {
  line-height: 1.5;
  min-height: 1.5em;
  color: var(--char-pending);
  user-select: none;
  pointer-events: none;
}

.line-echo .ec {
  border-radius: 3px;
  transition: color 0.16s var(--ease), background 0.16s var(--ease),
              box-shadow 0.24s var(--ease);
}

/* 尚未输入 → 淡色显示原文字符，保留整行轮廓，方便逐字对齐 */
.line-echo .ec.pending { color: var(--echo-pending); }

/* 已正确输入 */
.line-echo .ec.ok { color: var(--char-correct); }

/* 已输入但错误 */
.line-echo .ec.bad {
  color: var(--char-wrong);
  background: var(--char-wrong-bg);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

/* 当前待输入的字符 —— 方框即光标，带柔光呼吸 */
.line-echo .ec.cur {
  background: var(--char-current-bg);
  border-radius: 5px;
  box-shadow: 0 0 0 1.5px var(--stage-ring), 0 0 16px -3px var(--accent-glow);
  animation: currentBreath 1.8s var(--ease-soft) infinite;
}

/* 换行符（Enter）在回显行中的呈现 */
.line-echo .ec.is-nl {
  display: inline-block;
  width: 1ch;
  text-align: center;
  color: var(--nl-color);
}
.line-echo .ec.is-nl.pending { opacity: 0.5; }
.line-echo .ec.is-nl.bad { color: var(--char-wrong); background: var(--char-wrong-bg); }

/* 回车/空格这类「看不见」的键：额外配一个小徽标 */
.line-echo .ec.key-mark {
  position: relative;
  display: inline-block;
  min-width: 1ch;
  text-align: center;
  color: var(--accent);
}

.line-echo .ec.fresh { animation: echoIn 0.28s var(--ease-out); }
@keyframes echoIn {
  0%   { transform: translateY(-5px) scale(1.14); opacity: 0.25; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* 刚打错时的强调 */
.line-echo .ec.fresh-bad { animation: echoBad 0.55s var(--ease-out); }
@keyframes echoBad {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.22); background: rgba(194, 74, 63, 0.26); box-shadow: 0 0 18px -2px rgba(215, 87, 87, 0.5); }
  100% { transform: scale(1); box-shadow: none; }
}

/* 换行处的「段落结束」提示：回显行末尾的回车标记 */
.line-echo .ec.is-nl.hint { animation: nlHint 1.5s var(--ease-soft) infinite; }
@keyframes nlHint {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 1; }
}

/* ============================================================
   首屏加载动画
   ============================================================ */
.loader {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  background: var(--bg);
  transition: opacity 0.6s var(--ease), visibility 0.6s var(--ease);
}
.loader.hide { opacity: 0; visibility: hidden; }

.loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: loaderIn 0.75s var(--ease-out) both;
}
@keyframes loaderIn {
  from { opacity: 0; transform: translateY(18px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.loader-mark {
  position: relative;
  width: 74px; height: 74px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--accent-warm), var(--accent) 45%, var(--accent-deep));
  color: #FFFCF5;
  box-shadow: 0 14px 44px -10px var(--accent-glow),
              0 0 60px -18px var(--accent-glow),
              inset 0 1px 0 rgba(255, 255, 255, 0.4);
  animation: loaderPulse 2.2s var(--ease-soft) infinite;
}
.loader-mark svg { width: 40px; height: 40px; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.18)); }
@keyframes loaderPulse {
  0%, 100% { transform: translateY(0) scale(1); box-shadow: 0 14px 44px -10px var(--accent-glow), 0 0 60px -18px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.4); }
  50%      { transform: translateY(-7px) scale(1.045); box-shadow: 0 22px 54px -8px var(--accent-glow), 0 0 84px -14px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.45); }
}

.loader-title {
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  text-shadow: 0 0 30px var(--accent-glow);
}
.loader-sub { font-size: 12.5px; color: var(--text-muted); letter-spacing: 0.06em; }

.loader-track {
  position: relative;
  width: 190px;
  height: 4px;
  margin-top: 12px;
  border-radius: 100px;
  background: rgba(142, 132, 114, 0.2);
  box-shadow: inset 0 1px 2px rgba(74, 56, 32, 0.06);
  overflow: hidden;
}
[data-theme="dark"] .loader-track { background: rgba(245, 238, 223, 0.1); }
.loader-bar {
  position: relative;
  height: 100%;
  width: 0%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--accent), var(--accent-warm));
  box-shadow: 0 0 14px -2px var(--accent-glow);
  transition: width 0.32s var(--ease-out);
  overflow: hidden;
}
.loader-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  transform: translateX(-100%);
  animation: progressGlint 1.4s var(--ease-soft) infinite;
}

.loader-pct {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   开局过渡（倒数）
   ============================================================ */
.countdown {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: grid;
  place-items: center;
  background: rgba(251, 246, 235, 0.72);
  backdrop-filter: blur(12px) saturate(130%);
  -webkit-backdrop-filter: blur(12px) saturate(130%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.38s var(--ease-out), visibility 0.38s var(--ease-out);
}
[data-theme="dark"] .countdown { background: rgba(21, 18, 14, 0.78); }
.countdown.show { opacity: 1; visibility: visible; }

.countdown-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
/* 倒数数字背后的柔光核 */
.countdown-inner::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 340px; height: 340px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow), transparent 66%);
  opacity: 0.7;
  pointer-events: none;
  animation: countHalo 2.4s var(--ease-soft) infinite;
}
@keyframes countHalo {
  0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(0.94); }
  50%      { opacity: 0.85; transform: translate(-50%, -50%) scale(1.06); }
}

.countdown-num {
  position: relative;
  font-family: var(--font-mono);
  font-size: 96px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--accent);
  text-shadow: 0 12px 44px var(--accent-glow), 0 0 80px var(--accent-glow);
}
.countdown-num.tick { animation: countTick 0.72s var(--ease-out); }
@keyframes countTick {
  0%   { opacity: 0; transform: scale(2.1); filter: blur(8px); }
  55%  { opacity: 1; transform: scale(1); filter: blur(0); }
  100% { opacity: 1; transform: scale(1); }
}
.countdown-text {
  position: relative;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-light);
  letter-spacing: 0.1em;
}

/* ============================================================
   错误提示条 —— 玻璃面板，出错时边缘泛红光
   ============================================================ */
.error-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 13px 19px;
  margin-bottom: 16px;
  border-radius: var(--radius-md);
  background: var(--glass);
  border: 1px solid var(--border);
  box-shadow: var(--edge-hi-soft);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.error-bar.active {
  background: linear-gradient(135deg, rgba(215, 87, 87, 0.09), rgba(215, 87, 87, 0.04));
  border-color: rgba(215, 87, 87, 0.28);
  box-shadow: 0 0 0 1px rgba(215, 87, 87, 0.10),
              0 0 26px -6px rgba(215, 87, 87, 0.28),
              var(--edge-hi-soft);
  animation: errorGlow 0.5s var(--ease-out);
}
@keyframes errorGlow {
  0%   { box-shadow: 0 0 0 0 rgba(215, 87, 87, 0), var(--edge-hi-soft); }
  45%  { box-shadow: 0 0 0 3px rgba(215, 87, 87, 0.11), 0 0 34px -4px rgba(215, 87, 87, 0.36), var(--edge-hi-soft); }
  100% { box-shadow: 0 0 0 1px rgba(215, 87, 87, 0.10), 0 0 26px -6px rgba(215, 87, 87, 0.28), var(--edge-hi-soft); }
}

.eb-left {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
.eb-left svg { width: 15px; height: 15px; color: var(--text-muted); transition: color var(--dur) var(--ease); }
.eb-label { font-size: 11.5px; font-weight: 500; color: var(--text-muted); letter-spacing: 0.04em; }
.error-bar.active .eb-left svg,
.error-bar.active .eb-label { color: var(--danger); }

.eb-body {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.eb-item { display: flex; align-items: center; gap: 8px; }
.eb-dim { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }

.eb-key {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 30px;
  padding: 0 9px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  background: var(--glass-strong);
  border: 1px solid var(--border-strong);
  box-shadow: var(--edge-hi-soft);
  transition: all var(--dur) var(--ease);
}
.eb-key.wrong {
  color: var(--danger);
  border-color: rgba(215, 87, 87, 0.36);
  background: rgba(215, 87, 87, 0.09);
  box-shadow: 0 0 14px -4px rgba(215, 87, 87, 0.32), var(--edge-hi-soft);
}
.eb-key.right {
  color: var(--success);
  border-color: rgba(79, 159, 122, 0.38);
  background: rgba(79, 159, 122, 0.09);
  box-shadow: 0 0 14px -4px rgba(79, 159, 122, 0.30), var(--edge-hi-soft);
}
.eb-key.flash { animation: keyFlash 0.46s var(--ease-out); }
@keyframes keyFlash {
  0%   { transform: scale(1); }
  38%  { transform: scale(1.16); }
  100% { transform: scale(1); }
}

.eb-arrow { width: 15px; height: 15px; color: var(--text-faint); flex-shrink: 0; }

.eb-finger {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  text-shadow: 0 0 16px var(--accent-glow);
}
.eb-finger.idle { color: var(--text-faint); font-weight: 500; text-shadow: none; }

.eb-count {
  margin-left: auto;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(142, 132, 114, 0.12);
  color: var(--text-muted);
  white-space: nowrap;
  transition: all var(--dur) var(--ease);
}
[data-theme="dark"] .eb-count { background: rgba(245, 238, 223, 0.06); }
.eb-count.has-errors {
  background: rgba(215, 87, 87, 0.11);
  color: var(--danger);
  box-shadow: 0 0 14px -4px rgba(215, 87, 87, 0.3);
}
.eb-count.bump { animation: countBump 0.44s var(--ease-out); }
@keyframes countBump {
  0%   { transform: scale(1); }
  42%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ============================================================
   HUD 数据条
   ============================================================ */
.hud {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
/* HUD 项：玻璃面，hover 时抬起并泛光 */
.hud-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  background: var(--glass);
  border: 1px solid var(--border);
  box-shadow: var(--edge-hi-soft);
  overflow: hidden;
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease),
              border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
/* 顶部一道细光，随 hover 点亮 */
.hud-item::before {
  content: '';
  position: absolute;
  top: 0; left: 12%; right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-warm), transparent);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.hud-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--glow-sm), var(--halo), var(--edge-hi);
  border-color: rgba(193, 138, 74, 0.22);
  background: var(--glass-strong);
}
.hud-item:hover::before { opacity: 0.9; }

.hud-label { font-size: 11px; font-weight: 500; color: var(--text-muted); letter-spacing: 0.04em; }
.hud-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  transition: color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.hud-value small { font-size: 12.5px; font-weight: 500; color: var(--text-muted); margin-left: 1px; }
.hud-value.pop { animation: valuePop 0.46s var(--ease-out); }
@keyframes valuePop {
  0%   { transform: scale(1); }
  42%  { transform: scale(1.07); color: var(--accent); text-shadow: 0 0 18px var(--accent-glow); }
  100% { transform: scale(1); }
}
.hud-item.is-good {
  border-color: rgba(79, 159, 122, 0.4);
  background: linear-gradient(135deg, rgba(79, 159, 122, 0.09), rgba(79, 159, 122, 0.03));
  box-shadow: 0 0 20px -8px rgba(79, 159, 122, 0.4), var(--edge-hi-soft);
}
.hud-item.is-warn {
  border-color: rgba(201, 154, 62, 0.44);
  background: linear-gradient(135deg, rgba(201, 154, 62, 0.10), rgba(201, 154, 62, 0.03));
  box-shadow: 0 0 20px -8px rgba(201, 154, 62, 0.4), var(--edge-hi-soft);
}
.hud-item.is-bad {
  border-color: rgba(215, 87, 87, 0.4);
  background: linear-gradient(135deg, rgba(215, 87, 87, 0.09), rgba(215, 87, 87, 0.03));
  box-shadow: 0 0 20px -8px rgba(215, 87, 87, 0.4), var(--edge-hi-soft);
}

/* 进度条：光带填充 */
.progress-track {
  position: relative;
  height: 5px;
  border-radius: var(--radius-pill);
  background: rgba(142, 132, 114, 0.13);
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: inset 0 1px 2px rgba(74, 56, 32, 0.05);
}
[data-theme="dark"] .progress-track { background: rgba(245, 238, 223, 0.07); }
.progress-fill {
  position: relative;
  height: 100%;
  width: 0%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--accent-deep), var(--accent), var(--accent-warm));
  box-shadow: 0 0 12px -1px var(--accent-glow);
  transition: width 0.32s var(--ease-out);
  overflow: hidden;
}
/* 填充条前端的高光点 + 流动光 */
.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5) 50%, transparent);
  transform: translateX(-100%);
  animation: progressGlint 2.4s var(--ease-soft) infinite;
}
@keyframes progressGlint {
  0%, 55%   { transform: translateX(-100%); }
  85%, 100% { transform: translateX(100%); }
}

/* ============================================================
   打字舞台 —— 内发光玻璃腔体
   ============================================================ */
.type-stage {
  position: relative;
  min-height: 260px;
  max-height: 46vh;
  /* 始终保留滚动条，避免内容增减时宽度跳变导致逐行回显错位 */
  overflow-y: scroll;
  padding: 30px 34px;
  margin-bottom: 20px;
  border-radius: var(--radius-lg);
  background: var(--stage-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6),
              inset 0 0 40px -20px rgba(193, 138, 74, 0.10),
              var(--glow-sm);
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease),
              background var(--dur) var(--ease);
  scroll-behavior: smooth;
  /* 舞台内顶部的一道光，暗示「光从上方进来」 */
}
.type-stage::before {
  content: '';
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 80px;
  border-radius: inherit;
  background: radial-gradient(ellipse 70% 100% at 50% 0%, rgba(255, 246, 228, 0.55), transparent 70%);
  pointer-events: none;
  opacity: 0.9;
}
[data-theme="dark"] .type-stage::before {
  background: radial-gradient(ellipse 70% 100% at 50% 0%, rgba(193, 138, 74, 0.10), transparent 70%);
}
[data-theme="dark"] .type-stage { box-shadow: inset 0 1px 0 rgba(245, 238, 223, 0.05), var(--glow-sm); }

/* 聚焦态：整圈亮起 + 外发光 */
.type-stage.focused {
  border-color: var(--stage-ring);
  box-shadow: 0 0 0 3px var(--accent-light),
              0 0 32px -8px var(--accent-glow),
              inset 0 1px 0 rgba(255, 255, 255, 0.6),
              var(--glow-sm);
}

/* 打错时的舞台反馈：仅边缘红晕，克制 */
.type-stage.error-flash { animation: stageError 0.46s var(--ease-out); }
@keyframes stageError {
  0%   { box-shadow: 0 0 0 3px var(--accent-light), var(--glow-sm); }
  32%  { box-shadow: 0 0 0 3px rgba(215, 87, 87, 0.14), 0 0 28px -4px rgba(215, 87, 87, 0.30), var(--glow-sm); }
  100% { box-shadow: 0 0 0 3px var(--accent-light), var(--glow-sm); }
}

.type-stage.blurred .article-text { filter: blur(7px); opacity: 0.5; pointer-events: none; }
.type-stage.blurred { border-color: rgba(193, 138, 74, 0.30); }

.type-stage::-webkit-scrollbar { width: 8px; }
.type-stage::-webkit-scrollbar-track { background: transparent; }
.type-stage::-webkit-scrollbar-thumb { background: rgba(142, 132, 114, 0.22); border-radius: var(--radius-pill); }
.type-stage::-webkit-scrollbar-thumb:hover { background: rgba(142, 132, 114, 0.38); }
[data-theme="dark"] .type-stage::-webkit-scrollbar-thumb { background: rgba(245, 238, 223, 0.11); }

.article-text {
  position: relative;
  font-family: var(--font-mono);
  font-size: 20px;
  line-height: 1.95;
  letter-spacing: 0.005em;
  color: var(--char-pending);
  white-space: pre-wrap;
  word-break: break-word;
  user-select: none;
  transition: color 0.45s var(--ease-soft);
}

/* 一组 = 原文行 + 其下方的回显行；组与组之间留出明显间隔，避免拥挤 */
.line-group {
  display: block;
  margin-bottom: 26px;
  transition: opacity 0.45s var(--ease), filter 0.45s var(--ease);
}
.line-group:last-child { margin-bottom: 0; }

/* 「仅显示当前所在行」模式：当前组高亮，其余组淡化但仍可见 */
.article-text.focus-line .line-group { opacity: 0.26; filter: blur(1.4px); }
.article-text.focus-line .line-group.is-current {
  opacity: 1;
  filter: none;
}
.article-text.focus-line .line-group.is-current .line-echo {
  background: var(--accent-light);
  border-radius: var(--radius-sm);
}

.article-text .ch {
  position: relative;
  transition: color 0.16s var(--ease), background 0.16s var(--ease),
              text-shadow 0.24s var(--ease);
  border-radius: 2px;
}
.article-text .ch.correct { color: var(--char-correct); }

/* 打对时字符的轻微弹跳 + 一瞬暖光，增强打击感 */
.article-text .ch.correct.hit {
  animation: keyHit 0.26s var(--ease-out);
}
@keyframes keyHit {
  0%   { transform: translateY(0) scale(1); text-shadow: none; }
  38%  { transform: translateY(-2px) scale(1.13); text-shadow: 0 0 14px var(--accent-glow); }
  100% { transform: translateY(0) scale(1); text-shadow: none; }
}

/* 错误字符 —— 砖红 + 波浪下划线 + 红光 */
.article-text .ch.wrong {
  color: var(--char-wrong);
  background: var(--char-wrong-bg);
  text-decoration: underline wavy var(--char-wrong) 1.2px;
  text-underline-offset: 5px;
  text-shadow: 0 0 12px rgba(194, 74, 63, 0.30);
}

/* 刚刚打错的那个字，做一次性强调 */
.article-text .ch.wrong.fresh {
  animation: wrongPop 0.55s var(--ease-out);
}
@keyframes wrongPop {
  0%   { transform: scale(1); }
  28%  { transform: scale(1.18); background: rgba(194, 74, 63, 0.24); box-shadow: 0 0 20px -2px rgba(215, 87, 87, 0.5); }
  100% { transform: scale(1); box-shadow: none; }
}

/* 出错且尚未修正 的标记 */
.article-text .ch.reveal-correct {
  color: var(--char-wrong);
  background: var(--char-wrong-bg);
  pointer-events: none;
}

/* 当前字符指示：方框 + 柔光呼吸（光标已由方框承担） */
.article-text .ch.current {
  background: var(--char-current-bg);
  border-radius: 4px;
  box-shadow: 0 0 0 1px var(--stage-ring), 0 0 16px -2px var(--accent-glow);
  animation: currentBreath 1.8s var(--ease-soft) infinite;
}
@keyframes currentBreath {
  0%, 100% { box-shadow: 0 0 0 1px var(--stage-ring), 0 0 14px -3px var(--accent-glow); }
  50%      { box-shadow: 0 0 0 1px var(--stage-ring), 0 0 22px -2px var(--accent-glow); }
}
.article-text .ch.space.wrong { background: var(--char-wrong-bg); }

/* 换行符：渲染成可见的 ↵ 回车标记，提示此处需按回车 */
.article-text .ch.nl {
  display: inline-block;
  width: 1ch;
  text-align: center;
  color: var(--nl-color);
  opacity: 0.5;
  transform: translateY(-1px);
  transition: all 0.25s var(--ease);
}
.article-text .ch.nl::before { content: '\21B5'; }
.article-text .ch.nl.current {
  color: var(--accent-deep);
  opacity: 1;
  background: var(--char-current-bg);
  border-radius: 3px;
  box-shadow: 0 0 0 1px var(--stage-ring), 0 0 14px -3px var(--accent-glow);
}
.article-text .ch.nl.correct {
  color: var(--success);
  opacity: 0.72;
  background: transparent;
  box-shadow: none;
}
.article-text .ch.nl.wrong {
  color: var(--char-wrong);
  opacity: 1;
  background: var(--char-wrong-bg);
  text-decoration: none;
  border-radius: 3px;
}

/* 键盘指法提示 */
.keyboard-hint {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  margin-bottom: 22px;
  border-radius: var(--radius-md);
  background: var(--card-alt);
  border: 1px solid var(--border);
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}
.keyboard-hint.error {
  background: var(--danger-soft);
  border-color: rgba(215, 87, 87, 0.32);
}
.kh-label { font-size: 11.5px; font-weight: 500; color: var(--text-muted); letter-spacing: 0.04em; }
.kh-value {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  transition: color 0.25s var(--ease);
}
.kh-value.error { color: var(--char-wrong); }

/* 控制按钮 */
.typing-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  background: var(--glass-strong);
  backdrop-filter: blur(10px) saturate(130%);
  -webkit-backdrop-filter: blur(10px) saturate(130%);
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: var(--edge-hi-soft);
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.28s var(--ease-out), box-shadow 0.3s var(--ease-out), border-color 0.28s var(--ease), color 0.28s var(--ease), background 0.3s var(--ease);
}
.btn svg { width: 16px; height: 16px; }
/* 按钮掠光 */
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg,
    transparent 34%,
    rgba(255, 255, 255, 0.55) 48%,
    transparent 62%);
  opacity: 0;
  transform: translateX(-60%);
  pointer-events: none;
  z-index: 0;
}
.btn > * { position: relative; z-index: 1; }
.btn:hover {
  transform: translateY(-2px);
  border-color: rgba(193, 138, 74, 0.4);
  color: var(--accent);
  box-shadow: var(--glow-sm), var(--halo), var(--edge-hi-soft);
}
.btn:hover::before { animation: iconSheen 0.85s var(--ease-out); }
.btn:active { transform: translateY(0) scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-warm), var(--accent) 45%, var(--accent-deep));
  color: #FFFCF5;
  border-color: transparent;
  box-shadow: 0 6px 20px -5px var(--accent-glow),
              0 0 40px -14px var(--accent-glow),
              inset 0 1px 0 rgba(255, 255, 255, 0.32);
}
.btn-primary:hover {
  color: #FFFCF5;
  box-shadow: 0 12px 34px -6px var(--accent-glow),
              0 0 56px -12px var(--accent-glow),
              inset 0 1px 0 rgba(255, 255, 255, 0.36);
  transform: translateY(-2px);
}
.btn-primary:active { transform: translateY(0) scale(0.97); }
.btn-wide { flex: 1; }

.kbd {
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  background: rgba(255, 252, 245, 0.2);
  border: 1px solid rgba(255, 252, 245, 0.28);
  letter-spacing: 0.02em;
}

/* ============================================================
   文章库
   ============================================================ */
.section-head { margin-bottom: 28px; }
.section-head h2 {
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: 7px;
}
.section-head p { font-size: 14px; color: var(--text-light); }

.library-list { display: flex; flex-direction: column; gap: 16px; }

.library-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 22px 26px;
  border-radius: var(--radius-lg);
  background: var(--glass-strong);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--border);
  box-shadow: var(--glow-sm), var(--edge-hi);
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.38s var(--ease-out), box-shadow 0.38s var(--ease-out), border-color 0.32s var(--ease);
  animation: cardIn 0.6s var(--ease-out) both;
}
.library-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg,
    transparent 32%,
    var(--sheen) 46%,
    var(--sheen-mid) 52%,
    transparent 66%);
  opacity: 0;
  transform: translateX(-60%);
  pointer-events: none;
  z-index: 1;
}
.library-item:hover {
  transform: translateX(6px);
  border-color: rgba(193, 138, 74, 0.3);
  box-shadow: var(--glow-md), var(--halo), var(--edge-hi);
}
.library-item:hover::before { animation: cardSheen 0.95s var(--ease-out); }

.li-icon {
  width: 52px; height: 52px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  font-size: 24px;
  background: linear-gradient(135deg, var(--accent-light), rgba(217, 163, 104, 0.18));
  border: 1px solid rgba(193, 138, 74, 0.2);
  box-shadow: var(--edge-hi-soft), 0 0 22px -12px var(--accent-glow);
  transition: box-shadow 0.38s var(--ease-out), transform 0.38s var(--ease-out);
}
.library-item:hover .li-icon {
  transform: scale(1.04);
  box-shadow: var(--edge-hi-soft), 0 0 26px -6px var(--accent-glow);
}
.li-body { flex: 1; min-width: 0; }
.li-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 5px;
}
.li-desc { font-size: 13px; color: var(--text-light); line-height: 1.55; margin-bottom: 9px;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.li-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.li-tag {
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--tag-bg);
  color: var(--tag-text);
  box-shadow: var(--edge-hi-soft);
}
.li-tag.muted { background: rgba(142, 132, 114, 0.13); color: var(--text-muted); }
[data-theme="dark"] .li-tag.muted { background: rgba(245, 238, 223, 0.07); }

/* ============================================================
   成绩页
   ============================================================ */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}

.stat-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 26px;
  border-radius: var(--radius-lg);
  background: var(--glass-strong);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--border);
  box-shadow: var(--glow-sm), var(--edge-hi);
  overflow: hidden;
  transition: transform 0.38s var(--ease-out), box-shadow 0.38s var(--ease-out), border-color 0.32s var(--ease);
  animation: cardIn 0.6s var(--ease-out) both;
}
/* 顶部细光（hover 点亮） */
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 14%; right: 14%;
  height: 1.5px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
  pointer-events: none;
}
.stat-card:hover {
  transform: translateY(-4px);
  border-color: rgba(193, 138, 74, 0.26);
  box-shadow: var(--glow-md), var(--halo), var(--edge-hi);
}
.stat-card:hover::before { opacity: 0.9; }

.stat-icon {
  width: 48px; height: 48px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  background: var(--accent-light);
  color: var(--accent);
  box-shadow: var(--edge-hi-soft), 0 0 20px -10px var(--accent-glow);
}
.stat-icon svg { width: 23px; height: 23px; filter: drop-shadow(0 0 8px var(--accent-glow)); }

.stat-meta { display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: 12px; font-weight: 500; color: var(--text-muted); letter-spacing: 0.02em; }
.stat-big {
  font-family: var(--font-mono);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat-unit { font-size: 11px; font-weight: 500; color: var(--text-muted); }

.history-panel { padding: 26px 30px 30px; }
.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 700;
}

.history-list { display: flex; flex-direction: column; gap: 9px; max-height: 440px; overflow-y: auto; }
.history-list::-webkit-scrollbar { width: 8px; }
.history-list::-webkit-scrollbar-thumb { background: rgba(142, 132, 114, 0.25); border-radius: 100px; }
.history-list::-webkit-scrollbar-thumb:hover { background: rgba(193, 138, 74, 0.4); }

.history-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  align-items: center;
  gap: 22px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--card-alt);
  border: 1px solid var(--border);
  box-shadow: var(--edge-hi-soft);
  transition: transform 0.28s var(--ease), background 0.28s var(--ease), box-shadow 0.28s var(--ease), border-color 0.28s var(--ease);
  animation: rowIn 0.5s var(--ease-out) both;
}
@keyframes rowIn {
  from { opacity: 0; transform: translateX(-14px); }
  to   { opacity: 1; transform: translateX(0); }
}
.history-row:hover {
  transform: translateX(4px);
  border-color: rgba(193, 138, 74, 0.22);
  box-shadow: var(--glow-sm), var(--halo), var(--edge-hi-soft);
}

.hr-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hr-date { font-size: 11.5px; color: var(--text-muted); font-weight: 400; margin-top: 3px; }
.hr-stat { display: flex; flex-direction: column; align-items: flex-end; }
.hr-stat-label { font-size: 10px; color: var(--text-muted); font-weight: 500; letter-spacing: 0.04em; }
.hr-stat-value { font-family: var(--font-mono); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.hr-stat-value.good { color: var(--success); }
.hr-stat-value.warn { color: var(--warn); }
.hr-stat-value.bad { color: var(--danger); }

.empty-state {
  padding: 54px 20px;
  text-align: center;
  font-size: 13.5px;
  color: var(--text-muted);
}

/* ============================================================
   结算弹窗
   ============================================================ */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(42, 38, 32, 0.42);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.42s var(--ease-out), visibility 0.42s var(--ease-out);
}
[data-theme="dark"] .modal-mask { background: rgba(0, 0, 0, 0.62); }
.modal-mask.show { opacity: 1; visibility: visible; }

.result-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  padding: 40px 38px 34px;
  border-radius: var(--radius-xl);
  background: var(--glass-strong);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--border);
  box-shadow: var(--glow-lg), var(--halo), var(--edge-hi);
  text-align: center;
  overflow: hidden;
  isolation: isolate;
  transform: translateY(34px) scale(0.94);
  opacity: 0;
  transition: transform 0.6s var(--ease-out), opacity 0.46s var(--ease-out);
}
.modal-mask.show .result-card { transform: translateY(0) scale(1); opacity: 1; }

/* 顶部掠光：弹窗出现时扫过一次 */
.result-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg,
    transparent 30%,
    var(--sheen) 45%,
    var(--sheen-mid) 52%,
    transparent 68%);
  opacity: 0;
  transform: translateX(-70%);
  pointer-events: none;
  z-index: 1;
}
.modal-mask.show .result-card::before { animation: cardSheen 1.1s var(--ease-out) 0.18s; }

/* 顶部高光线 */
.result-card::after {
  content: '';
  position: absolute;
  top: 0; left: 12%; right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.9), transparent);
  pointer-events: none;
}

.result-glow {
  position: absolute;
  top: -140px; left: 50%;
  transform: translateX(-50%);
  width: 380px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-light), transparent 68%);
  pointer-events: none;
  animation: resultGlowPulse 4.5s var(--ease-soft) infinite;
}
@keyframes resultGlowPulse {
  0%, 100% { opacity: 0.75; transform: translateX(-50%) scale(1); }
  50%      { opacity: 1;    transform: translateX(-50%) scale(1.08); }
}

.result-head { position: relative; margin-bottom: 26px; }

.result-ring {
  position: relative;
  width: 148px; height: 148px;
  margin: 0 auto 20px;
}
.result-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(142, 132, 114, 0.18); stroke-width: 8; }
[data-theme="dark"] .ring-bg { stroke: rgba(245, 238, 223, 0.1); }
.ring-fg {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  filter: drop-shadow(0 0 8px var(--accent-glow));
  transition: stroke-dashoffset 1.3s var(--ease-out), stroke 0.55s var(--ease);
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}
.ring-center span {
  font-family: var(--font-mono);
  font-size: 41px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--accent);
  text-shadow: 0 0 30px var(--accent-glow);
  font-variant-numeric: tabular-nums;
}
.ring-center small { font-size: 11.5px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.09em; }

.result-head h3 {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: 7px;
}
.result-sub { font-size: 13.5px; color: var(--text-light); }

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  margin-bottom: 28px;
}
.rg-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--card-alt);
  border: 1px solid var(--border);
  box-shadow: var(--edge-hi-soft);
  text-align: left;
  animation: rgIn 0.55s var(--ease-out) both;
}
.rg-item:nth-child(1) { animation-delay: 0.15s; }
.rg-item:nth-child(2) { animation-delay: 0.22s; }
.rg-item:nth-child(3) { animation-delay: 0.29s; }
.rg-item:nth-child(4) { animation-delay: 0.36s; }
@keyframes rgIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.rg-label { font-size: 11px; font-weight: 500; color: var(--text-muted); letter-spacing: 0.04em; }
.rg-value {
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.result-actions { display: flex; gap: 11px; position: relative; }

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  bottom: 34px;
  left: 50%;
  transform: translate(-50%, 26px);
  z-index: 300;
  padding: 13px 24px;
  border-radius: 100px;
  font-size: 13.5px;
  font-weight: 500;
  color: #FFFCF5;
  background: linear-gradient(180deg, #3A3325, #2A2620);
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.4),
              0 0 26px -10px var(--accent-glow),
              inset 0 1px 0 rgba(255, 255, 255, 0.14);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.42s var(--ease-out), visibility 0.42s var(--ease-out), transform 0.42s var(--ease-out);
  white-space: nowrap;
}
[data-theme="dark"] .toast { background: linear-gradient(180deg, #453D2C, #332C1E); color: #F0E8D6; }
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 980px) {
  .article-grid { grid-template-columns: 1fr; }
  .hud { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 720px) {
  .topbar { padding: 12px 18px; gap: 12px; flex-wrap: wrap; }
  .brand-sub { display: none; }
  .nav-tab span { display: none; }
  .nav-tab { padding: 9px 11px; }
  .nav-tab.active::after { bottom: -13px; }
  .app-shell { padding: 26px 18px 70px; }
  .panel-picker { padding: 26px 20px 30px; }
  .panel-typing { padding: 22px 20px 26px; }
  .panel-word-setup { padding: 26px 20px 30px; }
  .picker-head h2 { font-size: 24px; }
  .hud { grid-template-columns: repeat(2, 1fr); }
  .article-text { font-size: 17px; line-height: 1.85; }
  .type-stage { padding: 22px 20px; }
  .section-head h2 { font-size: 22px; }
  .library-item { padding: 18px; gap: 16px; }
  .li-icon { width: 44px; height: 44px; font-size: 20px; }
  .history-row { grid-template-columns: 1fr auto; gap: 12px; }
  .hr-stat:nth-child(n+4) { display: none; }
  .result-card { padding: 32px 24px 28px; }
  .streak-pill { padding: 7px 12px; font-size: 12px; }
  .typing-title { font-size: 16px; }
  .typing-badges { display: none; }

  /* 模式切换与单词模式 */
  .mode-switch { width: 100%; max-width: 340px; }
  .ms-btn { flex: 1; justify-content: center; padding: 10px 12px; font-size: 13px; }
  .word-stage { min-height: 260px; padding: 26px 18px; }
  .word { padding: 6px 9px; font-size: 19px; }
  .word-stream { gap: 26px 4px; }
  .word-echo { left: 9px; }
  .chip { padding: 9px 16px; font-size: 12.5px; }
  .setup-label small { display: none; }
  .error-bar { gap: 10px; padding: 11px 14px; }
  .eb-body { gap: 9px; }
  .eb-dim { display: none; }
  .eb-count { margin-left: 0; }

  /* 指法入门 / 句子模式 */
  .posture-panel { padding: 18px 18px 20px; }
  .posture-grid { grid-template-columns: 1fr; gap: 10px; }
  .finger-levels { grid-template-columns: 1fr; gap: 14px; }
  .vkeyboard, .heat-keyboard { padding: 10px 8px; overflow-x: auto; }
  .vkb-key, .heat-key { width: 32px; height: 34px; font-size: 11.5px; border-radius: 6px; }
  .vkb-row, .heat-row { gap: 4px; justify-content: flex-start; }
  .vkb-key.home::after, .heat-key.home::after { width: 9px; }
  .vkb-space, .heat-space { width: 140px; }
  .sentence-live { font-size: 17px; line-height: 1.8; }
  .sentence-prev { font-size: 12px; }
  .sentence-next { font-size: 11.5px; }
  .chart-panel, .heat-panel { padding: 18px 18px 20px; }
  .chart-body { min-height: 160px; }
  .ht-chip { font-size: 12px; padding: 5px 11px; }
}

/* 中等屏幕：虚拟键盘与热力图按键缩放 */
@media (max-width: 980px) and (min-width: 721px) {
  .vkb-key, .heat-key { width: 38px; height: 38px; font-size: 12.5px; }
  .vkb-row, .heat-row { gap: 5px; }
}

/* ============================================================
   指法入门 —— 姿势要领 + 关卡卡片 + 虚拟键盘
   ============================================================ */
.posture-panel {
  position: relative;
  padding: 22px 26px 24px;
  margin-bottom: 24px;
  border-radius: var(--radius-xl);
  background: var(--glass-strong);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--border);
  box-shadow: var(--glow-sm), var(--edge-hi);
  overflow: hidden;
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease);
}
.posture-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(193, 138, 74, 0.55), transparent);
  opacity: 0.8;
  pointer-events: none;
}

.posture-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14.5px;
  font-weight: 700;
}
.posture-head svg {
  width: 17px; height: 17px;
  color: var(--accent);
  filter: drop-shadow(0 0 8px var(--accent-glow));
}
.posture-head .btn-ghost { margin-left: auto; }
.posture-head .btn-ghost:hover svg { transform: none; }

.posture-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 18px;
  overflow: hidden;
  max-height: 900px;
  transition: max-height 0.5s var(--ease-out), opacity 0.36s var(--ease-soft), margin 0.36s var(--ease-soft);
}
.posture-panel.collapsed .posture-grid {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}

.posture-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--card-alt);
  border: 1px solid var(--border);
  box-shadow: var(--edge-hi-soft);
  animation: cardIn 0.55s var(--ease-out) both;
  transition: transform 0.32s var(--ease), border-color 0.32s var(--ease), box-shadow 0.32s var(--ease);
}
.posture-item:hover {
  transform: translateY(-3px);
  border-color: rgba(193, 138, 74, 0.32);
  box-shadow: var(--glow-sm), var(--halo), var(--edge-hi-soft);
}

.pi-idx {
  flex-shrink: 0;
  width: 24px; height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: #FFFCF5;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  box-shadow: 0 0 14px -4px var(--accent-glow), var(--edge-hi-soft);
}
.pi-body { flex: 1; min-width: 0; }
.pi-title { font-size: 13.5px; font-weight: 700; margin-bottom: 3px; }
.pi-text { font-size: 12.5px; line-height: 1.6; color: var(--text-light); }

/* 关卡卡片 */
.finger-levels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 18px;
}

.finger-level-card {
  position: relative;
  padding: 20px 22px 18px;
  border-radius: var(--radius-lg);
  background: var(--glass-strong);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--border);
  box-shadow: var(--glow-sm), var(--edge-hi);
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.38s var(--ease-out), box-shadow 0.38s var(--ease-out), border-color 0.32s var(--ease);
  animation: cardIn 0.6s var(--ease-out) both;
}
/* 顶部进度光线（hover 展开） */
.finger-level-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2.5px;
  background: linear-gradient(90deg, var(--accent), var(--accent-warm));
  box-shadow: 0 0 12px var(--accent-glow);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s var(--ease-out);
  z-index: 2;
}
/* 掠光 */
.finger-level-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg,
    transparent 32%,
    var(--sheen) 46%,
    var(--sheen-mid) 52%,
    transparent 66%);
  opacity: 0;
  transform: translateX(-60%);
  pointer-events: none;
  z-index: 1;
}
.finger-level-card:hover {
  transform: translateY(-5px);
  border-color: rgba(193, 138, 74, 0.3);
  box-shadow: var(--glow-md), var(--halo), var(--edge-hi);
}
.finger-level-card:hover::after { transform: scaleX(1); }
.finger-level-card:hover::before { animation: cardSheen 0.95s var(--ease-out); }

.finger-level-card.done { border-color: rgba(79, 159, 122, 0.36); }
.finger-level-card.done::after { background: linear-gradient(90deg, var(--success), #6FB894); box-shadow: 0 0 12px rgba(79,159,122,0.45); }
.finger-level-card.done .flc-idx {
  background: linear-gradient(135deg, var(--success), #6FB894);
  box-shadow: 0 0 14px -4px rgba(79, 159, 122, 0.55), var(--edge-hi-soft);
}
.finger-level-card.locked { cursor: not-allowed; opacity: 0.5; filter: grayscale(0.5); }
.finger-level-card.locked:hover { transform: none; box-shadow: var(--glow-sm), var(--edge-hi); }
.finger-level-card.locked::after,
.finger-level-card.locked::before { display: none; }

.flc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.flc-idx {
  width: 28px; height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: #FFFCF5;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  box-shadow: 0 0 14px -4px var(--accent-glow), var(--edge-hi-soft);
}
.flc-state { font-size: 11px; font-weight: 600; color: var(--text-muted); }
.finger-level-card.done .flc-state { color: var(--success); text-shadow: 0 0 12px rgba(79,159,122,0.35); }

.flc-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
}
.flc-keys { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 10px; }
.flk {
  min-width: 24px;
  padding: 3px 7px;
  border-radius: 5px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent-deep);
  background: var(--tag-bg);
  box-shadow: var(--edge-hi-soft);
}
.flk-all { font-family: var(--font-body); font-size: 11px; }
.flc-focus { font-size: 12px; line-height: 1.55; color: var(--text-light); }

/* 关卡聚焦提示条 */
.finger-focus {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--accent-deep);
  background: linear-gradient(180deg, var(--accent-light), rgba(193,138,74,0.06));
  border: 1px solid rgba(193, 138, 74, 0.22);
  box-shadow: var(--edge-hi-soft), 0 0 22px -10px var(--accent-glow);
}

/* ---- 虚拟键盘 ---- */
.vkeyboard {
  padding: 16px 14px;
  margin-bottom: 20px;
  border-radius: var(--radius-lg);
  background: var(--card-alt);
  border: 1px solid var(--border);
  box-shadow: var(--glow-sm), var(--edge-hi-soft), inset 0 2px 10px -4px rgba(74, 56, 32, 0.06);
  user-select: none;
  overflow: hidden;
}
.vkb-row { display: flex; gap: 6px; justify-content: center; margin-bottom: 6px; }
.vkb-row:last-child { margin-bottom: 0; }

.vkb-key {
  position: relative;
  flex: 0 0 auto;
  width: 46px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-light);
  background: linear-gradient(180deg, var(--card), rgba(255,252,245,0.55));
  border: 1px solid var(--border);
  box-shadow: 0 1.5px 0 var(--border-strong), var(--edge-hi-soft);
  transition: transform 0.2s var(--ease), box-shadow 0.24s var(--ease), background 0.24s var(--ease), color 0.24s var(--ease);
}
[data-theme="dark"] .vkb-key {
  background: linear-gradient(180deg, var(--card), rgba(0,0,0,0.14));
}
/* 本关涉及的键位：加描边 */
.vkb-key.in-level {
  color: var(--accent-deep);
  border-color: rgba(193, 138, 74, 0.5);
  background: linear-gradient(180deg, var(--accent-light), rgba(193,138,74,0.10));
  box-shadow: 0 1.5px 0 var(--border-strong), var(--edge-hi-soft), 0 0 16px -8px var(--accent-glow);
}
/* 手指分组色（本关键位才显示） */
.vkb-key.hint-pinky  { border-bottom: 2.5px solid #D9A368; }
.vkb-key.hint-ring   { border-bottom: 2.5px solid #C99A3E; }
.vkb-key.hint-middle { border-bottom: 2.5px solid #4F9F7A; }
.vkb-key.hint-index  { border-bottom: 2.5px solid #6F9BD4; }
.vkb-key.hint-thumb  { border-bottom: 2.5px solid #B07F4E; }

/* 基准键 F / J 的小凸起 */
.vkb-key.home::after {
  content: '';
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px; height: 2px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  opacity: 0.75;
}

/* 当前待敲键 —— 强烈高亮 + 呼吸光晕 */
.vkb-key.active {
  color: #FFFCF5;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  border-color: transparent;
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 6px 18px -4px var(--accent-glow), var(--edge-hi-soft);
  animation: vkeyPulse 1.35s var(--ease-soft) infinite;
  z-index: 2;
}
@keyframes vkeyPulse {
  0%, 100% { box-shadow: 0 6px 16px -4px var(--accent-glow), var(--edge-hi-soft); }
  50%      { box-shadow: 0 9px 26px -2px var(--accent-glow), 0 0 34px -6px var(--accent-glow), var(--edge-hi-soft); }
}

.vkb-space-row { margin-top: 4px; }
.vkb-space { width: 44%; font-size: 11.5px; letter-spacing: 0.08em; }

/* ============================================================
   句子模式
   ============================================================ */
.sentence-stage {
  display: block;
  min-height: 300px;
  max-height: 48vh;
}
.sentence-nav { display: flex; flex-direction: column; gap: 12px; }

/* 上一句：淡出在光里 */
.sentence-prev {
  position: relative;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-faint);
  opacity: 0.62;
  padding-left: 2px;
  min-height: 22px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity 0.4s var(--ease-soft);
  -webkit-mask-image: linear-gradient(90deg, #000 76%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 76%, transparent 100%);
}
.sentence-prev.empty { opacity: 0; }

/* 句子计数条：底边一道渐隐光线 */
.sentence-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  padding-bottom: 9px;
  border-bottom: 1px dashed var(--border-strong);
}
.sentence-bar::after {
  content: '';
  position: absolute;
  left: 0; bottom: -1px;
  width: 86px; height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0.55;
}
.sentence-idx {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent-deep);
  text-shadow: 0 0 16px var(--accent-glow);
  font-variant-numeric: tabular-nums;
}
.sentence-total { font-size: 11.5px; color: var(--text-muted); margin-left: auto; }

.sentence-echo-wrap { padding: 6px 0 2px; }
.sentence-live {
  font-size: 21px;
  line-height: 1.9;
}

/* 下一句提示：玻璃底 + 顶部微光 */
.sentence-next {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255,252,245,0.9), rgba(255,252,245,0.62));
  border: 1px dashed rgba(193, 138, 74, 0.30);
  box-shadow: var(--edge-hi-soft);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  animation: hintIn 0.42s var(--ease-out) both;
}
[data-theme="dark"] .sentence-next {
  background: linear-gradient(180deg, rgba(245,238,223,0.09), rgba(245,238,223,0.04));
  border-color: rgba(217, 163, 104, 0.26);
}
.sn-label {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 5px;
  font-family: var(--font-body);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent-deep);
  background: var(--accent-light);
  box-shadow: 0 0 12px -4px var(--accent-glow);
}
.sn-text { overflow: hidden; text-overflow: ellipsis; }


/* 过渡平滑 */
.article-text .ch,
.article-text .line-echo { transition: opacity 0.25s var(--ease), color 0.14s var(--ease); }

/* ============================================================
   成绩页：进步曲线 + 错键热力图
   ============================================================ */
.chart-panel,
.heat-panel {
  position: relative;
  padding: 24px 28px 26px;
  margin-bottom: 26px;
  border-radius: var(--radius-xl);
  background: var(--glass-strong);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: var(--glow-sm), var(--edge-hi);
  overflow: hidden;
}
.chart-panel::before,
.heat-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(193, 138, 74, 0.5), transparent);
  pointer-events: none;
}

.chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.chart-title { font-family: var(--font-display); font-size: 16px; font-weight: 700; }
.chart-title em {
  font-style: normal;
  text-shadow: 0 0 20px var(--accent-glow);
}
.chart-sub { display: block; margin-top: 3px; font-size: 12px; color: var(--text-muted); }

.chart-legend { display: flex; align-items: center; gap: 14px; }
.cl-item { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-light); font-weight: 500; }
.cl-dot { width: 9px; height: 9px; border-radius: 50%; }
.cl-dot.cl-wpm { background: var(--accent); box-shadow: 0 0 10px -1px var(--accent-glow); }
.cl-dot.cl-acc { background: #6F9BD4; box-shadow: 0 0 10px -1px rgba(111, 155, 212, 0.55); }

.chart-body { min-height: 200px; }

.trend-svg { width: 100%; height: auto; display: block; overflow: visible; }

.tc-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 5; }
.tc-axis {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--text-muted);
}
.tc-line-wpm {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px var(--accent-glow));
}
.tc-line-acc {
  fill: none;
  stroke: #6F9BD4;
  stroke-width: 2;
  stroke-dasharray: 5 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.9;
  filter: drop-shadow(0 0 6px rgba(111, 155, 212, 0.4));
}
.tc-dot-wpm { fill: var(--accent); stroke: var(--card); stroke-width: 1.6; }
.tc-dot-acc { fill: #6F9BD4; stroke: var(--card); stroke-width: 1.4; }

/* ---- 热力图 ---- */
.heat-summary {
  padding: 5px 13px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(142, 132, 114, 0.12);
  box-shadow: var(--edge-hi-soft);
}
[data-theme="dark"] .heat-summary { background: rgba(245, 238, 223, 0.07); }
.heat-summary.has-data {
  color: var(--accent-deep);
  background: var(--accent-light);
  box-shadow: 0 0 18px -6px var(--accent-glow), var(--edge-hi-soft);
}

.heat-keyboard {
  padding: 16px 14px;
  margin-bottom: 18px;
  border-radius: var(--radius-lg);
  background: var(--card-alt);
  border: 1px solid var(--border);
  box-shadow: var(--glow-sm), var(--edge-hi-soft), inset 0 2px 10px -4px rgba(74, 56, 32, 0.06);
  user-select: none;
  overflow: hidden;
}
.heat-row { display: flex; gap: 6px; justify-content: center; margin-bottom: 6px; }
.heat-row:last-child { margin-bottom: 0; }

.heat-key {
  position: relative;
  width: 46px; height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--card);
  border: 1px solid var(--border);
  transition: all 0.32s var(--ease);
}
.heat-key.home::after {
  content: '';
  position: absolute;
  bottom: 5px; left: 50%;
  transform: translateX(-50%);
  width: 12px; height: 2px;
  border-radius: 2px;
  background: var(--text-faint);
}
/* 热度：--heat 0~1 → 红度递增 */
.heat-key.hot {
  --heat: 0;
  color: #FFFCF5;
  border-color: transparent;
  background: color-mix(in srgb,
    rgba(193, 138, 74, 0.55) calc((1 - var(--heat)) * 100%),
    #C24A3F);
  box-shadow: 0 3px 14px -3px rgba(194, 74, 63, calc(var(--heat) * 0.55)),
              0 0 22px -6px rgba(194, 74, 63, calc(var(--heat) * 0.45));
}
/* 不支持 color-mix 时的降级 */
@supports not (background: color-mix(in srgb, red, blue)) {
  .heat-key.hot {
    background: rgba(194, 74, 63, calc(0.24 + var(--heat) * 0.66));
  }
}
.heat-key.hot .hk-num { color: rgba(255, 252, 245, 0.92); }

.hk-char { line-height: 1; }
.hk-num {
  position: absolute;
  top: 3px; right: 5px;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--danger);
  font-variant-numeric: tabular-nums;
}

.heat-space-row { margin-top: 4px; }
.heat-space { width: 44%; font-size: 11.5px; letter-spacing: 0.08em; }

.heat-tips { display: flex; flex-direction: column; gap: 14px; }
.ht-empty { font-size: 12.5px; color: var(--text-muted); }

.ht-block { display: flex; flex-direction: column; gap: 8px; }
.ht-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.ht-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.ht-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--char-wrong);
  background: var(--danger-soft);
  border: 1px solid rgba(215, 87, 87, 0.28);
  box-shadow: 0 0 16px -6px rgba(215, 87, 87, 0.5), var(--edge-hi-soft);
}
.ht-chip em {
  font-style: normal;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 100px;
  background: rgba(215, 87, 87, 0.18);
}

.ht-finger {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-deep);
  text-shadow: 0 0 20px var(--accent-glow);
}
.ht-finger-sub { font-size: 12px; font-weight: 400; color: var(--text-muted); text-shadow: none; }

.ht-tip {
  position: relative;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text-light);
  background: linear-gradient(90deg, rgba(193,138,74,0.09), rgba(193,138,74,0.02));
  border-left: 3px solid var(--accent);
  box-shadow: var(--edge-hi-soft), inset 6px 0 20px -14px var(--accent-glow);
}

/* ============================================================
   滚动浮起态 —— 顶栏下滑时收紧并加深投影
   ============================================================ */
.topbar.scrolled {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5),
              0 6px 24px -10px rgba(140, 100, 50, 0.22),
              0 18px 46px -26px rgba(140, 100, 50, 0.22);
  background: var(--glass-strong);
}

/* ============================================================
   键盘可达性 —— 焦点光环
   ============================================================ */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent), 0 0 24px -4px var(--accent-glow);
  border-radius: 10px;
}
.article-text :focus-visible,
.type-stage :focus-visible {
  box-shadow: 0 0 0 2px var(--accent), 0 0 26px -4px var(--accent-glow);
}

/* ============================================================
   面板通用微光：所有玻璃面板顶部一道细光
   ============================================================ */
.panel,
.chart-panel,
.heat-panel,
.posture-panel,
.result-card {
  background-clip: padding-box;
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.06s !important;
  }
  .bg-layer,
  .bg-layer::before,
  .countdown-inner::before,
  .result-glow {
    animation: none !important;
  }
}

/* ============================================================
   成绩页 · 登录门禁 + 账号信息条
   ============================================================ */
.stats-gate {
  max-width: 520px;
  margin: 4px auto 0;
  padding: 42px 34px 36px;
  text-align: center;
}
.sg-badge {
  width: 62px;
  height: 62px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  color: var(--accent-deep);
  background: var(--accent-light);
  box-shadow: var(--edge-hi);
}
.sg-badge svg { width: 30px; height: 30px; }
.sg-title {
  font-family: var(--font-serif, inherit);
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.sg-desc {
  font-size: 13px;
  line-height: 1.75;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.sg-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}
.sg-field { position: relative; }
.sg-ico {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--text-faint);
  pointer-events: none;
}
.sg-field input {
  width: 100%;
  height: 48px;
  padding: 0 16px 0 44px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--card-alt);
  border: 1px solid var(--border-strong);
  box-shadow: var(--edge-hi-soft);
  outline: none;
  transition: border-color 0.28s var(--ease), box-shadow 0.32s var(--ease),
              background 0.32s var(--ease);
}
.sg-field input::placeholder { color: var(--text-faint); }
.sg-field input:focus {
  border-color: var(--accent-warm);
  background: var(--glass-strong);
  box-shadow: 0 0 0 3px var(--accent-light), 0 0 26px -10px var(--accent-glow), var(--edge-hi);
}
.sg-msg {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--danger);
  padding-left: 2px;
}
.sg-submit {
  width: 100%;
  height: 48px;
  margin-top: 2px;
}
.sg-submit[disabled] { opacity: 0.65; cursor: not-allowed; }
.sg-foot {
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.sg-foot a {
  color: var(--accent-deep);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.28s var(--ease);
}
.sg-foot a:hover { border-bottom-color: var(--accent-warm); }
.sg-dot { margin: 0 8px; color: var(--text-faint); }

/* 账号信息条 */
.stats-userbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 13px 18px;
  border-radius: var(--radius-md);
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--border);
  box-shadow: var(--edge-hi-soft);
}
.su-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.su-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  font-size: 15px;
  font-weight: 700;
  color: #FFFCF5;
  background: linear-gradient(135deg, var(--accent), var(--accent-warm));
  box-shadow: 0 4px 14px -6px var(--accent-glow);
}
.su-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.su-name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
}
.su-sub {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 46vw;
}
.su-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 560px) {
  .stats-gate { padding: 32px 20px 28px; }
  .stats-userbar { padding: 12px 14px; }
  .su-sub { max-width: 60vw; }
}

