/* ============================================
   高中知识点复习系统 - 主样式 v4.1
   UI/UX Refresh
   ============================================ */

/* --- CSS 变量 / 主题 --- */
:root {
  color-scheme: light;

  /* === 颜色系统（Apple 风格 · 全半透明） === */
  --bg-primary: rgba(245, 245, 247, 0.72);
  --bg-secondary: rgba(255, 255, 255, 0.5);
  --bg-tertiary: rgba(232, 232, 237, 0.45);
  --bg-hover: rgba(236, 236, 238, 0.55);
  --bg-active: rgba(210, 210, 215, 0.5);

  --surface: rgba(255, 255, 255, 0.4);
  --surface-strong: rgba(255, 255, 255, 0.65);
  --surface-border: rgba(0, 0, 0, 0.06);

  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --text-inverse: #ffffff;

  --accent: #007aff;
  --accent-hover: #0066d6;
  --accent-dark: #0051a8;
  --accent-light: #e8f2ff;
  --accent-lighter: #f0f7ff;
  --accent-subtle: #d0e4ff;
  --accent-rgb: 0, 122, 255;

  --success: #34c759;
  --success-light: #eafbef;
  --warning: #ff9f0a;
  --warning-light: #fff8eb;
  --danger: #ff3b30;
  --danger-light: #fff0ef;

  --border: rgba(0, 0, 0, 0.08);
  --border-light: rgba(0, 0, 0, 0.04);
  --border-hover: rgba(0, 0, 0, 0.15);

  /* === 阴影系统（Apple 风格：更柔和、更有层次） === */
  --shadow-sm: 0 0.5px 1px rgba(0,0,0,0.06);
  --shadow-md: 0 1px 3px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 14px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.04);
  --shadow-xl: 0 8px 30px rgba(0,0,0,0.08), 0 16px 48px rgba(0,0,0,0.04);
  --shadow-card: 0 0.5px 1px rgba(0,0,0,0.04), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-card-hover: 0 4px 16px rgba(0,0,0,0.08), 0 8px 32px rgba(0,0,0,0.04);

  /* === 代码块 === */
  --code-bg: rgba(29, 29, 31, 0.85);
  --code-text: #f5f5f7;

  /* === 间距（更 generous） === */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 52px;
  --space-3xl: 72px;

  /* === 圆角（Apple 风格：更大更圆润） === */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* === 过渡（Apple 风格：更丝滑的弹簧曲线） === */
  --transition-fast: 100ms cubic-bezier(0.25, 0.1, 0.25, 1);
  --transition-base: 180ms cubic-bezier(0.25, 0.1, 0.25, 1);
  --transition-normal: 220ms cubic-bezier(0.25, 0.1, 0.25, 1);
  --transition-slow: 280ms cubic-bezier(0.25, 0.1, 0.25, 1);
  --transition-spring: 250ms cubic-bezier(0.25, 0.1, 0.25, 1);

  /* === 布局 === */
  --nav-height: 52px;
  --max-width: 1120px;
  --sidebar-width: 280px;
}

/* 暗色主题（Apple 风格深色） */
[data-theme="dark"] {
  color-scheme: dark;
  --bg-primary: rgba(0, 0, 0, 0.75);
  --bg-secondary: rgba(28, 28, 30, 0.55);
  --bg-tertiary: rgba(28, 28, 30, 0.45);
  --bg-hover: rgba(44, 44, 46, 0.55);
  --bg-active: rgba(58, 58, 60, 0.5);

  --surface: rgba(28, 28, 30, 0.45);
  --surface-strong: rgba(28, 28, 30, 0.65);
  --surface-border: rgba(255, 255, 255, 0.08);

  --text-primary: #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-tertiary: #636366;

  --accent: #0a84ff;
  --accent-hover: #409cff;
  --accent-dark: #409cff;
  --accent-light: #0a84ff1a;
  --accent-lighter: #0a84ff10;
  --accent-subtle: #0a84ff22;
  --accent-rgb: 10, 132, 255;

  --success-light: #34c7591a;
  --warning-light: #ff9f0a1a;
  --danger-light: #ff3b301a;

  --border: rgba(255, 255, 255, 0.1);
  --border-light: rgba(255, 255, 255, 0.05);
  --border-hover: rgba(255, 255, 255, 0.18);

  --shadow-sm: 0 0.5px 1px rgba(0,0,0,0.4);
  --shadow-md: 0 1px 3px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 14px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.3);
  --shadow-xl: 0 8px 30px rgba(0,0,0,0.5), 0 16px 48px rgba(0,0,0,0.3);
  --shadow-card: 0 0.5px 1px rgba(0,0,0,0.3);
  --shadow-card-hover: 0 4px 16px rgba(0,0,0,0.4), 0 8px 32px rgba(0,0,0,0.3);

  --code-bg: rgba(28, 28, 30, 0.85);
  --code-text: #f5f5f7;
}

/* 暗色主题全局增强（Apple 风格） */
[data-theme="dark"] .mod-stat {
  background: var(--bg-tertiary);
}

/* 暗色主题：科目树形结构 hover 背景 */
[data-theme="dark"] .retree-subject[data-subject="chem"] .retree-subject-header:hover {
  background: rgba(255, 149, 0, 0.1);
}
[data-theme="dark"] .retree-subject[data-subject="bio"] .retree-subject-header:hover {
  background: rgba(52, 199, 89, 0.1);
}

/* 暗色主题：复习卡片答案标签 */
[data-theme="dark"] .review-card-answer .review-card-label {
  color: #30d158;
  background: rgba(52, 199, 89, 0.1);
  border-color: rgba(52, 199, 89, 0.15);
}
[data-theme="dark"] .review-card-answer .review-card-label::before {
  background: #34c759;
  box-shadow: 0 0 6px rgba(52, 199, 89, 0.4);
}

/* 暗色主题：解析区域 strong */
[data-theme="dark"] .review-card-explanation strong {
  color: #ffd60a;
}

/* 暗色主题：btn-retro 变体 */
[data-theme="dark"] .btn-retro.success {
  background: #30d158;
  color: #000;
  border-color: #30d158;
}
[data-theme="dark"] .btn-retro.success:hover {
  background: #2db84e;
  border-color: #2db84e;
  box-shadow: 0 2px 8px rgba(52, 199, 89, 0.3);
}
[data-theme="dark"] .btn-retro.danger {
  background: #ff453a;
  color: #fff;
  border-color: #ff453a;
}
[data-theme="dark"] .btn-retro.danger:hover {
  background: #e0342b;
  border-color: #e0342b;
  box-shadow: 0 2px 8px rgba(255, 69, 58, 0.3);
}

[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg,
    var(--bg-tertiary) 25%,
    var(--bg-active) 50%,
    var(--bg-tertiary) 75%
  );
  background-size: 400% 100%;
}

/* 暗色进度条 */
[data-theme="dark"] #nprogress .nprogress-bar {
  box-shadow: none;
}

/* 暗色错题本/已掌握增强 */
[data-theme="dark"] .wrong-tabs {
  background: var(--bg-secondary);
  border-color: var(--border);
}
[data-theme="dark"] .wrong-tab.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 1px 4px rgba(10, 132, 255, 0.3);
}

/* 暗色刷题模式 */
[data-theme="dark"] .quiz-progress-text {
  background: var(--bg-tertiary);
  border-color: var(--border);
}

/* 暗色刷题模式 */
[data-theme="dark"] .quiz-scope-title {
  background: var(--bg-secondary);
}
[data-theme="dark"] .quiz-scope-book:hover {
  background: var(--bg-hover);
}
[data-theme="dark"] .quiz-scope-tag {
  background: var(--bg-tertiary);
}

/* 暗色回顾笔记增强 */
[data-theme="dark"] .retro-sidebar {
  background: var(--bg-secondary);
  border-color: var(--border);
}
[data-theme="dark"] .retro-sidebar-header {
  background: var(--bg-secondary);
  border-color: var(--border);
}
[data-theme="dark"] .retro-toolbar {
  background: var(--bg-secondary);
  border-color: var(--border);
}
[data-theme="dark"] .retro-editor-wrapper {
  background: var(--bg-secondary);
  border-color: var(--border);
}
[data-theme="dark"] .retree-doc.active {
  background: rgba(10, 132, 255, 0.12);
}
[data-theme="dark"] .retro-preview-area code {
  background: var(--bg-tertiary);
  color: #c7bfff;
  border-color: var(--border);
}
[data-theme="dark"] .retro-preview-area pre {
  background: var(--code-bg);
  border-color: var(--border);
}
[data-theme="dark"] .retro-preview-area blockquote {
  background: rgba(10, 132, 255, 0.08);
  border-left-color: var(--accent);
}
[data-theme="dark"] .fullscreen-preview-overlay {
  background: var(--bg-primary);
}
[data-theme="dark"] .fullscreen-preview-header {
  background: var(--bg-secondary);
  border-color: var(--border);
}
[data-theme="dark"] .btn-retro {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-color: var(--border);
}
[data-theme="dark"] .btn-retro:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
[data-theme="dark"] .btn-retro.primary {
  background: var(--accent);
  border-color: var(--accent);
}
[data-theme="dark"] .btn-retro-download {
  background: #0a84ff;
  border-color: rgba(10, 132, 255, 0.4);
}
[data-theme="dark"] .btn-retro-download:hover {
  box-shadow: 0 2px 8px rgba(10, 132, 255, 0.3);
}

/* 暗色章节卡片增强 */
[data-theme="dark"] .chapter-card {
  background: var(--bg-secondary);
  border-color: var(--border);
}
[data-theme="dark"] .chapter-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-card-hover);
}

/* 暗色：搜索弹窗增强 */
[data-theme="dark"] .search-header {
  background: transparent;
}
[data-theme="dark"] .search-result-item {
  border-color: transparent;
}
[data-theme="dark"] .search-result-item:hover {
  border-color: transparent;
  background: var(--bg-hover);
}
[data-theme="dark"] .search-highlight {
  background: rgba(10, 132, 255, 0.2);
  color: #98c8ff;
}

/* 暗色：模态框增强 */
[data-theme="dark"] .modal-header {
  background: transparent;
  border-bottom-color: var(--border);
}
[data-theme="dark"] .modal-close {
  border: none;
  color: var(--text-tertiary);
}
[data-theme="dark"] .modal-close:hover {
  background: var(--bg-active);
  color: var(--text-primary);
}

/* 暗色：Toast 类型增强 */
[data-theme="dark"] .toast.success {
  border-left-color: #30d158;
}
[data-theme="dark"] .toast.error {
  border-left-color: #ff453a;
}
[data-theme="dark"] .toast.info {
  border-left-color: #0a84ff;
}

/* 暗色：表单增强 */
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group textarea,
[data-theme="dark"] .form-group select {
  background: var(--bg-tertiary);
  border-color: var(--border);
}
[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group textarea:focus,
[data-theme="dark"] .form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.15);
}
[data-theme="dark"] .textarea-toolbar {
  background: var(--bg-tertiary);
  border-color: var(--border);
}
[data-theme="dark"] .form-actions {
  border-top-color: var(--border);
}

/* --- 顶部加载进度条（Apple 风格） --- */
#nprogress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 2px;
  z-index: 9999;
  pointer-events: none;
  transition: none;
}

#nprogress.loading {
  width: 70%;
  transition: width 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

#nprogress.done {
  width: 100%;
  opacity: 0;
  transition: width 0.15s ease, opacity 0.25s ease 0.1s;
}

.nprogress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 0 1px 1px 0;
  box-shadow: none;
}

/* --- 全局重置 --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition-base), color var(--transition-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.01em;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: transparent;
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
}

/* 安全区域（刘海屏等） */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; display: block; }

/* --- 导航栏 GLASS（Apple 风格） === */
#top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(245, 245, 247, 0.72);
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
  z-index: 100;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  transition: all var(--transition-base);
  contain: layout style;
  will-change: box-shadow, border-color, background;
}

#top-nav.scrolled {
  border-bottom-color: rgba(0, 0, 0, 0.1);
  box-shadow: none;
  background: rgba(245, 245, 247, 0.78);
}

[data-theme="dark"] #top-nav {
  background: rgba(28, 28, 30, 0.55);
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] #top-nav.scrolled {
  background: rgba(28, 28, 30, 0.7);
  border-bottom-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  letter-spacing: -0.3px;
}

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  padding: 0;
}
.logo-icon svg {
  width: 16px;
  height: 16px;
  color: white;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  box-shadow: none;
}

.nav-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
  transform: none;
  box-shadow: var(--shadow-sm);
}

.nav-btn:focus-visible,
.nav-logo:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.nav-btn .btn-label { display: none; }

[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }

/* --- 主内容区 --- */

/* ========== 首页全面升级 v4.0 Apple 风格 ========== */
.home-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: calc(100vh - var(--nav-height) - var(--space-2xl));
  text-align: center;
  position: relative;
  overflow: hidden;
  padding: var(--space-3xl) var(--space-lg);
}

/* 背景网格装饰 */
.home-bg-grid {
  display: none;
}

/* 背景点阵 */
.home-bg-dots {
  display: none;
}

/* ===== Hero 区域（Apple 风格） ===== */
.home-hero {
  position: relative;
  z-index: 2;
  margin-bottom: var(--space-3xl);
}

/* 徽章标签 */
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 6px 16px;
  background: var(--accent-light);
  border: 0.5px solid var(--accent-subtle);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: var(--space-xl);
  animation: appleFadeIn 0.4s cubic-bezier(0.25, 0.1, 0.25, 1) both;
  backdrop-filter: blur(4px);
}

.hero-badge svg {
  width: 14px;
  height: 14px;
  color: var(--warning);
}

@keyframes appleFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 主标题 */
.hero-title {
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.04em;
  margin-bottom: var(--space-md);
  animation: appleFadeIn 0.5s cubic-bezier(0.25, 0.1, 0.25, 1) 0.05s both;
}

.title-icon {
  display: none;
}

.title-text {
  color: var(--text-primary);
  display: inline;
}

.title-highlight {
  display: inline;
  background: linear-gradient(135deg, var(--accent) 0%, #5856d6 50%, #af52de 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

@keyframes heroTitleIn {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 副标题 */
.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-secondary);
  margin-bottom: var(--space-2xl);
  font-weight: 400;
  animation: appleFadeIn 0.5s cubic-bezier(0.25, 0.1, 0.25, 1) 0.1s both;
}

@keyframes heroTitleIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 统计数据栏 */
.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xl);
  padding: var(--space-lg) var(--space-2xl);
  background: rgba(255,255,255,0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
  animation: appleFadeIn 0.5s cubic-bezier(0.25, 0.1, 0.25, 1) 0.15s both;
}

[data-theme="dark"] .hero-stats {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.06);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 70px;
}

.stat-number {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-divider {
  width: 1px;
  height: 36px;
  background: var(--border);
}

.skeleton-stat .stat-skeleton {
  width: 50px;
  height: 28px;
  border-radius: var(--radius-md);
  background: linear-gradient(110deg, var(--border) 8%, var(--bg-tertiary) 18%, var(--border) 33%);
  background-size: 200% 100%;
  animation: skeletonShimmer 0.8s infinite;
}

@keyframes heroStatsIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== 卡片区域 ===== */
.home-cards-section {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 720px;
  animation: appleFadeIn 0.5s cubic-bezier(0.25, 0.1, 0.25, 1) 0.2s both;
}

.section-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.label-line {
  height: 1px;
  width: 60px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.label-text {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 2px;
}

@keyframes cardsSectionIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 科目卡片网格 */
.subject-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-xl);
}

/* 科目卡片主体（Apple 风格） */
.subject-card {
  position: relative;
  border-radius: var(--radius-2xl);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
  contain: layout style;
  background: var(--bg-secondary);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 0.5px solid var(--border);
  box-shadow: var(--shadow-card);
}

