/* =========================================================
 * 小词匠 · 快乐记单词 — 温暖童趣主题
 * 设计：Impeccable 原则 · 玩具俏皮风
 * 字体：Baloo 2 (标题) + Nunito (正文)
 * ========================================================= */

/* ===== 基础 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* 品牌暖橙 */
  --primary: #ff9f43;
  --primary-dark: #e86a17;
  --primary-light: #ffd9a8;
  /* 糖果辅助色 */
  --secondary: #4d9fff;
  --secondary-light: #d3e9ff;
  --success: #3ecf8e;
  --success-light: #d8f5e8;
  --danger: #ff6b6b;
  --danger-light: #ffe3e3;
  --purple: #a78bfa;
  --purple-light: #ece6ff;
  --pink: #f472b6;
  --pink-light: #fde3f1;
  --mint: #34d399;
  /* 中性 */
  color-scheme: light;
  --bg: #fff8f0;
  --card: #ffffff;
  --text: #4a3f35;
  --text-light: #7d6e5e;
  /* 顶栏文字（深棕，保证橙色底上对比度 ≥4.5:1） */
  --nav-text: #6b3200;
  --nav-text-active: #9a3412;
  /* P3 令牌收拢：暖调中性面/分界线（明暗主题共用） */
  --tint-a: #fff8ef;
  --tint-b: #faf6f0;
  --line: #f0e6d8;
  --highlight: #fff3e0;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 8px 24px rgba(232, 106, 23, 0.10), 0 2px 6px rgba(74, 63, 53, 0.06);
  --shadow-sm: 0 4px 12px rgba(74, 63, 53, 0.08);
  --shadow-hover: 0 14px 34px rgba(232, 106, 23, 0.16), 0 4px 10px rgba(74, 63, 53, 0.08);
  /* 主题渐变令牌：主按钮/导航选中/进度条/顶栏共用，四主题各自覆盖 */
  --grad-primary: linear-gradient(135deg, #ffb066, #ff9f43);
  --grad-primary-soft: linear-gradient(90deg, #ffb066, #ff9f43, #ff8a5c);
  --grad-topbar: linear-gradient(120deg, #ffb066 0%, #ff9f43 45%, #ff8a5c 100%);
  --shadow-primary: rgba(232, 106, 23, 0.35);
}

html, body {
  min-height: 100%;
}

body {
  font-family: "Nunito", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 8% 12%, rgba(255, 159, 67, 0.14) 0, transparent 42%),
    radial-gradient(circle at 92% 8%, rgba(77, 159, 255, 0.12) 0, transparent 42%),
    radial-gradient(circle at 85% 88%, rgba(62, 207, 142, 0.12) 0, transparent 42%),
    radial-gradient(circle at 12% 90%, rgba(167, 139, 250, 0.10) 0, transparent 40%);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .word-item-english, .progress-count, .result-emoji {
  font-family: "Baloo 2", "Nunito", "PingFang SC", sans-serif;
}

/* ===== 键盘焦点可见性 ===== */
:focus {
  outline: none;
}
:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(77, 159, 255, 0.18);
}
.topbar :focus-visible {
  outline-color: #fff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.35);
}
/* 可点击卡片（div 模拟按钮）统一键盘可达 */
.book-card:focus-visible,
.user-item:focus-visible,
.unit-item:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 2px;
}
/* 已有专属聚焦样式的输入框，避免双层指示 */
.letter-input:focus-visible,
.daily-count-sel:focus-visible,
.form-row input:focus-visible,
.form-row select:focus-visible {
  outline: none;
}

/* ===== 顶部导航 ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--grad-topbar);
  box-shadow: 0 4px 16px rgba(232, 106, 23, 0.30);
  flex-wrap: wrap;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-emoji {
  font-size: 36px;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.12));
  animation: floaty 3.2s ease-in-out infinite;
}

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.logo h1 {
  font-size: 27px;
  font-weight: 800;
  color: var(--nav-text);
  letter-spacing: 1px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.logo-sub {
  color: var(--nav-text);
  font-size: 13px;
  font-weight: 800;
  background: rgba(255,255,255,0.5);
  padding: 4px 12px;
  border-radius: 20px;
}

/* 顶栏右侧功能钮（口音 / 主题 / 用户）：导航下沉后顶部只留快捷设置 */
.top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab {
  border: none;
  background: rgba(255,255,255,0.32);
  color: var(--nav-text);
  padding: 9px 16px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.25, 1, 0.5, 1), background 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 0 rgba(107, 50, 0, 0.18);
}

.tab:hover {
  background: rgba(255,255,255,0.55);
  transform: translateY(-1px);
}

.tab:active {
  transform: scale(0.95);
}

.tab.active {
  background: var(--card);
  color: var(--nav-text-active);
  box-shadow: 0 4px 12px rgba(120, 60, 0, 0.28);
}

/* P0-2 发音口音切换：始终可见，美式时高亮 */
.accent-tab,
.theme-tab {
  flex: 0 0 auto;
  white-space: nowrap;
}
.accent-tab.us {
  background: var(--accent, #ffce5b);
  color: #7a4a00;
  box-shadow: 0 4px 12px rgba(255, 159, 67, 0.35);
}

/* ===== 底部胶囊导航 ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 60;
  padding: 8px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}

.bottom-pill {
  pointer-events: auto;
  display: flex;
  gap: 4px;
  max-width: 520px;
  margin: 0 auto;
  height: 64px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 32px;
  box-shadow: 0 10px 28px rgba(120, 60, 0, 0.22), 0 2px 6px rgba(74, 63, 53, 0.10);
}

.bottom-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border: none;
  background: transparent;
  border-radius: 26px;
  font-family: "Nunito", "PingFang SC", sans-serif;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-light);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.bottom-tab .bn-ico {
  font-size: 19px;
  line-height: 1.2;
}
/* 主题 AI 图标：小圆徽，缺图时 JS 回退 emoji */
.bottom-tab .bn-ico img {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  display: block;
  pointer-events: none;
}

.bottom-tab:hover {
  color: var(--primary-dark);
}

.bottom-tab:active {
  transform: scale(0.94);
}

.bottom-tab.active {
  background: var(--grad-primary);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(232, 106, 23, 0.35);
}

.bottom-tab:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 2px;
}

/* ===== 主容器 ===== */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 22px 16px 130px;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: viewIn 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== 按钮 ===== */
.btn-primary, .btn-secondary {
  border: none;
  border-radius: 16px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 800;
  font-family: "Nunito", sans-serif;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.2s, background 0.2s;
}

.btn-primary {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 5px 14px var(--shadow-primary);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(232, 106, 23, 0.42);
}

