/* ===== 设计系统 ===== */
:root {
  --color-primary: #FF6B6B;
  --color-primary-dark: #ee5a5a;
  --color-secondary: #4ECDC4;
  --color-accent: #FFE66D;
  --color-bg: #FFF8F0;
  --color-card: #FFFFFF;
  --color-text: #2D3436;
  --color-text-secondary: #636E72;
  --color-text-light: #B2BEC3;
  --color-border: #F0E6D8;
  --color-success: #00B894;
  --color-cn-badge: #FF6B6B;
  --color-en-badge: #4ECDC4;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 999px;
  --font-cn: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-en: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== 基础重置 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-cn);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
input, button { font-family: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }

/* ===== 深色模式切换按钮 ===== */
.theme-toggle {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255,255,255,0.6);
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  flex-shrink: 0;
}
.theme-toggle:active { transform: scale(0.9); }
[data-theme="dark"] .theme-toggle {
  background: rgba(255,255,255,0.12);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ===== 视图切换 ===== */
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Hero 搜索区 ===== */
.hero {
  background: url('../images/hero-banner.jpg') 30% center/cover no-repeat;
  background-color: #FFFAF0; /* fallback */
  padding: 48px 20px 32px;
  text-align: center;
  position: relative;
  overflow: visible;
  z-index: 20;
}
.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* 从右侧叠层渐变，确保文字区可读 */
  background: linear-gradient(
    to right,
    rgba(255, 248, 240, 0.3) 0%,
    rgba(255, 248, 240, 0.7) 40%,
    rgba(255, 248, 240, 0.9) 60%,
    rgba(255, 248, 240, 0.95) 100%
  );
}
.hero-content { position: relative; z-index: 1; }
.hero-emoji { font-size: 48px; margin-bottom: 4px; }
.hero-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: 2px;
  text-shadow: 0 1px 4px rgba(255,248,240,0.8);
}
.hero-subtitle {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-top: 4px;
  font-weight: 400;
}
.search-container {
  position: relative;
  z-index: 1;
  margin-top: 20px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}
.search-box {
  display: flex;
  align-items: center;
  background: var(--color-card);
  border-radius: var(--radius-full);
  padding: 0 16px;
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
}
.search-box:focus-within { box-shadow: 0 8px 32px rgba(0,0,0,0.18); transform: scale(1.02); }
.search-icon { width: 20px; height: 20px; color: var(--color-text-light); flex-shrink: 0; }
#search-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 14px 12px;
  font-size: 15px;
  background: transparent;
  color: var(--color-text);
}
#search-input::placeholder { color: var(--color-text-light); }
.search-clear {
  background: none;
  border: none;
  color: var(--color-text-light);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  background: var(--color-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
  text-align: left;
}
.search-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
  transition: var(--transition);
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: #fafafa; }
.search-item-cover {
  width: 36px;
  height: 48px;
  border-radius: 4px;
  object-fit: cover;
  margin-right: 12px;
  background: #eee;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.search-item-info {
  flex: 1;
  overflow: hidden;
}
.search-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-item-author {
  font-size: 12px;
  color: var(--color-text-light);
  margin-top: 2px;
}

/* ===== 分类标签 ===== */
.category-tabs {
  display: flex;
  gap: 8px;
  padding: 16px 20px 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.category-tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0;
  padding: 8px 18px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-card);
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.tab:active { transform: scale(0.96); }
.tab.active {
  background: var(--color-primary);
  color: #FFF;
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(255,107,107,0.3);
}

/* ===== 书籍网格 ===== */
.content {
  padding: 0 0 32px;
  position: relative;
  z-index: 1;
}
.book-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px 16px;
}
.book-card {
  background: var(--color-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.book-card:active { transform: scale(0.97); box-shadow: var(--shadow-md); }
.book-cover {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  background: linear-gradient(135deg, #f5f0e8 0%, #ede4d8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  position: relative;
}
.card-fav-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  z-index: 2;
}
.book-info { padding: 10px 12px 14px; }
.book-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
mark.highlight {
  background-color: rgba(255, 107, 107, 0.15);
  color: var(--color-primary);
  border-radius: 2px;
  padding: 0 2px;
}
.book-author {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 4px;
}
.book-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  color: #FFF;
}
.book-badge.cn { background: var(--color-cn-badge); }
.book-badge.en { background: var(--color-en-badge); }
.book-age {
  display: inline-block;
  font-size: 11px;
  color: var(--color-text-light);
  margin-top: 4px;
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--color-text-secondary);
}
.empty-emoji { font-size: 48px; display: block; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }
.empty-hint { font-size: 13px; color: var(--color-text-light); margin-top: 4px; }

/* ===== 绘本详情页 ===== */
.book-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255,248,240,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}
.back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 4px;
}
.back-btn svg { width: 20px; height: 20px; }
.icon-btn {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--color-text-secondary);
}
.icon-btn svg { width: 22px; height: 22px; }
.book-header-actions { display: flex; gap: 4px; }