[data-theme="dark"] .subject-card {
  background: rgba(44, 44, 46, 0.6);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.subject-card::before {
  display: none;
}

.card-chem {
  --card-color: #ff9500;
  --card-light: rgba(255, 149, 0, 0.08);
  --card-glow: rgba(255, 149, 0, 0.15);
}

.card-bio {
  --card-color: #34c759;
  --card-light: rgba(52, 199, 89, 0.08);
  --card-glow: rgba(52, 199, 89, 0.15);
}

/* 卡片光晕效果 */
.card-glow {
  display: none;
}

/* 卡片内容区 */
.card-content {
  position: relative;
  z-index: 1;
  padding: var(--space-2xl) var(--space-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  min-height: 220px;
}

/* 图标容器 */
.card-icon-wrapper {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.card-icon-wrapper svg {
  width: 48px;
  height: 48px;
}

.chem-icon {
  background: linear-gradient(135deg, #fff3e0, #ffe0b2);
  box-shadow: 0 2px 12px rgba(255, 149, 0, 0.15);
}

.bio-icon {
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
  box-shadow: 0 2px 12px rgba(52, 199, 89, 0.15);
}

.subject-card:hover .card-icon-wrapper {
  transform: scale(1.06);
  box-shadow: 0 4px 20px var(--card-glow);
}

/* 卡片标题 */
.card-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  transition: color 0.18s ease;
}

.subject-card:hover .card-title {
  color: var(--card-color);
}

/* 卡片描述 */
.card-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* 箭头指示器 */
.card-arrow {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--card-light);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
  margin-top: auto;
  opacity: 0.6;
}

.card-arrow svg {
  width: 18px;
  height: 18px;
  color: var(--card-color);
  transition: transform 0.2s ease;
}

.subject-card:hover .card-arrow {
  opacity: 1;
  background: var(--card-color);
  box-shadow: 0 4px 16px var(--card-glow);
}

.subject-card:hover .card-arrow svg {
  color: white;
  transform: translateX(4px);
}

/* 悬浮状态（Apple 风格：更克制） */
.subject-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}

.subject-card:active {
  transform: translateY(-2px) scale(0.99);
  transition-duration: 80ms;
}

/* 卡片粒子动画 - 移除（Apple 风格更简洁） */
.card-particles {
  display: none;
}

/* 骨架屏卡片 */
.skeleton-subject-card {
  pointer-events: none;
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border) !important;
}

.skeleton-circle-lg {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-2xl);
  margin: 0 auto var(--space-md);
  background: linear-gradient(110deg, var(--border) 8%, var(--bg-tertiary) 18%, var(--border) 33%);
  background-size: 200% 100%;
  animation: skeletonShimmer 0.8s infinite;
}

.skeleton-text-md {
  width: 60px;
  height: 20px;
  border-radius: var(--radius-md);
  margin: 0 auto var(--space-sm);
  background: linear-gradient(110deg, var(--border) 8%, var(--bg-tertiary) 18%, var(--border) 33%);
  background-size: 200% 100%;
  animation: skeletonShimmer 0.8s infinite;
}

.skeleton-text-sm {
  width: 120px;
  height: 14px;
  border-radius: var(--radius-full);
  margin: 0 auto;
  background: linear-gradient(110deg, var(--border) 8%, var(--bg-tertiary) 18%, var(--border) 33%);
  background-size: 200% 100%;
  animation: skeletonShimmer 0.8s infinite;
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== 快捷入口栏 ===== */
.home-shortcuts {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin-top: var(--space-2xl);
  padding: var(--space-lg) var(--space-xl);
  background: var(--bg-secondary);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-2xl);
  max-width: 560px;
  width: 100%;
  animation: appleFadeIn 0.5s cubic-bezier(0.25, 0.1, 0.25, 1) 0.25s both;
  box-shadow: var(--shadow-sm);
}

.shortcut-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all 0.18s ease;
  flex: 1;
  max-width: 120px;
}

.shortcut-item:hover {
  background: var(--card-hover-bg, var(--bg-tertiary));
  transform: translateY(-3px);
}

.shortcut-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
}

.shortcut-icon svg {
  width: 22px;
  height: 22px;
}

.review-icon { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: #3b82f6; }
.quiz-icon { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #f59e0b; }
.wrong-icon { background: linear-gradient(135deg, #fee2e2, #fecaca); color: #ef4444; }
.retro-icon { background: linear-gradient(135deg, #ede9fe, #ddd6fe); color: #8b5cf6; }

.shortcut-item:hover .shortcut-icon {
  transform: scale(1.1);
  box-shadow: 0 4px 14px color-mix(in srgb, currentColor 20%, transparent);
}

.shortcut-item span {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

@keyframes shortcutsIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== 暗色主题适配 ===== */
[data-theme="dark"] .home-page {
  /* Apple 风格：纯黑背景 */
}
[data-theme="dark"] .home-bg-grid {
  display: none;
}
[data-theme="dark"] .hero-badge {
  background: rgba(10, 132, 255, 0.12);
  border-color: rgba(10, 132, 255, 0.2);
}
[data-theme="dark"] .card-chem {
  background: rgba(44, 44, 46, 0.6);
}
[data-theme="dark"] .card-bio {
  background: rgba(44, 44, 46, 0.6);
}
[data-theme="dark"] .subject-card {
  background: rgba(44, 44, 46, 0.6);
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .subject-card::before {
  display: none;
}
[data-theme="dark"] .chem-icon {
  background: linear-gradient(135deg, #3a2a00, #4a3500);
  box-shadow: 0 2px 12px rgba(255, 149, 0, 0.1);
}
[data-theme="dark"] .bio-icon {
  background: linear-gradient(135deg, #0a2e10, #0f3a18);
  box-shadow: 0 2px 12px rgba(52, 199, 89, 0.1);
}
[data-theme="dark"] .hero-stats {
  background: var(--bg-tertiary);
  border-color: var(--border);
}
[data-theme="dark"] .home-shortcuts {
  background: var(--bg-tertiary);
  border-color: var(--border);
}
[data-theme="dark"] .stat-number {
  color: var(--accent);
}

/* ===== 响应式适配 ===== */
@media (max-width: 640px) {
  .subject-card-grid {
    grid-template-columns: 1fr;
    max-width: 320px;
    margin: 0 auto;
  }
  
  .card-content {
    flex-direction: row;
    padding: var(--space-xl);
    min-height: auto;
    gap: var(--space-lg);
  }

  .card-icon-wrapper {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
  }

  .card-icon-wrapper svg {
    width: 42px;
    height: 42px;
  }

  .card-content > *:not(.card-icon-wrapper):not(.card-arrow) {
    text-align: left;
  }

  .card-title {
    font-size: 1.2rem;
  }

  .card-desc {
    font-size: 0.82rem;
  }

  .card-arrow {
    position: absolute;
    right: var(--space-lg);
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    margin-top: 0;
  }

  .hero-stats {
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
  }

  .stat-number {
    font-size: 1.4rem;
  }

  .home-shortcuts {
    gap: var(--space-sm);
    padding: var(--space-md);
  }

  .shortcut-item {
    padding: var(--space-sm) var(--space-sm);
  }

  .shortcut-icon {
    width: 38px;
    height: 38px;
  }

  .shortcut-icon svg {
    width: 18px;
    height: 18px;
  }

  .shortcut-item span {
    font-size: 0.72rem;
  }

  .hero-title {
    letter-spacing: -0.5px;
  }
}

/* 页面容器切换过渡（Apple 风格） */
#page-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: calc(var(--nav-height) + var(--space-xl)) var(--space-lg) var(--space-2xl);
  min-height: 100vh;
  animation: applePageEnter 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
  contain: layout style;
  position: relative;
}

#page-container::before {
  display: none;
}

#page-container.ov-fullwidth {
  max-width: none;
  contain: unset;
}

@keyframes applePageEnter {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 卡片网格子项交错动画（Apple 风格：更微妙） */
.module-card:nth-child(1) { animation: appleFadeIn 0.4s cubic-bezier(0.25, 0.1, 0.25, 1) 0s both; }
.module-card:nth-child(2) { animation: appleFadeIn 0.4s cubic-bezier(0.25, 0.1, 0.25, 1) 0.02s both; }
.module-card:nth-child(3) { animation: appleFadeIn 0.4s cubic-bezier(0.25, 0.1, 0.25, 1) 0.04s both; }
.module-card:nth-child(4) { animation: appleFadeIn 0.4s cubic-bezier(0.25, 0.1, 0.25, 1) 0.06s both; }
.module-card:nth-child(5) { animation: appleFadeIn 0.4s cubic-bezier(0.25, 0.1, 0.25, 1) 0.08s both; }

.home-page .card:nth-child(1) { animation: appleFadeIn 0.45s cubic-bezier(0.25, 0.1, 0.25, 1) 0.05s both; }
.home-page .card:nth-child(2) { animation: appleFadeIn 0.45s cubic-bezier(0.25, 0.1, 0.25, 1) 0.08s both; }

/* 错题本/已掌握条目交错动画 */
.wrong-item:nth-child(1) { animation: appleFadeIn 0.3s cubic-bezier(0.25, 0.1, 0.25, 1) 0s both; }
.wrong-item:nth-child(2) { animation: appleFadeIn 0.3s cubic-bezier(0.25, 0.1, 0.25, 1) 0.02s both; }
.wrong-item:nth-child(3) { animation: appleFadeIn 0.3s cubic-bezier(0.25, 0.1, 0.25, 1) 0.04s both; }
.wrong-item:nth-child(4) { animation: appleFadeIn 0.3s cubic-bezier(0.25, 0.1, 0.25, 1) 0.06s both; }
.wrong-item:nth-child(5) { animation: appleFadeIn 0.3s cubic-bezier(0.25, 0.1, 0.25, 1) 0.08s both; }
.wrong-item:nth-child(n+6) { animation: appleFadeIn 0.3s cubic-bezier(0.25, 0.1, 0.25, 1) 0.1s both; }

/* 复习-章节卡片交错动画 */
.chapter-card:nth-child(1) { animation: appleFadeIn 0.3s cubic-bezier(0.25, 0.1, 0.25, 1) 0s both; }
.chapter-card:nth-child(2) { animation: appleFadeIn 0.3s cubic-bezier(0.25, 0.1, 0.25, 1) 0.02s both; }
.chapter-card:nth-child(3) { animation: appleFadeIn 0.3s cubic-bezier(0.25, 0.1, 0.25, 1) 0.04s both; }
.chapter-card:nth-child(4) { animation: appleFadeIn 0.3s cubic-bezier(0.25, 0.1, 0.25, 1) 0.06s both; }
.chapter-card:nth-child(5) { animation: appleFadeIn 0.3s cubic-bezier(0.25, 0.1, 0.25, 1) 0.08s both; }
.chapter-card:nth-child(n+6) { animation: appleFadeIn 0.3s cubic-bezier(0.25, 0.1, 0.25, 1) 0.1s both; }

/* 复习-书籍卡片交错动画 */
.card-grid .card:nth-child(1) { animation: appleFadeIn 0.35s cubic-bezier(0.25, 0.1, 0.25, 1) 0s both; }
.card-grid .card:nth-child(2) { animation: appleFadeIn 0.35s cubic-bezier(0.25, 0.1, 0.25, 1) 0.02s both; }
.card-grid .card:nth-child(3) { animation: appleFadeIn 0.35s cubic-bezier(0.25, 0.1, 0.25, 1) 0.04s both; }
.card-grid .card:nth-child(4) { animation: appleFadeIn 0.35s cubic-bezier(0.25, 0.1, 0.25, 1) 0.06s both; }
.card-grid .card:nth-child(5) { animation: appleFadeIn 0.35s cubic-bezier(0.25, 0.1, 0.25, 1) 0.08s both; }
.card-grid .card:nth-child(n+6) { animation: appleFadeIn 0.35s cubic-bezier(0.25, 0.1, 0.25, 1) 0.1s both; }

@keyframes cardStaggerIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- 搜索弹窗（Apple 风格） --- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 18vh;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: overlayIn 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.overlay.hidden { display: none; }

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.search-dialog {
  width: 90%;
  max-width: 620px;
  background: var(--surface-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl), 0 0 0 0.5px var(--border);
  overflow: hidden;
  animation: slideIn 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
  backdrop-filter: saturate(180%) blur(30px);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.search-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 0.5px solid var(--border);
  color: var(--text-tertiary);
  background: transparent;
}

.search-header input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1rem;
  color: var(--text-primary);
  font-weight: 400;
  letter-spacing: -0.01em;
}

.search-header input::placeholder {
  color: var(--text-tertiary);
}

.search-header kbd {
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.72rem;
  font-family: inherit;
  color: var(--text-tertiary);
  background: var(--bg-tertiary);
  font-weight: 500;
}

.search-filters {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

.filter-chip {
  padding: 5px 14px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-chip:hover { background: var(--bg-hover); color: var(--text-primary); }

.filter-chip.active {
  background: var(--accent);
  color: var(--text-inverse);
  border-color: transparent;
  box-shadow: 0 1px 4px rgba(0, 122, 255, 0.2);
}

.search-results {
  max-height: 50vh;
  overflow-y: auto;
  padding: var(--space-sm);
}

.search-result-item {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  margin-bottom: 2px;
}

.search-result-item:hover {
  background: var(--bg-hover);
  border-color: color-mix(in srgb, var(--accent) 15%, transparent);
  transform: translateX(4px);
}

.search-result-item .result-subject {
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 4px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-result-item .result-question {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.6;
}

.search-result-item .result-answer {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

.search-empty {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-tertiary);
  font-size: 0.9rem;
}

.search-highlight {
  background: color-mix(in srgb, var(--warning) 30%, transparent);
  color: var(--text-primary);
  padding: 1px 3px;
  border-radius: 3px;
  font-weight: 600;
}

/* --- 弹窗（Apple 风格） --- */
.modal-dialog {
  width: 90%;
  max-width: 580px;
  max-height: 85vh;
  background: var(--surface-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl), 0 0 0 0.5px var(--border);
  overflow: hidden;
  animation: slideIn 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
  display: flex;
  flex-direction: column;
  backdrop-filter: saturate(180%) blur(30px);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 0.5px solid var(--border);
  background: transparent;
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.modal-close {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--bg-tertiary);
  font-size: 1.1rem;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg-active);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-xl);
  overflow-y: auto;
}

/* --- Toast（Apple 风格） --- */
#toast-container {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  padding: 12px 20px;
  background: var(--surface-strong);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  animation: toastIn 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  letter-spacing: -0.01em;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast-exit {
  animation: toastOut 0.2s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(8px); }
}

/* --- 骨架屏加载 --- */
@keyframes skeletonPulse {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg,
    var(--bg-tertiary) 25%,
    color-mix(in srgb, var(--bg-tertiary) 60%, var(--bg-hover)) 50%,
    var(--bg-tertiary) 75%
  );
  background-size: 400% 100%;
  animation: skeletonPulse 1s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-card {
  padding: var(--space-2xl) var(--space-xl);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  border-radius: var(--radius-xl);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

.skeleton-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-xl);
}

.skeleton-title {
  width: 80px;
  height: 24px;
}

.skeleton-text {
  width: 120px;
  height: 14px;
}

/* 骨架屏变体：章节列表 */
.skeleton-chapter {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  min-height: auto;
  padding: var(--space-md) var(--space-lg);
  gap: var(--space-sm);
}

/* 骨架屏变体：闪卡 */
.skeleton-flashcard {
  width: 100%;
  max-width: 840px;
  min-height: 260px;
  align-items: flex-start;
  padding: var(--space-2xl);
  border-radius: var(--radius-2xl);
  gap: var(--space-lg);
}

/* --- 涟漪效果（Apple 风格：更微妙） --- */
.ripple-container,
.ripple-host {
  position: relative;
  overflow: hidden;
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.04);
  transform: scale(0);
  animation: rippleExpand 0.4s ease-out forwards;
  pointer-events: none;
}

[data-theme="dark"] .ripple {
  background: rgba(255, 255, 255, 0.06);
}

@keyframes rippleExpand {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* --- 图片查看器 --- */
.image-viewer-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: overlayIn 0.15s ease;
  cursor: zoom-out;
  padding: var(--space-xl);
}

.image-viewer-overlay img {
  max-width: 95%;
  max-height: 90vh;
  border-radius: var(--radius-md);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
  object-fit: contain;
  animation: imageZoomIn 0.2s cubic-bezier(0.2, 0, 0, 1);
}

@keyframes imageZoomIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* --- 页面通用样式 --- */
.page-header {
  margin-bottom: var(--space-xl);
}

.page-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: var(--space-xs);
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header-icon {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

/* 闪卡页面进度文字特殊样式 */
.flashcard-header-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

#flashcard-progress-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  font-size: 0.85rem !important;
  color: var(--text-secondary) !important;
  font-weight: 500;
  border: 1px solid var(--border);
}

#flashcard-progress-text::before {
  content: '📊';
  font-size: 0.8rem;
}

.flashcard-first-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px !important;
  font-size: 0.78rem !important;
  border-radius: var(--radius-full) !important;
  transition: all var(--transition-fast);
}
.flashcard-first-btn:hover {
  background: var(--accent-light, rgba(79,110,247,0.1)) !important;
  color: var(--accent-color, var(--accent, #6366f1)) !important;
  border-color: var(--accent-color, var(--accent, #6366f1)) !important;
}
.flashcard-first-btn svg {
  flex-shrink: 0;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.page-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.back-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  color: var(--accent);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  box-shadow: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.back-btn:hover {
  background: var(--bg-hover);
  color: var(--accent);
  border-color: var(--border-hover);
  transform: none;
  box-shadow: var(--shadow-sm);
}

.back-btn:active { transform: scale(0.95); }

/* ========== 资料选择页 v3.0 ========== */

.books-page {
  position: relative;
  min-height: calc(100vh - var(--nav-height) - var(--space-2xl));
}

.bk-header { display: flex; align-items: center; gap: var(--space-lg); margin-bottom: var(--space-xl); position: relative; z-index: 2; animation: appleFadeIn 0.4s cubic-bezier(0.25, 0.1, 0.25, 1) both; }

.bk-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
  position: relative;
  z-index: 2;
  animation: modGridIn 0.25s ease 0.06s both;
}

.bk-card {
  position: relative;
  border-radius: var(--radius-2xl);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.23, 1, 0.32, 1);
  contain: layout style;
  animation: modCardStaggerIn 0.25s ease both;
}
.bk-card:nth-child(1) { animation-delay: 0.06s; }
.bk-card:nth-child(2) { animation-delay: 0.09s; }
.bk-card:nth-child(3) { animation-delay: 0.12s; }
.bk-card:nth-child(4) { animation-delay: 0.15s; }
.bk-card:nth-child(5) { animation-delay: 0.18s; }
.bk-card:nth-child(n+6) { animation-delay: 0.2s; }

.bk-card::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: linear-gradient(135deg, var(--border), transparent 60%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  transition: all 0.22s ease;
  pointer-events: none;
  z-index: 3;
}

.bk-card-glow {
  position: absolute;
  top: 50%; left: 50%;
  width: 140%; height: 140%;
  transform: translate(-50%, -50%) scale(0.8);
  background: radial-gradient(circle, var(--bki-glow, rgba(0,0,0,0.08)) 0%, transparent 60%);
  opacity: 0;
  transition: all 0.15s ease;
  pointer-events: none;
  z-index: 0;
}
.bk-card:hover .bk-card-glow { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }

.bk-card-inner {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: var(--space-lg);
  padding: var(--space-xl);
  min-height: 100px;
  background: var(--bg-secondary);
}

.bk-icon-wrap {
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bki-bg, rgba(59,130,246,0.08));
  border-radius: var(--radius-xl);
  flex-shrink: 0;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid color-mix(in srgb, var(--bki-color, #3b82f6) 10%, transparent);
}
.bk-icon-wrap svg { width: 24px; height: 24px; stroke: var(--bki-color, #3b82f6); }

.bk-card:hover .bk-icon-wrap {
  transform: scale(1.1) rotate(-5deg);
  background: color-mix(in srgb, var(--bki-color, #3b82f6) 10%, transparent);
  border-color: color-mix(in srgb, var(--bki-color, #3b82f6) 25%, transparent);
  box-shadow: 0 6px 20px var(--bki-glow, rgba(59,130,246,0.15));
}

.bk-info { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bk-info h3 { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); margin: 0; transition: color 0.18s; }
.bk-card:hover .bk-info h3 { color: var(--bki-color, var(--accent)); }
.bk-info p { font-size: 0.82rem; color: var(--text-tertiary); margin: 0; line-height: 1.35; }

.bk-arrow {
  width: 34px; height: 34px;
  border-radius: var(--radius-full);
  background: var(--bki-bg, rgba(59,130,246,0.06));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.12s ease; opacity: 0.45;
}
.bk-arrow svg { width: 16px; height: 16px; color: var(--bki-color, var(--accent)); transition: transform 0.35s; }

.bk-card:hover .bk-arrow { opacity: 1; background: var(--bki-color, var(--accent)); box-shadow: 0 4px 14px var(--bki-glow, rgba(59,130,246,0.2)); }
.bk-card:hover .bk-arrow svg { color: white; transform: translateX(3px); }

.bk-card:hover {
  transform: translateY(-5px) scale(1.01);
  box-shadow: 0 14px 36px -8px var(--bki-glow, rgba(0,0,0,0.1)), 0 6px 18px -4px rgba(0,0,0,0.05);
}
.bk-card:hover::before { background: linear-gradient(135deg, var(--border-hover), transparent 70%); }
.bk-card:active { transform: translateY(-2px) scale(0.99); }

.bk-skeleton {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-sm); pointer-events: none;
}
.bk-skeleton .skeleton-circle-lg { width: 48px; height: 48px; margin-bottom: var(--space-xs); }
.bk-skeleton .skeleton-text-md { width: 80px; height: 16px; }
.bk-skeleton .skeleton-text-sm { width: 60px; height: 12px; }

/* ========== 模块选择页全面升级 v3.0 ========== */

.modules-page {
  position: relative;
  min-height: calc(100vh - var(--nav-height) - var(--space-2xl));
}

.modules-bg-dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, color-mix(in srgb, var(--text-tertiary) 18%, transparent) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.35;
  pointer-events: none;
}

/* ===== 头部区域 ===== */
.mod-header {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
  position: relative;
  z-index: 2;
  animation: modHeaderIn 0.3s ease both;
}

@keyframes modHeaderIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.mod-back-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  color: var(--accent);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  box-shadow: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.mod-back-btn svg { width: 18px; height: 18px; }

.mod-back-btn:hover {
  background: var(--bg-hover);
  color: var(--accent);
  border-color: var(--border-hover);
  transform: none;
  box-shadow: var(--shadow-sm);
}

.mod-back-btn:active { transform: scale(0.95); }

.mod-title-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.mod-subject-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-lg);
  background: var(--ml);
  border: 1.5px solid color-mix(in srgb, var(--mc) 20%, transparent);
  border-radius: var(--radius-full);
  width: fit-content;
}

.mod-badge-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.mod-badge-text {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--mc, var(--text-primary));
  letter-spacing: -0.3px;
}

.mod-subtitle {
  font-size: 0.9rem;
  color: var(--text-tertiary);
  margin: 0;
  padding-left: var(--space-md);
}

/* ===== 统计行 ===== */
.mod-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
  position: relative;
  z-index: 2;
  animation: modStatsIn 0.25s ease 0.04s both;
}

@keyframes modStatsIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.mod-stat {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-xl);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  transition: all 0.18s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: default;
  overflow: hidden;
  position: relative;
}

.mod-stat::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--ms-color);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  opacity: 0.7;
}

.mod-stat:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--ms-color) 10%, transparent);
  border-color: color-mix(in srgb, var(--ms-color) 25%, transparent);
}

.mod-stat-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ms-bg);
  border-radius: var(--radius-lg);
  flex-shrink: 0;
  color: var(--ms-color);
}

