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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* Icon Action Buttons */
.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
}
.btn-icon:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}
.btn-icon.active {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  background: var(--accent-glow);
}

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

/* App Main Layout */
.app-container {
  position: relative;
  z-index: 10;
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Stats Bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}
.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.2s;
}
.stat-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-2px);
}
.stat-card.clickable {
  cursor: pointer;
}
.stat-card.clickable:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-value {
  font-size: 22px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1.2;
}
.stat-value.highlight {
  color: var(--accent-primary);
}
.stat-value.success {
  color: var(--success);
}
.stat-value.warning {
  color: var(--warning);
}
.stat-unit {
  font-size: 11px;
  color: var(--text-muted);
}

/* Progress Line Bar */
.progress-container {
  grid-column: 1 / -1;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 14px;
}
.progress-bar-bg {
  flex: 1;
  height: 8px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-text {
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  font-weight: 600;
  min-width: 110px;
  text-align: right;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* 无障碍/省电：尊重系统减弱动态效果设置 */
@media (prefers-reduced-motion: reduce) {
  .ambient-orb,
  .letter-box.current::after,
  .key.target,
  .btn-danger-lg.armed {
    animation: none;
  }
  .ambient-orb {
    opacity: 0.12;
  }
  * {
    transition-duration: 0.01ms !important;
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    align-items: stretch;
  }
  .nav-controls {
    justify-content: space-between;
  }
  .select-input {
    max-width: none;
    flex: 1;
  }
  .mode-btn {
    padding: 6px 8px;
    font-size: 12px;
  }
  .typing-card {
    padding: 24px 16px 20px;
  }
  .letter-box {
    width: 42px;
    height: 52px;
    font-size: 24px;
  }
  .word-box {
    min-height: 52px;
  }
  .key {
    height: 40px;
    min-width: 32px;
    padding: 0 6px;
    font-size: 13px;
  }
  .key-space {
    width: 160px;
  }
  .finger-guide {
    display: none;
  }
  .modal-content {
    padding: 24px 18px;
  }
  .modal-stat-value {
    font-size: 22px;
  }
  .profile-panel {
    position: fixed;
    left: 12px;
    right: 12px;
    top: 110px;
    width: auto;
  }
}