.btn-primary:active {
  transform: scale(0.96);
}

.btn-secondary {
  background: var(--card);
  color: var(--primary-dark);
  border: 2.5px solid var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.btn-secondary:active {
  transform: scale(0.96);
}

.btn-primary.small, .btn-secondary.small {
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 14px;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ===== 进度卡 ===== */
.progress-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 22px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  border: 1px solid rgba(255, 159, 67, 0.12);
}

.progress-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.progress-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-light);
}

.progress-count {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary-dark);
}

.progress-bar {
  height: 14px;
  background: var(--tint-b);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.progress-fill {
  height: 100%;
  background: var(--grad-primary-soft);
  border-radius: 20px;
  transition: width 0.5s cubic-bezier(0.25, 1, 0.5, 1);
  position: relative;
}

.progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  animation: shimmer 2.2s ease-in-out infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ===== 每日学习头部 ===== */
.daily-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.daily-head h2 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
}

.daily-date {
  background: linear-gradient(135deg, var(--highlight), var(--tint-b));
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 700;
  padding: 7px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--primary-light);
}

/* 每日数量选择 */
.daily-count-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 2px solid var(--primary-light);
  border-radius: 22px;
  padding: 5px 12px;
  box-shadow: var(--shadow-sm);
}

.daily-count-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-light);
  white-space: nowrap;
}

.daily-count-sel {
  border: 2px solid var(--primary);
  background: var(--tint-b);
  color: var(--primary-dark);
  font-size: 15px;
  font-weight: 800;
  font-family: "Nunito", sans-serif;
  border-radius: 14px;
  padding: 4px 10px;
  width: 72px;
  text-align: center;
  outline: none;
  transition: box-shadow 0.2s;
}

.daily-count-sel:focus {
  box-shadow: 0 0 0 3px rgba(255, 159, 67, 0.25);
}

/* ===== 当前词库书签 ===== */
.book-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 2px solid var(--primary-light);
  border-radius: 18px;
  padding: 12px 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.book-chip strong {
  color: var(--primary-dark);
  font-size: 16px;
}

.chip-note {
  color: var(--text-light);
  font-size: 13px;
  margin-left: auto;
}

.chip-btn {
  border: 2px solid var(--primary);
  background: var(--card);
  color: var(--primary-dark);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.chip-btn:hover {
  background: var(--tint-a);
  transform: translateY(-1px);
}

.learn-tip {
  color: var(--text-light);
  font-size: 14px;
  margin-bottom: 14px;
  background: var(--card);
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--primary);
}

/* ===== 复习横幅 ===== */
.review-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #d3e9ff, #e3f1ff);
  border: 2px solid #bcdcff;
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  animation: viewIn 0.35s ease;
}

.review-banner-emoji {
  font-size: 26px;
  animation: floaty 2.4s ease-in-out infinite;
}

.review-banner-text {
  color: #1a5f9e;
  font-size: 14px;
  font-weight: 700;
  flex: 1;
}

.review-btn {
  border: none;
  background: linear-gradient(135deg, #4d9fff, #3d8bf5);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  font-family: "Nunito", sans-serif;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(61, 139, 245, 0.3);
  white-space: nowrap;
}

.review-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(61, 139, 245, 0.4);
}

.review-btn:active {
  transform: scale(0.95);
}

/* ===== 打卡区 ===== */
.checkin-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 159, 67, 0.12);
}

.checkin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.checkin-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}

.checkin-streak {
  font-size: 14px;
  font-weight: 700;
  color: var(--danger);
  background: var(--danger-light);
  padding: 5px 14px;
  border-radius: 20px;
}

.checkin-streak strong {
  font-size: 18px;
  font-family: "Baloo 2", sans-serif;
}

.checkin-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.checkin-cell {
  text-align: center;
  padding: 10px 4px;
  border-radius: 14px;
  background: var(--tint-b);
  border: 2px solid transparent;
  transition: transform 0.15s, background 0.2s;
}

.checkin-cell.learned {
  background: linear-gradient(135deg, #d8f5e8, #c3efd9);
  border-color: #9be0bd;
}

.checkin-cell.today {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 159, 67, 0.18);
}

.checkin-dow {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 3px;
}

.checkin-dot {
  font-size: 16px;
}

.checkin-note {
  font-size: 12.5px;
  color: var(--text-light);
  text-align: center;
  margin-bottom: 12px;
}

.checkin-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== 单词卡片 ===== */
.card-stage {
  min-height: 150px;
  margin-bottom: 20px;
}

.word-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 2px solid rgba(255, 159, 67, 0.15);
  border: 2px solid color-mix(in srgb, var(--primary) 15%, transparent);
  position: relative;
  overflow: hidden;
  animation: cardIn 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

/* 释义 + 发音按钮一行排布：单词卡的主角组 */
.word-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.word-card::before {
  content: "";
  position: absolute;
  top: -50px;
  right: -50px;
  width: 130px;
  height: 130px;
  background: radial-gradient(circle, rgba(255, 159, 67, 0.10) 0%, transparent 70%);
  background: radial-gradient(circle, color-mix(in srgb, var(--primary) 10%, transparent) 0%, transparent 70%);
  pointer-events: none;
}

.card-tag {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--highlight);
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 18px;
}

.mean-hint {
  font-size: 44px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
  font-family: "Baloo 2", sans-serif;
  letter-spacing: 2px;
}

.letter-tip {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 20px;
}