.mod-stat-icon svg { width: 22px; height: 22px; }

.mod-stat-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mod-stat-num {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--ms-color);
  line-height: 1.15;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

.mod-stat-lbl {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* ===== 模块卡片网格 ===== */
.mod-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
  position: relative;
  z-index: 2;
  animation: modGridIn 0.25s ease 0.08s both;
}

@keyframes modGridIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 模块卡片主体 */
.mod-card {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-spring);
  contain: layout style;
  animation: modCardStaggerIn 0.25s ease both;
}

.mod-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
}

.mod-card:nth-child(1) { animation-delay: 0.08s; }
.mod-card:nth-child(2) { animation-delay: 0.11s; }
.mod-card:nth-child(3) { animation-delay: 0.14s; }
.mod-card:nth-child(4) { animation-delay: 0.17s; }
.mod-card:nth-child(5) { animation-delay: 0.2s; }
.mod-card:nth-child(6) { animation-delay: 0.23s; }

@keyframes modCardStaggerIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.mod-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: linear-gradient(135deg, var(--border), transparent 60%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  transition: all 0.22s ease;
  pointer-events: none;
  z-index: 3;
}

.mod-card-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 140%;
  height: 140%;
  transform: translate(-50%, -50%) scale(0.8);
  background: radial-gradient(circle, var(--ccg, rgba(0,0,0,0.08)) 0%, transparent 60%);
  opacity: 0;
  transition: all 0.15s ease;
  pointer-events: none;
  z-index: 0;
}

.mod-card:hover .mod-card-glow {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.15);
}

.mod-card-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-lg) var(--space-xl);
  min-height: 108px;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: inherit;
}

[data-theme="dark"] .mod-card-inner {
  background: rgba(255,255,255,0.04);
}

.mod-card-icon-wrap {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ccb, rgba(59,130,246,0.08));
  border-radius: 14px;
  flex-shrink: 0;
  transition: all var(--transition-spring);
  border: 1px solid rgba(99, 102, 241, 0.1);
}

.mod-card-icon-wrap svg {
  width: 24px;
  height: 24px;
  stroke: var(--cci, #3b82f6);
  transition: all var(--transition-base);
}

.mod-card:hover .mod-card-icon-wrap {
  transform: scale(1.08) rotate(-3deg);
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.2);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.12);
}

.mod-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.mod-card-info h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  transition: color var(--transition-base);
}

.mod-card:hover .mod-card-info h3 {
  color: var(--cci, var(--accent));
}

.mod-card-info p {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  margin: 0;
  line-height: 1.4;
}

.mod-card-arrow {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-base);
  opacity: 0.4;
}

.mod-card-arrow svg {
  width: 16px;
  height: 16px;
  color: var(--cci, var(--accent));
  transition: transform 0.2s ease;
}

.mod-card:hover .mod-card-arrow {
  opacity: 1;
  background: var(--cci, var(--accent));
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
}

.mod-card:hover .mod-card-arrow svg {
  color: white;
  transform: translateX(3px);
}

.mod-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
}

.mod-card:hover::before {
  background: linear-gradient(135deg, var(--border-hover), transparent 70%);
}

.mod-card:active {
  transform: translateY(-1px) scale(0.98);
}

/* ========== 章节选择页 v3.0 ========== */

.ch-page {
  position: relative;
  min-height: calc(100vh - var(--nav-height) - var(--space-2xl));
}

.ch-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
  position: relative;
  z-index: 2;
  animation: modGridIn 0.25s ease 0.06s both;
}

.ch-card {
  position: relative;
  border-radius: var(--radius-2xl);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.23, 1, 0.32, 1);
  contain: layout style;
  animation: modCardStaggerIn 0.25s ease both;
}
.ch-card:nth-child(1) { animation-delay: 0.06s; }
.ch-card:nth-child(2) { animation-delay: 0.09s; }
.ch-card:nth-child(3) { animation-delay: 0.12s; }
.ch-card:nth-child(4) { animation-delay: 0.15s; }
.ch-card:nth-child(n+5) { animation-delay: 0.18s; }

.ch-card::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: linear-gradient(135deg, var(--border), transparent 60%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  transition: all 0.22s ease;
  pointer-events: none;
  z-index: 3;
}

.ch-card-glow {
  position: absolute;
  top: 50%; left: 50%;
  width: 140%; height: 140%;
  transform: translate(-50%, -50%) scale(0.8);
  background: radial-gradient(circle, rgba(99,102,241,0.05) 0%, transparent 60%);
  opacity: 0;
  transition: all 0.15s ease;
  pointer-events: none;
  z-index: 0;
}

[data-theme="dark"] .ch-card-glow {
  background: radial-gradient(circle, rgba(129,140,248,0.05) 0%, transparent 60%);
}
.ch-card:hover .ch-card-glow { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }

.ch-card-inner {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; gap: var(--space-sm);
  padding: var(--space-xl); min-height: 110px;
  background: var(--bg-secondary);
}

.ch-top-row {
  display: flex; align-items: center; gap: var(--space-md);
}

.ch-num {
  font-size: 1.35rem; font-weight: 800;
  color: var(--cn-color, #3b82f6);
  line-height: 1;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.3s;
}
.ch-card:hover .ch-num { opacity: 1; }

.ch-name {
  font-size: 1rem; font-weight: 700;
  color: var(--text-primary); margin: 0;
  transition: color 0.18s;
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ch-card:hover .ch-name { color: var(--ch-color, var(--accent)); }

.ch-arrow {
  width: 18px; height: 18px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.ch-card:hover .ch-arrow { transform: translateX(3px); }

.ch-meta-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-md);
}

.ch-count {
  font-size: 0.82rem; color: var(--text-tertiary);
}

.ch-pct {
  font-size: 0.78rem; font-weight: 600;
}

.ch-card-download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.12s ease;
  padding: 0;
  flex-shrink: 0;
}
.ch-card-download-btn:hover {
  background: #0ea5e9;
  color: #fff;
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(14,165,233,0.3);
}

.ch-download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.12s ease;
  padding: 0;
  flex-shrink: 0;
}
.ch-download-btn:hover {
  background: rgba(14,165,233,0.15);
  color: #0ea5e9;
}

.ch-progress {
  height: 5px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: var(--space-xs);
}

.ch-progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.ch-card:hover {
  transform: translateY(-5px) scale(1.01);
  box-shadow: 0 14px 36px -8px var(--ch-bg, rgba(0,0,0,0.08)), 0 6px 18px -4px rgba(0,0,0,0.04);
}
.ch-card:hover::before { background: linear-gradient(135deg, var(--border-hover), transparent 70%); }
.ch-card:active { transform: translateY(-2px) scale(0.99); }

.ch-skeleton {
  display: flex; flex-direction: column; gap: var(--space-sm);
  pointer-events: none;
}
.ch-skeleton .skeleton-text-md { width: 60%; height: 16px; }
.ch-skeleton .skeleton-text-sm { width: 40%; height: 12px; }
.ch-skeleton .skeleton-bar { width: 100%; height: 5px; border-radius: var(--radius-full); background: linear-gradient(110deg, var(--border) 8%, var(--bg-tertiary) 18%, var(--border) 33%); background-size: 200% 100%; animation: skeletonShimmer 0.8s infinite; }

/* ========== 多层级章节树 v1.0 ========== */

.ch-tree {
  display: flex; flex-direction: column; gap: var(--space-sm);
  position: relative; z-index: 2;
  animation: modGridIn 0.25s ease 0.06s both;
}

/* 树节点通用样式 */
.ch-tree-node {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all 0.18s ease;
  contain: layout style;
}

/* 文件夹节点 */
.ch-folder-node {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
}

.ch-folder-header {
  display: flex; align-items: center; gap: var(--space-md);
  padding: var(--space-lg) var(--space-xl);
  transition: all 0.18s ease;
}