/* ===== 详情内容 ===== */
.book-detail { padding: 20px 16px; max-width: 480px; margin: 0 auto; }
.detail-hero {
  text-align: center;
  margin-bottom: 24px;
}
.detail-cover {
  width: 120px;
  height: 160px;
  border-radius: var(--radius-md);
  object-fit: cover;
  box-shadow: var(--shadow-md);
  margin-bottom: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  background: linear-gradient(135deg, #f5f0e8 0%, #ede4d8 100%);
}
.detail-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
}
.detail-subtitle {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}
.detail-meta {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
  flex-wrap: wrap;
}
.meta-tag {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

/* ===== L1 教学大纲区 ===== */
.outline-section {
  background: var(--color-card);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--color-border);
}
.outline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #fdfaf5;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--color-border);
}
.outline-header h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.outline-toggle {
  font-size: 12px;
  color: var(--color-text-light);
  transition: var(--transition);
}
.outline-section.collapsed .outline-toggle::after { content: '展开'; }
.outline-section.collapsed .outline-toggle { font-size: 0; }
.outline-section.collapsed .outline-toggle::after { font-size: 12px; }
.outline-body {
  padding: 16px;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}
.outline-section.collapsed .outline-body {
  display: none;
}
.outline-block {
  margin-bottom: 14px;
}
.outline-block:last-child { margin-bottom: 0; }
.outline-label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.outline-text {
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

/* 保留旧的 prep-list 样式供兼容 */
.prep-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.prep-list li {
  font-size: 14px;
  color: var(--color-text-secondary);
  padding-left: 20px;
  position: relative;
  line-height: 1.5;
}
.prep-list li::before {
  content: '•';
  position: absolute;
  left: 6px;
  color: var(--color-primary);
  font-weight: 700;
}

/* ===== L3 绘本便签下载栏 ===== */
.cheatsheet-bar {
  margin-top: 24px;
  padding: 16px 0;
  text-align: center;
}
.cheatsheet-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 24px;
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-full);
  background: rgba(255, 107, 107, 0.06);
  color: var(--color-primary);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.cheatsheet-btn:hover {
  background: var(--color-primary);
  color: #FFF;
}
.cheatsheet-btn:active {
  transform: scale(0.97);
}

/* 版本选择器中的描述 */
.version-desc {
  font-size: 12px;
  color: var(--color-text-light);
  margin-top: 4px;
  text-align: center;
}

/* 绘本便签弹窗选择按钮 */
.cs-lang-btn, .cs-size-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: auto !important;
  padding: 12px 8px !important;
  border: 2px solid var(--color-border) !important;
  border-radius: var(--radius-md) !important;
  transition: var(--transition);
  cursor: pointer;
}
.cs-lang-btn.active, .cs-size-btn.active {
  background: var(--color-primary) !important;
  color: #FFF !important;
  border-color: var(--color-primary) !important;
  box-shadow: 0 2px 8px rgba(255,107,107,0.3);
}

/* ===== 二级 Tab：语言层 + 版本层 ===== */
.lang-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  background: var(--color-card);
  border-radius: var(--radius-full);
  padding: 4px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}
.lang-tab {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: var(--radius-full);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  background: transparent;
  color: var(--color-text-secondary);
}
.lang-tab.active {
  background: var(--color-primary);
  color: #FFF;
  box-shadow: 0 2px 8px rgba(255,107,107,0.3);
}
.lang-tab:not(.active):hover {
  background: rgba(0,0,0,0.04);
}

.version-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.version-tab {
  flex: 1;
  padding: 10px 12px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}
.version-tab.active {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(255, 107, 107, 0.06);
  font-weight: 600;
}
.version-tab:not(.active):hover {
  border-color: var(--color-text-light);
}

/* 空脚本提示 */
.empty-script {
  text-align: center;
  padding: 24px 16px;
  color: var(--color-text-light);
  font-size: 14px;
}

/* ===== TTS 控制条 ===== */
.tts-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  background: var(--color-card);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  box-shadow: var(--shadow-sm);
}
.tts-bar label {
  font-size: 13px;
  color: var(--color-text-secondary);
  white-space: nowrap;
}
.voice-select {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--color-bg);
  color: var(--color-text);
  outline: none;
}

/* ===== 逐页脚本卡片流 ===== */
.page-card {
  background: var(--color-card);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--color-border);
}
.page-card-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: #fdfaf5;
  border-bottom: 1px solid var(--color-border);
}
.page-number {
  font-size: 13px;
  font-weight: 600;
  color: #FFF;
  background: var(--color-primary);
  padding: 3px 12px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.page-title {
  font-size: 16px;
  font-weight: 600;
  margin-left: 12px;
  color: var(--color-text);
  line-height: 1.4;
}
.page-body-inner {
  padding: 20px 16px;
}
.script-block {
  margin-bottom: 24px;
}
.script-text {
  font-size: 18px;
  line-height: 1.6;
  color: var(--color-text);
  margin-bottom: 12px;
  padding: 0 4px;
}
.script-text.en-text {
  font-family: var(--font-en);
  font-size: 17px;
}

/* ===== 英文折叠区 ===== */
.en-section {
  margin-top: 8px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: #fafaf8;
}
.en-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}
.en-toggle:hover { background: #f0ede6; }
.en-toggle-icon {
  font-size: 10px;
  color: var(--color-text-light);
  transition: transform 0.2s ease;
}
.en-section:not(.collapsed) .en-toggle-icon {
  transform: rotate(90deg);
}
.en-toggle-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-secondary);
  flex: 1;
}
.audio-player-inline {
  flex-shrink: 0;
}
.en-body {
  padding: 0 14px 14px;
}
.en-section.collapsed .en-body {
  display: none;
}
/* ===== 迷你播放器 ===== */
.audio-player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: #fafafa;
  margin-bottom: 10px;
}
.ap-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.ap-btn.cn-btn { background: rgba(255, 107, 107, 0.15); color: var(--color-primary-dark); }
.ap-btn.en-btn { background: rgba(78, 205, 196, 0.15); color: #2b9991; }

.ap-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-light);
  white-space: nowrap;
}