.word-card .speak-btn {
  border: none;
  background: linear-gradient(135deg, var(--secondary-light), #e8f3ff);
  background: linear-gradient(135deg, var(--secondary-light), color-mix(in srgb, var(--secondary-light) 55%, #ffffff));
  color: #1a5f9e;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(77, 159, 255, 0.25);
  animation: speakPulse 2.6s ease-in-out infinite;
}

@keyframes speakPulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(77, 159, 255, 0.25), 0 0 0 0 rgba(77, 159, 255, 0.30); }
  50% { box-shadow: 0 4px 12px rgba(77, 159, 255, 0.25), 0 0 0 8px rgba(77, 159, 255, 0.06); }
}

.word-card .speak-btn:hover {
  transform: scale(1.1);
}

.word-card .speak-btn:active {
  transform: scale(0.92);
}

.word-card.correct {
  border-color: var(--success);
  animation: popCorrect 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popCorrect {
  0% { transform: scale(1); }
  40% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

.word-card.wrong {
  border-color: var(--danger);
  animation: shakeX 0.45s ease;
}

@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

/* ===== 字母输入 ===== */
.answer-area {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 159, 67, 0.12);
}

.letter-boxes {
  display: flex;
  gap: 9px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.letter-input {
  width: 52px;
  height: 64px;
  border: 3px solid var(--line);
  border-radius: 16px;
  font-size: 32px;
  font-weight: 800;
  font-family: "Baloo 2", sans-serif;
  text-align: center;
  outline: none;
  background: var(--tint-a);
  color: var(--text);
  transition: border-color 0.2s, transform 0.12s, box-shadow 0.2s, background 0.2s;
  caret-color: var(--primary);
}

.letter-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(255, 159, 67, 0.15);
  transform: translateY(-2px);
}

.letter-input.filled {
  border-color: #ffcf9e;
  background: var(--highlight);
}

.letter-input.correct-box {
  border-color: var(--success);
  background: var(--success-light);
  color: #1d7a4f;
  animation: popIn 0.3s ease;
}

.letter-input.wrong-box {
  border-color: var(--danger);
  background: var(--danger-light);
  color: var(--danger);
  animation: flashRed 0.5s ease;
}

/* 答错：描边闪红 2 下（柔和提示不刺眼） */
@keyframes flashRed {
  0%, 100% { box-shadow: none; }
  25%, 75% { box-shadow: 0 0 0 4px rgba(255, 79, 110, 0.30); }
  50% { box-shadow: 0 0 0 2px rgba(255, 79, 110, 0.12); }
}

/* 答错：字母格整体小幅抖动（容器级） */
.letter-boxes.shake-boxes {
  animation: boxesShake 0.32s ease;
}
@keyframes boxesShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* 答对：字母格依次弹跳（JS 递增 animation-delay，每格 40ms） */
.letter-input.pop-box {
  animation: boxPop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes boxPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.22) translateY(-4px); }
  100% { transform: scale(1); }
}

/* 答对：星星/爱心飘落 + 彩纸屑圆点 */
.fx-star {
  position: absolute;
  pointer-events: none;
  animation: fxStarFall 1.2s ease-in both;
  z-index: 5;
}
@keyframes fxStarFall {
  0% { transform: translateY(-14px) scale(0.6) rotate(0deg); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateY(64px) scale(1.15) rotate(24deg); opacity: 0; }
}
.fx-dot {
  position: absolute;
  top: -8px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  pointer-events: none;
  animation: fxDotFall 1.1s ease-in both;
  z-index: 5;
}
@keyframes fxDotFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translateY(150px) rotate(200deg); opacity: 0; }
}

@keyframes popIn {
  from { transform: scale(0.8); opacity: 0.5; }
  to { transform: scale(1); opacity: 1; }
}

.check-row {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

.feedback {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  min-height: 24px;
  padding: 6px;
  border-radius: 12px;
  transition: all 0.2s;
}

.feedback.reveal-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.reveal-btn {
  border: none;
  background: linear-gradient(135deg, var(--secondary), #3d8bf5);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  font-family: "Nunito", sans-serif;
  padding: 7px 18px;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(61, 139, 245, 0.3);
  transition: transform 0.15s, box-shadow 0.2s;
}

.reveal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(61, 139, 245, 0.4);
}

.reveal-btn:active {
  transform: scale(0.95);
}

.feedback-txt strong {
  color: var(--secondary);
}

.feedback.correct-msg {
  color: #1d7a4f;
  background: var(--success-light);
  animation: popIn 0.35s ease;
}

.feedback.wrong-msg {
  color: var(--danger);
  background: var(--danger-light);
  animation: shakeX 0.4s ease;
}

/* ===== 结果页 ===== */
.result-page {
  background: var(--card);
  border-radius: var(--radius);
  padding: 44px 28px;
  text-align: center;
  box-shadow: var(--shadow);
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 2px solid rgba(62, 207, 142, 0.25);
  border: 2px solid color-mix(in srgb, var(--success) 30%, transparent);
}

.result-emoji {
  font-size: 84px;
  margin-bottom: 10px;
  animation: bounce 1.2s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.result-page h2 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--primary-dark);
}

.result-text {
  color: var(--text-light);
  margin-bottom: 24px;
}

.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== 词库管理头部 ===== */
.manage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.manage-head h2 {
  font-size: 24px;
  font-weight: 800;
}

.manage-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ===== 添加表单 ===== */
.add-form {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  animation: popIn 0.3s ease;
  border: 1px solid rgba(255, 159, 67, 0.12);
}

.add-form h3 {
  margin-bottom: 14px;
  color: var(--primary-dark);
  font-size: 18px;
  font-weight: 800;
}

.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.form-row label {
  flex: 1;
  min-width: 180px;
  font-size: 14px;
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row input,
.form-row select {
  padding: 11px 14px;
  font-size: 16px;
  font-family: "Nunito", sans-serif;
  border: 2.5px solid var(--line);
  border-radius: 14px;
  outline: none;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-row input:focus,
.form-row select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(255, 159, 67, 0.12);
}

.hint-note {
  color: var(--text-light);
  font-size: 14px;
  background: var(--highlight);
  border: 2px dashed var(--primary-light);
  padding: 10px 14px;
  border-radius: 12px;
  width: 100%;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ===== 单词列表 ===== */
.word-list {
  display: grid;
  gap: 12px;
}

.word-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border-radius: 18px;
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
  gap: 10px;
  border: 1px solid rgba(255, 159, 67, 0.10);
  transition: transform 0.15s, box-shadow 0.2s;
}

.word-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.word-item-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

.word-item-english {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

.word-item-mean {
  color: var(--text-light);
  font-size: 15px;
}

.word-item-gap {
  font-size: 12px;
  font-weight: 700;
  color: var(--secondary);
  background: var(--secondary-light);
  padding: 2px 10px;
  border-radius: 12px;
  white-space: nowrap;
}

/* 错词本徽章 */
.wrong-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--danger);
  background: var(--danger-light);
  padding: 2px 10px;
  border-radius: 12px;
  white-space: nowrap;
}

.wrong-badge.progress {
  color: var(--secondary);
  background: var(--secondary-light);
}

.wrong-count-chip {
  background: var(--danger-light);
  color: var(--danger);
  font-weight: 800;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 20px;
}

.word-item-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  border: none;
  background: var(--tint-b);
  width: 40px;
  height: 40px;
  border-radius: 14px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

.icon-btn:hover {
  background: #ece0d0;
  transform: scale(1.08);
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn.delete:hover {
  background: var(--danger-light);
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 44px 20px;
  color: var(--text-light);
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 2px dashed var(--line);
}

.empty-emoji {
  font-size: 64px;
  margin-bottom: 12px;
  animation: floaty 3s ease-in-out infinite;
}

.empty-state p {
  margin-bottom: 16px;
  font-weight: 600;
}

.empty-sub {
  color: var(--text-light);
  font-size: 13px;
  margin-top: 4px;
}

/* ===== 词库选择 ===== */
.library-head {
  margin-bottom: 18px;
}

.library-head h2 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 4px;
}