.ch-folder-node:hover .ch-folder-header {
  background: color-mix(in srgb, var(--ch-color, #6366f1) 5%, transparent);
}

.ch-folder-icon {
  width: 24px; height: 24px;
  flex-shrink: 0;
  transition: transform 0.18s ease;
}

.ch-folder-name {
  font-size: 1rem; font-weight: 700;
  color: var(--text-primary);
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.ch-folder-count {
  font-size: 0.82rem; color: var(--text-tertiary);
  flex-shrink: 0;
}

.ch-folder-arrow {
  width: 18px; height: 18px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.ch-folder-children {
  display: flex; flex-direction: column;
  gap: var(--space-xs);
  padding-left: var(--tree-indent, 24px);
  border-left: 2px solid color-mix(in srgb, var(--ch-color, #6366f1) 20%, transparent);
  margin-left: calc(var(--space-lg) + 12px);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.ch-folder-children.collapsed {
  max-height: 0 !important;
  opacity: 0;
  margin-top: 0; margin-bottom: 0;
  padding-top: 0; padding-bottom: 0;
}

/* 文件节点（实际章节） */
.ch-file-node {
  background: var(--bg-secondary);
  border: 1px solid transparent;
  cursor: pointer;
  margin: 2px 0;
  transition: all 0.15s ease;
}

.ch-file-node:hover {
  border-color: color-mix(in srgb, var(--ch-color, #3b82f6) 30%, transparent);
  background: color-mix(in srgb, var(--ch-color, #3b82f6) 4%, var(--bg-secondary));
  transform: translateX(4px);
}

.ch-file-inner {
  display: flex; align-items: center; gap: var(--space-md);
  padding: var(--space-md) var(--space-xl);
}

.ch-file-bullet {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}

.ch-file-name {
  font-size: 0.95rem; font-weight: 600;
  color: var(--text-primary);
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: color 0.15s ease;
}

.ch-file-node:hover .ch-file-name {
  color: var(--ch-color, #3b82f6);
}

.ch-file-meta {
  display: flex; align-items: center; gap: var(--space-md);
  flex-shrink: 0;
  font-size: 0.78rem;
}

.ch-file-meta .ch-count { color: var(--text-tertiary); }
.ch-file-meta .ch-pct { font-weight: 600; }

.ch-file-node .ch-progress {
  height: 3px;
  margin: 0;
  background: var(--bg-tertiary);
}

/* ========== 闪卡复习页 Apple 风格 ========== */

.fc-page { position: relative; min-height: calc(100vh - var(--nav-height) - var(--space-2xl)); }

/* 章节文件名显示 */
.fc-chapter-name {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  padding-left: 12px;
  margin-top: 4px;
}

.fc-chapter-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 进度行 */
.fc-progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fc-progress-wrap {
  position: relative; z-index: 2;
  margin-bottom: var(--space-xl);
  animation: modStatsIn 0.25s ease 0.04s both;
}

.fc-progress-bar {
  width: 100%; height: 6px;
  background: var(--bg-tertiary); border-radius: var(--radius-full);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.08);
}

.fc-progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: var(--radius-full);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.fc-progress-fill::after {
  content: ''; position: absolute;
  top: 0; right: 0; bottom: 0; width: 30px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35));
  border-radius: var(--radius-full);
  animation: progressShimmer 1.2s ease-in-out infinite;
}

.fc-container {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-xl);
  position: relative; z-index: 2;
  animation: modGridIn 0.25s ease 0.06s both;
}

.fc-skeleton {
  width: 100%; max-width: 820px;
  display: flex; flex-direction: column; gap: var(--space-md);
  padding: var(--space-2xl); border-radius: var(--radius-2xl);
  background: var(--bg-secondary); border: 1px solid var(--border);
  pointer-events: none;
}

.fc-first-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; font-size: 0.75rem; font-weight: 600;
  color: var(--text-tertiary); cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-full);
  background: var(--bg-secondary);
  transition: all 0.15s ease;
}
.fc-first-btn:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-light); }

.fc-list-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; font-size: 0.75rem; font-weight: 600;
  color: var(--text-tertiary); cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-full);
  background: var(--bg-secondary);
  transition: all 0.15s ease;
  margin-left: 6px;
}
.fc-list-btn:hover { color: #06b6d4; border-color: color-mix(in srgb, #06b6d4 40%, transparent); background: rgba(6,182,212,0.06); }

/* --- 列表模式（查看全部题目） --- */
.rv-list-container {
  max-width: 860px !important;
  width: 100%;
  margin: 0 auto;
}

.rv-list-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-bottom: none;
}
.rv-list-title {
  font-size: 0.95rem; font-weight: 700;
  color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}
.rv-list-title::before {
  content: ''; display: inline-block; width: 4px; height: 18px;
  border-radius: 2px; background: linear-gradient(to bottom, #06b6d4, #8b5cf6);
}
.rv-list-count {
  font-size: 0.78rem; color: var(--text-tertiary);
  background: var(--bg-tertiary); padding: 2px 10px;
  border-radius: var(--radius-full);
}

.rv-list-body {
  display: flex; flex-direction: column;
  border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
}

.rv-item {
  padding: 18px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition-fast);
  position: relative;
}
.rv-item:last-child { border-bottom: none; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.rv-item:hover { background: var(--bg-hover); }
.rv-item-answered { background: var(--success-light); }
[data-theme="dark"] .rv-item-answered { background: rgba(16,185,129,0.06); }
.rv-item-answered:hover { background: rgba(16,185,129,0.12); }

.rv-item-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.rv-item-num {
  font-size: 0.8rem; font-weight: 700;
  color: #06b6d4; background: rgba(6,182,212,0.08);
  padding: 1px 8px; border-radius: var(--radius-full);
}
.rv-item-badge {
  font-size: 0.7rem; font-weight: 600;
  color: var(--success); background: var(--success-light);
  padding: 1px 8px; border-radius: var(--radius-full);
}
[data-theme="dark"] .rv-item-badge { background: rgba(16,185,129,0.12); }

.rv-item-body {
  display: flex; flex-direction: column; gap: 8px;
}
.rv-item-q,
.rv-item-a {
  font-size: 0.9rem; line-height: 1.65;
  color: var(--text-primary);
}
.rv-item-q strong,
.rv-item-a strong {
  color: var(--accent); margin-right: 4px;
}
.rv-exp {
  font-size: 0.85rem; line-height: 1.65;
  color: var(--text-secondary); padding: 10px 14px;
  background: var(--bg-tertiary); border-radius: var(--radius-md);
  margin-top: 2px;
  border-left: 3px solid var(--accent);
}
.rv-exp strong { color: var(--accent); }

/* --- 复习卡片（展开/收起模式） --- */
.flashcard-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xl);
}

/* 复习页面顶部进度条 */
.flashcard-progress-bar {
  width: 100%;
  max-width: 820px;
  height: 5px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
}

.flashcard-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: var(--radius-full);
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

/* 进度条光效动画 */
.flashcard-progress-fill::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 20px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4));
  border-radius: var(--radius-full);
  animation: progressShimmer 0.9s ease-in-out infinite;
}

@keyframes progressShimmer {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

/* ========== 复习卡片 - 全新设计 ========== */

/* 卡片左右点击区域提示（上一题/下一题） */
.review-card-tap {
  cursor: default;
}
.review-card-tap .review-card-question {
  position: relative;
}
/* 左右半区 hover 渐变提示 */
.review-card-tap .review-card-question::before,
.review-card-tap .review-card-question::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0; width: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: 1;
}
.review-card-tap .review-card-question::before {
  left: 0;
  background: linear-gradient(90deg, rgba(0, 122, 255, 0.04), transparent 70%);
  border-radius: var(--radius-2xl) 0 0 0;
}
.review-card-tap .review-card-question::after {
  right: 0;
  background: linear-gradient(-90deg, rgba(0, 122, 255, 0.04), transparent 70%);
  border-radius: 0 var(--radius-2xl) 0 0;
}
[data-theme="dark"] .review-card-tap .review-card-question::before {
  background: linear-gradient(90deg, rgba(10, 132, 255, 0.06), transparent 70%);
}
[data-theme="dark"] .review-card-tap .review-card-question::after {
  background: linear-gradient(-90deg, rgba(10, 132, 255, 0.06), transparent 70%);
}

/* hover 时显示箭头 + 背景渐变 */
.review-card-tap:hover .review-card-question::before { opacity: 1; }
.review-card-tap:hover .review-card-question::after { opacity: 1; }

/* 箭头图标 - 用伪元素叠加在 ::before/::after 上方 */
.review-card-tap .review-card-question > * {
  position: relative; z-index: 2;
}
.review-card-tap:hover .card-hint-left,
.review-card-tap:hover .card-hint-right {
  display: flex;
}
/* 箭头通过额外 span 实现（由 JS 注入）*/
.card-hint-left, .card-hint-right {
  display: none !important;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  align-items: center;
  justify-content: center;
  z-index: 3;
  pointer-events: none;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}
.card-hint-left { left: 12px; }
.card-hint-right { right: 12px; }
.card-hint-left svg, .card-hint-right svg {
  width: 18px; height: 18px;
  stroke: var(--accent); stroke-width: 2.5;
  fill: none; stroke-linecap: round; stroke-linejoin: round;
}
[data-theme="dark"] .card-hint-left svg,
[data-theme="dark"] .card-hint-right svg {
  stroke: var(--accent);
}

/* 移动端不显示箭头提示 */
.review-card {
  width: 100%;
  max-width: 840px;
  background: var(--bg-secondary);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  transition: all 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
  position: relative;
  border: 0.5px solid var(--border);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* 卡片渐变边框 — 移除（Apple 风格更简洁） */
.review-card::before {
  display: none;
}

/* 卡片内部光晕层 — 移除 */
.review-card::after {
  display: none;
}

/* 卡片内层容器 */
.review-card > * { position: relative; z-index: 1; }
.review-card .review-card-question,
.review-card .review-card-answer {
  position: relative; z-index: 1;
  background: transparent;
}

.review-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

/* ===== 问题区域 ===== */
.review-card-question {
  padding: var(--space-2xl) var(--space-2xl) var(--space-xl);
  position: relative;
  background: transparent;
}

/* 问题标签 - Apple 风格胶囊 */
.review-card-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: var(--space-lg);
  padding: 5px 14px;
  background: var(--accent-light);
  border: 0.5px solid var(--accent-subtle);
  border-radius: var(--radius-full);
  position: relative;
}

.review-card-label::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0.6;
}

/* 答案标签用绿色 */
.review-card-answer .review-card-label {
  color: #34c759;
  background: rgba(52, 199, 89, 0.08);
  border-color: rgba(52, 199, 89, 0.15);
}
.review-card-answer .review-card-label::before {
  background: #34c759;
}

/* 问题内容 */
.review-card-content {
  font-size: 1.2rem;
  line-height: 1.7;
  color: var(--text-primary);
  font-weight: 400;
  letter-spacing: -0.01em;
}

.review-card-content table {
  font-size: 0.92rem;
  margin: var(--space-sm) 0;
  border-collapse: collapse;
}

.review-card-content table th,
.review-card-content table td {
  padding: 8px 14px;
  border: 1px solid var(--border);
}

.review-card-content table th {
  background: var(--bg-tertiary);
  font-weight: 600;
}

/* ===== 答案区域 ===== */
.review-card-answer {
  border-top: 1px solid var(--border);
  position: relative;
}

/* 展开按钮 - Apple 风格 */
.review-card-toggle {
  width: 100%;
  padding: 14px var(--space-2xl);
  border: none;
  border-top: 0.5px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s cubic-bezier(0.25, 0.1, 0.25, 1),
              color 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
  position: relative;
  overflow: hidden;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* 眼睛图标 - 查看答案（Apple SF Symbols 风格） */
.toggle-icon {
  display: inline-flex;
  width: 16px; height: 16px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23007aff' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.062 11.062c-.625.875-.625 2.062 0 2.938l.563.75a10.05 10.05 0 008.375 4.5h2c3.313 0 6.375-1.563 8.375-4.5l.563-.75c.625-.876.625-2.063 0-2.938l-.563-.75A10.05 10.05 0 0013 5.75h-2A10.05 10.05 0 002.625 10.312z'%3E%3C/path%3E%3Ccircle cx='12' cy='12.5' r='3'%3E%3C/circle%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: contain;
}

/* 收起时的向上箭头图标 */
.toggle-icon-up {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23007aff' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='18 15 12 9 6 15'%3E%3C/polyline%3E%3C/svg%3E") !important;
}

/* 按钮呼吸动画提示可点击 */
.review-card-toggle::after {
  content: '';
  position: absolute;
  bottom: 0; left: 25%; right: 25%;
  height: 2px;
  background: var(--accent);
  opacity: 0.3;
  border-radius: var(--radius-full);
}

.review-card-toggle:hover {
  background: var(--bg-hover);
  color: var(--accent-hover);
}

.review-card-toggle:hover::after {
  opacity: 0.6;
}

/* 答案内容区域（Apple 风格展开动画） */
.review-card-answer-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s cubic-bezier(0.25, 0.1, 0.25, 1),
              padding 0.18s cubic-bezier(0.25, 0.1, 0.25, 1),
              opacity 0.15s cubic-bezier(0.25, 0.1, 0.25, 1);
  opacity: 0;
  padding: 0 var(--space-2xl);
}

.review-card-answer.expanded .review-card-answer-body {
  max-height: 5000px;
  padding: var(--space-2xl);
  opacity: 1;
  background: var(--bg-tertiary);
  border-top: 0.5px solid var(--border);
  transition: max-height 0.25s cubic-bezier(0.25, 0.1, 0.25, 1),
              padding 0.22s cubic-bezier(0.25, 0.1, 0.25, 1),
              opacity 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* 切换题目时禁用过渡动画 */
.no-transition,
.no-transition * {
  transition: none !important;
  animation: none !important;
}

/* 答案展开时隐藏toggle按钮的底部线 */
.review-card-answer.expanded .review-card-toggle::after {
  display: none;
}

/* ===== 解析区域 ===== */
.review-card-explanation {
  margin-top: var(--space-lg);
  padding: var(--space-lg) var(--space-xl);
  background: color-mix(in srgb, #f59e0b 6%, transparent);
  border: 1px solid color-mix(in srgb, #f59e0b 15%, var(--border));
  border-left: 3px solid #f59e0b;
  border-radius: var(--radius-lg);
  position: relative;
}

.review-card-explanation strong {
  color: #d97706;
  font-weight: 700;
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ===== 操作按钮组 ===== */
.flashcard-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 720px;
  padding: var(--space-lg) 0 0;
}

.flashcard-nav {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  justify-content: center;
}

/* --- 按钮（Apple 风格） --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 9px 20px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  letter-spacing: -0.01em;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.btn::before {
  display: none;
}

.btn:hover {
  background: var(--bg-hover);
  transform: none;
  box-shadow: var(--shadow-sm);
}

.btn:active {
  transform: scale(0.98) !important;
  opacity: 0.8;
  transition-duration: 60ms;
}

.btn:disabled {
  opacity: 0.36;
  cursor: not-allowed;
  transform: none !important;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
  border-color: transparent;
  box-shadow: 0 1px 4px rgba(0, 122, 255, 0.2);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
  transform: none;
}

.btn-success {
  background: var(--success);
  color: white;
  border-color: transparent;
  box-shadow: 0 1px 4px rgba(52, 199, 89, 0.2);
}

.btn-success:hover {
  background: #2db84e;
  box-shadow: 0 2px 8px rgba(52, 199, 89, 0.3);
  transform: none;
}

.btn-danger {
  background: var(--danger);
  color: white;
  border-color: transparent;
  box-shadow: 0 1px 4px rgba(255, 59, 48, 0.2);
}

.btn-danger:hover {
  background: #e0342b;
  box-shadow: 0 2px 8px rgba(255, 59, 48, 0.3);
  transform: none;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.8rem;
  border-radius: var(--radius-md);
  font-weight: 500;
}

/* ========== 按钮图标系统（Apple SF Symbols 风格） ========== */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

/* 左箭头 - 上一题 */
.btn-icon-prev {
  width: 13px; height: 13px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'%3E%3C/polyline%3E%3C/svg%3E");
}
.btn:hover .btn-icon-prev { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'%3E%3C/polyline%3E%3C/svg%3E"); }
.btn-primary .btn-icon-prev { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.85)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'%3E%3C/polyline%3E%3C/svg%3E"); }

/* 右箭头 - 下一题 */
.btn-icon-next {
  width: 13px; height: 13px;
  margin-left: 4px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'%3E%3C/polyline%3E%3C/svg%3E");
}
.btn:hover .btn-icon-next { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'%3E%3C/polyline%3E%3C/svg%3E"); }

/* 编辑 - 铅笔 */
.btn-icon-edit {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z'%3E%3C/path%3E%3C/svg%3E");
}
.btn-success .btn-icon-check { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.95)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E"); }
.btn-danger .btn-icon-cross { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.95)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E"); }

/* Ghost 按钮 - 次要操作（编辑等） */
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border);
  box-shadow: none;
  transform: none;
}

/* ===== 操作按钮组布局调整 ===== */
.flashcard-nav-main {
  gap: var(--space-sm);
}

.flashcard-nav-actions {
  gap: var(--space-md);
}

/* ===== 超小屏：操作按钮等宽两列网格 + 章节单列 ===== */
/* ===== 平板中间断点（600px）===== */
@media (max-width: 600px) {
  .bk-grid { grid-template-columns: 1fr; }
  .ch-grid { grid-template-columns: 1fr 1fr; gap: var(--space-sm); }
  .bk-card-inner { padding: var(--space-lg); min-height: 88px; }
  .bk-icon-wrap { width: 44px; height: 44px; }
  .ch-card-inner { padding: var(--space-lg); min-height: 96px; }
  .page-header h1 { font-size: 1.2rem; }
}

@media (max-width: 520px) {

  /* 模块页超小屏 */
  .mod-stats-row { grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); }
  .mod-stat { padding: var(--space-md); }
  .mod-stat-icon { width: 34px; height: 34px; }
  .mod-stat-icon svg { width: 18px; height: 18px; }
  .mod-stat-num { font-size: 1.3rem; }
  .mod-stat-lbl { font-size: 0.68rem; }

  .mod-grid { grid-template-columns: 1fr !important; gap: var(--space-md); }
  .mod-card-inner { padding: var(--space-lg); min-height: 90px; }
  .mod-card-icon-wrap { width: 46px; height: 46px; }
  .mod-card-icon-wrap svg { width: 22px; height: 22px; }
  .mod-card-info h3 { font-size: 1.05rem; }
  .mod-card-info p { font-size: 0.8rem; }
  .mod-header { gap: var(--space-md); }

  /* 按钮组网格 */
  .flashcard-actions {
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
    max-width: 100%;
  }
  .flashcard-nav-main {
    width: 100%;
    justify-content: center;
  }
  .flashcard-nav-actions {
    width: 100%;
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xs);
    justify-content: unset;
    flex-wrap: unset;
  }
  .flashcard-nav-actions .btn {
    flex: 1;
    justify-content: center;
    font-size: 0.8rem;
    padding: 10px 10px;
    border-radius: var(--radius-md);
  }

  /* 章节改为单列，避免标题换行太丑 */
  .ch-grid { grid-template-columns: 1fr !important; }
  .ch-card-inner { flex-direction: row; align-items: center; justify-content: space-between; gap: var(--space-sm); padding: var(--space-md) var(--space-lg); min-height: auto; }
  .ch-top-row { flex: 1; min-width: 0; flex-wrap: nowrap; }
  .ch-num { font-size: 1.1rem; }
  .ch-card-download-btn { width: 24px; height: 24px; }
  .ch-card-download-btn svg { width: 12px; height: 12px; }
  .ch-arrow { display: none; }
  .ch-meta-row { flex-shrink: 0; flex-direction: column; align-items: flex-end; gap: 2px; }
  .ch-progress { display: none; }
  .ch-name { -webkit-line-clamp: 1; font-size: 0.8rem; }

  /* 多层级章节树移动端适配 */
  .ch-folder-header { padding: var(--space-md) var(--space-lg); gap: var(--space-sm); }
  .ch-folder-icon { width: 20px; height: 20px; }
  .ch-folder-name { font-size: 0.92rem; }
  .ch-folder-count { font-size: 0.75rem; }
  .ch-folder-arrow { width: 16px; height: 16px; }
  .ch-folder-children { margin-left: calc(var(--space-md) + 10px); padding-left: calc(var(--tree-indent, 24px) * 0.8); }
  .ch-file-inner { padding: var(--space-sm) var(--space-lg); gap: var(--space-sm); }
  .ch-file-name { font-size: 0.88rem; }
  .ch-file-meta { font-size: 0.72rem; }

  /* 卡片内容字体进一步缩小 */
  .review-card-content { font-size: 0.98rem; line-height: 1.65; }
  .page-header h1 { font-size: 1.15rem; }

  /* 进度文字更紧凑 */
  #flashcard-progress-text { font-size: 0.78rem !important; padding: 3px 10px; }
  .flashcard-first-btn { font-size: 0.72rem !important; padding: 3px 8px !important; }

  /* 章节文件名移动端适配 */
  .fc-chapter-name {
    font-size: 0.75rem;
    padding: 4px 10px;
    max-width: calc(100vw - 120px);
  }

  .fc-progress-row {
    gap: 6px;
  }

  /* 统计条图标隐藏emoji只保留数字 */
  .stat-icon { display: none; }
  .stats-bar { padding: var(--space-xs) var(--space-sm); }
}

.btn-xs {
  padding: 2px 8px;
  font-size: 0.75rem;
  opacity: 0.7;
}
.btn-xs:hover { opacity: 1; }

.textarea-toolbar {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  padding: 6px 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}


/* --- 刷题模式 --- */
.quiz-container {
  max-width: 700px;
  margin: 0 auto;
}

.quiz-progress {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.quiz-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: var(--radius-full);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.quiz-progress-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 4px 14px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.quiz-progress-text::before {
  content: '🎲';
  font-size: 0.75rem;
}

.quiz-scope-tag {
  font-size: 0.75rem;
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-tertiary));
  border-color: color-mix(in srgb, var(--accent) 20%, var(--border));
  color: var(--accent);
}
.quiz-scope-tag::before { content: none; }