/* 可点击单词 */
.word-tap {
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.15s;
}
.word-tap:active {
  background: rgba(255,107,107,0.15);
}

/* 底部查词弹层 */
#word-popup {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3);
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}
#word-popup.show { opacity: 1; }
.word-popup-content {
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 20px 24px 28px;
  width: 100%;
  max-width: 500px;
  position: relative;
  transform: translateY(100%);
  transition: transform 0.25s ease-out;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
}
#word-popup.show .word-popup-content {
  transform: translateY(0);
}
.word-popup-word {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
  font-family: var(--font-en);
}
.word-popup-phonetic {
  font-size: 14px;
  color: var(--color-text-light);
  font-family: var(--font-en);
  margin: 4px 0 8px;
}
.word-popup-meaning {
  font-size: 14px;
  color: var(--color-text);
  line-height: 1.6;
  max-height: 120px;
  overflow-y: auto;
}
.word-popup-speak {
  margin-top: 12px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 8px 20px;
  font-size: 14px;
  cursor: pointer;
}
.word-popup-close {
  position: absolute;
  top: 16px; right: 20px;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--color-text-light);
  cursor: pointer;
}

/* ===== 连播按钮 ===== */
.autoplay-bar { display: flex; gap: 8px; margin-bottom: 16px; }
.autoplay-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-card);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.autoplay-btn:hover { background: var(--color-bg); }
.interaction-tip {
  margin-top: 16px;
  padding: 16px;
  background: rgba(255, 230, 109, 0.15);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--color-accent);
}
.tip-header {
  font-weight: 600;
  color: #bfa300;
  font-size: 14px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tip-content {
  font-size: 15px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* ===== 延伸活动 ===== */
.activities-section {
  background: var(--color-card);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 16px;
  box-shadow: var(--shadow-sm);
}
.activities-section h3 { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.activity-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 14px;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon { font-size: 20px; flex-shrink: 0; }

/* ===== 底部 ===== */
.book-footer {
  padding: 24px 20px 40px;
  text-align: center;
  max-width: 480px;
  margin: 0 auto;
}
.footer-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--color-text-light);
  font-size: 13px;
}
.footer-divider::before, .footer-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}
.footer-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.footer-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--color-card);
  box-shadow: var(--shadow-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  transition: var(--transition);
}
.footer-link:active { transform: scale(0.98); }
.footer-disclaimer {
  font-size: 11px;
  color: var(--color-text-light);
  line-height: 1.5;
  margin-bottom: 8px;
}
.footer-copyright {
  font-size: 11px;
  color: var(--color-text-light);
}

/* ===== 弹窗 ===== */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.modal-content {
  position: relative;
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 24px 20px 32px;
  width: 90%;
  max-width: 400px;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-content h3 { font-size: 18px; font-weight: 600; margin-bottom: 12px; text-align: center; }
.share-url {
  background: var(--color-bg);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--color-text-secondary);
  word-break: break-all;
  margin-bottom: 16px;
  font-family: var(--font-en);
}
.btn {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 8px;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--color-primary); color: #FFF; }
.btn-secondary { background: var(--color-bg); color: var(--color-text-secondary); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-text);
  color: #FFF;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 14px;
  z-index: 2000;
  opacity: 0;
  transition: all 0.3s ease;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

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

/* ===== 加载中状态样式 ===== */
.tts-btn-large.loading {
  background: rgba(255, 199, 0, 0.12);
  color: #b8860b;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

/* ===== 版本标签 ===== */
.version-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  margin-top: 16px;
}
.version-tab {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-light);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}
.version-tab.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
  font-weight: 500;
}

/* ===== 页脚免责与版权 ===== */
.site-footer {
  padding: 32px 20px;
  text-align: center;
  border-top: 1px solid var(--color-border);
  margin-top: 40px;
}
.footer-disclaimer {
  font-size: 11px;
  color: var(--color-text-light);
  line-height: 1.6;
  max-width: 600px;
  margin: 0 auto 12px;
}
.footer-copyright {
  font-size: 11px;
  color: var(--color-text-light);
}

/* ============================================
   响应式适配 — 手机 / 平板 / 桌面
   ============================================ */

/* --- 移动端 (<768px) --- */
@media (max-width: 767px) {
  .hero-icon { display: none !important; }
  .header-top { display: none !important; }
}