.library-sub {
  color: var(--text-light);
  font-size: 14px;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.book-card {
  background: var(--card);
  border-radius: 20px;
  padding: 20px 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1), border-color 0.2s, box-shadow 0.2s;
}

.book-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-hover);
}

.book-card.selected {
  border-color: var(--primary);
  background: linear-gradient(160deg, #fff8ef, #fff);
  box-shadow: 0 10px 26px rgba(232, 106, 23, 0.18);
  position: relative;
}

/* 选中词库卡：右上角对勾徽章 */
.book-card.selected::after {
  content: "✓ 当前学习";
  position: absolute;
  top: -10px;
  right: -6px;
  background: var(--grad-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 14px;
  box-shadow: 0 3px 8px rgba(232, 106, 23, 0.35);
}

.book-emoji {
  font-size: 42px;
  margin-bottom: 6px;
  display: inline-block;
  animation: floaty 3.4s ease-in-out infinite;
}

.book-card:nth-child(2n) .book-emoji {
  animation-delay: 0.8s;
}

.book-grade {
  font-size: 13px;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 2px;
}

.book-label {
  font-size: 19px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.book-meta {
  font-size: 12px;
  color: var(--text-light);
}

/* ===== 单元面板 ===== */
.unit-panel {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  animation: popIn 0.3s ease;
  border: 1px solid rgba(255, 159, 67, 0.12);
}

.unit-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.unit-panel-head h3 {
  color: var(--primary-dark);
  font-size: 18px;
  font-weight: 800;
}

.unit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.unit-list {
  display: grid;
  gap: 8px;
}

.unit-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  flex-wrap: wrap;
}

.unit-item:hover {
  border-color: var(--primary);
  background: var(--highlight);
  transform: translateX(3px);
}

.unit-item.checked {
  border-color: var(--primary);
  background: var(--highlight);
}

.unit-item input {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  cursor: pointer;
}

.unit-title {
  font-weight: 700;
  color: var(--text);
  font-size: 15px;
}

.unit-name {
  color: var(--text-light);
  font-size: 13px;
  flex: 1;
  min-width: 60px;
}

.unit-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--secondary);
  background: var(--secondary-light);
  padding: 2px 10px;
  border-radius: 12px;
  white-space: nowrap;
}

/* ===== 学习模式切换 ===== */
.mode-switch {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  background: var(--card);
  border-radius: 18px;
  padding: 6px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 159, 67, 0.12);
}

.mode-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 800;
  font-family: "Nunito", sans-serif;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
}

.mode-btn.active {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 4px 12px var(--shadow-primary);
}

.mode-btn:not(.active):hover {
  color: var(--primary-dark);
  background: var(--highlight);
}

/* ===== 弹窗 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(74, 63, 53, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  backdrop-filter: blur(3px);
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--card);
  border-radius: var(--radius);
  max-width: 440px;
  width: 100%;
  padding: 26px;
  box-shadow: 0 20px 50px rgba(74, 63, 53, 0.28);
  animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 85vh;
  overflow-y: auto;
  border: 2px solid rgba(255, 159, 67, 0.15);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.modal-head h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary-dark);
}

.modal-close {
  border: none;
  background: var(--tint-b);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.15s;
}

.modal-close:hover {
  background: #ece0d0;
  transform: rotate(90deg);
}

.modal-sub {
  color: var(--text-light);
  font-size: 13px;
  margin-bottom: 16px;
}

/* ===== 徽章 ===== */
.badge-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.badge-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: var(--tint-b);
  border: 2px solid var(--line);
  transition: transform 0.15s;
}

.badge-item.unlocked {
  background: linear-gradient(135deg, #fff8ef, #ffe9cc);
  border-color: var(--primary);
  animation: badgeUnlock 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes badgeUnlock {
  0% { transform: scale(0.8) rotate(-4deg); opacity: 0.4; }
  60% { transform: scale(1.06) rotate(2deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.badge-item.locked {
  opacity: 0.55;
  filter: grayscale(0.4);
}

.badge-emoji {
  font-size: 30px;
}

.badge-item.unlocked .badge-emoji {
  animation: floaty 2.8s ease-in-out infinite;
}

.badge-info {
  min-width: 0;
}

.badge-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  display: block;
}

.badge-desc {
  font-size: 11.5px;
  color: var(--text-light);
  display: block;
  line-height: 1.4;
}

/* ===== 周报 ===== */
.week-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.week-stat {
  background: var(--tint-b);
  border-radius: 16px;
  padding: 14px;
  text-align: center;
  border: 2px solid var(--line);
}

.week-stat-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 4px;
}

.week-stat-value {
  font-size: 24px;
  font-weight: 800;
  font-family: "Baloo 2", sans-serif;
  color: var(--primary-dark);
}

.week-wrong-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}

.week-chart-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  margin: 6px 0 10px;
}

.week-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 8px 6px;
  border-radius: 16px;
  background: var(--tint-b);
  border: 2px solid var(--line);
  margin-bottom: 16px;
}

.week-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.week-bar-num {
  font-size: 12px;
  font-weight: 800;
  color: var(--primary-dark);
  font-family: "Baloo 2", sans-serif;
  height: 16px;
  line-height: 16px;
}

.week-bar-fill {
  width: 22px;
  max-width: 70%;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--primary), var(--primary-light));
  transition: height .4s ease;
}

.week-bar.today .week-bar-fill {
  background: linear-gradient(180deg, var(--warning, #ff9f43), var(--accent, #ffce5b));
  box-shadow: 0 0 8px rgba(255, 159, 67, .45);
}

.week-bar-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-light);
  white-space: nowrap;
}

.week-bar-label.today {
  color: var(--accent);
}

.week-wrong-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.week-wrong-item {
  background: var(--danger-light);
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
}

.week-wrong-empty {
  color: var(--success);
  font-size: 14px;
  font-weight: 700;
  background: var(--success-light);
  padding: 10px 14px;
  border-radius: 14px;
}

/* ===== 用户列表 ===== */
.user-list {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.user-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 3px solid var(--line);
  border-radius: 18px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.user-item:hover {
  border-color: var(--primary);
  background: var(--highlight);
  transform: translateX(3px);
}

.user-item.active {
  border-color: var(--primary);
  background: linear-gradient(135deg, #fff8ef, #ffe9cc);
}

.user-item-emoji {
  font-size: 36px;
  animation: floaty 3s ease-in-out infinite;
}

.user-item-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  flex: 1;
}

.user-item-active-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--success);
  background: var(--success-light);
  padding: 3px 10px;
  border-radius: 12px;
}