/* --- 刷题范围选择面板 --- */
.quiz-scope-panel {
  background: var(--bg-secondary);
  border: none;
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.quiz-scope-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--space-lg) var(--space-xl);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 5%, var(--bg-secondary)), var(--bg-secondary));
  border-bottom: 1px solid var(--border-light);
}

.quiz-scope-quick {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: var(--space-sm) var(--space-xl);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}

.quiz-scope-count {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.quiz-scope-list {
  padding: var(--space-md) var(--space-lg);
  max-height: 50vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.quiz-scope-book {
  margin-bottom: var(--space-sm);
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

/* ===== 分组容器（父级） ===== */
.quiz-scope-group {
  border: none;
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-md);
  background: color-mix(in srgb, #6366f1 2%, transparent);
  overflow: hidden;
  transition: all 0.18s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.quiz-scope-group:hover {
  border-color: transparent;
  background: color-mix(in srgb, #6366f1 4%, transparent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.quiz-scope-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--space-md) var(--space-lg);
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--border-light);
  background: linear-gradient(135deg, color-mix(in srgb, #6366f1 5%, transparent), transparent);
  transition: background 0.15s ease;
}
.quiz-scope-group-header:hover {
  background: linear-gradient(135deg, color-mix(in srgb, #6366f1 8%, transparent), transparent);
}

/* 分组子内容区域 */
.quiz-scope-group-children {
  padding: var(--space-xs) var(--space-md) var(--space-md) var(--space-2xl);
  max-height: 2000px;
  overflow: hidden;
  transition: max-height 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.18s ease, padding 0.2s ease;
}

/* 分组收起 */
.quiz-scope-group.collapsed .quiz-scope-group-children {
  max-height: 0 !important;
  opacity: 0;
  padding-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0;
}
.quiz-scope-group.collapsed .quiz-group-toggle svg {
  transform: rotate(-90deg);
}

.quiz-scope-book:hover {
  border-color: color-mix(in srgb, var(--accent) 15%, var(--border));
  background: color-mix(in srgb, var(--accent) 2%, var(--bg-secondary));
}

.quiz-scope-book-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-lg);
  transition: background var(--transition-fast);
}

.quiz-scope-book-header:hover {
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}

/* ===== 自定义 check 元素（替代原生 checkbox） ===== */
.quiz-check {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--border-hover);
  background: transparent;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  transition: all 0.15s cubic-bezier(0.25, 0.1, 0.25, 1);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.quiz-check::after {
  content: '';
  position: absolute;
  top: 3px; left: 5px;
  width: 5px; height: 9px;
  border: 2px solid white;
  border-top: none; border-left: none;
  transform: rotate(45deg) scale(0);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.quiz-check.checked {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 1px 4px rgba(0, 122, 255, 0.25);
}
.quiz-check.checked::after {
  transform: rotate(45deg) scale(1);
}
.quiz-check.partial {
  background: var(--accent);
  border-color: var(--accent);
  opacity: 0.6;
}
.quiz-check.partial::after {
  content: '';
  top: 50%; left: 50%;
  width: 8px; height: 2px;
  border: none;
  border-radius: 1px;
  background: white;
  transform: translate(-50%, -50%) scale(1);
}
.quiz-check:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}
.quiz-check-sm {
  width: 17px;
  height: 17px;
  border-radius: 5px;
}
.quiz-check-sm::after {
  top: 2px; left: 4px;
  width: 4px; height: 7px;
}

/* ===== 通用 item 布局 ===== */
.quiz-scope-item,
.quiz-scope-chapter-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px var(--space-md);
  border-radius: var(--radius-md);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
}
.quiz-scope-item:hover,
.quiz-scope-chapter-item:hover {
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.quiz-item-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.quiz-item-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quiz-item-count {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.quiz-toggle-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  color: var(--text-tertiary);
  transition: all 0.2s ease;
}
.quiz-toggle-arrow svg {
  width: 14px; height: 14px;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.quiz-toggle-arrow:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
}
.quiz-toggle-spacer {
  width: 24px; height: 24px;
  flex-shrink: 0;
}

.quiz-scope-book-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-lg);
  transition: background var(--transition-fast);
}

.quiz-scope-book-header:hover {
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}

.quiz-scope-chapters {
  padding: 2px 0 var(--space-xs) 40px;
  max-height: 600px;
  overflow: hidden;
  transition: max-height 0.22s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.15s ease, padding 0.18s ease;
}

.quiz-scope-book.collapsed .quiz-scope-chapters {
  max-height: 0 !important;
  opacity: 0;
  padding-top: 0; padding-bottom: 0;
}
.quiz-scope-book.collapsed .quiz-toggle-arrow svg {
  transform: rotate(-90deg);
}

.quiz-scope-children {
  padding: var(--space-xs) var(--space-md) var(--space-md) var(--space-2xl);
  max-height: 2000px;
  overflow: hidden;
  transition: max-height 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.18s ease, padding 0.2s ease;
}
.quiz-scope-group.collapsed .quiz-scope-children {
  max-height: 0 !important;
  opacity: 0;
  padding-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0;
}
.quiz-scope-group.collapsed .quiz-toggle-arrow svg {
  transform: rotate(-90deg);
}

.quiz-scope-footer {
  padding: var(--space-md) var(--space-xl) var(--space-lg);
  display: flex;
  justify-content: center;
  border-top: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}

.btn-quiz-start {
  padding: 12px 32px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-quiz-start:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-quiz-start:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 30%, transparent);
}

.quiz-input-area {
  margin-top: var(--space-lg);
}

.quiz-input-area textarea {
  width: 100%;
  min-height: 120px;
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.6;
  resize: vertical;
  transition: border-color var(--transition-fast);
}

.quiz-input-area textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* --- 错题本/已掌握 v3.0 --- */
.wrong-tabs {
  display: flex; align-items: center; gap: var(--space-xs);
  margin-bottom: var(--space-xl); padding: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  position: relative; z-index: 2;
  animation: modStatsIn 0.25s ease 0.04s both;
}

.wrong-tab {
  padding: 8px 20px; border: none; background: none;
  color: var(--text-tertiary); font-size: 0.85rem; font-weight: 500;
  cursor: pointer; border-radius: var(--radius-full);
  transition: all 0.18s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.wrong-tab:hover { color: var(--text-primary); background: rgba(255,255,255,0.5); }

.wrong-tab.active { background: var(--accent, #6366f1); color: white; font-weight: 600; box-shadow: 0 4px 14px rgba(99,102,241,0.35); }
.wrong-tab-green.active { background: #22c55e; color: white; font-weight: 600; box-shadow: 0 4px 14px rgba(34,197,94,0.35); }

.wrong-tab-clear { margin-left:auto !important; color:var(--text-tertiary) !important; display:flex; align-items:center; gap:6px; }
.wrong-tab-clear:hover { color:#ef4444 !important; background:rgba(239,68,68,0.08) !important; }

/* ===== 错题本统计卡片 ===== */
.wrong-stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-md);
  margin-bottom: var(--space-xl);
  animation: modStatsIn 0.3s ease both;
}

.wrong-stat-card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--space-md) var(--space-sm);
  text-align: center; transition: all 0.2s ease;
}
.wrong-stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.wrong-stat-num {
  font-size: 1.5rem; font-weight: 800; color: var(--text-primary);
  line-height: 1.2; margin-bottom: 4px;
}
.wrong-stat-label {
  font-size: 0.75rem; color: var(--text-tertiary); font-weight: 500;
}

/* ===== 错题本工具栏 ===== */
.wrong-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-md);
  margin-bottom: var(--space-xl);
  animation: modStatsIn 0.3s ease 0.05s both;
}

.wrong-search-wrap {
  position: relative; flex: 1; min-width: 200px;
}
.wrong-search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-tertiary);
  pointer-events: none;
}
.wrong-search-input {
  width: 100%; padding: 10px 12px 10px 36px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-full); font-size: 0.85rem;
  color: var(--text-primary); outline: none;
  transition: all 0.2s ease;
}
.wrong-search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.wrong-search-input::placeholder { color: var(--text-tertiary); }

.wrong-filters, .wrong-group-tabs {
  display: flex; gap: var(--space-xs);
}
.wrong-filter-btn, .wrong-group-btn {
  padding: 7px 14px; border: 1px solid var(--border);
  background: var(--bg-secondary); color: var(--text-secondary);
  border-radius: var(--radius-full); font-size: 0.8rem; font-weight: 500;
  cursor: pointer; transition: all 0.18s ease;
}
.wrong-filter-btn:hover, .wrong-group-btn:hover {
  background: var(--bg-hover); color: var(--text-primary);
}
.wrong-filter-btn.active, .wrong-group-btn.active {
  background: var(--accent); color: white; border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(99,102,241,0.25);
}

/* 已掌握绿色主题 */
.mastered-stats .wrong-stat-num { color: #22c55e; }
.mastered-stats .wrong-stat-card:hover { border-color: rgba(34,197,94,0.3); }

.wrong-clear-btn, .wrong-export-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; border: 1px solid var(--border);
  background: var(--bg-secondary); color: var(--text-secondary);
  border-radius: var(--radius-full); font-size: 0.8rem; font-weight: 500;
  cursor: pointer; transition: all 0.18s ease; margin-left: auto;
}
.wrong-clear-btn:hover { background: rgba(239,68,68,0.06); color: #ef4444; border-color: rgba(239,68,68,0.2); }
.wrong-export-btn { background: rgba(99,102,241,0.06); color: var(--accent); border-color: rgba(99,102,241,0.2); }
.wrong-export-btn:hover { background: rgba(99,102,241,0.12); }

.wrong-group { margin-bottom: var(--space-lg); animation: modCardStaggerIn 0.25s ease both; }

.wrong-group-header {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: 10px var(--space-md);
  margin-bottom: var(--space-md);
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-lg);
  background: rgba(99,102,241,0.04);
  transition: background var(--transition-fast);
}
.wrong-group-header:hover {
  background: rgba(99,102,241,0.07);
}

.wg-color-bar {
  width: 4px; height: 20px; border-radius: 2px;
  flex-shrink: 0;
}