/* --- 平板 (≥768px) --- */
@media (min-width: 768px) {
  .hero { padding: 56px 32px 40px; background-position: center; }
  .header-top { position: relative; z-index: 10; }
  .hero-title { font-size: 36px; }
  .hero-subtitle { font-size: 16px; }
  .search-container { max-width: 500px; }

  .category-tabs { justify-content: center; padding: 20px 32px 12px; }

  .content { max-width: 900px; margin: 0 auto; padding: 0 24px 40px; }
  .book-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; padding: 16px 0; }

  .book-detail { max-width: 700px; padding: 28px 32px; }
  .detail-cover { width: 160px; height: 213px; }
  .detail-title { font-size: 26px; }

  .script-text { font-size: 17px; }
  .tts-btn-large { padding: 14px; font-size: 15px; }

  .page-card { max-width: 700px; margin-left: auto; margin-right: auto; }

  .modal-content { border-radius: var(--radius-lg); max-width: 440px; margin-bottom: 10vh; }

  .site-footer { max-width: 900px; margin-left: auto; margin-right: auto; }
}

/* --- 桌面 (≥1024px) --- */
@media (min-width: 1024px) {
  .hero { padding: 64px 40px 48px; }
  .hero-emoji { font-size: 56px; }
  .hero-title { font-size: 42px; letter-spacing: 3px; }
  .hero-subtitle { font-size: 17px; margin-top: 8px; }
  .search-container { max-width: 560px; }

  .category-tabs { padding: 24px 0 16px; max-width: 1100px; margin: 0 auto; }

  .content { max-width: 1200px; padding: 0 40px 48px; }
  .book-grid { grid-template-columns: repeat(5, 1fr); gap: 20px; padding: 20px 0; }
  .book-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
  .book-info { padding: 12px 14px 16px; }
  .book-title { font-size: 15px; }

  .book-detail { max-width: 800px; padding: 40px 48px; }
  .detail-cover { width: 180px; height: 240px; }
  .detail-title { font-size: 30px; }

  /* 单栏脚本布局 */
  .page-body-inner {
    padding: 24px;
  }

  .page-card { max-width: 680px; }

  .site-footer { max-width: 1200px; }
}

/* --- 超宽屏 (≥1440px) --- */
@media (min-width: 1440px) {
  .content { max-width: 1400px; }
  .book-grid { grid-template-columns: repeat(6, 1fr); }
  .book-detail { max-width: 900px; }
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .site-footer { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
}

/* ===== V3: 多维筛选栏 ===== */
.filter-bar {
  padding: 4px 16px 12px;
  position: relative;
  z-index: 10;
}
.filter-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  flex-shrink: 0;
  min-width: 40px;
}
.filter-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px 0;
}
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0;
  padding: 5px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-card);
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.filter-chip:active { transform: scale(0.95); }
.filter-chip.active {
  background: var(--color-secondary);
  color: #FFF;
  border-color: var(--color-secondary);
  box-shadow: 0 2px 6px rgba(78,205,196,0.25);
}
.filter-chip.active-skill {
  background: #6C5CE7;
  color: #FFF;
  border-color: #6C5CE7;
  box-shadow: 0 2px 6px rgba(108,92,231,0.25);
}

/* ===== V3: Wiki 信息卡片 ===== */
.wiki-section {
  background: var(--color-card);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--color-border);
}
.wiki-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, #f0f9f8 0%, #f5f3ff 100%);
  border-bottom: 1px solid var(--color-border);
}
.wiki-header h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.wiki-body {
  padding: 16px;
}
.wiki-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}
.wiki-row:last-child { margin-bottom: 0; }
.wiki-row-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  flex-shrink: 0;
  min-width: 60px;
  padding-top: 2px;
}
.wiki-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.wiki-tag {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-weight: 500;
}
.wiki-tag.skill {
  background: rgba(108,92,231,0.1);
  color: #6C5CE7;
  border: 1px solid rgba(108,92,231,0.2);
}
.wiki-tag.theme {
  background: rgba(78,205,196,0.1);
  color: #00B894;
  border: 1px solid rgba(78,205,196,0.2);
}
.wiki-tag.difficulty {
  background: rgba(255,165,0,0.1);
  color: #e67e22;
  border: 1px solid rgba(255,165,0,0.2);
}

/* 难度指示条 */
.difficulty-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}
.difficulty-dots {
  display: flex;
  gap: 3px;
}
.difficulty-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e0e0e0;
}
.difficulty-dot.filled {
  background: #e67e22;
}
.difficulty-label {
  font-size: 12px;
  color: var(--color-text-light);
}

/* ===== V3: 关联推荐 ===== */
.related-section {
  margin-top: 24px;
  margin-bottom: 24px;
}
.related-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.related-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
  scrollbar-width: none;
}
.related-scroll::-webkit-scrollbar { display: none; }
.related-card {
  flex-shrink: 0;
  width: 140px;
  cursor: pointer;
  transition: var(--transition);
}
.related-card:active { transform: scale(0.96); }
.related-card-cover {
  width: 140px;
  height: 180px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: linear-gradient(135deg, #f5f0e8 0%, #ede4d8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 8px;
}
.related-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.related-card-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.related-card-reason {
  font-size: 11px;
  color: var(--color-text-light);
  margin-top: 2px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 首页 book-card 上的 skill 标签 */
.card-skill-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.card-skill-tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: rgba(108,92,231,0.08);
  color: #6C5CE7;
}

/* 评分星标 */
.card-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}
.card-rating-score {
  font-size: 12px;
  font-weight: 700;
  color: #e67e22;
}
.card-rating-star {
  font-size: 10px;
  color: #f39c12;
}
.card-rating-count {
  font-size: 10px;
  color: var(--color-text-light);
}

