/* =========================================
   学习网 - 全局样式 + 三科主题
   高颜值商用级 CSS
   ========================================= */

/* Google Fonts */
/* Google Fonts — 仅作增强兜底，系统字体优先 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;700&display=swap');

/* =========================================
   CSS 变量 & 主题
   ========================================= */
:root {
  /* 全局 */
  --font-main: 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', 'Noto Sans SC', 'WenQuanYi Micro Hei', sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 3px 10px rgba(0,0,0,0.06);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.10), 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12), 0 8px 32px rgba(0,0,0,0.08);
  --transition: 0.2s ease;
  --transition-fast: 0.12s ease;
  
  /* 底色（更中性，适合中小学通用） */
  --bg-base: #f4f6f8;
  --bg-card: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-overlay: rgba(255,255,255,0.97);
  --text-primary: #1a202c;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border-color: #e5e7eb;
  
  /* 语文主题（暖米+浅绿） */
  --chinese-primary: #4caf7d;
  --chinese-light: #e8f5ee;
  --chinese-accent: #ff8a65;
  --chinese-bg: #faf8f0;
  --chinese-gradient: linear-gradient(135deg, #4caf7d 0%, #81c784 100%);
  
  /* 数学主题（浅蓝+淡青） */
  --math-primary: #42a5d0;
  --math-light: #e3f4fb;
  --math-accent: #7c4dff;
  --math-bg: #f0f7fc;
  --math-gradient: linear-gradient(135deg, #42a5d0 0%, #4dd0e1 100%);
  
  /* 英语主题（暖橙+浅黄） */
  --english-primary: #ff8c42;
  --english-light: #fff3e8;
  --english-accent: #ffd54f;
  --english-bg: #fffaf2;
  --english-gradient: linear-gradient(135deg, #ff8c42 0%, #ffb74d 100%);
  
  /* 奥数主题（紫色） */
  --aoshu-primary: #9b59b6;
  --aoshu-light: #f5eefb;
  --aoshu-accent: #d4a5f5;
  --aoshu-bg: #faf5ff;
  --aoshu-gradient: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
  
  /* 初中语文主题（暖绿） */
  --chinese-mid-primary: #2e7d52;
  --chinese-mid-light: #e6f4ec;
  --chinese-mid-accent: #66bb6a;
  --chinese-mid-bg: #f6faf7;
  --chinese-mid-gradient: linear-gradient(135deg, #2e7d52 0%, #43a047 100%);
  
  /* 初中数学主题（深蓝） */
  --math-mid-primary: #1565c0;
  --math-mid-light: #e3edf9;
  --math-mid-accent: #42a5f5;
  --math-mid-bg: #f4f8fc;
  --math-mid-gradient: linear-gradient(135deg, #1565c0 0%, #1e88e5 100%);
  
  /* 初中英语主题（琥珀） */
  --english-mid-primary: #e6512c;
  --english-mid-light: #fef0eb;
  --english-mid-accent: #ff7043;
  --english-mid-bg: #fef9f7;
  --english-mid-gradient: linear-gradient(135deg, #e6512c 0%, #ef5350 100%);
  
  /* 初中物理主题（靛青） */
  --physics-mid-primary: #006095;
  --physics-mid-light: #e4f1fa;
  --physics-mid-accent: #29b6f6;
  --physics-mid-bg: #f5f9fc;
  --physics-mid-gradient: linear-gradient(135deg, #006095 0%, #039be5 100%);
  
  /* 初中化学主题（紫红） */
  --chemistry-mid-primary: #7b1fa2;
  --chemistry-mid-light: #f3eafa;
  --chemistry-mid-accent: #ab47bc;
  --chemistry-mid-bg: #fbf7fd;
  --chemistry-mid-gradient: linear-gradient(135deg, #7b1fa2 0%, #9c27b0 100%);
  
  /* 高中数学主题（深邃靛蓝） */
  --math-high-primary: #1a237e;
  --math-high-light: #e8eaf6;
  --math-high-accent: #5c6bc0;
  --math-high-bg: #f5f6fc;
  --math-high-gradient: linear-gradient(135deg, #1a237e 0%, #283593 100%);

  /* 高中英语主题（深玫瑰红） */
  --english-high-primary: #b71c1c;
  --english-high-light: #fce4ec;
  --english-high-accent: #ef5350;
  --english-high-bg: #fef8f9;
  --english-high-gradient: linear-gradient(135deg, #b71c1c 0%, #d32f2f 100%);

  /* 高中物理主题（深空蓝） */
  --physics-high-primary: #004d73;
  --physics-high-light: #e0f0f8;
  --physics-high-accent: #0288d1;
  --physics-high-bg: #f2f7fb;
  --physics-high-gradient: linear-gradient(135deg, #004d73 0%, #01579b 100%);

  /* 高中化学主题（深紫罗兰） */
  --chemistry-high-primary: #4a148c;
  --chemistry-high-light: #f3e5f5;
  --chemistry-high-accent: #ab47bc;
  --chemistry-high-bg: #faf5fc;
  --chemistry-high-gradient: linear-gradient(135deg, #4a148c 0%, #6a1b9a 100%);

  /* 高中生物主题（森林绿） */
  --biology-high-primary: #1b5e20;
  --biology-high-light: #e8f5e9;
  --biology-high-accent: #66bb6a;
  --biology-high-bg: #f6faf7;
  --biology-high-gradient: linear-gradient(135deg, #1b5e20 0%, #2e7d32 100%);
  
  /* 默认主题（无学科） */
  --primary: #5b7cfa;
  --primary-light: #eef1ff;
  --primary-gradient: linear-gradient(135deg, #5b7cfa 0%, #7c3aed 100%);
  
  /* 状态色 */
  --success: #4caf50;
  --warning: #ff9800;
  --danger: #ef5350;
  --star-color: #fbbf24;
}

/* 学科主题覆盖 */
body.subject-chinese { --s-primary: var(--chinese-primary); --s-light: var(--chinese-light); --s-accent: var(--chinese-accent); --s-bg: var(--chinese-bg); --s-gradient: var(--chinese-gradient); }
body.subject-math    { --s-primary: var(--math-primary);    --s-light: var(--math-light);    --s-accent: var(--math-accent);    --s-bg: var(--math-bg);    --s-gradient: var(--math-gradient); }
body.subject-english { --s-primary: var(--english-primary); --s-light: var(--english-light); --s-accent: var(--english-accent); --s-bg: var(--english-bg); --s-gradient: var(--english-gradient); }
body.subject-aoshu   { --s-primary: var(--aoshu-primary);   --s-light: var(--aoshu-light);   --s-accent: var(--aoshu-accent);   --s-bg: var(--aoshu-bg);   --s-gradient: var(--aoshu-gradient); }
body.subject-middle_chinese   { --s-primary: var(--chinese-mid-primary); --s-light: var(--chinese-mid-light); --s-accent: var(--chinese-mid-accent); --s-bg: var(--chinese-mid-bg); --s-gradient: var(--chinese-mid-gradient); }
body.subject-middle_math      { --s-primary: var(--math-mid-primary);    --s-light: var(--math-mid-light);    --s-accent: var(--math-mid-accent);    --s-bg: var(--math-mid-bg);    --s-gradient: var(--math-mid-gradient); }
body.subject-middle_english   { --s-primary: var(--english-mid-primary); --s-light: var(--english-mid-light); --s-accent: var(--english-mid-accent); --s-bg: var(--english-mid-bg); --s-gradient: var(--english-mid-gradient); }
body.subject-middle_physics   { --s-primary: var(--physics-mid-primary); --s-light: var(--physics-mid-light); --s-accent: var(--physics-mid-accent); --s-bg: var(--physics-mid-bg); --s-gradient: var(--physics-mid-gradient); }
body.subject-middle_chemistry { --s-primary: var(--chemistry-mid-primary); --s-light: var(--chemistry-mid-light); --s-accent: var(--chemistry-mid-accent); --s-bg: var(--chemistry-mid-bg); --s-gradient: var(--chemistry-mid-gradient); }
body.subject-high_math      { --s-primary: var(--math-high-primary);    --s-light: var(--math-high-light);    --s-accent: var(--math-high-accent);    --s-bg: var(--math-high-bg);    --s-gradient: var(--math-high-gradient); }
body.subject-high_english   { --s-primary: var(--english-high-primary); --s-light: var(--english-high-light); --s-accent: var(--english-high-accent); --s-bg: var(--english-high-bg); --s-gradient: var(--english-high-gradient); }
body.subject-high_physics   { --s-primary: var(--physics-high-primary); --s-light: var(--physics-high-light); --s-accent: var(--physics-high-accent); --s-bg: var(--physics-high-bg); --s-gradient: var(--physics-high-gradient); }
body.subject-high_chemistry { --s-primary: var(--chemistry-high-primary); --s-light: var(--chemistry-high-light); --s-accent: var(--chemistry-high-accent); --s-bg: var(--chemistry-high-bg); --s-gradient: var(--chemistry-high-gradient); }
body.subject-high_biology   { --s-primary: var(--biology-high-primary); --s-light: var(--biology-high-light); --s-accent: var(--biology-high-accent); --s-bg: var(--biology-high-bg); --s-gradient: var(--biology-high-gradient); }

/* =========================================
   全局重置
   ========================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-main);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; outline: none; font-family: inherit; }
input, textarea, select { font-family: inherit; outline: none; border: none; }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* =========================================
   顶部导航栏（旧版 - 保留兼容）
   ========================================= */
.nav-top {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 64px;
  background: var(--bg-overlay);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 22px; font-weight: 900;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.nav-logo .logo-icon { font-size: 28px; }
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition-fast);
}
.nav-link:hover, .nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
}
.nav-user { display: flex; align-items: center; gap: 12px; }

/* =========================================
   统一水平导航栏（新版 - 全站使用）
   ========================================= */
.unified-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  transition: box-shadow 0.2s ease;
}
.unified-nav.scrolled {
  box-shadow: 0 2px 20px rgba(0,0,0,0.08);
}
.unified-nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}

/* 品牌 */
.unified-nav-left {
  display: flex; align-items: center; gap: 14px;
  flex-shrink: 0;
}
.unified-brand {
  display: flex; align-items: center; gap: 8px;
  font-size: 17px; font-weight: 900;
  color: var(--text-primary);
  flex-shrink: 0;
  text-decoration: none;
}
.unified-brand-icon { font-size: 24px; }
.unified-brand-text {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 学段标签页（旧版分段按钮，保留兼容） */
.unified-stage-tabs {
  display: flex;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.unified-stage-tab {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px; font-weight: 600;
  border: none; background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  font-family: inherit;
}
.unified-stage-tab:hover {
  background: rgba(255,255,255,0.6);
  color: var(--text-primary);
}
.unified-stage-tab.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  font-weight: 700;
}

/* 主导航链接 */
.unified-nav-links {
  display: flex; align-items: center; gap: 2px;
  flex: 1; justify-content: center;
}
.unified-nav-link {
  display: flex; align-items: center; gap: 5px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px; font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s ease;
}
.unified-nav-link:hover {
  background: #f1f5f9;
  color: var(--text-primary);
}
.unified-nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.unified-link-icon { font-size: 15px; }

/* ====== v2 下拉菜单系统 ====== */

/* 下拉容器 */
.unified-nav-dropdown {
  position: relative;
  display: flex;
}

/* 下拉触发器（复用 nav-link 样式 + 箭头） */
.unified-dropdown-trigger {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: transparent;
  /* 继承 unified-nav-link 的样式 */
}
.unified-dropdown-trigger .dropdown-arrow {
  font-size: 10px;
  margin-left: 2px;
  transition: transform 0.2s ease;
  opacity: 0.6;
}
.unified-nav-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

/* 下拉菜单面板 */
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: 170px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.04);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 1100;
  display: flex;
  flex-direction: column;
}
.dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* 下拉菜单项 */
.dropdown-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.dropdown-menu .dropdown-item:hover {
  background: var(--bg-secondary);
}
.dropdown-menu .dropdown-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}
.dropdown-item .dropdown-item-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}
.dropdown-item .dropdown-item-sub {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}
.dropdown-menu .dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 8px;
}

/* 旧学段链接样式（保留兼容，已不再使用） */
.unified-stage-link {
  padding: 8px 16px;
  font-size: 14px; font-weight: 600;
  border-radius: 10px;
  background: transparent;
  transition: all 0.18s ease;
}
.unified-stage-link:hover {
  background: #f0f4ff;
  color: var(--primary);
  transform: translateY(-1px);
}
.unified-nav-link.unified-stage-link.active {
  background: var(--primary, #4a6cf7);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(74,108,247,0.25);
}
.unified-nav-link.unified-stage-link.active:hover {
  background: var(--primary, #4a6cf7);
  color: #fff;
  transform: none;
}

/* 顶部栏独立快捷链接（报告入口用） */
.unified-nav-link-solo {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 8px;
  font-size: 16px;
  text-decoration: none;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.unified-nav-link-solo:hover {
  background: #f1f5f9;
  color: var(--text-primary);
}
.unified-nav-link-solo.active {
  background: var(--primary-light);
  color: var(--primary);
}

/* 分隔线 */
.nav-separator {
  display: inline-block;
  width: 1px; height: 22px;
  background: var(--border-color);
  margin: 0 8px;
  align-self: center;
}

/* 右侧用户区 */
.unified-nav-right {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.unified-login-btn, .unified-register-btn {
  font-size: 13px !important;
  padding: 7px 16px !important;
}
.unified-stars-badge {
  display: flex; align-items: center; gap: 3px;
  background: #fffbeb;
  color: #f59e0b;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px; font-weight: 700;
  text-decoration: none;
}
/* 连续学习火焰 */
.unified-streak-badge {
  display: flex; align-items: center; gap: 2px;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px; font-weight: 700;
  transition: all 0.2s ease;
  cursor: default;
  animation: pulse-streak 2s ease-in-out infinite;
}
.unified-streak-badge.streak-warm {
  background: #fff7ed; color: #f97316;
}
.unified-streak-badge.streak-hot {
  background: linear-gradient(135deg, #fef2f2, #fde8e8);
  color: #dc2626;
}
.unified-streak-badge .streak-num {
  font-size: 14px; font-weight: 800;
}
.unified-streak-badge .streak-label {
  font-size: 10px; opacity: 0.8;
}
@keyframes pulse-streak {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
.unified-streak-badge.streak-hot {
  animation: pulse-hot 0.8s ease-in-out infinite;
}
@keyframes pulse-hot {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.05) rotate(-2deg); }
  75% { transform: scale(1.05) rotate(2deg); }
}
.unified-user-badge {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 24px;
  transition: background 0.15s;
  text-decoration: none;
  color: var(--text-primary);
}
.unified-user-badge:hover {
  background: #f1f5f9;
}
.unified-username {
  font-size: 13px; font-weight: 600;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 移动端菜单按钮 */
.unified-mobile-toggle {
  display: none;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  background: #f1f5f9;
  border: none; border-radius: 8px;
  cursor: pointer; flex-shrink: 0;
}
.mobile-toggle-icon { font-size: 18px; }

/* 移动端下拉菜单 */
.unified-mobile-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 999;
}
.unified-mobile-overlay.show { display: block; }
.unified-mobile-menu {
  display: none;
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 280px; max-width: 80vw;
  background: #fff;
  z-index: 1001;
  box-shadow: -4px 0 20px rgba(0,0,0,0.12);
  flex-direction: column;
  padding: 20px 0;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.unified-mobile-menu.open {
  display: flex;
  transform: translateX(0);
}
.mobile-menu-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px 16px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 8px;
}
.mobile-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  font-size: 15px; font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.12s;
}
.mobile-menu-item:hover { background: #f8f9ff; }
.mobile-menu-item.active {
  color: var(--primary);
  background: var(--primary-light);
  font-weight: 600;
}
.mobile-menu-divider {
  height: 1px; background: var(--border-color);
  margin: 8px 20px;
}
.mobile-menu-label {
  padding: 6px 20px 2px;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.mobile-menu-login {
  color: var(--primary) !important;
  font-weight: 700 !important;
}

/* 页面主区域适配统一导航 */
.main-wrap-unified {
  padding-top: 76px;
  min-height: 100vh;
  min-height: 100dvh;
}

/* 响应式适配 */
@media (max-width: 960px) {
  .unified-nav-links {
    gap: 0;
  }
  .unified-nav-link {
    padding: 8px 10px;
    font-size: 12px;
  }
  .unified-dropdown-trigger {
    padding: 8px 10px;
    font-size: 12px;
  }
  .dropdown-menu {
    min-width: 150px;
  }
  .dropdown-menu .dropdown-item {
    padding: 9px 14px;
    font-size: 13px;
  }
  .dropdown-item .dropdown-item-title { font-size: 13px; }
  .nav-separator { margin: 0 4px; height: 18px; }
  .unified-username { display: none; }
}

@media (max-width: 768px) {
  .unified-nav-inner { padding: 0 10px; gap: 6px; }
  .unified-brand-text { display: none; }
  .unified-brand-icon { font-size: 22px; }
  /* 导航精简：4个入口 + 分隔 */
  .unified-nav-links {
    display: flex;
    flex: 1;
    justify-content: center;
    gap: 0;
    overflow: hidden;
  }
  .unified-nav-link {
    padding: 6px 8px;
    font-size: 11px;
    border-radius: 6px;
  }
  .unified-dropdown-trigger {
    padding: 6px 8px;
    font-size: 11px;
    border-radius: 6px;
  }
  .dropdown-menu {
    min-width: 140px;
    border-radius: 12px;
  }
  .dropdown-menu .dropdown-item {
    padding: 8px 12px;
    font-size: 12px;
  }
  .dropdown-item .dropdown-item-title { font-size: 12px; }
  .dropdown-item .dropdown-item-sub { font-size: 10px; }
  .nav-separator { margin: 0 3px; height: 16px; }
  .unified-username { display: none; }
  .unified-nav-right { gap: 6px; }
  .unified-nav-right .btn { font-size: 11px !important; padding: 5px 10px !important; }
  .unified-stars-badge { padding: 4px 8px; font-size: 11px; }
  .unified-mobile-toggle { display: flex; }
  .main-wrap-unified {
    padding-top: 66px;
    padding-bottom: 74px;
  }
}

@media (max-width: 480px) {
  .unified-nav-inner { padding: 0 6px; gap: 3px; }
  .unified-brand-icon { font-size: 20px; }
  /* 超小屏：导航链接只显示 emoji，隐藏文字 */
  .unified-nav-link,
  .unified-dropdown-trigger {
    padding: 5px 7px;
    font-size: 12px;
    border-radius: 7px;
  }
  .stage-link-text { display: none; }
  .unified-dropdown-trigger .dropdown-arrow { display: none; }
  .dropdown-menu {
    min-width: 130px;
    border-radius: 10px;
  }
  .dropdown-menu .dropdown-item {
    padding: 8px 10px;
    font-size: 12px;
  }
  .dropdown-item .dropdown-item-title { font-size: 12px; }
  .dropdown-item .dropdown-item-sub { font-size: 10px; }
  .nav-separator { margin: 0 2px; height: 14px; }
  .unified-login-btn, .unified-register-btn { display: none; }
  .unified-nav-right { gap: 4px; }
  .unified-nav-right .unified-stars-badge {
    padding: 3px 6px; font-size: 10px; border-radius: 14px;
  }
  .unified-mobile-toggle { width: 32px; height: 32px; border-radius: 6px; }
  .mobile-toggle-icon { font-size: 16px; }
  .unified-user-badge { padding: 2px 6px 2px 2px; }
  .unified-user-badge .emoji-avatar { width: 24px !important; height: 24px !important; font-size: 14px !important; }
}

/* Emoji 头像系统 */
.emoji-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #f0f4ff 0%, #e8eeff 100%);
  border: 2px solid var(--primary-light);
  flex-shrink: 0;
  line-height: 1;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.emoji-avatar:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 12px rgba(91,124,250,0.25);
}
.emoji-avatar-nav {
  width: 36px; height: 36px;
  font-size: 20px;
  border-width: 2px;
}
.emoji-avatar-sm {
  width: 28px; height: 28px;
  font-size: 15px;
  border-width: 1.5px;
}
.emoji-avatar-profile {
  width: 90px; height: 90px;
  font-size: 52px;
  border: 4px solid rgba(255,255,255,0.5);
  background: linear-gradient(135deg, #ede9fe 0%, #e0e7ff 50%, #dbeafe 100%);
  box-shadow: 0 4px 20px rgba(91,124,250,0.15);
}
.emoji-avatar-profile:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 28px rgba(91,124,250,0.3);
}

/* ===== XP 等级标识 ===== */
.level-badge {
  display: inline-flex; align-items: center; gap: 3px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1.5px solid #f59e0b;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 11px; font-weight: 800; color: #92400e;
  white-space: nowrap;
}
.xp-progress-mini {
  background: #e5e7eb; border-radius: 6px; height: 4px; overflow: hidden;
}
.xp-progress-mini-fill {
  height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, #f59e0b, #ea580c);
  transition: width 0.5s ease;
}

/* ===== 体力条 ===== */
.stamina-bar-wrap {
  display: flex; align-items: center; gap: 6px;
}
.stamina-bar {
  background: #e5e7eb; border-radius: 6px; height: 6px; overflow: hidden;
  flex: 1; min-width: 40px;
}
.stamina-bar-fill {
  height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, #34d399, #10b981);
  transition: width 0.5s ease;
}
.stamina-bar-fill.low { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.stamina-bar-fill.critical { background: linear-gradient(90deg, #f87171, #ef4444); }
.stamina-label {
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
/* 保留 .nav-avatar / .profile-avatar 兼容性（映射到 emoji） */
.nav-avatar {
  width: 36px; height: 36px;
  font-size: 20px;
}
.nav-stars {
  display: flex; align-items: center; gap: 4px;
  background: #fff8e1; color: #f59e0b;
  padding: 4px 12px; border-radius: 20px;
  font-size: 13px; font-weight: 700;
}

/* =========================================
   主体容器
   ========================================= */
.main-wrap { padding-top: 80px; min-height: 100vh; min-height: 100dvh; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.container-sm { max-width: 640px; margin: 0 auto; padding: 0 20px; }
.container-md { max-width: 900px; margin: 0 auto; padding: 0 20px; }

/* =========================================
   卡片组件
   ========================================= */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  border: 1px solid var(--border-color);
  transition: box-shadow var(--transition-fast);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-sm { padding: 14px 16px; border-radius: var(--radius-md); }
.card-header { margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 15px; font-weight: 700; }

/* =========================================
   按钮
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  border: 1.5px solid transparent;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(91,124,250,0.3); }
.btn-success {
  background: #4caf50;
  color: #fff;
  border-color: #4caf50;
}
.btn-warn {
  background: #ff9800;
  color: #fff;
  border-color: #ff9800;
}
.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
}
.btn-ghost:hover { background: var(--primary-light); }
.btn-lg { padding: 13px 32px; font-size: 15px; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-full { width: 100%; }
.btn-round { border-radius: 50px; }

/* 学科主题按钮 — outline 悬停填色风格 */
.btn-chinese { background: transparent; color: var(--chinese-primary); border: 1.5px solid var(--chinese-primary); }
.btn-chinese:hover { background: var(--chinese-primary); color: #fff; }
.btn-math    { background: transparent; color: var(--math-primary);    border: 1.5px solid var(--math-primary); }
.btn-math:hover    { background: var(--math-primary);    color: #fff; }
.btn-english { background: transparent; color: var(--english-primary); border: 1.5px solid var(--english-primary); }
.btn-english:hover { background: var(--english-primary); color: #fff; }
.btn-aoshu   { background: transparent; color: var(--aoshu-primary);   border: 1.5px solid var(--aoshu-primary); }
.btn-aoshu:hover   { background: var(--aoshu-primary);   color: #fff; }

/* =========================================
   表单控件
   ========================================= */
.form-group { margin-bottom: 20px; }
.form-label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.form-input {
  width: 100%;
  padding: 13px 18px;
  background: #f8f9ff;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 15px;
  color: var(--text-primary);
  transition: var(--transition-fast);
}
.form-input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px var(--primary-light);
}
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }

/* =========================================
   星级评分
   ========================================= */
.stars-display { display: flex; gap: 4px; }
.star-icon { font-size: 20px; transition: var(--transition); }
.star-icon.filled { color: var(--star-color); filter: drop-shadow(0 0 4px rgba(251,191,36,0.5)); }
.star-icon.empty { color: #d1d5db; }

/* =========================================
   进度条
   ========================================= */
.progress-bar {
  height: 12px;
  background: #e9ecef;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}
.progress-fill {
  height: 100%;
  border-radius: 10px;
  background: var(--primary-gradient);
  transition: width 0.6s ease;
  position: relative;
}
.progress-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 0%{transform:translateX(-100%)} 100%{transform:translateX(200%)} }

/* =========================================
   勋章/徽章
   ========================================= */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px; font-weight: 700;
}
.badge-star   { background: #fff8e1; color: #f59e0b; }
.badge-level  { background: var(--primary-light); color: var(--primary); }
.badge-new    { background: #e8f5e9; color: #4caf50; }
.badge-hot    { background: #fce4ec; color: #e91e63; }

/* =========================================
   关卡地图节点
   ========================================= */
.level-node {
  width: 80px; height: 80px;
  border-radius: 50%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  background: #fff;
  box-shadow: var(--shadow-md);
  border: 3px solid transparent;
}
.level-node.locked {
  background: #f3f4f6;
  border-color: #d1d5db;
  cursor: not-allowed;
  filter: grayscale(1) opacity(0.6);
}
.level-node.active {
  border-color: var(--s-primary, var(--primary));
  animation: breathe 2s ease-in-out infinite;
  box-shadow: 0 0 20px rgba(91,124,250,0.3);
}
.level-node.completed {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  border-color: #fbbf24;
  color: #fff;
}
.level-node:not(.locked):hover { transform: scale(1.1) translateY(-4px); }
@keyframes breathe {
  0%,100% { box-shadow: 0 0 10px rgba(91,124,250,0.2); }
  50%      { box-shadow: 0 0 25px rgba(91,124,250,0.5); }
}
.level-node-num { font-size: 14px; font-weight: 800; }
.level-node-stars { display: flex; gap: 2px; font-size: 10px; }
.level-node-lock { font-size: 24px; }

/* =========================================
   答题卡片
   ========================================= */
.question-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-lg);
  border: 2px solid var(--border-color);
}
.question-step-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--s-light, var(--primary-light));
  color: var(--s-primary, var(--primary));
  padding: 6px 16px; border-radius: 20px;
  font-size: 13px; font-weight: 700; margin-bottom: 16px;
}
.question-text { font-size: 18px; font-weight: 600; line-height: 1.8; margin-bottom: 24px; }
.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.option-btn {
  padding: 16px 20px;
  background: #f8f9ff;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: left;
  font-size: 15px; font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  display: flex; align-items: center; gap: 12px;
}
.option-btn:hover:not(.disabled) {
  background: var(--s-light, var(--primary-light));
  border-color: var(--s-primary, var(--primary));
  transform: scale(1.02);
}
.option-btn.selected {
  background: var(--s-light, var(--primary-light));
  border-color: var(--s-primary, var(--primary));
  color: var(--s-primary, var(--primary));
}
.option-btn.correct { background: #e8f5e9; border-color: #4caf50; color: #4caf50; }
.option-btn.wrong   { background: #fff3e0; border-color: #ff9800; color: #ff9800; animation: shake 0.4s ease; }
.option-tag {
  width: 30px; height: 30px; border-radius: 8px;
  background: rgba(0,0,0,0.05);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; flex-shrink: 0;
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

/* 填空输入 */
.fill-input {
  width: 100%;
  padding: 14px 20px;
  background: #f8f9ff;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 16px;
  transition: var(--transition-fast);
  margin-bottom: 16px;
}
.fill-input:focus { border-color: var(--s-primary, var(--primary)); background: #fff; box-shadow: 0 0 0 4px var(--s-light, var(--primary-light)); }

/* =========================================
   AI 对话框（卡通老师样式）
   ========================================= */
.ai-dialog {
  display: flex; gap: 16px; align-items: flex-start;
  margin-bottom: 24px; animation: slideIn 0.4s ease;
}
.ai-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--s-gradient, var(--primary-gradient));
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.ai-bubble {
  background: var(--bg-card);
  border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg);
  padding: 18px 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  max-width: calc(100% - 70px);
  font-size: 15px; line-height: 1.8;
  position: relative;
}
.ai-bubble::before {
  content: '';
  position: absolute;
  top: 14px; left: -10px;
  border: 6px solid transparent;
  border-right-color: var(--bg-card);
}
.ai-bubble p { margin-bottom: 10px; }
.ai-bubble p:last-child { margin-bottom: 0; }
.ai-typing { display: flex; gap: 6px; align-items: center; padding: 8px 0; }
.ai-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--s-primary, var(--primary));
  animation: bounce 1.4s ease-in-out infinite;
}
.ai-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%,80%,100% { transform: scale(0.8); opacity: 0.5; }
  40% { transform: scale(1.2); opacity: 1; }
}
@keyframes slideIn { from { opacity:0; transform: translateY(16px); } to { opacity:1; transform: translateY(0); } }

/* =========================================
   反馈弹窗（答对/答错）
   ========================================= */
.feedback-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.2s ease;
}
.feedback-box {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 36px 40px;
  text-align: center;
  max-width: 380px; width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: popIn 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.feedback-icon { font-size: 60px; margin-bottom: 16px; }
.feedback-title { font-size: 24px; font-weight: 900; margin-bottom: 10px; }
.feedback-msg { font-size: 15px; color: var(--text-secondary); margin-bottom: 24px; line-height: 1.6; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
@keyframes scaleIn { from{transform:scale(0.7);opacity:0} to{transform:scale(1);opacity:1} }
@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity:1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity:0; }
}
@keyframes pulse-streak { 0%,100%{transform:scale(1)} 50%{transform:scale(1.08)} }
@keyframes pulse-hot { 0%,100%{transform:scale(1)} 25%{transform:scale(1.05) rotate(-2deg)} 75%{transform:scale(1.05) rotate(2deg)} }
@keyframes popIn {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* 星星飘落动画 */
.star-rain { position: fixed; pointer-events: none; z-index: 3000; }
.star-particle {
  position: absolute;
  font-size: 20px;
  animation: starFall 1.5s ease-in forwards;
}
@keyframes starFall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(200px) rotate(720deg); opacity: 0; }
}

/* =========================================
   个人中心
   ========================================= */
.profile-hero {
  border-radius: var(--radius-xl);
  padding: 36px;
  background: var(--primary-gradient);
  color: #fff;
  display: flex; align-items: center; gap: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-lg);
}
.profile-avatar-wrap { position: relative; }
.profile-frame {
  position: absolute; inset: -6px;
  border-radius: 50%;
  border: 4px solid #fbbf24;
  pointer-events: none;
}
.profile-name { font-size: 24px; font-weight: 900; }
.profile-level { font-size: 14px; opacity: 0.85; margin-top: 4px; }
.profile-stats { display: flex; gap: 24px; margin-top: 16px; }
.stat-item { text-align: center; }
.stat-num { font-size: 22px; font-weight: 900; }
.stat-label { font-size: 12px; opacity: 0.8; }

/* 勋章墙 */
.badge-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 12px; }
.badge-item {
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px; font-size: 11px; font-weight: 700;
  text-align: center; padding: 8px;
  transition: var(--transition);
}
.badge-item.earned { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #fff; box-shadow: 0 4px 12px rgba(251,191,36,0.4); }
.badge-item.locked { background: #f3f4f6; color: #9ca3af; filter: grayscale(1); }
.badge-icon { font-size: 28px; }
.badge-item:hover { transform: scale(1.08); }

/* =========================================
   错题本
   ========================================= */
.wrong-card {
  border-radius: var(--radius-lg);
  border: 2px solid #fde68a;
  background: #fffbeb;
  padding: 20px 24px;
  margin-bottom: 12px;
  transition: var(--transition-fast);
}
.wrong-card:hover { border-color: #f59e0b; box-shadow: var(--shadow-sm); }
.wrong-tag { display: inline-block; background: #fee2e2; color: #ef4444; padding: 3px 10px; border-radius: 8px; font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.wrong-question { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.wrong-footer { display: flex; align-items: center; justify-content: space-between; }
.wrong-count { font-size: 13px; color: var(--text-muted); }
.mastered-tag { background: #dcfce7; color: #16a34a; padding: 3px 10px; border-radius: 8px; font-size: 12px; font-weight: 700; }

/* =========================================
   骨架屏加载
   ========================================= */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-loading { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
.skeleton-text { height: 16px; margin-bottom: 10px; }
.skeleton-text.w60 { width: 60%; }
.skeleton-text.w80 { width: 80%; }
.skeleton-block { height: 80px; }

/* =========================================
   空状态
   ========================================= */
.empty-state {
  text-align: center; padding: 60px 20px;
}
.empty-icon { font-size: 72px; margin-bottom: 16px; opacity: 0.5; }
.empty-title { font-size: 18px; font-weight: 700; color: var(--text-secondary); margin-bottom: 8px; }
.empty-desc { font-size: 14px; color: var(--text-muted); }

/* =========================================
   Toast 通知
   ========================================= */
#toast-container { position: fixed; top: 80px; right: 20px; z-index: 5000; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 220px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 12px;
  font-size: 14px; font-weight: 500;
  animation: slideRight 0.3s cubic-bezier(0.34,1.56,0.64,1);
  border-left: 4px solid var(--primary);
}
.toast.success { border-color: var(--success); }
.toast.warn    { border-color: var(--warning); }
.toast.error   { border-color: var(--danger); }
@keyframes slideRight { from{transform:translateX(120%);opacity:0} to{transform:translateX(0);opacity:1} }

/* =========================================
   底部导航（移动端）
   ========================================= */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 64px;
  background: var(--bg-overlay);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-color);
  z-index: 1000;
}
.bottom-nav-inner { display: flex; height: 100%; }
.bottom-nav-item {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; font-size: 10px; font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition-fast);
}
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-icon { font-size: 22px; }

/* =========================================
   响应式
   ========================================= */
@media (max-width: 768px) {
  .nav-top { padding: 0 16px; }
  .nav-links { display: none; }
  .bottom-nav { display: flex; }
  .main-wrap { padding-top: 72px; padding-bottom: 74px; }
  .container { padding: 0 12px; }
  .options-grid { grid-template-columns: 1fr; }
  .profile-hero { flex-direction: column; text-align: center; padding: 24px; }
  .profile-stats { justify-content: center; }
  .card { padding: 20px; }
  .question-card { padding: 20px; }
  .btn-lg { padding: 14px 28px; font-size: 16px; }
  .feedback-box { padding: 28px 24px; }
}
@media (max-width: 480px) {
  .level-node { width: 64px; height: 64px; }
  .badge-wall { grid-template-columns: repeat(4, 1fr); }
}

/* =========================================
   页面过渡动画
   ========================================= */
.page-enter {
  animation: pageIn 0.25s ease;
}
@keyframes pageIn { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }

/* 回到顶部 */
.back-top {
  position: fixed; bottom: 90px; right: 20px;
  width: 44px; height: 44px;
  background: var(--bg-card);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md);
  cursor: pointer; z-index: 500;
  transition: var(--transition);
  opacity: 0; pointer-events: none;
}
.back-top.show { opacity: 1; pointer-events: auto; }
.back-top:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

/* =========================================
   暗色模式 — 深蓝主题
   ========================================= */

/* 手动暗色模式 */
:root[data-theme="dark"] {
  --bg-base: #0f172a;
  --bg-card: #1e293b;
  --bg-secondary: #172033;
  --bg-overlay: rgba(15,23,42,0.97);
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #334155;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.40), 0 3px 10px rgba(0,0,0,0.30);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.50), 0 4px 16px rgba(0,0,0,0.40);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.60), 0 8px 32px rgba(0,0,0,0.50);
  --chinese-light: #1a2a1f; --chinese-bg: #0e1a14;
  --math-light: #1b2838; --math-mid-light: #1b2838; --math-mid-bg: #0f1b28;
  --english-light: #30221a; --english-bg: #1e1614;
  --aoshu-light: #221e34; --aoshu-bg: #171424;
  --chinese-mid-light: #1a2a1f; --chinese-mid-bg: #0e1a14;
  --english-mid-light: #30221a; --english-mid-bg: #1e1614;
  --physics-mid-light: #192838; --physics-mid-bg: #0e1b28;
  --chemistry-mid-light: #221e34; --chemistry-mid-bg: #171424;
  --math-high-light: #1c2238; --math-high-bg: #121628;
  --english-high-light: #301e1f; --english-high-bg: #1e1315;
  --physics-high-light: #192c3d; --physics-high-bg: #0e1c2a;
  --chemistry-high-light: #221e34; --chemistry-high-bg: #171424;
  --biology-high-light: #1b2e22; --biology-high-bg: #101e16;
  --primary-light: #1e293b;
}

/* 系统自动暗色（无手动亮色覆盖时） */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-base: #0f172a;
    --bg-card: #1e293b;
    --bg-secondary: #172033;
    --bg-overlay: rgba(15,23,42,0.97);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.40), 0 3px 10px rgba(0,0,0,0.30);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.50), 0 4px 16px rgba(0,0,0,0.40);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.60), 0 8px 32px rgba(0,0,0,0.50);
    --chinese-light: #1a2a1f; --chinese-bg: #0e1a14;
    --math-light: #1b2838; --math-bg: #0f1b28;
    --english-light: #30221a; --english-bg: #1e1614;
    --aoshu-light: #221e34; --aoshu-bg: #171424;
    --chinese-mid-light: #1a2a1f; --chinese-mid-bg: #0e1a14;
    --math-mid-light: #1b2838; --math-mid-bg: #0f1b28;
    --english-mid-light: #30221a; --english-mid-bg: #1e1614;
    --physics-mid-light: #192838; --physics-mid-bg: #0e1b28;
    --chemistry-mid-light: #221e34; --chemistry-mid-bg: #171424;
    --math-high-light: #1c2238; --math-high-bg: #121628;
    --english-high-light: #301e1f; --english-high-bg: #1e1315;
    --physics-high-light: #192c3d; --physics-high-bg: #0e1c2a;
    --chemistry-high-light: #221e34; --chemistry-high-bg: #171424;
    --biology-high-light: #1b2e22; --biology-high-bg: #101e16;
    --primary-light: #1e293b;
  }
}

/* 暗色模式 body 级覆盖 */
:root[data-theme="dark"] body { background: var(--bg-base); color: var(--text-primary); }

/* 暗色骨架屏 */
:root[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
  background-size: 200% 100%;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
  }
}

/* 暗色导航栏 */
:root[data-theme="dark"] .unified-nav { border-bottom-color: #334155; }
:root[data-theme="dark"] .unified-nav-link:hover,
:root[data-theme="dark"] .unified-dropdown-trigger:hover { background: #1e293b; }
:root[data-theme="dark"] .dropdown-menu {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 12px 40px rgba(0,0,0,0.40), 0 2px 8px rgba(0,0,0,0.20);
}
:root[data-theme="dark"] .dropdown-menu .dropdown-item:hover { background: #334155; }
:root[data-theme="dark"] .unified-nav-link-solo:hover { background: #1e293b; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .unified-nav { border-bottom-color: #334155; }
  :root:not([data-theme="light"]) .unified-nav-link:hover,
  :root:not([data-theme="light"]) .unified-dropdown-trigger:hover { background: #1e293b; }
  :root:not([data-theme="light"]) .dropdown-menu {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 12px 40px rgba(0,0,0,0.40), 0 2px 8px rgba(0,0,0,0.20);
  }
  :root:not([data-theme="light"]) .dropdown-menu .dropdown-item:hover { background: #334155; }
  :root:not([data-theme="light"]) .unified-nav-link-solo:hover { background: #1e293b; }
}

/* 暗色切换按钮 */
.theme-toggle-btn {
  background: none; border: none; font-size: 18px; cursor: pointer;
  padding: 6px 8px; border-radius: 8px; transition: var(--transition); line-height: 1;
}
.theme-toggle-btn:hover { background: var(--bg-secondary); }

/* =========================================
   无障碍增强
   ========================================= */

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

/* 全局焦点样式 — 键盘导航可见 */
:focus-visible {
  outline: 3px solid var(--primary, #5b7cfa);
  outline-offset: 2px;
  border-radius: 4px;
}

/* 跳至内容 — 无障碍跳转链接 */
.skip-to-content {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--primary, #5b7cfa);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  z-index: 9999;
  transition: top 0.2s ease;
  text-decoration: none;
}
.skip-to-content:focus {
  top: 8px;
}

/* 屏幕阅读器专用文本 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =========================================
   滚动条美化
   ========================================= */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* 暗色模式滚动条 */
:root[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #475569;
}
:root[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) ::-webkit-scrollbar-thumb {
    background: #475569;
  }
  :root:not([data-theme="light"]) ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
  }
}

/* Firefox 滚动条 */
* {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
:root[data-theme="dark"] * {
  scrollbar-color: #475569 transparent;
}

/* =========================================
   空状态（错题本/成就为空时的引导）
   ========================================= */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}
.empty-state-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.6;
}
.empty-state-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.empty-state-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}
.empty-state .btn {
  display: inline-block;
}