.wg-chevron {
  width: 16px; height: 16px;
  flex-shrink: 0;
  color: var(--text-tertiary);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.wrong-group-header h3 { font-size: 0.95rem; font-weight: 700; color: var(--text-primary); flex: 1; }

.wg-count {
  font-size: 0.78rem; font-weight: 700; padding: 2px 10px;
  border-radius: var(--radius-full); opacity: 0.8;
}

/* 折叠态 */
.wg-collapsed .wg-items {
  display: none;
}
.wg-collapsed .wg-chevron {
  transform: rotate(-90deg);
}

/* ===== 错题/掌握卡片 v3.0 ===== */
.wrong-item {
  padding: var(--space-lg); background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  margin-bottom: var(--space-md);
  transition: all 0.2s cubic-bezier(0.23, 1, 0.32, 1);
  cursor: pointer; overflow: hidden; position: relative;
  box-shadow: var(--shadow-sm);
}
/* 渐变边框 */
.wrong-item::before {
  content:''; position:absolute; inset:0; border-radius:inherit; padding:1.5px;
  background: linear-gradient(135deg, transparent 30%, var(--border), transparent 70%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity:0; transition: opacity 0.2s ease; pointer-events:none; z-index:2;
}

.wrong-item:hover { transform: translateY(-3px); box-shadow: 0 12px 32px -8px rgba(0,0,0,0.06); border-color: var(--border-hover); }
.wrong-item:hover::before { opacity: 1; }

.wrong-item.expanded { transform: none; box-shadow: var(--shadow-lg); border-color: var(--border-hover); }
.wrong-item.expanded::before { opacity:1; background: linear-gradient(135deg, var(--border-hover), transparent 80%); }

/* 已掌握绿色主题 */
.wi-mastered { --wi-accent: #22c55e; }
.wi-mastered:hover { border-color: var(--border-hover); box-shadow: 0 12px 32px -8px rgba(0,0,0,0.06); }
.wi-mastered.expanded { border-color: #22c55e; }
.wi-mastered.expanded::before { background: linear-gradient(135deg, #22c55e, transparent 80%); }

/* 卡片顶部：问题 + 展开箭头 */
.wi-top { display: flex; align-items: flex-start; gap: var(--space-md); position: relative; z-index: 1; }
.wi-pin { color: var(--warning); font-size: 1rem; line-height: 1.6; flex-shrink: 0; margin-top: 2px; }

.wi-chevron {
  width: 18px; height: 18px; flex-shrink: 0;
  color: var(--text-tertiary);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 4px; opacity: 0.5;
}
.wrong-item.expanded .wi-chevron { transform: rotate(180deg); opacity: 1; }

.wrong-q { font-size: 1rem; line-height: 1.75; color: var(--text-primary); font-weight: 500; flex: 1; min-width: 0; }

.wrong-item .wrong-a {
  font-size: 0.88rem; color: var(--text-secondary); line-height: 1.7;
  display: none; padding-top: var(--space-md);
  border-top: 1px dashed var(--border); animation: fadeSlideIn 0.2s ease;
}
.wrong-item.expanded .wrong-a { display: block; }

.wrong-e { font-size: 0.8rem; color: var(--text-tertiary); margin-top: 6px; display: none; }
.wrong-item.expanded .wrong-e { display: block; }

.wrong-item .wrong-meta {
  display: flex; align-items: center; gap: var(--space-md);
  font-size: 0.75rem; color: var(--text-tertiary);
  margin-top: var(--space-md); padding-top: var(--space-sm);
}
.wm-time { opacity: 0.7; }
.wm-source { flex: 1; }

/* 操作按钮 */
.wrong-item-actions { display: flex; gap: var(--space-xs); margin-left: auto; }
.wi-action-btn {
  padding: 5px 12px; border: 1px solid var(--border); border-radius: var(--radius-full);
  background: none; cursor: pointer;
  font-size: 0.75rem; font-weight: 500; color: var(--text-secondary);
  transition: all 0.15s ease; display: flex; align-items: center; gap: 4px;
}
.wi-action-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.wi-btn-pin:hover { background: rgba(245,158,11,0.08) !important; color: #f59e0b !important; }
.wi-btn-del:hover { background: rgba(239,68,68,0.06) !important; color: #ef4444 !important; }
.wi-btn-unmaster:hover { background: rgba(34,197,94,0.06) !important; color: #22c55e !important; }

/* --- 回顾笔记 --- */
.retrospect-layout {
  display: flex;
  gap: var(--space-lg);
  min-height: calc(100vh - var(--nav-height) - 120px);
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
}

.sidebar-tree {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.tree-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px var(--space-md);
  cursor: pointer;
  font-size: 0.88rem;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border-light);
}

.tree-item:last-child { border-bottom: none; }

.tree-item:hover { background: var(--bg-hover); }

.tree-item.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 500;
}

.tree-item .tree-toggle {
  width: 16px;
  font-size: 0.7rem;
  color: var(--text-tertiary);
  transition: transform var(--transition-fast);
}

.tree-item .tree-toggle.open { transform: rotate(90deg); }

.tree-children .tree-item {
  padding-left: var(--space-xl);
}

.editor-area {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.editor-toolbar {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
  align-items: center;
}

.editor-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.editor-content textarea {
  flex: 1;
  width: 100%;
  min-height: 400px;
  padding: var(--space-lg);
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-family: "Cascadia Code", "Fira Code", "JetBrains Mono", monospace;
  font-size: 0.9rem;
  line-height: 1.7;
  resize: none;
}

.editor-preview {
  padding: var(--space-lg);
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.editor-preview h1 { font-size: 1.5rem; margin-bottom: var(--space-md); }
.editor-preview h2 { font-size: 1.2rem; margin: var(--space-lg) 0 var(--space-sm); }
.editor-preview h3 { font-size: 1.05rem; margin: var(--space-md) 0 var(--space-sm); }
.editor-preview p { margin-bottom: var(--space-sm); }
.editor-preview ul, .editor-preview ol { padding-left: var(--space-lg); margin-bottom: var(--space-sm); }
.editor-preview code { background: var(--bg-tertiary); padding: 2px 6px; border-radius: 4px; font-size: 0.85em; }
.editor-preview pre { background: var(--bg-tertiary); padding: var(--space-md); border-radius: var(--radius-sm); overflow-x: auto; margin-bottom: var(--space-md); }
/* 全局表格样式（闪卡答案、编辑器预览等场景共用） */
table { width: 100%; border-collapse: collapse; margin: var(--space-sm) 0 var(--space-md); }
th, td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; font-size: 0.88rem; }
th { background: var(--bg-tertiary); font-weight: 600; }
tr:nth-child(even) { background: var(--bg-tertiary); }
.editor-preview hr { border: none; border-top: 1px solid var(--border); margin: var(--space-lg) 0; }
.editor-preview blockquote { border-left: 3px solid var(--accent); padding-left: var(--space-md); color: var(--text-secondary); margin-bottom: var(--space-md); }

/* --- 模态框内表单 --- */
.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 11px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
  background: var(--bg-primary);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-tertiary);
  opacity: 0.8;
}

.form-group textarea { min-height: 100px; resize: vertical; line-height: 1.6; }

.form-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}

/* --- 空状态 v3.0 --- */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
  color: var(--text-tertiary);
}

.empty-icon-wrap {
  width: 120px; height: 100px; margin: 0 auto var(--space-xl);
  animation: emptyFloat 2.5s ease-in-out infinite;
}
.empty-icon-wrap svg { width: 100%; height: 100%; }

@keyframes emptyFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* 兼容旧版 emoji 空图标 */
.empty-state .empty-icon {
  font-size: 4rem; margin-bottom: var(--space-lg);
  animation: emptyBounce 2s ease-in-out infinite; display: inline-block;
}

@keyframes emptyBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-4px) scale(1.02); }
}

.empty-state h3 {
  font-size: 1.15rem; font-weight: 700; color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}
.empty-state p {
  font-size: 0.92rem; line-height: 1.6; opacity: 0.8;
}

/* --- 统计条（旧版保留兼容） --- */

/* --- 响应式 --- */
@media (max-width: 768px) {
  :root {
    --space-lg: 16px;
    --space-xl: 24px;
    --nav-height: 56px;
  }

  /* ===== 闪卡提示箭头隐藏 ===== */
  .card-hint-left, .card-hint-right {
    display: none !important;
  }

  /* ===== 页面容器 ===== */
  #page-container {
    padding: calc(var(--nav-height) + var(--space-md)) var(--space-md) var(--space-xl);
  }

  /* ===== 首页卡片 ===== */
  .home-page .card-grid {
    gap: var(--space-md);
  }
  .home-page .card {
    min-height: 130px;
    padding: var(--space-md) var(--space-lg);
  }
  .home-page .card-icon {
    width: 44px; height: 44px;
    font-size: 1.5rem;
  }

  /* ===== 标题 ===== */
  .page-header h1 { font-size: 1.1rem; }

  /* ===== 统计条 ===== */
  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
    padding: var(--space-md);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-lg);
  }
  .stat-item { min-height: 60px; padding: var(--space-sm); }
  .stat-item .stat-value { font-size: 1.1rem; }
  .stat-icon { width: 16px; height: 16px; margin-bottom: 2px; }
  .stat-item .stat-label { font-size: 0.6rem; }

  /* ===== 模块页（平板）===== */
  .mod-header { gap: var(--space-md); }
  .mod-stats-row { grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); }
  .mod-stat { padding: var(--space-sm) var(--space-md); min-height: 56px; }
  .mod-stat-icon { width: 32px; height: 32px; }
  .mod-stat-icon svg { width: 16px; height: 16px; }
  .mod-stat-num { font-size: 1.05rem; }
  .mod-stat-lbl { font-size: 0.62rem; }

  .mod-grid { grid-template-columns: 1fr 1fr; gap: var(--space-sm); }
  .mod-card-inner { padding: var(--space-sm) var(--space-md); gap: var(--space-sm); min-height: 80px; }
  .mod-card-icon-wrap { width: 38px; height: 38px; flex-shrink: 0; }
  .mod-card-icon-wrap svg { width: 18px; height: 18px; }
  .mod-card-info h3 { font-size: 0.88rem; }
  .mod-card-info p { font-size: 0.72rem; }

  /* ===== 书籍列表 ===== */
  .card-grid {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }
  .card {
    padding: var(--space-md) var(--space-lg);
  }
  .card h3 { font-size: 0.9rem; }

  /* ===== 章节网格 ===== */
  .ch-grid { grid-template-columns: 1fr 1fr; gap: var(--space-xs); }
  .ch-card-inner { padding: var(--space-md); min-height: 96px; }
  .ch-name { font-size: 0.88rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .ch-count { font-size: 0.75rem; }

  /* ===== 复习卡片 ===== */
  .review-card {
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
  }
  .review-card-question {
    padding: var(--space-md) var(--space-sm) var(--space-sm);
  }
  .review-card-label {
    font-size: 0.6rem;
    padding: 2px 8px;
    letter-spacing: 1.2px;
  }
  .review-card-label::before { left: 5px; width: 4px; height: 4px; }
  .review-card-content {
    font-size: 0.9rem;
    line-height: 1.65;
  }
  .review-card-toggle {
    padding: 12px var(--space-sm);
    font-size: 0.82rem;
  }
  .review-card-answer.expanded .review-card-answer-body {
    padding: var(--space-sm);
  }
  .review-card-explanation {
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-md);
    font-size: 0.82rem;
  }
  .page-title-row { gap: var(--space-sm); }

  /* ===== 按钮组（被520px的grid覆盖，这里保留基础） ===== */
  .flashcard-actions {
    flex-direction: column;
    width: 100%;
    max-width: 100%;
  }

  /* ===== 错题本移动端 ===== */
  .wrong-stats-row { grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); }
  .wrong-stat-card { padding: var(--space-sm); }
  .wrong-stat-num { font-size: 1rem; }
  .wrong-toolbar { flex-direction: column; align-items: stretch; }
  .wrong-search-wrap { min-width: 100%; }
  .wrong-filters, .wrong-group-tabs { justify-content: center; }

  /* ===== 其他页面 ===== */
  .retrospect-layout { flex-direction: column; }
  .sidebar { width: 100%; }
  .wrong-item .wrong-meta { flex-wrap: wrap; }
  .wrong-item-actions { width: 100%; justify-content: flex-end; margin-top: var(--space-xs); }
  .editor-toolbar { gap: var(--space-xs); }

  /* ===== 空状态 ===== */
  .empty-icon { font-size: 2rem; }

  /* ===== 回顾笔记模块（手机端适配）====== */
  .retro-container {
    flex-direction: column;
  }

  /* 侧边栏 → 可折叠顶栏（默认展开）*/
  .retro-sidebar {
    width: 100%;
    max-height: 45vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
    box-shadow: none;
    position: relative;
    z-index: auto;
  }
  .retro-sidebar.mobile-collapsed {
    max-height: 0 !important;
    overflow: hidden;
    border-bottom: none;
  }
  .retro-sidebar-header {
    padding-top: var(--space-sm);
  }

  /* 关闭按钮 */
  .retro-sidebar-header-right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
  }
  .retro-sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    flex-shrink: 0;
    transition: all 0.15s;
  }
  .retro-sidebar-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
  }

  /* 移动端顶栏（文档列表触发器 + 当前文档名）*/
  .retro-mobile-doc-bar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    min-height: 44px;
  }
  .retro-sidebar-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.15s;
  }
  .retro-sidebar-toggle:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
  }
  .retro-toggle-icon {
    font-size: 1.1rem;
    line-height: 1;
  }
  .retro-mobile-doc-name {
    font-size: 0.82rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* 主区域圆角恢复 */
  .retro-main {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }
  .retro-editor-wrapper {
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  }

  /* 工具栏换行适配 */
  .retro-toolbar {
    padding: var(--space-xs) var(--space-sm);
    min-height: 44px;
  }
  .doc-title-text {
    max-width: 160px;
    font-size: 0.82rem;
  }
  .doc-path-badge {
    display: none;
  }
  .btn-retro.sm {
    padding: 5px 8px;
    font-size: 0.75rem;
  }

  /* 预览区缩小padding和字体 */
  .retro-preview-area {
    padding: var(--space-sm) var(--space-md);
  }
  .retro-preview-area h1 { font-size: 1.3rem; }
  .retro-preview-area h2 { font-size: 1.1rem; }
  .retro-preview-area h3 { font-size: 0.96rem; }
  .retro-preview-area h4 { font-size: 0.88rem; }
  .retro-preview-area p { font-size: 0.88rem; line-height: 1.7; }
  .retro-preview-area li { font-size: 0.86rem; }
  .retro-preview-area code { font-size: 0.78em; padding: 1px 5px; }
  .retro-preview-area pre {
    padding: var(--space-sm);
    margin: var(--space-sm) 0;
    border-radius: var(--radius-sm);
    font-size: 0.82em;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .pane-label { display: none; }

  /* 表格横向滚动 */
  .retro-preview-area table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: var(--space-sm) -var(--space-md);
    padding: 0 var(--space-md);
    border-radius: var(--radius-sm);
  }
  .retro-preview-area table th,
  .retro-preview-area table td {
    padding: 6px 10px;
    font-size: 0.82rem;
    white-space: nowrap;
  }

  /* 空状态缩小 */
  .retro-no-doc .big-icon { font-size: 2.5rem; }
  .retro-no-doc p { font-size: 0.84rem; }

  /* 树形项目触控优化 */
  .retree-doc { padding: 10px var(--space-lg); }
  .retree-group-header { padding: 11px var(--space-lg); }
  .retree-subject-header { padding: 10px 14px; }
}

@media (min-width: 769px) {
  .nav-btn .btn-label { display: inline; }
}

/* --- 移动端增强：触控与手势 --- */
@media (max-width: 768px) {
  /* 增大所有可点击元素的触控区域 */
  .btn, .nav-btn, .filter-chip, .card, .chapter-card, .module-card {
    min-height: 44px;
    -webkit-user-select: none;
    user-select: none;
  }

  /* 按钮触控友好 */
  .btn {
    padding: 12px 20px;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
  }

  /* 首页标题移动端优化 */
  .home-page .page-header h1 {
    font-size: 1.2rem;
    justify-content: center;
  }

  /* 卡片触控反馈（无 hover 改为 active） */
  .home-page .card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }

  .module-card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }

  /* 搜索弹窗移动端全屏 */
  .search-dialog {
    width: 95%;
    margin-top: -5vh;
    border-radius: var(--radius-xl);
  }

  .overlay {
    padding-top: 8vh;
  }

  /* Toast 移动端底部居中 */
  #toast-container {
    left: var(--space-md);
    right: var(--space-md);
    bottom: var(--space-md);
    align-items: center;
  }

  .toast {
    width: 100%;
    text-align: center;
    justify-content: center;
    font-size: 0.85rem;
    padding: 10px 16px;
  }

  /* 弹窗移动端优化 */
  .modal-dialog {
    width: 95%;
    max-height: 80vh;
    border-radius: var(--radius-xl);
  }

  /* 骨架屏移动端 */
  .skeleton-card {
    min-height: 130px;
    padding: var(--space-md) var(--space-lg);
  }

  .skeleton-icon {
    width: 44px;
    height: 44px;
  }

  /* 底部安全区域 */
  #page-container {
    padding-bottom: calc(var(--space-2xl) + env(safe-area-inset-bottom, 0px));
  }

  /* 表单移动端优化 */
  .form-group input,
  .form-group textarea,
  .form-group select {
    padding: 13px 16px;
    font-size: 16px; /* 防止 iOS 自动缩放 */
  }

  .form-group textarea {
    min-height: 120px;
  }

  .textarea-toolbar {
    padding: 8px;
    gap: 4px;
    flex-wrap: wrap;
  }

  .form-actions {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .form-actions .btn {
    width: 100%;
    text-align: center;
  }

  /* 搜索结果移动端紧凑 */
  .search-result-item {
    padding: var(--space-sm) var(--space-md);
  }

  /* 错题本 Tab 移动端滚动 */
  .wrong-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .wrong-tabs::-webkit-scrollbar { display: none; }

  /* 刷题范围选择移动端 */
  .quiz-scope-list {
    max-height: 40vh;
  }
  .quiz-scope-chapters {
    padding-left: 24px;
  }
  .quiz-book-name,
  .quiz-chapter-name {
    white-space: normal;
    word-break: break-word;
    font-size: 0.82rem;
  }
  .quiz-scope-book-header {
    gap: 8px;
    padding: 6px var(--space-sm);
  }
  .quiz-scope-chapter {
    gap: 6px;
    padding: 4px var(--space-sm);
  }
  .quiz-chapter-count {
    font-size: 0.68rem;
  }
  .quiz-book-count {
    font-size: 0.68rem;
  }
  .quiz-check {
    width: 18px;
    height: 18px;
  }
  .quiz-check-sm {
    width: 15px;
    height: 15px;
  }
  .quiz-toggle-arrow {
    width: 20px;
    height: 20px;
  }
  .quiz-scope-footer {
    padding: var(--space-sm) var(--space-md) var(--space-md);
  }
  .btn-quiz-start {
    width: 100%;
    justify-content: center;
  }
}

/* --- 焦点样式（键盘导航 + 无障碍） --- */
.btn:focus-visible,
.nav-btn:focus-visible,
.filter-chip:focus-visible,
.card:focus-visible,
.module-card:focus-visible,
.chapter-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- 减少动画偏好 --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* --- KaTeX 渲染 --- */
.katex-display {
  margin: var(--space-sm) 0;
  overflow-x: auto;
}

/* --- 滚动条（Apple 风格） --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

::-webkit-scrollbar-corner { background: transparent; }

/* --- 选择器 --- */
::selection {
  background: rgba(0, 122, 255, 0.2);
  color: var(--text-primary);
}

/* ============================================================
   回顾笔记模块 - UI 全面升级
   ============================================================ */

/* --- 基础（桌面/手机共用）--- */
.retro-sidebar-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}
.retro-sidebar-close { display: none; }  /* 桌面端隐藏 */
.retro-mobile-doc-bar { display: none; } /* 桌面端隐藏 */

/* --- 布局 --- */
/* ========== 回顾笔记 v4.0 ========== */
.retro-page {
  animation: fadeSlideIn 0.22s ease;
}

.retro-container {
  display: flex;
  gap: 0;
  min-height: calc(100vh - var(--nav-height) - 140px);
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  background: var(--bg-primary);
}

/* --- 侧边栏 --- */
.retro-sidebar {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.retro-sidebar-header {
  padding: 14px 16px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 6%, var(--bg-secondary)), var(--bg-secondary));
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.retro-sidebar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.retro-sidebar-icon {
  width: 18px; height: 18px;
  color: var(--accent);
  flex-shrink: 0;
}

.retro-sidebar-title {
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--text-primary);
  letter-spacing: 0.3px;
}

.retro-sidebar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.retro-doc-count {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  letter-spacing: 0.3px;
}

.retro-sidebar-close {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-tertiary);
  transition: all 0.12s ease;
}
.retro-sidebar-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.retro-sidebar-close svg { width: 13px; height: 13px; }

.retro-tree {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

/* 树形结构 */
.retree-group { margin-bottom: 2px; }

.retree-group-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
  position: relative;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.retree-group-header::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: height 0.15s ease;
}
.retree-group-header:hover::before { height: 55%; }
.retree-group-header.active::before { height: 75%; }