/* 排序切换 */
.sort-toggle {
  position: relative;
  flex-shrink: 0;
  margin-left: auto;
  padding: 5px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
  z-index: 50;
}
.sort-toggle:active { transform: scale(0.95); }
.sort-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
}
.sort-icon {
  font-size: 10px;
  color: var(--color-text-light);
}
.sort-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 100;
  min-width: 120px;
}
.sort-option {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  text-align: left;
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.15s;
}
.sort-option:hover { background: rgba(0,0,0,0.04); }
.sort-option.active {
  color: var(--color-secondary);
  font-weight: 600;
}

/* 年龄筛选 active 状态 */
.filter-chip.active-age {
  background: #e67e22;
  color: #FFF;
  border-color: #e67e22;
  box-shadow: 0 2px 6px rgba(230,126,34,0.25);
}

/* 桌面端关联推荐适配 */
@media (min-width: 1024px) {
  .related-card { width: 160px; }
  .related-card-cover { width: 160px; height: 210px; }
  .filter-bar { max-width: 1100px; margin: 0 auto; padding: 4px 0 12px; }

  /* 桌面端详情页双栏布局 */
  .detail-hero {
    display: flex;
    gap: 32px;
    align-items: flex-start;
    text-align: left;
  }
  .detail-hero .detail-cover {
    flex-shrink: 0;
  }
  .detail-hero .detail-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 8px;
  }
  .detail-hero .detail-meta {
    justify-content: flex-start;
  }
}