.user-item-del {
  border: none;
  background: var(--danger-light);
  color: var(--danger);
  width: 34px;
  height: 34px;
  border-radius: 12px;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s;
}

.user-item-del:hover {
  transform: scale(1.1);
}

.modal-actions {
  display: flex;
  justify-content: center;
}

.add-user-form {
  margin-top: 14px;
  border-top: 2px dashed var(--line);
  padding-top: 16px;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(74, 63, 53, 0.92);
  color: #fff;
  padding: 13px 28px;
  border-radius: 30px;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  z-index: 300;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  max-width: 88vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-8px);
}

/* ===== 工具类 ===== */
.hidden {
  display: none !important;
}

/* ===== 响应式 ===== */
@media (max-width: 480px) {
  .topbar {
    padding: 12px 14px;
  }
  .logo h1 {
    font-size: 22px;
  }
  .tab {
    padding: 8px 12px;
    font-size: 13px;
  }
  .mean-hint {
    font-size: 34px;
    padding: 8px 20px;
  }
  .letter-input {
    width: 44px;
    height: 56px;
    font-size: 28px;
  }
  .letter-boxes {
    gap: 7px;
  }
  .word-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .book-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .daily-date {
    width: 100%;
    text-align: center;
  }
  .badge-list, .week-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .result-emoji {
    font-size: 64px;
  }
}

/* ===== 移动端 / 微信内触控优化 ===== */
@media (hover: none) {
  button, .tab, .bottom-tab, .letter-input, .reveal-btn, .book-card, .unit-item, .user-item {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation; /* 去除双击缩放延迟，儿童连续拼写更跟手 */
  }
  .btn-primary, .btn-secondary { min-height: 48px; }
  .speak-btn { min-height: 44px; }
  .check-row .btn-primary {
    min-height: 54px;
    font-size: 18px;
    min-width: 180px;
  }
}

/* 刘海屏安全区适配 */
@supports (padding: env(safe-area-inset-top)) {
  .topbar {
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
  }
  .container {
    padding-bottom: max(130px, calc(110px + env(safe-area-inset-bottom, 0px)));
  }
}

/* ===== 登录 / 注册遮罩 ===== */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 20% 15%, rgba(255, 159, 67, 0.18) 0, transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(77, 159, 255, 0.15) 0, transparent 45%),
    radial-gradient(circle at 50% 100%, rgba(62, 207, 142, 0.15) 0, transparent 45%);
}
.auth-overlay:not(.hidden) {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  padding: 36px 30px 28px;
  text-align: center;
}
.auth-logo { font-size: 52px; line-height: 1; margin-bottom: 8px; }
.auth-title { font-family: "Baloo 2", "PingFang SC", sans-serif; color: var(--primary-dark); font-size: 22px; }
.auth-sub { color: var(--text-light); font-size: 13px; margin: 6px 0 22px; }
.auth-label {
  display: block;
  text-align: left;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  margin: 4px 2px -2px;
}
.auth-form { display: flex; flex-direction: column; gap: 8px; }
.auth-form input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.auth-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 159, 67, 0.18);
}
.auth-btn { width: 100%; }
.auth-msg { min-height: 18px; font-size: 13px; color: var(--danger); margin: 0; }
.auth-msg:empty { display: none; }
.auth-switch { font-size: 13px; color: var(--text-light); margin-top: 4px; }
.auth-switch a { color: var(--primary-dark); font-weight: 700; text-decoration: none; }

/* 动效偏好：减弱动画 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========== 主题系统（JS 摘挂 html[data-theme]，缺省 = 经典蜜橙） ========== */