.retree-group-header:hover { background: var(--bg-hover); }
.retree-group-header.active { background: var(--accent-light); }

/* chevron 箭头 */
.retree-chevron {
  width: 15px; height: 15px;
  color: var(--text-tertiary);
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

/* 文件夹图标 */
.retree-folder-icon {
  width: 15px; height: 15px;
  color: var(--accent);
  opacity: 0.7;
  flex-shrink: 0;
}

.retree-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.retree-count {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--bg-tertiary);
  padding: 1px 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.retree-docs {
  overflow: hidden;
  transition: max-height 0.2s ease;
}
.retree-docs.collapsed { max-height: 0 !important; }

/* 文档项 */
.retree-doc {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 8px 24px;
  cursor: pointer;
  transition: all 0.12s ease;
  font-size: 0.83rem;
  color: var(--text-secondary);
  position: relative;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1px 4px 1px 4px;
}

.retree-file-icon {
  width: 14px; height: 14px;
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: color 0.12s ease;
}

.retree-doc-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.retree-doc:hover { background: var(--bg-hover); color: var(--text-primary); }
.retree-doc:hover .retree-file-icon { color: var(--accent); }
.retree-doc.active {
  background: var(--accent-lighter);
  color: var(--accent);
  font-weight: 550;
}
.retree-doc.active .retree-file-icon { color: var(--accent); }

/* 侧边栏空状态 */
.retro-empty-sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-tertiary);
}

.retro-empty-icon {
  width: 64px; height: 64px;
  opacity: 0.5;
  margin-bottom: 16px;
  animation: gentleBounce 1.5s ease-in-out infinite;
}

@keyframes gentleBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.retro-empty-sidebar p { font-size: 0.84rem; line-height: 1.6; margin-bottom: 4px; }
.retro-empty-sidebar .sub { font-size: 0.78rem; opacity: 0.6; }

/* --- 主内容区 --- */
.retro-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-primary);
}

/* 工具栏 v4.0 */
.retro-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  min-height: 52px;
}

.retro-toolbar-left,
.retro-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.retro-filename-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
}

.retro-filename-icon {
  width: 14px; height: 14px;
  color: var(--accent);
  flex-shrink: 0;
}

.doc-title-text {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-primary);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 按钮系统 v4.0 */
.btn-retro-edit,
.btn-retro-save,
.btn-retro-cancel,
.btn-retro-fullscreen,
.btn-retro-download {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 550;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.23, 1, 0.32, 1);
  white-space: nowrap;
}
.btn-retro-edit svg,
.btn-retro-save svg,
.btn-retro-fullscreen svg,
.btn-retro-download svg { width: 14px; height: 14px; }

.btn-retro-download {
  background: #0ea5e9;
  color: #fff;
  border-color: rgba(14,165,233,0.3);
  box-shadow: 0 2px 8px rgba(14,165,233,0.2);
}
.btn-retro-download:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(14,165,233,0.35);
}

.btn-retro-edit {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border-color: rgba(99,102,241,0.3);
  box-shadow: 0 2px 8px rgba(99,102,241,0.2);
}
.btn-retro-edit:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(99,102,241,0.35);
}

.btn-retro-save {
  background: #10b981;
  color: #fff;
  border-color: rgba(16,185,129,0.3);
  box-shadow: 0 2px 8px rgba(16,185,129,0.2);
}
.btn-retro-save:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(16,185,129,0.35);
}

.btn-retro-cancel {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-retro-cancel:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.btn-retro-fullscreen {
  background: transparent;
  color: var(--text-tertiary);
  border-color: transparent;
  padding: 6px 10px;
}
.btn-retro-fullscreen:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.retro-word-count {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  padding: 3px 10px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  letter-spacing: 0.2px;
}

/* 编辑/预览区 */
.retro-editor-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  overflow: hidden;
  min-height: 0;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-xl) 0;
}

.retro-split-view {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.retro-edit-pane,
.retro-preview-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.retro-edit-pane {
  border-right: 3px solid var(--accent);
  position: relative;
}

.retro-preview-only .retro-edit-pane { display: none; }
.retro-edit-only .retro-preview-pane { display: none; }

.pane-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 7px 16px;
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}
.pane-label-edit { color: var(--warning); }

.retro-editor-textarea {
  flex: 1;
  width: 100%;
  padding: 20px;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text-primary);
  font-family: "Cascadia Code", "Fira Code", "JetBrains Mono", "Consolas", monospace;
  font-size: 0.87rem;
  line-height: 1.78;
  tab-size: 2;
}
.retro-editor-textarea::placeholder { color: var(--text-tertiary); }

/* 预览区 Markdown 渲染样式 */
.retro-preview-area {
  flex: 1;
  overflow-y: auto;
  padding: 28px 36px;
  scroll-behavior: smooth;
  line-height: 1.82;
}

.retro-preview-area h1 {
  font-size: 1.55rem; font-weight: 750;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent);
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.retro-preview-area h2 {
  font-size: 1.28rem; font-weight: 680;
  margin: 28px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.retro-preview-area h3 {
  font-size: 1.08rem; font-weight: 630;
  margin: 22px 0 10px;
  color: var(--text-primary);
}

.retro-preview-area h4 {
  font-size: 0.95rem; font-weight: 600;
  margin: 16px 0 8px;
  color: var(--text-primary);
}

.retro-preview-area p { margin-bottom: 12px; line-height: 1.8; }

.retro-preview-area ul, .retro-preview-area ol {
  padding-left: 24px;
  margin-bottom: 12px;
}

.retro-preview-area li { margin-bottom: 5px; line-height: 1.72; }
.retro-preview-area li > ul, .retro-preview-area li > ol { margin-top: 4px; margin-bottom: 4px; }

.retro-preview-area code {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.84em;
  font-family: "Cascadia Code", "Fira Code", monospace;
  border: 1px solid var(--border);
}

.retro-preview-area pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--border);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.06);
}

.retro-preview-area pre code {
  background: transparent; border: none; padding: 0;
  color: inherit; font-size: 0.87em;
}

.retro-preview-area blockquote {
  border-left: 4px solid var(--accent);
  padding: 12px 18px;
  margin: 16px 0;
  background: var(--accent-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
  font-style: italic;
}

.retro-preview-area hr {
  border: none; border-top: 2px solid var(--border);
  margin: 28px 0;
}

.retro-preview-area strong { font-weight: 720; color: var(--text-primary); }
.retro-preview-area em { color: var(--text-secondary); }

.retro-preview-area a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.retro-preview-area a:hover { color: var(--accent-dark); }

.md-image {
  max-width: 100%;
  border-radius: var(--radius-md);
  margin: 16px 0;
  box-shadow: var(--shadow-sm);
  cursor: zoom-in;
  transition: transform 0.15s ease, box-shadow 0.25s ease;
}
.md-image:hover { transform: scale(1.02); box-shadow: var(--shadow-md); }

/* 表格 */
.retro-preview-area table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 0.89rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.retro-preview-area th,
.retro-preview-area td {
  padding: 11px 15px;
  text-align: left;
  border: 1px solid var(--border);
}
.retro-preview-area thead th {
  background: linear-gradient(135deg, var(--accent-light), var(--bg-tertiary));
  font-weight: 620;
  color: var(--text-primary);
}
.retro-preview-area tbody tr:nth-child(even) td { background: var(--bg-secondary); }
.retro-preview-area tbody tr:hover td { background: var(--accent-light); }

/* 空状态 v4.0 */
.retro-no-doc {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  padding: 48px 24px;
  text-align: center;
  background: linear-gradient(160deg, var(--bg-primary), color-mix(in srgb, var(--accent) 2%, var(--bg-secondary)));
}

.retro-no-doc-svg {
  width: 120px; height: 100px;
  opacity: 0.45;
  margin-bottom: 24px;
  animation: gentleBounce 1.8s ease-in-out infinite;
}

.retro-no-doc h3 {
  font-size: 1.08rem;
  font-weight: 650;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.retro-no-doc p { font-size: 0.86rem; line-height: 1.65; opacity: 0.7; }

/* 全屏预览覆盖层 */
.fullscreen-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.15s ease;
}

.fullscreen-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.fs-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fs-header-icon {
  width: 17px; height: 17px;
  color: var(--accent);
  flex-shrink: 0;
}

.fs-title {
  font-size: 0.95rem;
  font-weight: 620;
  color: var(--text-primary);
}

.fs-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fullscreen-preview-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  line-height: 1.85;
}
.fullscreen-preview-content img { max-width: 100%; border-radius: var(--radius-md); margin: 16px 0; cursor: zoom-in; }

/* ========== 科目树形结构 ========== */
.retree-subject { margin-bottom: 4px; }
.retree-subject-header {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 12px; cursor: pointer;
  border-radius: var(--radius-md);
  font-weight: 620;
  font-size: 0.87rem;
  transition: all 0.12s ease;
  user-select: none;
}
.retree-subject-header:hover { background: var(--bg-hover); }
.retree-subject-icon { font-size: 1.05rem; }
.retree-subject-header .retree-name { flex: 1; font-weight: 720; font-size: 0.9rem; letter-spacing: 0.3px; }

/* 分组颜色标识 */
.retree-subject[data-subject="chem"] .retree-subject-header { color: #0891b2; }
.retree-subject[data-subject="chem"] .retree-subject-header:hover { background: rgba(236, 254, 255, 0.6); }
.retree-subject[data-subject="bio"] .retree-subject-header { color: #7c3aed; }
.retree-subject[data-subject="bio"] .retree-subject-header:hover { background: rgba(245, 243, 255, 0.6); }

.retree-groups {
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}
.retree-groups.collapsed { max-height: 0 !important; opacity: 0; overflow: hidden; }

/* 文档路径徽章（保留兼容） */
.doc-path-badge {
  font-size: 0.72rem;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

/* 响应式 - 已合并到主 @media 断点中 */

/* ============================================================
   复习总览模块 - Apple 风格
   ============================================================ */

/* --- 页面布局 --- */
.overview-page {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.ov-container {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* --- 侧边栏（目录树）--- */
.ov-sidebar {
  width: 100%;
  background: var(--bg-primary);
  border-right: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all var(--transition-base);
}

.ov-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
  gap: 8px;
}

.ov-sidebar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.ov-sidebar-icon {
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex-shrink: 0;
}

.ov-sidebar-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.ov-sidebar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ov-sidebar-actions {
  display: none;
  align-items: center;
  gap: 6px;
}
.ov-sidebar-actions.ov-visible {
  display: flex;
}

.ov-select-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
}

.ov-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
}
.ov-action-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.ov-action-btn.ov-action-md {
  background: #10b981;
  color: white;
  border-color: transparent;
}
.ov-action-btn.ov-action-md:hover {
  background: #059669;
}
.ov-action-btn.ov-action-print {
  background: var(--accent);
  color: white;
  border-color: transparent;
}
.ov-action-btn.ov-action-print:hover {
  background: var(--accent-hover);
}

.ov-sidebar-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.ov-sidebar-close:hover {
  background: var(--bg-active);
  color: var(--text-primary);
}

/* --- 树形结构 --- */
.ov-tree {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm) 0;
}

/* --- 书籍节点 --- */
.ov-book {
  margin: 2px 0;
}
.ov-book-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  user-select: none;
}
.ov-book-header:hover {
  background: var(--bg-hover);
}
.ov-book-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--accent);
}

/* --- 章节列表 --- */
.ov-chapters {
  overflow: hidden;
  transition: max-height var(--transition-normal), opacity var(--transition-normal);
  max-height: 2000px;
  opacity: 1;
  padding-left: 20px;
}
.ov-chapters.collapsed {
  max-height: 0 !important;
  opacity: 0;
}

/* --- 章节条目 --- */
.ov-chapter,
.ov-file-node {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  user-select: none;
  margin: 2px 0;
}
.ov-chapter:hover,
.ov-file-node:hover {
  background: var(--bg-hover);
}
.ov-chapter.active,
.ov-file-node.active {
  background: rgba(0, 122, 255, 0.08);
  color: var(--accent);
}

/* --- 复选框（对齐刷题模块自定义 check） --- */
.ov-check {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 2px solid var(--border-hover);
  background: transparent;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  transition: all 0.15s cubic-bezier(0.25, 0.1, 0.25, 1);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.ov-check::after {
  content: '';
  position: absolute;
  top: 2px; left: 4px;
  width: 4px; height: 8px;
  border: 2px solid white;
  border-top: none; border-left: none;
  transform: rotate(45deg) scale(0);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ov-check.checked {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 1px 4px rgba(0, 122, 255, 0.25);
}
.ov-check.checked::after {
  transform: rotate(45deg) scale(1);
}
.ov-check:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

/* --- 章节圆点 --- */
.ov-ch-bullet,
.ov-file-bullet {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--ov-color, var(--accent));
  opacity: 0.7;
}

/* --- 章节名称 --- */
.ov-ch-name,
.ov-file-node .ov-name {
  flex: 1;
  font-size: 0.88rem;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 450;
}

/* --- 章节元信息 --- */
.ov-ch-meta,
.ov-meta {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* --- 章节标题（打印用）--- */
.ovc-chapter-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 20px 0 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
  letter-spacing: -0.01em;
  page-break-after: avoid;
}
.ovc-chapter-wrap:first-child > .ovc-chapter-title {
  margin-top: 0;
}

@media print {
  .ovc-chapter-wrap {
    page-break-before: always;
  }
  .ovc-chapter-wrap:first-child {
    page-break-before: auto;
  }
  .ovc-chapter-title {
    margin-top: 0;
    padding-top: 20px;
  }
  .ovc-chapter-wrap:first-child > .ovc-chapter-title {
    padding-top: 0;
  }
}

/* --- 分组节点 --- */
.ov-group {
  margin: 2px 0;
}
.ov-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  user-select: none;
}
.ov-group-header:hover {
  background: var(--bg-hover);
}
.ov-folder-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--warning);
}
.ov-chevron {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  transition: transform var(--transition-normal);
  color: var(--text-tertiary);
}
.ov-group-children {
  overflow: hidden;
  transition: max-height var(--transition-normal), opacity var(--transition-normal);
  max-height: 2000px;
  opacity: 1;
}
.ov-group-children.collapsed {
  max-height: 0 !important;
  opacity: 0;
}
.ov-name {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 550;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ov-count {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* --- 文件夹节点（多层级）--- */
.ov-folder-node {
  margin: 2px 0;
}
.ov-folder-hdr {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  user-select: none;
  padding-left: calc(16px + var(--ov-indent, 0px));
}
.ov-folder-hdr:hover {
  background: var(--bg-hover);
}
.ov-folder-children {
  overflow: hidden;
  transition: max-height var(--transition-normal), opacity var(--transition-normal);
  max-height: 2000px;
  opacity: 1;
}
.ov-folder-children.collapsed {
  max-height: 0 !important;
  opacity: 0;
}

/* --- 下载按钮（overview 页面 hover 显示）--- */
.ov-chapter .ch-card-download-btn,
.ov-chapter .ch-download-btn,
.ov-file-node .ch-card-download-btn,
.ov-file-node .ch-download-btn {
  opacity: 0;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
  flex-shrink: 0;
}
.ov-chapter:hover .ch-card-download-btn,
.ov-chapter:hover .ch-download-btn,
.ov-file-node:hover .ch-card-download-btn,
.ov-file-node:hover .ch-download-btn {
  opacity: 1;
}
.ov-chapter .ch-card-download-btn:hover,
.ov-chapter .ch-download-btn:hover,
.ov-file-node .ch-card-download-btn:hover,
.ov-file-node .ch-download-btn:hover {
  background: rgba(0, 122, 255, 0.1);
  color: var(--accent);
}

/* --- 主内容区 --- */
.ov-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: var(--bg-secondary);
}

.ov-mobile-bar {
  display: none;
}

/* --- 工具栏 --- */
.ov-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-primary);
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
  min-height: 44px;
}