/* ===== 骨架屏 ===== */
.skeleton-detail {
  padding: 48px 20px;
  text-align: center;
}
.skeleton-cover {
  width: 120px;
  height: 160px;
  border-radius: var(--radius-md);
  margin: 0 auto 20px;
}
.skeleton-title {
  width: 60%;
  height: 28px;
  border-radius: 6px;
  margin: 0 auto 12px;
}
.skeleton-line {
  width: 40%;
  height: 16px;
  border-radius: 4px;
  margin: 0 auto 8px;
}
.skeleton-line.short {
  width: 25%;
}
.skeleton-pulse {
  background: linear-gradient(90deg, #f0e6d8 25%, #f8f0e4 50%, #f0e6d8 75%);
  background-size: 200% 100%;
  animation: skeletonPulse 1.5s ease-in-out infinite;
}
@keyframes skeletonPulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== 搜索高亮 ===== */
.search-item mark.highlight,
mark.highlight {
  background: rgba(255, 107, 107, 0.2);
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

/* ===== 深色模式 ===== */
/* 手动切换（data-theme="dark"）优先，系统偏好兜底 */
[data-theme="dark"] {
  --color-bg: #1a1a2e;
  --color-card: #222240;
  --color-text: #e8e8f0;
  --color-text-secondary: #a0a0b8;
  --color-text-light: #6c6c88;
  --color-border: #333355;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --color-bg: #1a1a2e;
    --color-card: #222240;
    --color-text: #e8e8f0;
    --color-text-secondary: #a0a0b8;
    --color-text-light: #6c6c88;
    --color-border: #333355;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  }
}

/* 深色模式组件样式 */
[data-theme="dark"] .hero { background-color: #16213e !important; }
[data-theme="dark"] .hero::before {
  background: linear-gradient(to top, #1a1a2e 0%, rgba(26,26,46,0.7) 40%, transparent 100%) !important;
}
[data-theme="dark"] .hero-title,
[data-theme="dark"] .hero-subtitle { color: #e8e8f0 !important; }
[data-theme="dark"] .hero-content p { color: #a0a0b8 !important; }

[data-theme="dark"] .search-box {
  background: #2a2a48;
  border-color: #444466;
}
[data-theme="dark"] .search-box input { color: #e8e8f0; }
[data-theme="dark"] .search-box input::placeholder { color: #6c6c88; }
[data-theme="dark"] .search-dropdown {
  background: #2a2a48;
  border-color: #444466;
}

[data-theme="dark"] .tab {
  background: #2a2a48;
  border-color: #444466;
  color: #a0a0b8;
}
[data-theme="dark"] .tab.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

[data-theme="dark"] .book-card { background: var(--color-card); }
[data-theme="dark"] .book-cover {
  background: linear-gradient(135deg, #2a2a48 0%, #333355 100%);
}

[data-theme="dark"] .filter-chip {
  background: #2a2a48;
  border-color: #444466;
  color: #a0a0b8;
}

[data-theme="dark"] .sort-toggle {
  background: #2a2a48;
  border-color: #444466;
}
[data-theme="dark"] .sort-dropdown {
  background: #2a2a48;
  border-color: #444466;
}
[data-theme="dark"] .sort-option:hover { background: rgba(255,255,255,0.06); }

[data-theme="dark"] .book-detail { background: var(--color-card); }

[data-theme="dark"] .wiki-section {
  background: var(--color-card);
  border-color: var(--color-border);
}
[data-theme="dark"] .wiki-header {
  background: linear-gradient(135deg, #1e2a40 0%, #2a2048 100%);
  border-color: var(--color-border);
}

[data-theme="dark"] .outline-section {
  background: var(--color-card);
  border-color: var(--color-border);
}
[data-theme="dark"] .outline-header {
  background: linear-gradient(135deg, #1e2a40 0%, #2a2048 100%) !important;
}

[data-theme="dark"] .page-card {
  border-color: var(--color-border);
  background: #2a2a48;
}

[data-theme="dark"] .modal-content {
  background: #222240;
  color: #e8e8f0;
}

[data-theme="dark"] .skeleton-pulse {
  background: linear-gradient(90deg, #2a2a48 25%, #333355 50%, #2a2a48 75%);
  background-size: 200% 100%;
}

[data-theme="dark"] .site-footer {
  background: #16213e;
  border-color: #333355;
  color: #6c6c88;
}

[data-theme="dark"] .hero-icon { background: #222240 !important; }

/* 详情页组件深色模式 */
[data-theme="dark"] .book-header {
  background: rgba(26,26,46,0.95);
  border-color: #333355;
}
[data-theme="dark"] .back-btn { color: var(--color-primary); }
[data-theme="dark"] .icon-btn { color: #a0a0b8; }

[data-theme="dark"] .detail-cover {
  background: linear-gradient(135deg, #2a2a48 0%, #333355 100%);
}

[data-theme="dark"] .page-card-header {
  background: #1e1e38;
  border-color: #333355;
}

[data-theme="dark"] .en-section {
  background: #1e1e38;
  border-color: #333355;
}
[data-theme="dark"] .en-toggle:hover { background: #2a2a48; }

[data-theme="dark"] .audio-player {
  background: #1e1e38;
}

[data-theme="dark"] .tts-bar {
  background: #2a2a48;
}
[data-theme="dark"] .voice-select {
  background: #1e1e38;
  border-color: #444466;
  color: #e8e8f0;
}

[data-theme="dark"] .lang-tabs {
  background: #2a2a48;
  border-color: #444466;
}
[data-theme="dark"] .lang-tab {
  color: #a0a0b8;
}
[data-theme="dark"] .lang-tab:not(.active):hover {
  background: rgba(255,255,255,0.06);
}

[data-theme="dark"] .version-tab {
  background: #2a2a48;
  border-color: #444466;
  color: #a0a0b8;
}
[data-theme="dark"] .version-tab.active {
  background: rgba(255, 107, 107, 0.12);
}

[data-theme="dark"] .meta-tag {
  background: #2a2a48;
  color: #a0a0b8;
}

[data-theme="dark"] .prep-list li { color: #a0a0b8; }

[data-theme="dark"] .book-footer {
  background: #16213e;
  border-color: #333355;
}
[data-theme="dark"] .footer-disclaimer { color: #6c6c88; }

[data-theme="dark"] .related-card-cover {
  background: linear-gradient(135deg, #2a2a48 0%, #333355 100%);
}

[data-theme="dark"] .tip-jar-section {
  background: linear-gradient(135deg, #1e1e38 0%, #222240 50%, #1e1e38 100%) !important;
  border-color: #333355 !important;
}

/* 系统偏好兜底（未手动设置时） */
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .hero { background-color: #16213e !important; }
  html:not([data-theme="light"]) .hero::before { background: linear-gradient(to top, #1a1a2e 0%, rgba(26,26,46,0.7) 40%, transparent 100%) !important; }
  html:not([data-theme="light"]) .hero-title,
  html:not([data-theme="light"]) .hero-subtitle { color: #e8e8f0 !important; }
  html:not([data-theme="light"]) .hero-content p { color: #a0a0b8 !important; }
  html:not([data-theme="light"]) .search-box { background: #2a2a48; border-color: #444466; }
  html:not([data-theme="light"]) .search-box input { color: #e8e8f0; }
  html:not([data-theme="light"]) .search-dropdown { background: #2a2a48; border-color: #444466; }
  html:not([data-theme="light"]) .tab { background: #2a2a48; border-color: #444466; color: #a0a0b8; }
  html:not([data-theme="light"]) .tab.active { background: var(--color-primary); color: #fff; }
  html:not([data-theme="light"]) .book-card { background: var(--color-card); }
  html:not([data-theme="light"]) .book-cover { background: linear-gradient(135deg, #2a2a48 0%, #333355 100%); }
  html:not([data-theme="light"]) .filter-chip { background: #2a2a48; border-color: #444466; color: #a0a0b8; }
  html:not([data-theme="light"]) .sort-toggle { background: #2a2a48; border-color: #444466; }
  html:not([data-theme="light"]) .sort-dropdown { background: #2a2a48; border-color: #444466; }
  html:not([data-theme="light"]) .book-detail { background: var(--color-card); }
  html:not([data-theme="light"]) .wiki-section { background: var(--color-card); border-color: var(--color-border); }
  html:not([data-theme="light"]) .wiki-header { background: linear-gradient(135deg, #1e2a40 0%, #2a2048 100%); }
  html:not([data-theme="light"]) .outline-section { background: var(--color-card); border-color: var(--color-border); }
  html:not([data-theme="light"]) .outline-header { background: linear-gradient(135deg, #1e2a40 0%, #2a2048 100%) !important; }
  html:not([data-theme="light"]) .page-card { border-color: var(--color-border); background: #2a2a48; }
  html:not([data-theme="light"]) .modal-content { background: #222240; color: #e8e8f0; }
  html:not([data-theme="light"]) .skeleton-pulse { background: linear-gradient(90deg, #2a2a48 25%, #333355 50%, #2a2a48 75%); background-size: 200% 100%; }
  html:not([data-theme="light"]) .site-footer { background: #16213e; border-color: #333355; color: #6c6c88; }
  html:not([data-theme="light"]) .hero-icon { background: #222240 !important; }
  html:not([data-theme="light"]) .theme-toggle { background: rgba(255,255,255,0.12); box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
  /* 详情页组件 */
  html:not([data-theme="light"]) .book-header { background: rgba(26,26,46,0.95); border-color: #333355; }
  html:not([data-theme="light"]) .page-card-header { background: #1e1e38; border-color: #333355; }
  html:not([data-theme="light"]) .en-section { background: #1e1e38; border-color: #333355; }
  html:not([data-theme="light"]) .en-toggle:hover { background: #2a2a48; }
  html:not([data-theme="light"]) .audio-player { background: #1e1e38; }
  html:not([data-theme="light"]) .tts-bar { background: #2a2a48; }
  html:not([data-theme="light"]) .voice-select { background: #1e1e38; border-color: #444466; color: #e8e8f0; }
  html:not([data-theme="light"]) .lang-tabs { background: #2a2a48; border-color: #444466; }
  html:not([data-theme="light"]) .lang-tab { color: #a0a0b8; }
  html:not([data-theme="light"]) .version-tab { background: #2a2a48; border-color: #444466; color: #a0a0b8; }
  html:not([data-theme="light"]) .detail-cover { background: linear-gradient(135deg, #2a2a48 0%, #333355 100%); }
  html:not([data-theme="light"]) .related-card-cover { background: linear-gradient(135deg, #2a2a48 0%, #333355 100%); }
  html:not([data-theme="light"]) .book-footer { background: #16213e; border-color: #333355; }
  html:not([data-theme="light"]) .meta-tag { background: #2a2a48; color: #a0a0b8; }
}

/* ===== #5 封面图片懒加载淡入 ===== */
.book-cover img {
  opacity: 0;
  transition: opacity 0.4s ease;
}
.book-cover img.cover-loaded {
  opacity: 1;
}
/* 封面占位渐变（图片加载前显示） */
.book-cover {
  background: linear-gradient(135deg, #f5f0e8 0%, #ede4d8 50%, #e8dfd4 100%);
}

/* ===== #3 搜索筛选增强 ===== */
.filter-bar {
  padding: 8px 16px 4px;
}
.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  min-width: 32px;
  flex-shrink: 0;
}
.filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}
.filter-chip {
  padding: 4px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-card);
  color: var(--color-text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.filter-chip:active { transform: scale(0.95); }
.filter-chip.active,
.filter-chip.active-skill,
.filter-chip.active-age {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* 筛选统计栏 */
.filter-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 16px 8px;
  font-size: 12px;
  color: var(--color-text-light);
}
.filter-stats-count {
  font-weight: 600;
  color: var(--color-text-secondary);
}
.filter-clear-btn {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: 3px 12px;
  font-size: 11px;
  color: var(--color-text-light);
  cursor: pointer;
  transition: var(--transition);
}
.filter-clear-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.filter-clear-btn.hidden { display: none; }

/* ===== B4: 深色模式封面适配 ===== */
[data-theme="dark"] .book-cover {
  background: linear-gradient(135deg, #2a2a3e 0%, #1e1e2e 100%);
  border: 1px solid rgba(255,255,255,0.08);
}
[data-theme="dark"] .book-cover img {
  border-radius: 0;
}
[data-theme="dark"] .book-card {
  border: 1px solid rgba(255,255,255,0.06);
}
[data-theme="dark"] .detail-cover {
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
/* 系统深色模式兼容 */
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .book-cover {
    background: linear-gradient(135deg, #2a2a3e 0%, #1e1e2e 100%);
    border: 1px solid rgba(255,255,255,0.08);
  }
  html:not([data-theme="light"]) .book-card {
    border: 1px solid rgba(255,255,255,0.06);
  }
  html:not([data-theme="light"]) .detail-cover {
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  }
}

/* ===== B1: 阅读进度条 ===== */
.card-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(0,0,0,0.06);
  z-index: 2;
}
.card-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  border-radius: 0 2px 2px 0;
  transition: width 0.3s ease;
}
.card-progress-label {
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-size: 10px;
  color: #fff;
  background: rgba(0,0,0,0.5);
  padding: 1px 6px;
  border-radius: 8px;
  z-index: 3;
  backdrop-filter: blur(4px);
}

/* ===== 详情页 Sticky 导航条 ===== */
.detail-sticky-nav {
  display: flex;
  gap: 0;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 56px; /* header 高度下方 */
  z-index: 8;
  padding: 0 16px;
  margin: 0 -20px;
}
.detail-nav-item {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}
.detail-nav-item:hover {
  color: var(--color-primary);
}
.detail-nav-item.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* ===== 故事图谱时间线 ===== */
.story-arc-section {
  margin-top: 20px;
}
.arc-legend {
  display: flex;
  gap: 12px;
  font-size: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.arc-timeline {
  display: flex;
  align-items: flex-start;
  overflow-x: auto;
  padding: 8px 0 16px;
  gap: 0;
  -webkit-overflow-scrolling: touch;
}
.arc-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 72px;
  flex-shrink: 0;
}
.arc-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  flex-shrink: 0;
}
.arc-connector {
  width: 24px;
  height: 2px;
  background: var(--color-border);
  align-self: center;
  margin-top: 6px;
  flex-shrink: 0;
}
.arc-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 6px;
  gap: 2px;
}
.arc-page {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-text-light);
}
.arc-title {
  font-size: 11px;
  color: var(--color-text-secondary);
  text-align: center;
  max-width: 68px;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ===== 工具栏 4 按钮适配 ===== */
.book-header-actions {
  gap: 6px !important;
}
.book-header-actions .icon-btn {
  width: 36px;
  height: 36px;
  padding: 7px;
}

/* ===== 智能选绘本 ===== */
.book-finder-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 10px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border: none;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 14px rgba(102,126,234,0.35);
}
.book-finder-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102,126,234,0.45);
}

.book-finder-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.book-finder-overlay.hidden { display: none; }

.book-finder-modal {
  background: var(--color-bg);
  border-radius: 20px;
  padding: 32px 24px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.book-finder-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 28px;
  color: var(--color-text-light);
  cursor: pointer;
  line-height: 1;
}

.finder-progress {
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  margin-bottom: 24px;
}
.finder-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.finder-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
}
.finder-subtitle {
  font-size: 14px;
  color: var(--color-text-secondary);
  text-align: center;
  margin-bottom: 20px;
}

.finder-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.finder-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 12px;
  border: 2px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-bg);
  cursor: pointer;
  transition: all 0.2s;
}
.finder-option:hover {
  border-color: #667eea;
  background: rgba(102,126,234,0.05);
  transform: translateY(-2px);
}
.finder-option-emoji { font-size: 28px; }
.finder-option-label { font-size: 14px; font-weight: 600; color: var(--color-text); }
.finder-option-desc { font-size: 11px; color: var(--color-text-light); }

.finder-back {
  display: block;
  margin: 16px auto 0;
  padding: 8px 20px;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  color: var(--color-text-secondary);
  font-size: 13px;
  cursor: pointer;
}

/* 推荐结果卡片 */
.finder-result-card {
  display: flex;
  gap: 14px;
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.finder-result-card:hover {
  border-color: #667eea;
  box-shadow: 0 4px 16px rgba(102,126,234,0.12);
}
.finder-result-rank {
  position: absolute;
  top: -8px;
  left: -8px;
  font-size: 22px;
}
.finder-result-cover {
  width: 72px;
  height: 96px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: #f5f5f5;
}
.finder-result-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.finder-result-info h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}
.finder-result-sub {
  font-size: 12px;
  color: var(--color-text-light);
  margin-bottom: 6px;
}
.finder-result-reasons { display: flex; gap: 4px; flex-wrap: wrap; }
.finder-reason-tag {
  font-size: 11px;
  padding: 2px 8px;
  background: rgba(102,126,234,0.1);
  color: #667eea;
  border-radius: 10px;
}
.finder-result-rating {
  font-size: 12px;
  color: #f59e0b;
  margin-top: 4px;
}
.finder-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
}
.finder-close-btn {
  padding: 8px 24px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
}

/* ===== 分享海报 ===== */
.btn-poster {
  width: 100%;
  margin-top: 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 4px 14px rgba(102,126,234,0.3);
}
.btn-poster:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(102,126,234,0.4);
}
.btn-poster:active {
  transform: scale(0.98);
}

/* 海报预览弹窗 */
.poster-preview-content {
  max-width: 420px !important;
  padding: 20px !important;
}
.poster-preview-wrap {
  max-height: 55vh;
  overflow-y: auto;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  margin: 12px 0;
  background: #f5f5f5;
}
.poster-preview-wrap img {
  width: 100%;
  display: block;
  border-radius: 12px;
}

/* ===== 微信引导条 ===== */
.wechat-guide-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  margin: 0 -20px;
  background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
  border-top: 1px solid rgba(76,175,80,0.15);
  font-size: 14px;
  color: #2e7d32;
  animation: wechatGuideSlideIn 0.4s ease;
}
.wechat-guide-bar button {
  background: none;
  border: none;
  font-size: 18px;
  color: #81c784;
  cursor: pointer;
  padding: 4px 8px;
  flex-shrink: 0;
}
@keyframes wechatGuideSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