/* --- 🍯 蜜糖绘本：奶油纸张 + 蜂蜜琥珀，故事书质感 --- */
html[data-theme="honey"] {
  --primary: #f0a24b;
  --primary-dark: #c07a15;
  --primary-light: #ffe4b8;
  --secondary: #5aa9a2;
  --secondary-light: #d9efec;
  --success: #7cb26b;
  --success-light: #e4f2dd;
  --danger: #e76f51;
  --danger-light: #fde4dc;
  --purple: #b0889f;
  --purple-light: #f2e4f0;
  --pink: #e593b5;
  --pink-light: #fbe3ee;
  --mint: #6fbf9b;
  --bg: #fbf3e3;
  --card: #fffdf6;
  --text: #54432f;
  --text-light: #8a7458;
  --nav-text: #6b3d00;
  --nav-text-active: #8a5a00;
  --tint-a: #fbf4e6;
  --tint-b: #f6ecd9;
  --line: #eadfc8;
  --highlight: #fdf0d5;
  --shadow: 0 8px 24px rgba(154, 106, 44, 0.12), 0 2px 6px rgba(84, 67, 47, 0.06);
  --shadow-sm: 0 4px 12px rgba(84, 67, 47, 0.09);
  --shadow-hover: 0 14px 34px rgba(154, 106, 44, 0.18), 0 4px 10px rgba(84, 67, 47, 0.08);
  --grad-primary: linear-gradient(135deg, #f6bd63, #eda23f);
  --grad-primary-soft: linear-gradient(90deg, #f6bd63, #eda23f, #e58f3c);
  --grad-topbar: linear-gradient(120deg, #f3b95f 0%, #eda23f 45%, #e09040 100%);
  --shadow-primary: rgba(176, 112, 20, 0.35);
}
html[data-theme="honey"] body {
  background-image:
    radial-gradient(circle at 8% 12%, rgba(240, 162, 75, 0.15) 0, transparent 42%),
    radial-gradient(circle at 92% 8%, rgba(90, 169, 162, 0.10) 0, transparent 42%),
    radial-gradient(circle at 85% 88%, rgba(124, 178, 107, 0.10) 0, transparent 42%),
    radial-gradient(circle at 12% 90%, rgba(229, 147, 181, 0.08) 0, transparent 40%);
}

/* --- 🚀 星际探险：深空蓝紫 + 霓虹光感，自带深色 --- */
html[data-theme="space"] {
  color-scheme: dark;
  --primary: #6ea8ff;
  --primary-dark: #3b82f6;
  --primary-light: #31437f;
  --secondary: #4dd0e1;
  --secondary-light: #1b3a52;
  --success: #34d399;
  --success-light: #123b33;
  --danger: #ff6b81;
  --danger-light: #46202c;
  --purple: #b388ff;
  --purple-light: #32285c;
  --pink: #f472b6;
  --pink-light: #4a2440;
  --mint: #34d399;
  --bg: #0e1430;
  --card: #1a2150;
  --text: #e7ecff;
  --text-light: #9aa6d8;
  --nav-text: #dfe6ff;
  --nav-text-active: #0e1430;
  --tint-a: #171d42;
  --tint-b: #131836;
  --line: #2c3768;
  --highlight: #232c5e;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.40);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.40);
  --shadow-hover: 0 14px 34px rgba(0, 0, 0, 0.55), 0 4px 10px rgba(0, 0, 0, 0.45);
  --grad-primary: linear-gradient(135deg, #4f7dff, #8b5cf6);
  --grad-primary-soft: linear-gradient(90deg, #4f7dff, #8b5cf6, #c05cff);
  --grad-topbar: linear-gradient(120deg, #1b2350 0%, #232c5e 45%, #2c1f60 100%);
  --shadow-primary: rgba(79, 125, 255, 0.40);
}
html[data-theme="space"] body {
  background-image:
    radial-gradient(circle at 10% 12%, rgba(139, 92, 246, 0.16) 0, transparent 45%),
    radial-gradient(circle at 90% 8%, rgba(77, 208, 225, 0.12) 0, transparent 42%),
    radial-gradient(circle at 85% 90%, rgba(79, 125, 255, 0.12) 0, transparent 45%);
}
/* 深空主题下的组件微调（保持对比度） */
html[data-theme="space"] .topbar { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45); }
html[data-theme="space"] .tab { background: rgba(255, 255, 255, 0.12); }
html[data-theme="space"] .tab:hover { background: rgba(255, 255, 255, 0.22); }
html[data-theme="space"] .tab.active {
  background: #e7ecff;
  color: #1a2150;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}
html[data-theme="space"] .letter-input,
html[data-theme="space"] .form-row input,
html[data-theme="space"] .form-row select {
  background: var(--tint-b);
  color: var(--text);
}
html[data-theme="space"] .letter-input { border-color: var(--line); }
html[data-theme="space"] .daily-count-sel { background: var(--tint-b); color: var(--text); }
/* 深空下 primary-dark 偏暗，日期徽章改用亮蓝保证对比度 */
html[data-theme="space"] .daily-date { color: var(--primary); }
html[data-theme="space"] .book-card.selected {
  background: linear-gradient(160deg, #232c5e, #1a2150);
  border-color: var(--primary);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}

/* --- 🦄 梦幻独角兽：粉紫马卡龙 + 云朵渐变 --- */
html[data-theme="unicorn"] {
  --primary: #cf7ce0;
  --primary-dark: #a24bb8;
  --primary-light: #f7defb;
  --secondary: #7cc6ee;
  --secondary-light: #e1f2fd;
  --success: #7ed6a5;
  --success-light: #e2f7ec;
  --danger: #f2779d;
  --danger-light: #fde5ed;
  --purple: #b794f6;
  --purple-light: #efe6fd;
  --pink: #f9a8d4;
  --pink-light: #fdeaf5;
  --mint: #8fdcc2;
  --bg: #fdf3fb;
  --card: #fffdfc;
  --text: #584360;
  --text-light: #937f9f;
  --nav-text: #701f5e;
  --nav-text-active: #8f2a77;
  --tint-a: #fcf0fa;
  --tint-b: #f8e9f6;
  --line: #f1dcee;
  --highlight: #fbeefb;
  --shadow: 0 8px 24px rgba(177, 102, 204, 0.12), 0 2px 6px rgba(88, 67, 96, 0.06);
  --shadow-sm: 0 4px 12px rgba(88, 67, 96, 0.08);
  --shadow-hover: 0 14px 34px rgba(177, 102, 204, 0.18), 0 4px 10px rgba(88, 67, 96, 0.08);
  --grad-primary: linear-gradient(135deg, #f2a1dd, #c984ea);
  --grad-primary-soft: linear-gradient(90deg, #f2a1dd, #c984ea, #ab8ff2);
  --grad-topbar: linear-gradient(120deg, #f5aede 0%, #d98ae8 45%, #b78cf0 100%);
  --shadow-primary: rgba(177, 102, 204, 0.38);
}
html[data-theme="unicorn"] body {
  background-image:
    radial-gradient(circle at 8% 12%, rgba(242, 161, 221, 0.16) 0, transparent 42%),
    radial-gradient(circle at 92% 8%, rgba(124, 198, 238, 0.12) 0, transparent 42%),
    radial-gradient(circle at 85% 88%, rgba(183, 148, 246, 0.12) 0, transparent 42%),
    radial-gradient(circle at 12% 90%, rgba(249, 168, 212, 0.10) 0, transparent 40%);
}

/* --- 🍓 草莓甜心：纯粉草莓系 + 薄荷解腻 + 奶油白纸底 --- */
html[data-theme="strawberry"] {
  --primary: #ff6b9d;
  --primary-dark: #e0447c;
  --primary-light: #ffd9e8;
  --secondary: #45d0b8;
  --secondary-light: #d9f6ef;
  --success: #3ecf8e;
  --success-light: #dff7ee;
  --danger: #ff4f6e;
  --danger-light: #ffe4ea;
  --purple: #c98ee8;
  --purple-light: #f5e9fd;
  --pink: #ff8fb8;
  --pink-light: #ffe9f1;
  --mint: #45d0b8;
  --bg: #fff5f8;
  --card: #fffdfa;
  --text: #5c3348;
  --text-light: #a3758a;
  --nav-text: #7a1038;
  --nav-text-active: #c2265e;
  --tint-a: #fff0f5;
  --tint-b: #ffe9f1;
  --line: #f9d7e4;
  --highlight: #ffedf4;
  --shadow: 0 8px 24px rgba(224, 68, 124, 0.12), 0 2px 6px rgba(92, 51, 72, 0.06);
  --shadow-sm: 0 4px 12px rgba(92, 51, 72, 0.08);
  --shadow-hover: 0 14px 34px rgba(224, 68, 124, 0.18), 0 4px 10px rgba(92, 51, 72, 0.08);
  --grad-primary: linear-gradient(135deg, #ff8fb8, #ff5c8a);
  --grad-primary-soft: linear-gradient(90deg, #ff8fb8, #ff6b9d, #ff4f6e);
  --grad-topbar: linear-gradient(120deg, #ffa8cc 0%, #ff6b9d 45%, #ff5c8a 100%);
  --shadow-primary: rgba(255, 92, 138, 0.38);
}
html[data-theme="strawberry"] body {
  background-image:
    radial-gradient(circle at 8% 12%, rgba(255, 107, 157, 0.13) 0, transparent 42%),
    radial-gradient(circle at 92% 8%, rgba(69, 208, 184, 0.10) 0, transparent 42%),
    radial-gradient(circle at 85% 88%, rgba(255, 217, 61, 0.10) 0, transparent 42%),
    radial-gradient(circle at 12% 90%, rgba(255, 143, 184, 0.10) 0, transparent 40%);
}
/* 糖果波点：单词卡右上角装饰（伪元素，不占结构） */
html[data-theme="strawberry"] .word-card::after {
  content: "🍬";
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 16px;
  opacity: 0.85;
  pointer-events: none;
}

/* --- ⚡ 竞技场：橙紫对撞 + 墨紫硬描边 + 错位硬投影，漫画竞技感 --- */html[data-theme="arena"] {
  --primary: #ff5a1f;
  --primary-dark: #d9420e;
  --primary-light: #ffe0c7;
  --secondary: #7b2ff2;
  --secondary-light: #ebdffd;
  --success: #1fc98e;
  --success-light: #dff7ee;
  --danger: #ff3b5c;
  --danger-light: #ffe4ea;
  --purple: #9b5cf6;
  --purple-light: #efe6fd;
  --pink: #ff5c8a;
  --pink-light: #ffe4ec;
  --mint: #1fc98e;
  --bg: #fff2e8;
  --card: #ffffff;
  --text: #33223f;
  --text-light: #7a6a88;
  --nav-text: #3d1200;
  --nav-text-active: #b33a0a;
  --tint-a: #fff6ee;
  --tint-b: #ffeede;
  --line: #f3ddc9;
  --highlight: #fff0e2;
  --shadow: 0 8px 24px rgba(217, 66, 14, 0.12), 0 2px 6px rgba(51, 34, 63, 0.06);
  --shadow-sm: 0 4px 12px rgba(51, 34, 63, 0.08);
  --shadow-hover: 0 14px 34px rgba(217, 66, 14, 0.18), 0 4px 10px rgba(51, 34, 63, 0.08);
  --grad-primary: linear-gradient(135deg, #ff8a3d, #ff4d1f);
  --grad-primary-soft: linear-gradient(90deg, #ff8a3d, #ff4d1f, #e8331f);
  --grad-topbar: linear-gradient(120deg, #ffb13d 0%, #ff5a1f 55%, #e8331f 100%);
  --shadow-primary: rgba(255, 77, 31, 0.38);
  /* 竞技场专属：漫画描边与错位硬投影 */
  --arena-ink: #2d1b3d;
}
html[data-theme="arena"] body {
  background-image:
    radial-gradient(circle at 8% 12%, rgba(255, 90, 31, 0.14) 0, transparent 42%),
    radial-gradient(circle at 92% 8%, rgba(123, 47, 242, 0.10) 0, transparent 42%),
    radial-gradient(circle at 85% 88%, rgba(255, 59, 92, 0.10) 0, transparent 42%);
}
/* 卡片类：2px 墨紫硬描边 + 右下 3px 错位硬投影 */
html[data-theme="arena"] .progress-card,
html[data-theme="arena"] .checkin-card,
html[data-theme="arena"] .book-chip,
html[data-theme="arena"] .book-card,
html[data-theme="arena"] .word-card,
html[data-theme="arena"] .answer-area,
html[data-theme="arena"] .result-page,
html[data-theme="arena"] .review-banner {
  border: 2px solid var(--arena-ink);
  box-shadow: 3px 3px 0 rgba(45, 27, 61, 0.85);
}
html[data-theme="arena"] .book-card.selected {
  border-color: var(--primary-dark);
  box-shadow: 3px 3px 0 rgba(45, 27, 61, 0.85), 0 0 0 3px rgba(255, 90, 31, 0.25);
}
/* 主按钮 / 底部胶囊：硬投影取代柔光 */
html[data-theme="arena"] .btn-primary {
  border: 2px solid var(--arena-ink);
  box-shadow: 3px 3px 0 rgba(45, 27, 61, 0.85);
}
html[data-theme="arena"] .btn-primary:hover {
  box-shadow: 4px 4px 0 rgba(45, 27, 61, 0.85);
}
html[data-theme="arena"] .bottom-pill {
  border: 2px solid var(--arena-ink);
  box-shadow: 3px 3px 0 rgba(45, 27, 61, 0.85);
}
/* 字母格：描边加粗到 2px，竞技牌质感 */
html[data-theme="arena"] .letter-input {
  border: 2px solid var(--arena-ink);
}

/* ========== 🖼 主题质感层：AI 生成平铺纹理背景 + 结果页庆祝插画 ========== */
/* 纹理铺在 body 背景与内容之间，pointer-events 无干扰 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-repeat: repeat;
  background-size: 360px 360px;
  opacity: 0.5;
}
html[data-theme="classic"]    body::before { background-image: url("assets/themes/tex-classic.webp"); }
html[data-theme="honey"]      body::before { background-image: url("assets/themes/tex-honey.webp"); }
html[data-theme="space"]      body::before { background-image: url("assets/themes/tex-space.webp"); mix-blend-mode: screen; opacity: 0.9; }
html[data-theme="unicorn"]    body::before { background-image: url("assets/themes/tex-unicorn.webp"); }
html[data-theme="arena"]      body::before { background-image: url("assets/themes/tex-arena.webp"); }
html[data-theme="strawberry"] body::before { background-image: url("assets/themes/tex-strawberry.webp"); }

/* 结果页：主题庆祝插画（拍立得式圆角相框），各主题注入 --res-art */
html[data-theme="classic"]    .result-page { --res-art: url("assets/themes/res-classic.webp"); }
html[data-theme="honey"]      .result-page { --res-art: url("assets/themes/res-honey.webp"); }
html[data-theme="space"]      .result-page { --res-art: url("assets/themes/res-space.webp"); }
html[data-theme="unicorn"]    .result-page { --res-art: url("assets/themes/res-unicorn.webp"); }
html[data-theme="arena"]      .result-page { --res-art: url("assets/themes/res-arena.webp"); }
html[data-theme="strawberry"] .result-page { --res-art: url("assets/themes/res-strawberry.webp"); }
.result-page::before {
  content: "";
  display: block;
  width: min(300px, 86%);
  aspect-ratio: 4 / 3;
  margin: 0 auto 16px;
  background: var(--res-art, none) center / cover no-repeat;
  border-radius: 20px;
  border: 4px solid var(--card);
  box-shadow: var(--shadow-sm);
}
.result-emoji { font-size: 56px; }

/* ========== 🎨 主题切换弹层（顶栏右上角） ========== */
.theme-pop-wrap { position: relative; }

.theme-pop {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 90;
  min-width: 208px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 16px 38px rgba(30, 20, 10, 0.22), 0 3px 8px rgba(30, 20, 10, 0.10);
  transform-origin: top right;
  animation: theme-pop-in 0.18s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes theme-pop-in {
  from { opacity: 0; transform: scale(0.9) translateY(-4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.theme-opt {
  display: flex;
  align-items: center;
  gap: 9px;
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 12px;
  font-family: "Nunito", "PingFang SC", sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.theme-opt:hover { background: var(--tint-a); }
.theme-opt:active { transform: scale(0.97); }

.theme-opt.active {
  background: var(--tint-a);
  color: var(--primary-dark);
}

.theme-opt .opt-emoji { font-size: 17px; }
/* 配色预览色块：切主题前一眼看到该主题的渐变质感 */
.theme-opt .opt-swatch {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, 0.08), 0 2px 5px rgba(0, 0, 0, 0.12);
}
.theme-opt[data-theme="classic"] .opt-swatch { background: linear-gradient(135deg, #ffb066, #ff9f43 55%, #ff8a5c); }
.theme-opt[data-theme="honey"] .opt-swatch { background: linear-gradient(135deg, #f6bd63, #eda23f 55%, #c07a15); }
.theme-opt[data-theme="space"] .opt-swatch { background: linear-gradient(135deg, #1b2350, #4f7dff 55%, #8b5cf6); }
.theme-opt[data-theme="unicorn"] .opt-swatch { background: linear-gradient(135deg, #f5aede, #c984ea 55%, #ab8ff2); }
.theme-opt[data-theme="arena"] .opt-swatch { background: linear-gradient(135deg, #ffb13d, #ff5a1f 55%, #7b2ff2); }
.theme-opt[data-theme="strawberry"] .opt-swatch { background: linear-gradient(135deg, #ffa8cc, #ff5c8a 60%, #45d0b8); }
.theme-opt .opt-check {
  margin-left: auto;
  font-weight: 800;
  opacity: 0;
  transition: opacity 0.15s;
}
.theme-opt.active .opt-check { opacity: 1; }

/* ===== 平板/横屏：错词本、词库单词、选书单元列表双列排布 ===== */
@media (min-width: 760px) {
  .word-list,
  .unit-list {
    grid-template-columns: repeat(2, 1fr);
  }
  /* 双列每项较窄，释义过长时允许 actions 换行，避免挤压 */
  .word-item {
    flex-wrap: wrap;
  }
}

/* ========== 🎉 完成一组学习的全屏庆祝动画 ========== */
#celebrateLayer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
  cursor: pointer;
  background:
    radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--primary) 22%, transparent) 0%, transparent 62%),
    rgba(24, 14, 34, 0.42);
  animation: cel-bg 0.25s ease;
}
@keyframes cel-bg { from { opacity: 0; } to { opacity: 1; } }

.cel-rays {
  position: absolute;
  width: min(420px, 120vw);
  height: min(420px, 120vw);
  border-radius: 50%;
  background: repeating-conic-gradient(
    from 0deg,
    color-mix(in srgb, var(--primary) 40%, transparent) 0deg 12deg,
    transparent 12deg 24deg
  );
  -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 68%);
  mask-image: radial-gradient(circle, #000 20%, transparent 68%);
  opacity: 0.35;
  animation: cel-spin 7s linear infinite;
  pointer-events: none;
}
@keyframes cel-spin { to { transform: rotate(360deg); } }

.cel-mascot { position: relative; }
.cel-mascot img {
  width: min(250px, 66vw);
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  border-radius: 26px;
  border: 6px solid #fffdf8;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.35);
  animation: cel-pop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes cel-pop {
  0% { transform: scale(0.2) rotate(-10deg); opacity: 0; }
  60% { transform: scale(1.12) rotate(4deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.cel-text {
  position: relative;
  font-family: "Baloo 2", "Nunito", "PingFang SC", sans-serif;
  font-size: 44px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.18), 0 0 22px color-mix(in srgb, var(--primary) 65%, transparent);
  animation: cel-rise 0.5s 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.cel-sub {
  position: relative;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  background: color-mix(in srgb, var(--primary) 55%, rgba(0, 0, 0, 0.25));
  padding: 7px 20px;
  border-radius: 24px;
  animation: cel-rise 0.5s 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes cel-rise {
  from { transform: translateY(26px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.cel-confetti {
  position: absolute;
  top: -14px;
  width: 10px;
  height: 16px;
  border-radius: 3px;
  animation: cel-fall linear both;
  pointer-events: none;
}
.cel-confetti.round { width: 12px; height: 12px; border-radius: 50%; }
@keyframes cel-fall {
  from { transform: translateY(-5vh) rotate(0deg); opacity: 1; }
  to { transform: translateY(112vh) rotate(720deg); opacity: 0.85; }
}

@media (prefers-reduced-motion: reduce) {
  #celebrateLayer *, #celebrateLayer { animation-duration: 0.01s !important; animation-delay: 0s !important; }
}

/* ===== 冒险岛游戏视图（全屏浮层，留出底部导航） ===== */
#view-game {
  padding: 0;
}
#view-game.active {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 0 calc(90px + env(safe-area-inset-bottom, 0px)) 0;
  z-index: 55;
  background: #10131a;
  animation: none;
}
.game-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 14px 8px;
  background: linear-gradient(180deg, #243044, #1a2230);
  color: #fff;
}
.game-title {
  font-size: 16px;
  font-weight: 800;
}
.game-sub {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  color: #a8b6cc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-btn {
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  border-radius: 10px;
  padding: 6px 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.game-btn:active { transform: scale(0.94); }
.game-btn.game-exit {
  background: rgba(232, 106, 23, 0.85);
  border-color: transparent;
}
.game-frame {
  flex: 1 1 auto;
  width: 100%;
  border: 0;
  display: block;
  background: #10131a;
}

/* 触屏设备：游戏占满全屏（盖住顶栏与底部导航，用游戏内 ✕ 退出；顶栏 z-index 为 50/60） */
@media (pointer: coarse) {
  #view-game.active {
    inset: 0;
    z-index: 80;
  }
}

/* 竖屏手机：整个游戏视图旋转 90°，强制横屏游玩 */
@media (orientation: portrait) and (pointer: coarse) {
  #view-game.active {
    top: 0;
    left: 100vw;
    right: auto;
    bottom: auto;
    width: 100vh;
    width: 100dvh; /* 支持则用可视高度，避开地址栏 */
    height: 100vw;
    transform: rotate(90deg);
    transform-origin: left top;
  }
}