.ov-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ov-filename-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
}
.ov-filename-wrap svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
}
.ov-chapter:hover,
.ov-file-node:hover {
  background: var(--bg-hover);
}
.ov-chapter.active,
.ov-file-node.active {
  background: rgba(0, 122, 255, 0.08);
  color: var(--accent);
  font-weight: 500;
}
.ov-check {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 2px solid var(--border-hover);
  background: transparent;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  transition: all 0.15s cubic-bezier(0.25, 0.1, 0.25, 1);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.ov-check::after {
  content: '';
  position: absolute;
  top: 1px; left: 3px;
  width: 4px; height: 7px;
  border: 2px solid white;
  border-top: none; border-left: none;
  transform: rotate(45deg) scale(0);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ov-check.checked {
  background: var(--accent);
  border-color: var(--accent);
}
.ov-check.checked::after {
  transform: rotate(45deg) scale(1);
}
.ov-ch-bullet,
.ov-file-bullet {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--ov-color, var(--accent));
  opacity: 0.7;
}
.ov-ch-name,
.ov-file-node .ov-name {
  flex: 1;
  font-size: 0.88rem;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 450;
}
.ov-ch-meta,
.ov-meta {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* --- 章节标题（打印用）--- */
.ovc-chapter-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 20px 0 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
  letter-spacing: -0.01em;
  page-break-after: avoid;
}
.ovc-chapter-wrap:first-child > .ovc-chapter-title {
  margin-top: 0;
}

@media print {
  .ovc-chapter-wrap {
    page-break-before: always;
  }
  .ovc-chapter-wrap:first-child {
    page-break-before: auto;
  }
  .ovc-chapter-title {
    margin-top: 0;
    padding-top: 20px;
  }
  .ovc-chapter-wrap:first-child > .ovc-chapter-title {
    padding-top: 0;
  }
}

/* --- 文件夹节点（多层级）--- */
.ov-folder-node {
  margin: 2px 0;
}
.ov-folder-hdr {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  user-select: none;
  padding-left: calc(16px + var(--ov-indent, 0px));
}
.ov-folder-hdr:hover {
  background: var(--bg-hover);
}
.ov-folder-children {
  overflow: hidden;
  transition: max-height var(--transition-normal), opacity var(--transition-normal);
  max-height: 2000px;
  opacity: 1;
}
.ov-folder-children.collapsed {
  max-height: 0 !important;
  opacity: 0;
}


/* --- 主内容区 --- */
.ov-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: var(--bg-secondary);
}

.ov-mobile-bar {
  display: none;
}

/* --- 工具栏 --- */
.ov-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-primary);
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
  min-height: 44px;
}

.ov-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ov-filename-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}
.ov-filename-wrap svg {
  width: 13px;
  height: 13px;
  color: #06b6d4;
}

.ov-qcount {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
}

.ov-toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* --- 文档内容区 --- */
.ov-doc-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  scroll-behavior: smooth;
}

/* --- 题目文档块（紧凑列表版）--- */
.ovc-list {
  display: flex; flex-direction: column; gap: 3px;
}

.ovc-item {
  display: flex; gap: 8px;
  padding: 5px 6px;
  border-radius: var(--radius-sm);
  page-break-inside: avoid;
  break-inside: avoid;
}
.ovc-item:hover { background: var(--bg-hover); }
.ovc-reviewed { background: var(--success-light); }
[data-theme="dark"] .ovc-reviewed { background: rgba(16,185,129,0.05); }
.ovc-reviewed:hover { background: rgba(16,185,129,0.12); }

.ovc-num {
  flex-shrink: 0; width: 24px; text-align: right;
  font-size: 0.7rem; font-weight: 700;
  color: var(--text-tertiary); padding-top: 2px;
}

.ovc-body { flex: 1; min-width: 0; }

.ovc-q {
  font-size: 0.82rem; line-height: 1.5;
  color: var(--text-primary); font-weight: 550;
  margin-bottom: 1px;
}

.ovc-a {
  font-size: 0.78rem; line-height: 1.45;
  color: var(--accent); margin-bottom: 1px;
}
.ovc-a em { color: var(--text-tertiary); font-style: normal; font-weight: 700; margin-right: 2px; }

.ovc-exp {
  font-size: 0.72rem; line-height: 1.45;
  color: var(--text-secondary); margin-top: 2px;
  padding: 3px 6px;
  background: var(--bg-tertiary); border-radius: 4px;
  border-left: 2px solid var(--accent);
}
.ovc-exp strong { color: var(--accent); font-weight: 650; }

.doc-title-text {
  font-size: 0.85rem; font-weight: 650; color: var(--text-primary);
}

.ov-reviewed {
  font-size: 0.68rem; font-weight: 600;
  color: var(--success); background: var(--success-light);
  padding: 1px 7px; border-radius: var(--radius-full);
}

/* --- 已废弃的旧样式（保留兼容） --- */
.ov-question-block { display: none; }
.ov-q-header { display: none; }
.ov-q-num { display: none; }
.ov-q-body { display: none; }
.ov-q-question,
.ov-q-answer { display: none; }
.ov-q-question strong,
.ov-q-answer strong { display: none; }
.ov-explanation { display: none; }
.ov-explanation strong { display: none; }

/* --- 空状态 --- */
.ov-no-doc {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  color: var(--text-tertiary);
  padding: var(--space-2xl);
}
.ov-no-doc svg {
  width: 120px;
  height: auto;
  opacity: 0.4;
}
.ov-no-doc h3 {
  font-size: 1rem;
  font-weight: 650;
  color: var(--text-secondary);
}
.ov-no-doc p {
  font-size: 0.82rem;
}

.ov-empty-content {
  text-align: center;
  padding: var(--space-xl);
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.ov-empty-tree {
  text-align: center;
  padding: var(--space-xl);
  color: var(--text-tertiary);
}

/* --- 全屏预览（复用回顾模块）--- */

/* --- 打印样式 - 简洁版：全屏预览模式专用 --- */
@media print {
  /* 基础设置 */
  html, body {
    height: auto;
    overflow: visible;
    margin: 0;
    padding: 0;
    background: white;
  }

  /* 核心策略：隐藏body下所有元素，除了全屏预览overlay */
  body > *:not(.fullscreen-preview-overlay) {
    display: none !important;
  }

  /* 全屏预览overlay容器 - 不占额外空间 */
  .fullscreen-preview-overlay {
    display: block !important;
    position: static !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    min-height: auto !important;
    inset: auto !important;
    background: white !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* 隐藏全屏预览的头部和控制按钮 */
  .fullscreen-preview-header,
  .fullscreen-preview-header *,
  .fs-header-left,
  .fs-title,
  .fs-actions,
  [data-action="close-fullscreen"],
  [data-action="fs-print"] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* 只显示文档正文内容 */
  .fullscreen-preview-content {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    padding: 8px 12px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    height: auto !important;
    overflow: visible !important;
    background: white !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
  }

  /* 确保内容可见 */
  .fullscreen-preview-content * {
    visibility: visible !important;
  }

  /* 角标等特殊元素保持定位 */
  .fullscreen-preview-content sup,
  .fullscreen-preview-content sub {
    position: relative !important;
  }

  /* 问题块样式优化 - 紧凑打印 */
  .ovc-item {
    break-inside: avoid;
    page-break-inside: avoid;
    border-bottom: 1px solid #ddd !important;
    background: white !important;
    color: #111 !important;
    padding: 3px 4px !important;
    gap: 4px !important;
    margin-bottom: 0 !important;
  }
  .ovc-q, .ovc-a, .ovc-exp { color: #111 !important; }
  .ovc-a { color: #222 !important; }
  .ovc-exp {
    background: #f5f5f5 !important;
    border-left-color: #bbb !important;
    padding: 2px 5px !important;
    margin-top: 1px !important;
    font-size: 0.7rem !important;
    line-height: 1.35 !important;
  }
  .ovc-q {
    font-size: 0.78rem !important;
    line-height: 1.35 !important;
    margin-bottom: 0 !important;
  }
  .ovc-a {
    font-size: 0.74rem !important;
    line-height: 1.35 !important;
    margin-bottom: 0 !important;
  }

  .ovc-list {
    display: block !important;
    column-count: 2;
    column-gap: 14px;
  }
  .ovc-list > .ovc-item {
    break-inside: avoid-column;
    display: block !important;
  }
  .ovc-num {
    display: inline; float: left;
    width: auto;
    margin-right: 4px;
    font-size: 0.65rem !important;
    padding-top: 1px !important;
  }
  .ovc-body { display: block; }

  /* 分页控制 */
  h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
  img { max-width: 100%; page-break-inside: avoid; }
  table { page-break-inside: avoid; font-size: 0.72rem !important; }
  code, pre { white-space: pre-wrap; word-break: break-word; }
  a { text-decoration: none; color: inherit !important; }

  .ovc-chapter-wrap {
    page-break-before: always !important;
    break-before: page !important;
  }
  .ovc-chapter-wrap:first-child {
    page-break-before: auto !important;
    break-before: auto !important;
  }
  .ovc-chapter-title {
    margin-top: 0 !important;
    padding-top: 10px !important;
    padding-bottom: 4px !important;
    margin-bottom: 4px !important;
    font-size: 1rem !important;
    border-bottom: 2px solid #333 !important;
  }
  .ovc-chapter-wrap:first-child > .ovc-chapter-title {
    padding-top: 0 !important;
  }

  /* 确保颜色打印 */
  .ovc-num {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* --- 移动端适配 --- */
@media (max-width: 768px) {
  .ov-container {
    flex-direction: column;
  }

  /* 侧边栏 → 可折叠顶栏 */
  .ov-sidebar {
    width: 100%;
    max-height: 42vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
    box-shadow: none;
    z-index: auto;
  }
  .ov-sidebar.mobile-collapsed {
    max-height: 0 !important;
    overflow: hidden;
    border-bottom: none;
  }

  .ov-sidebar-close { display: flex; }

  /* 移动端顶栏 */
  .ov-mobile-bar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 8px var(--space-md);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    min-height: 40px;
  }
  .ov-sidebar-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.15s;
  }
  .ov-sidebar-toggle:hover {
    background: rgba(6,182,212,0.1);
    border-color: #06b6d4;
    color: #0891b2;
  }
  .ov-mobile-name {
    font-size: 0.8rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* 主区域圆角恢复 */
  .ov-main {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  /* 工具栏紧凑 */
  .ov-toolbar {
    padding: 6px 10px;
    min-height: 40px;
  }
  .doc-title-text {
    max-width: 140px;
    font-size: 0.78rem;
  }
  .ov-qcount { font-size: 0.68rem; }
  .ov-reviewed { font-size: 0.62rem; }

  .ov-doc-content {
    padding: 10px 12px;
  }
  .ovc-q { font-size: 0.78rem; }
  .ovc-a { font-size: 0.74rem; }
  .ovc-exp { font-size: 0.68rem; }

  /* 树形项目触控优化 */
  .ov-group-header,
  .ov-book-header,
  .ov-folder-hdr { padding: 9px 12px; }
  .ov-chapter,
  .ov-file-node { padding: 8px 10px; }
}

/* ========== Capacitor 设置弹窗 ========== */

.capacitor-only { display: none !important; }
html.capacitor-app .capacitor-only { display: inline-flex !important; }

.settings-dialog {
  background: var(--surface-strong);
  border-radius: var(--radius-2xl);
  width: 90%;
  max-width: 420px;
  box-shadow: var(--shadow-xl), 0 0 0 0.5px var(--border);
  animation: modalIn 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
  backdrop-filter: saturate(180%) blur(30px);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 0.5px solid var(--border);
}

.settings-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.settings-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  cursor: pointer;
  color: var(--text-tertiary);
  transition: all var(--transition-fast);
}

.settings-close svg { width: 14px; height: 14px; }

.settings-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.settings-body {
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.settings-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

.settings-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

#input-server-url {
  width: 100%;
  padding: 10px 14px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-sizing: border-box;
  letter-spacing: -0.01em;
}

#input-server-url:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}

.settings-hint {
  font-size: 0.78rem;
  color: var(--text-tertiary);
}

.settings-actions {
  display: flex;
  gap: var(--space-sm);
  padding-top: var(--space-sm);
}

.settings-actions .btn {
  flex: 1;
}

.settings-result {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 500;
}

.settings-result.success {
  background: var(--success-light);
  color: #248a3d;
}

.settings-result.error {
  background: var(--danger-light);
  color: #d70015;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  box-shadow: var(--shadow-card-hover);
}

/* ========== 搜索页面 ========== */
.search-page {
  animation: fadeSlideIn 0.22s ease;
}

.search-page-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  padding: var(--space-lg) var(--space-xl);
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  transition: all var(--transition-fast);
  max-width: 680px;
  margin: 0 auto;
}

.search-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}

.search-input-wrap .search-icon {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.search-input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1rem;
  color: var(--text-primary);
  font-weight: 400;
  letter-spacing: -0.01em;
}

.search-input-wrap input::placeholder {
  color: var(--text-tertiary);
}

.search-input-wrap .btn-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.search-input-wrap .btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.search-filter-group {
  padding: var(--space-md) var(--space-xl);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.filter-row {
  display: flex;
  align-items: center;
  gap: var(--space-2xl);
  flex-wrap: wrap;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.filter-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.filter-chips {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* 资料筛选下拉框 */
.book-select-wrap {
  position: relative;
}

.book-select-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-width: 160px;
}

.book-select-btn:hover {
  border-color: var(--accent);
}

.book-select-text {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text-primary);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-select-arrow {
  color: var(--text-tertiary);
  transition: transform var(--transition-fast);
}

.book-select-wrap.open .book-select-arrow {
  transform: rotate(180deg);
}

.book-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 280px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition-fast);
  z-index: 100;
}

.book-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.book-dropdown-search {
  padding: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

.book-dropdown-search input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.82rem;
  outline: none;
  box-sizing: border-box;
}

.book-dropdown-search input:focus {
  border-color: var(--accent);
}

.book-dropdown-list {
  max-height: 300px;
  overflow-y: auto;
  padding: var(--space-xs);
}

.book-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.82rem;
}

.book-option:hover {
  background: var(--bg-hover);
}

.book-option.selected {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
}

.book-option-name {
  flex: 1;
  color: inherit;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-option-meta {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.book-option-count {
  font-size: 0.68rem;
  color: var(--text-tertiary);
  padding: 1px 5px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.book-option-subject {
  font-size: 0.68rem;
  color: var(--text-tertiary);
  padding: 2px 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
}

.book-option-empty {
  padding: var(--space-lg);
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.82rem;
}

.search-page-content {
  padding: var(--space-xl);
  max-width: 800px;
  margin: 0 auto;
}

.search-results-container {
  min-height: 300px;
}

/* 搜索历史 */
.search-history-section {
  margin-bottom: var(--space-2xl);
}

.search-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.search-history-header h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.btn-text {
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 0.78rem;
  cursor: pointer;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.btn-text:hover {
  color: var(--accent);
  background: rgba(0, 122, 255, 0.08);
}

.search-history-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.search-history-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-secondary);
}

.search-history-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.search-history-item svg {
  flex-shrink: 0;
  color: var(--text-tertiary);
}

.search-history-item span {
  flex: 1;
  font-size: 0.88rem;
}

.btn-icon-sm {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  border-radius: var(--radius-full);
  cursor: pointer;
  opacity: 0;
  transition: all var(--transition-fast);
}

.search-history-item:hover .btn-icon-sm {
  opacity: 1;
}

.btn-icon-sm:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* 搜索结果 */
.search-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.results-count {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.results-group {
  margin-bottom: var(--space-2xl);
}

.results-group-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  display: inline-block;
}

.results-group-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.search-result-card {
  padding: var(--space-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.search-result-card:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.result-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.result-badge {
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
}

.result-badge.bio {
  background: rgba(52, 211, 153, 0.15);
  color: #059669;
}

.result-badge.chem {
  background: rgba(99, 102, 241, 0.15);
  color: #4f46e5;
}

.result-location {
  font-size: 0.78rem;
  color: var(--text-tertiary);
}

.result-question {
  font-size: 0.92rem;
  font-weight: 550;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-answer {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 搜索空状态 */
.search-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xl) var(--space-xl);
  text-align: center;
  color: var(--text-tertiary);
}

.search-empty-state svg {
  margin-bottom: var(--space-lg);
  opacity: 0.4;
}

.search-empty-state p {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 0 0 var(--space-sm);
}

.search-empty-state .search-hint {
  font-size: 0.85rem;
}

.search-empty-state.error svg {
  color: var(--danger);
  opacity: 0.6;
}

/* 搜索加载状态 */
.search-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xl);
  gap: var(--space-md);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.search-loading span {
  font-size: 0.9rem;
  color: var(--text-tertiary);
}

/* 搜索高亮 */
.search-highlight {
  background: color-mix(in srgb, var(--warning) 30%, transparent);
  color: var(--text-primary);
  padding: 1px 3px;
  border-radius: 3px;
  font-weight: 600;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .search-page-header {
    padding: var(--space-md);
  }

  .search-input-wrap {
    padding: var(--space-sm) var(--space-md);
  }

  .search-filter-group {
    padding: var(--space-sm) var(--space-md);
  }

  .filter-row {
    flex-direction: column;
    gap: var(--space-md);
  }

  .filter-item {
    width: 100%;
  }

  .filter-chips {
    flex: 1;
  }

  .book-select-wrap {
    flex: 1;
  }

  .book-select-btn {
    width: 100%;
  }

  .book-dropdown {
    min-width: 100%;
    left: auto;
    right: auto;
  }

  .search-page-content {
    padding: var(--space-md);
  }

  .search-result-card {
    padding: var(--space-sm) var(--space-md);
  }

  .result-question {
    font-size: 0.82rem;
  }

  .result-answer {
    font-size: 0.72rem;
  }
}
