:root {
  --bg-main: #0B0F1A;
  --bg-primary: #0B0F1A;
  --bg-secondary: #111827;
  --bg-card: rgba(255,255,255,0.04);
  --bg-card-hover: rgba(255,255,255,0.08);
  --border-glass: rgba(255,255,255,0.08);
  --border-glass-hover: rgba(255,255,255,0.15);
  --text-primary: #F1F0EB;
  --text-secondary: #9CA3AF;
  --text-muted: #6B7280;
  --accent-gold: #D4A853;
  --accent-gold-dim: rgba(212,168,83,0.15);
  --accent-blue: #60A5FA;
  --accent-blue-dim: rgba(96,165,250,0.15);
  --accent-green: #34D399;
  --accent-green-dim: rgba(52,211,153,0.15);
  --accent-red: #F87171;
  --accent-red-dim: rgba(248,113,113,0.15);
  --accent-purple: #A78BFA;
  --accent-purple-dim: rgba(167,139,250,0.15);
  --gradient-gold: linear-gradient(135deg, #D4A853, #F0D78C);
  --gradient-card: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  --shadow-card: 0 8px 32px rgba(0,0,0,0.3);
  --shadow-card-hover: 0 12px 40px rgba(0,0,0,0.4);
  --shadow-dropdown: 0 12px 40px rgba(0,0,0,0.5);
  --nav-bg: rgba(11,15,26,0.8);
  --noise-opacity: 0.03;
  --btn-primary-text: #0B0F1A;
  --scrollbar-track: rgba(255,255,255,0.02);
  --chart-grid: rgba(255,255,255,0.04);
  --chart-border: rgba(255,255,255,0.06);
  --code-bg: rgba(255,255,255,0.06);
  --pre-bg: rgba(255,255,255,0.04);
  --flip-card-bg: var(--bg-card);
  --mindmap-export-bg: #0B0F1A;
}

/* Light theme */
[data-theme="light"] {
  --bg-main: #FAF8F5;
  --bg-primary: #FAF8F5;
  --bg-secondary: #F0EDE8;
  --bg-card: rgba(255,255,255,0.75);
  --bg-card-hover: rgba(255,255,255,0.9);
  --border-glass: rgba(0,0,0,0.08);
  --border-glass-hover: rgba(0,0,0,0.15);
  --text-primary: #1F2937;
  --text-secondary: #4B5563;
  --text-muted: #9CA3AF;
  --accent-gold: #B8860B;
  --accent-gold-dim: rgba(184,134,11,0.1);
  --accent-blue: #2563EB;
  --accent-blue-dim: rgba(37,99,235,0.1);
  --accent-green: #059669;
  --accent-green-dim: rgba(5,150,105,0.1);
  --accent-red: #DC2626;
  --accent-red-dim: rgba(220,38,38,0.1);
  --accent-purple: #7C3AED;
  --accent-purple-dim: rgba(124,58,237,0.1);
  --gradient-gold: linear-gradient(135deg, #B8860B, #D4A853);
  --gradient-card: linear-gradient(135deg, rgba(255,255,255,0.3), rgba(255,255,255,0.1));
  --shadow-card: 0 8px 32px rgba(0,0,0,0.08);
  --shadow-card-hover: 0 12px 40px rgba(0,0,0,0.12);
  --shadow-dropdown: 0 12px 40px rgba(0,0,0,0.15);
  --nav-bg: rgba(250,248,245,0.85);
  --noise-opacity: 0.015;
  --btn-primary-text: #FFFFFF;
  --scrollbar-track: rgba(0,0,0,0.03);
  --chart-grid: rgba(0,0,0,0.06);
  --chart-border: rgba(0,0,0,0.1);
  --code-bg: rgba(0,0,0,0.05);
  --pre-bg: rgba(0,0,0,0.03);
  --flip-card-bg: rgba(255,255,255,0.85);
  --mindmap-export-bg: #FAF8F5;
}

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

body {
  font-family: 'Noto Serif SC', serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Noise texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: var(--noise-opacity);
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
  contain: paint;
}

/* Background gradient blobs */
.bg-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}
.bg-blob-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(212,168,83,0.08), transparent 70%);
  top: -200px; right: -100px;
}
.bg-blob-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(96,165,250,0.06), transparent 70%);
  bottom: -150px; left: -100px;
}
.bg-blob-3 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(167,139,250,0.05), transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}

/* Glassmorphism */
.glass {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.3s ease;
  contain: layout style;
}
.glass:hover {
  border-color: var(--border-glass-hover);
  box-shadow: var(--shadow-card-hover);
}

/* Navigation */
.nav-glass {
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
}
.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  font-size: 14px;
  font-family: 'Noto Serif SC', serif;
  transition: color 0.3s ease, background-color 0.3s ease;
  position: relative;
}
.nav-link:hover, .nav-link.active {
  color: var(--accent-gold);
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--gradient-gold);
  transition: all 0.3s;
  transform: translateX(-50%);
  border-radius: 1px;
}
.nav-link:hover::after, .nav-link.active::after {
  width: 60%;
}

/* Buttons */
.btn-primary {
  background: var(--gradient-gold);
  color: var(--btn-primary-text);
  font-weight: 600;
  padding: 0.625rem 1.5rem;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-family: 'Noto Serif SC', serif;
  transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
}
.btn-primary:hover {
  transform: scale(1.02);
  box-shadow: 0 0 20px rgba(212,168,83,0.3);
}
.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--accent-gold);
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  border-radius: 9999px;
  border: 1px solid rgba(212,168,83,0.3);
  cursor: pointer;
  font-size: 13px;
  font-family: 'Noto Serif SC', serif;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
}
.btn-secondary:hover {
  border-color: var(--accent-gold);
  transform: scale(1.02);
  box-shadow: 0 0 16px rgba(212,168,83,0.15);
}
.btn-secondary:active {
  transform: scale(0.98);
}

.btn-danger {
  background: rgba(248,113,113,0.1);
  color: var(--accent-red);
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  border-radius: 9999px;
  border: 1px solid rgba(248,113,113,0.2);
  cursor: pointer;
  font-size: 13px;
  font-family: 'Noto Serif SC', serif;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
}
.btn-danger:hover {
  background: rgba(248,113,113,0.2);
  border-color: rgba(248,113,113,0.4);
  transform: scale(1.02);
}

.btn-sm {
  padding: 0.4rem 0.875rem;
  font-size: 13px;
}

/* Animations */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 5px rgba(212,168,83,0.1); }
  50% { box-shadow: 0 0 20px rgba(212,168,83,0.2); }
}
@keyframes charFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.fade-in-up {
  animation: fadeInUp 0.5s ease forwards;
  opacity: 0;
}

/* Staggered card animation */
.stagger-card {
  --i: 0;
  animation: fadeInUp 0.5s ease forwards;
  animation-delay: calc(var(--i) * 0.08s);
  opacity: 0;
}

/* Progress bar */
.progress-bar {
  background: var(--bg-card);
  border-radius: 9999px;
  overflow: hidden;
  height: 6px;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 9999px;
  background: var(--gradient-gold);
  background-size: 200% 100%;
  will-change: transform;
  animation: shimmer 3s ease-in-out infinite;
  transition: width 0.6s ease;
}


/* Drag over */
.drag-over {
  border-color: var(--accent-gold) !important;
  background: var(--accent-gold-dim) !important;
}

/* Sidebar items */
.sidebar-item {
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  animation: slideInLeft 0.4s ease forwards;
  opacity: 0;
}
.sidebar-item:hover {
  background: var(--bg-card-hover);
}
.sidebar-item.active {
  background: var(--accent-gold-dim);
  color: var(--accent-gold);
  border-left-color: var(--accent-gold);
}

/* Mastery badges - refined palette */
.mastery-new { background: rgba(129, 140, 248, 0.12); color: #818CF8; }
.mastery-learning { background: rgba(59, 130, 246, 0.12); color: #3B82F6; }
.mastery-review { background: rgba(168, 85, 247, 0.12); color: #A855F7; }
.mastery-familiar { background: rgba(34, 197, 94, 0.12); color: #22C55E; }
.mastery-mastered { background: rgba(16, 185, 129, 0.15); color: #10B981; }

/* Task card */
.task-card {
  transition: all 0.3s ease;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.task-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card-hover);
}
.task-card.completed { opacity: 0.5; }
.task-card.completed .task-title { text-decoration: line-through; }

/* Custom checkbox */
.task-card input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-glass-hover);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  margin-top: 2px;
}
.task-card input[type="checkbox"]:checked {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
}
.task-card input[type="checkbox"]:checked::after {
  content: '';
  display: block;
  width: 5px;
  height: 9px;
  border: solid var(--accent-gold);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin: 1px auto;
}


/* Chart container */
.chart-container {
  position: relative;
  width: 100%;
}

/* Gold gradient text */
.gold-text {
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Brand title — navbar */
.brand-title {
  font-family: 'Noto Serif SC', 'Songti SC', serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.25em;
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
}
/* Brand link — remove underline */
a:has(.brand-title),
.nav-glass a[href="#home"] {
  text-decoration: none;
}

/* Brand title — hero */
.brand-title-hero {
  margin-bottom: 0.75rem;
  font-family: 'Noto Serif SC', 'Songti SC', 'STSong', serif;
  font-size: clamp(52px, 10vw, 80px);
  font-weight: 900;
  letter-spacing: 0.15em;
  line-height: 1.2;
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  display: inline-block;
}

/* Decorative divider */
.gold-divider {
  width: 60px;
  height: 2px;
  background: var(--gradient-gold);
  margin: 1rem auto;
  border-radius: 1px;
}

html {
  scrollbar-width: thin;
  scrollbar-color: var(--accent-gold-dim) transparent;
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: rgba(212,168,83,0.2); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(212,168,83,0.4); }

/* Theme toggle button */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-glass);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  font-size: 16px;
  flex-shrink: 0;
}
.theme-toggle:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  transform: rotate(20deg) scale(1.1);
  box-shadow: 0 0 16px rgba(212,168,83,0.15);
}
.theme-toggle:active {
  transform: rotate(0deg) scale(0.95);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
  transition: transform 0.4s ease;
}
.theme-toggle:hover svg {
  transform: rotate(15deg);
}
/* Hide/show sun/moon based on theme */
.theme-icon-sun { display: none; }
.theme-icon-moon { display: block; }
[data-theme="light"] .theme-icon-sun { display: block; }
[data-theme="light"] .theme-icon-moon { display: none; }




/* ==================== Knowledge Point Cards (Refined) ==================== */
.kp-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: 1rem 1.125rem;
  margin-bottom: 0.75rem;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.kp-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
}

.kp-card.kp-new::before { background: #818CF8; }
.kp-card.kp-learning::before { background: #3B82F6; }
.kp-card.kp-review::before { background: #A855F7; }
.kp-card.kp-familiar::before { background: #22C55E; }
.kp-card.kp-mastered::before { background: #10B981; }

.kp-card:hover {
  border-color: rgba(129, 140, 248, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.kp-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  margin-bottom: 0.5rem;
}

.kp-type-tag {
  font-size: 11px;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.4;
}

.kp-type-fact { background: rgba(59, 130, 246, 0.1); color: #60A5FA; }
.kp-type-causal { background: rgba(168, 85, 247, 0.1); color: #C084FC; }
.kp-type-compare { background: rgba(251, 191, 36, 0.1); color: #FBBF24; }
.kp-type-definition { background: rgba(34, 197, 94, 0.1); color: #4ADE80; }
.kp-type-method { background: rgba(251, 146, 60, 0.1); color: #FB923C; }

.kp-fact-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.7;
  flex: 1;
}

.kp-actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-shrink: 0;
}

.kp-question-row {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
  padding: 0.5rem 0.625rem;
  background: rgba(168, 85, 247, 0.06);
  border-radius: 8px;
  margin-bottom: 0.375rem;
  border-left: 2px solid rgba(168, 85, 247, 0.3);
}

.kp-question-label {
  font-size: 11px;
  font-weight: 700;
  color: #A855F7;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.kp-question-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.kp-answer-hint {
  font-size: 12px;
  color: #34D399;
  padding: 0.375rem 0.625rem;
  background: rgba(52, 211, 153, 0.06);
  border-radius: 6px;
  border-left: 2px solid rgba(52, 211, 153, 0.3);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.kp-status-badge {
  font-size: 11px;
  padding: 0.2rem 0.625rem;
  border-radius: 9999px;
  font-weight: 500;
  flex-shrink: 0;
  line-height: 1.4;
}

/* Flashcard rating buttons */
.rate-btn {
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
  border: 1px solid transparent;
  font-family: 'Noto Serif SC', serif;
}
.rate-btn:hover { transform: scale(1.03); }
.rate-btn:active { transform: scale(0.97); }
.rate-btn-red {
  background: rgba(248,113,113,0.1);
  color: var(--accent-red);
  border-color: rgba(248,113,113,0.2);
}
.rate-btn-red:hover { background: rgba(248,113,113,0.2); box-shadow: 0 0 16px rgba(248,113,113,0.15); }
.rate-btn-yellow {
  background: rgba(251,191,36,0.1);
  color: #FCD34D;
  border-color: rgba(251,191,36,0.2);
}
.rate-btn-yellow:hover { background: rgba(251,191,36,0.2); box-shadow: 0 0 16px rgba(251,191,36,0.15); }
.rate-btn-green {
  background: rgba(52,211,153,0.1);
  color: var(--accent-green);
  border-color: rgba(52,211,153,0.2);
}
.rate-btn-green:hover { background: rgba(52,211,153,0.2); box-shadow: 0 0 16px rgba(52,211,153,0.15); }

/* Filter button active */
.day-card.filter-active {
  background: var(--accent-gold);
  color: #fff;
  border-color: var(--accent-gold);
}

/* Day card active ring */
.day-card.day-card-today {
  border-color: rgba(212,168,83,0.3);
  box-shadow: 0 0 30px rgba(212,168,83,0.08), var(--shadow-card);
}

/* AI glow effect */
.ai-glow {
  background: linear-gradient(135deg, rgba(167,139,250,0.15), rgba(96,165,250,0.15));
  color: var(--accent-purple);
  font-weight: 500;
  padding: 0.375rem 1rem;
  border-radius: 9999px;
  border: 1px solid rgba(167,139,250,0.3);
  cursor: pointer;
  font-size: 12px;
  font-family: 'Noto Serif SC', serif;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  text-decoration: none;
}
.ai-glow:hover {
  border-color: var(--accent-purple);
  transform: scale(1.02);
  box-shadow: 0 0 20px rgba(167,139,250,0.25), 0 0 40px rgba(96,165,250,0.1);
}
.ai-glow:active {
  transform: scale(0.98);
}
.ai-glow:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* AI generated Q&A display */
.ai-qa-block {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: 8px;
  background: rgba(167,139,250,0.06);
  border: 1px solid rgba(167,139,250,0.15);
}
.ai-qa-block .ai-qa-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-purple);
  margin-bottom: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ai-qa-block .ai-qa-question {
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-weight: 500;
}
.ai-qa-block .ai-qa-answer {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Loading spinner */
@keyframes aiSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.ai-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(167,139,250,0.2);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: aiSpin 0.8s linear infinite;
  vertical-align: middle;
}
.ai-spinner-lg {
  width: 24px;
  height: 24px;
  border-width: 3px;
}

/* AI streaming cursor */
.ai-streaming-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent-gold);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: streamBlink 0.8s ease-in-out infinite;
}
@keyframes streamBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* AI style selector dropdown */
.ai-style-selector {
  position: relative;
  display: inline-block;
}
.ai-style-dropdown {
  position: fixed;
  z-index: 500;
  min-width: 180px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass-hover);
  border-radius: 12px;
  box-shadow: var(--shadow-dropdown);
  overflow: hidden;
  animation: fadeInUp 0.2s ease;
}
.ai-style-dropdown-item {
  display: block;
  width: 100%;
  padding: 0.625rem 1rem;
  text-align: left;
  font-size: 13px;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Noto Serif SC', serif;
  transition: all 0.2s;
}
.ai-style-dropdown-item:hover {
  background: rgba(167,139,250,0.1);
  color: var(--accent-purple);
}

/* AI progress bar */
.ai-progress-bar {
  background: rgba(167,139,250,0.1);
  border-radius: 9999px;
  overflow: hidden;
  height: 4px;
  margin-top: 0.5rem;
}
.ai-progress-fill {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-blue));
  transition: width 0.4s ease;
}

/* AI Summary block */
.ai-summary-block {
  margin-top: 0.75rem;
  padding: 1rem;
  border-radius: 10px;
  background: rgba(96,165,250,0.06);
  border: 1px solid rgba(96,165,250,0.15);
  animation: fadeInUp 0.4s ease;
}
.ai-summary-block .ai-summary-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-blue);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.ai-summary-block .ai-summary-content {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.8;
  white-space: pre-wrap;
}

/* Mind Map container */
.mindmap-container {
  margin-top: 0.75rem;
  border-radius: 12px;
  background: rgba(212,168,83,0.04);
  border: 1px solid rgba(212,168,83,0.15);
  overflow: hidden;
  animation: fadeInUp 0.5s ease;
}
.mindmap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: rgba(212,168,83,0.08);
  border-bottom: 1px solid rgba(212,168,83,0.1);
}
.mindmap-header .mindmap-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.mindmap-svg-wrap {
  width: 100%;
  height: 420px;
  position: relative;
  background: radial-gradient(ellipse at center, rgba(212,168,83,0.03) 0%, transparent 70%);
}
.mindmap-svg-wrap svg {
  width: 100%;
  height: 100%;
}
.mindmap-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 13px;
}
.mindmap-actions {
  display: flex;
  gap: 0.375rem;
}
.mindmap-actions button {
  padding: 0.25rem 0.625rem;
  border-radius: 6px;
  font-size: 11px;
  background: rgba(212,168,83,0.1);
  border: 1px solid rgba(212,168,83,0.2);
  color: var(--accent-gold);
  cursor: pointer;
  font-family: 'Noto Serif SC', serif;
  transition: all 0.2s;
}
.mindmap-actions button:hover {
  background: rgba(212,168,83,0.2);
  border-color: var(--accent-gold);
}

/* Settings page styles */
.settings-input {
  width: 100%;
  padding: 0.625rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Noto Serif SC', serif;
  transition: all 0.3s;
  outline: none;
}
.settings-input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(167,139,250,0.1);
}
.settings-input::placeholder {
  color: var(--text-muted);
}
.settings-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}
.settings-select {
  width: 100%;
  padding: 0.625rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Noto Serif SC', serif;
  transition: all 0.3s;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239CA3AF' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
}
.settings-select:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(167,139,250,0.1);
}
.settings-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.preset-btn {
  padding: 0.5rem 1rem;
  border-radius: 10px;
  font-size: 13px;
  font-family: 'Noto Serif SC', serif;
  cursor: pointer;
  transition: all 0.3s;
  border: 1px solid var(--border-glass);
  background: var(--bg-card);
  color: var(--text-secondary);
}
.preset-btn:hover {
  border-color: var(--accent-purple);
  color: var(--accent-purple);
  background: rgba(167,139,250,0.08);
}
.preset-btn.active {
  border-color: var(--accent-purple);
  color: var(--accent-purple);
  background: rgba(167,139,250,0.12);
}

/* ==================== Responsive: Tablet ==================== */
@media (max-width: 768px) {
  body { font-size: 14px; }
  .glass { border-radius: 12px; }

  /* 导航栏适配 */
  .nav-glass { padding: 0 0.5rem !important; }
  .nav-links-wrap {
    gap: 0.125rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap !important;
  }
  .nav-links-wrap::-webkit-scrollbar { display: none; }
  .nav-link { font-size: 12px; padding: 0.375rem 0.5rem; white-space: nowrap; flex-shrink: 0; }
  .brand-title { font-size: 17px; letter-spacing: 0.15em; }
  .theme-toggle { width: 32px; height: 32px; font-size: 14px; flex-shrink: 0; }

  /* 首页卡片适配 */
  .glass[style*="padding: 2.5rem"] { padding: 1.5rem !important; }
  .idiom-char { font-size: 32px !important; }

  /* 主内容区缩减边距 */
  main#app { padding-left: 1rem !important; padding-right: 1rem !important; }

  /* 阅读器布局适配 */
  .reader-layout { flex-direction: column; height: auto; min-height: calc(100vh - 64px); }
  .reader-sidebar {
    width: 100% !important;
    height: auto;
    max-height: 40vh;
    border-right: none;
    border-bottom: 1px solid var(--border-glass);
    order: 2;
  }
  .reader-sidebar.collapsed { max-height: 0; opacity: 0; }
  .reader-sidebar-toggle { display: none; }
  .reader-main { order: 1; }
  .reader-content { padding: 1.25rem 1rem !important; max-width: 100%; }

  /* AI 按钮适配 */
  .ai-glow { font-size: 11px; padding: 0.3rem 0.75rem; }

  /* 知识点卡片适配 */
  .kp-card { padding: 0.75rem 1rem; }
  .kp-fact-text { font-size: 13px; }
}

/* ==================== Responsive: Mobile ==================== */
@media (max-width: 480px) {
  /* 导航栏 */
  .brand-title { font-size: 15px; letter-spacing: 0.1em; }
  .nav-link { font-size: 11px; padding: 0.25rem 0.375rem; }
  .theme-toggle { width: 28px; height: 28px; font-size: 12px; }

  /* 首页 Hero */
  .brand-title-hero { font-size: clamp(36px, 12vw, 56px) !important; margin-bottom: 0.5rem !important; }
  .glass { padding: 1rem !important; border-radius: 10px; }
  .idiom-char { font-size: 26px !important; }

  /* 按钮 */
  .btn-primary, .btn-secondary { padding: 0.5rem 1rem !important; font-size: 13px !important; }
  .btn-sm { font-size: 11px !important; padding: 0.25rem 0.625rem !important; }

  /* AI 按钮 — 允许换行 */
  .ai-glow {
    font-size: 11px;
    padding: 0.3rem 0.625rem;
    white-space: normal;
    text-align: center;
    flex: 1;
    min-width: 0;
  }

  /* 知识点卡片 */
  .kp-card { padding: 0.625rem 0.75rem; border-radius: 10px; }
  .kp-card-header { gap: 0.5rem; }
  .kp-fact-text { font-size: 13px; line-height: 1.6; }
  .kp-question-row { padding: 0.375rem 0.5rem; font-size: 12px; }
  .kp-actions { gap: 0.25rem; }

  /* AI Q&A 块 */
  .ai-qa-block { padding: 0.625rem; }
  .ai-qa-block .ai-qa-question { font-size: 12px; }
  .ai-qa-block .ai-qa-answer { font-size: 12px; }

  /* 学习面板 */
  .study-panel { border-radius: 10px; }
  .study-panel-header { padding: 0.625rem 0.75rem; font-size: 13px; }
  .study-panel-body.open { padding: 0 0.75rem 0.75rem; }

  /* 阅读器内容 */
  .reader-content { padding: 1rem 0.75rem !important; }

  /* 防止水平溢出 */
  .reader-main, .reader-content, .study-panel, .kp-card, .ai-qa-block, .glass {
    max-width: 100%;
    overflow-x: hidden;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  /* 导航栏文字不换行 */
  .nav-glass a, .nav-glass button { white-space: nowrap; }
}

/* marked content styling in dark theme */
.marked-content h1, .marked-content h2, .marked-content h3,
.marked-content h4, .marked-content h5, .marked-content h6 {
  color: var(--text-primary);
  margin-top: 1em;
  margin-bottom: 0.5em;
}
.marked-content p { margin-bottom: 0.75em; }
.marked-content ul, .marked-content ol { padding-left: 1.5em; margin-bottom: 0.75em; }
.marked-content li { margin-bottom: 0.25em; }
.marked-content code { background: var(--code-bg); padding: 0.15em 0.4em; border-radius: 4px; font-size: 0.9em; }
.marked-content pre { background: var(--pre-bg); padding: 1rem; border-radius: 8px; overflow-x: auto; margin-bottom: 0.75em; }
.marked-content blockquote { border-left: 3px solid var(--accent-gold); padding-left: 1rem; color: var(--text-secondary); margin-bottom: 0.75em; }
.marked-content strong { color: var(--accent-gold); }
.marked-content a { color: var(--accent-blue); }
.marked-content hr { border-color: var(--border-glass); margin: 1.5em 0; }

/* ==================== Reader Mode ==================== */
.reader-layout {
  display: flex;
  height: calc(100vh - 64px);
  overflow: hidden;
}

.reader-sidebar {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-glass);
  background: var(--bg-main);
  transition: width 0.3s ease, opacity 0.3s ease;
  overflow: hidden;
}

.reader-sidebar.collapsed {
  width: 0;
  opacity: 0;
  border-right: none;
}

.reader-sidebar-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.reader-sidebar-toggle {
  position: absolute;
  left: 280px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 24px;
  height: 48px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-left: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: left 0.3s ease, color 0.2s;
  font-size: 14px;
}

.reader-sidebar-toggle:hover {
  color: var(--accent-gold);
}

.reader-sidebar-toggle.shifted {
  left: 0;
}

.reader-main {
  flex: 1;
  overflow-y: auto;
  position: relative;
}

.reader-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 2.5rem;
}

.reader-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-glass);
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.reader-body {
  font-size: 16px;
  line-height: 2;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.reader-body p {
  margin-bottom: 1.2em;
  text-indent: 2em;
}

.reader-body h1, .reader-body h2, .reader-body h3, .reader-body h4 {
  color: var(--text-primary);
  margin: 1.5em 0 0.75em;
  text-indent: 0;
}

.reader-body h1 { font-size: 1.5em; }
.reader-body h2 { font-size: 1.3em; }
.reader-body h3 { font-size: 1.15em; }

.reader-body blockquote {
  border-left: 3px solid var(--accent-gold);
  padding-left: 1rem;
  color: var(--text-secondary);
  margin: 1em 0;
}

.reader-body strong { color: var(--accent-gold); }

/* Pure reading mode - clean single-page pagination */
.reader-pure-mode {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--reader-bg, var(--bg-main));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Top bar */
.reader-pure-mode .pure-exit-bar {
  flex-shrink: 0;
  padding: 0.625rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--reader-bg, var(--bg-main));
  border-bottom: 1px solid rgba(128,128,128,0.1);
  opacity: 1;
  transition: opacity 0.3s;
  z-index: 10;
}

.reader-pure-mode.ui-hidden .pure-exit-bar,
.reader-pure-mode.ui-hidden .reader-bottom-bar,
.reader-pure-mode.ui-hidden .reader-progress-bar {
  opacity: 0;
  pointer-events: none;
}

/* Page container - scrollable content area */
.reader-pure-mode .page-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.reader-pure-mode .reader-page {
  min-height: 100%;
  padding: 2rem;
  display: flex;
  justify-content: center;
  box-sizing: border-box;
}

.reader-pure-mode .reader-page-inner {
  max-width: 680px;
  width: 100%;
  font-size: 17px;
  line-height: 2;
  color: var(--reader-text, var(--text-primary));
  letter-spacing: 0.02em;
  padding: 1rem 0 4rem;
  user-select: text;
  -webkit-user-select: text;
}

.reader-pure-mode .reader-page-inner p {
  margin-bottom: 1.2em;
  text-indent: 2em;
}

.reader-pure-mode .reader-page-inner h1,
.reader-pure-mode .reader-page-inner h2,
.reader-pure-mode .reader-page-inner h3,
.reader-pure-mode .reader-page-inner h4 {
  color: var(--reader-text, var(--text-primary));
  margin: 1.5em 0 0.75em;
  text-indent: 0;
}

.reader-pure-mode .reader-page-inner h1 { font-size: 1.4em; }
.reader-pure-mode .reader-page-inner h2 { font-size: 1.25em; }
.reader-pure-mode .reader-page-inner h3 { font-size: 1.1em; }

.reader-pure-mode .reader-page-inner blockquote {
  border-left: 3px solid var(--accent-gold);
  padding-left: 1rem;
  color: var(--reader-text-secondary, var(--text-secondary));
  margin: 1em 0;
}

.reader-pure-mode .reader-page-inner strong { color: var(--accent-gold); }

/* Bottom bar */
.reader-pure-mode .reader-bottom-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.5rem;
  background: var(--reader-bg, var(--bg-main));
  border-top: 1px solid rgba(128,128,128,0.1);
  opacity: 1;
  transition: opacity 0.3s;
  z-index: 10;
}

/* Progress bar */
.reader-pure-mode .reader-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(128,128,128,0.1);
  z-index: 10;
  cursor: pointer;
}

.reader-pure-mode .reader-progress-fill {
  height: 100%;
  background: var(--accent-gold);
  border-radius: 0 2px 2px 0;
  transition: width 0.3s;
}

/* Responsive */
@media (max-width: 600px) {
  .reader-pure-mode .reader-page {
    padding: 1rem;
  }
  .reader-pure-mode .reader-page-inner {
    font-size: 15px;
  }
}

/* Collapsible study panels */
.study-panel {
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1rem;
  background: var(--bg-card);
}

.study-panel-header {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.study-panel-header:hover {
  background: rgba(255,255,255,0.03);
}

.study-panel-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.3s ease;
  padding: 0 1rem;
}

.study-panel-body.open {
  max-height: 2000px;
  padding: 0 1rem 1rem;
}

.study-panel-arrow {
  transition: transform 0.3s;
  font-size: 12px;
  color: var(--text-muted);
}

.study-panel-arrow.open {
  transform: rotate(180deg);
}

/* ==================== Apple Books Style Reader ==================== */
.reader-settings-panel {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 170;
  background: var(--bg-primary);
  border: 1px solid var(--border-glass);
  border-bottom: none;
  border-radius: 16px 16px 0 0;
  padding: 1rem 1.5rem 1.25rem;
  min-width: 340px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
  animation: settingsSlideUp 0.2s ease;
}

@keyframes settingsSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.reader-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.reader-settings-row:last-child {
  margin-bottom: 0;
}

.reader-settings-label {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 60px;
}

.reader-settings-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.reader-settings-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-glass);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.15s;
}

.reader-settings-btn:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.reader-settings-btn.active {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #fff;
}

.reader-theme-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}

.reader-theme-dot:hover {
  transform: scale(1.1);
}

.reader-theme-dot.active {
  border-color: var(--accent-gold);
}

.reader-theme-dot.theme-dark { background: #1a1a2e; }
.reader-theme-dot.theme-warm { background: #f5e6d3; }
.reader-theme-dot.theme-light { background: #ffffff; border: 2px solid #ddd; }
.reader-theme-dot.theme-sepia { background: #f0e4c8; }
.reader-theme-dot.theme-green { background: #c8e6c9; }

.reader-nav-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  font-size: 13px;
  font-family: 'Noto Serif SC', serif;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  transition: color 0.2s;
}

.reader-nav-btn:hover {
  color: var(--accent-gold);
}

.reader-nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

/* Reading themes */
.reader-pure-mode[data-reading-theme="warm"] {
  --reader-bg: #f5e6d3;
  --reader-text: #3e2c1c;
  --reader-text-secondary: #6b5744;
}

.reader-pure-mode[data-reading-theme="light"] {
  --reader-bg: #ffffff;
  --reader-text: #1a1a1a;
  --reader-text-secondary: #666666;
}

.reader-pure-mode[data-reading-theme="sepia"] {
  --reader-bg: #f0e4c8;
  --reader-text: #4a3728;
  --reader-text-secondary: #7a6652;
}

.reader-pure-mode[data-reading-theme="green"] {
  --reader-bg: #c8e6c9;
  --reader-text: #1b3a1b;
  --reader-text-secondary: #3d5a3d;
}

.reader-pure-mode[data-reading-theme="dark"],
.reader-pure-mode:not([data-reading-theme]) {
  --reader-bg: var(--bg-main);
  --reader-text: var(--text-primary);
  --reader-text-secondary: var(--text-secondary);
}

.reader-pure-mode .text-highlight {
  background: rgba(250, 204, 21, 0.35);
}

.reader-pure-mode .text-selection-toolbar {
  background: var(--reader-bg);
  border-color: rgba(128,128,128,0.2);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

/* ==================== Annotation & Notes ==================== */
.text-selection-toolbar {
  position: fixed;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  padding: 0.375rem;
  display: flex;
  gap: 0.25rem;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: toolbarFadeIn 0.15s ease;
  pointer-events: auto;
}

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

.text-selection-toolbar button {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 0.375rem 0.625rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-family: 'Noto Serif SC', serif;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  transition: all 0.15s;
}

.text-selection-toolbar button:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
}

.text-selection-toolbar button.highlight-btn:hover {
  background: rgba(250, 204, 21, 0.15);
  color: #facc15;
}

.text-selection-toolbar button.note-btn:hover {
  background: rgba(96, 165, 250, 0.15);
  color: var(--accent-blue);
}

.text-selection-toolbar button.ai-btn:hover {
  background: rgba(168, 85, 247, 0.15);
  color: var(--accent-purple);
}

/* Highlighted text */
.text-highlight {
  background: rgba(250, 204, 21, 0.25);
  border-radius: 2px;
  padding: 0 2px;
  cursor: pointer;
  transition: background 0.2s;
}

.text-highlight:hover {
  background: rgba(250, 204, 21, 0.4);
}

/* Note marker */
.note-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--accent-blue);
  color: #fff;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 600;
  vertical-align: super;
  margin-left: 2px;
  cursor: pointer;
  transition: transform 0.2s;
}

.note-marker:hover {
  transform: scale(1.2);
}

/* Annotation panel (slide-in from right in pure mode) */
.annotation-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  height: 100vh;
  background: var(--bg-primary);
  border-left: 1px solid var(--border-glass);
  z-index: 150;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0,0,0,0.3);
}

.annotation-panel.open {
  transform: translateX(0);
}

.annotation-panel-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.annotation-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
}

.annotation-item {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.625rem;
  cursor: pointer;
  transition: border-color 0.2s;
}

.annotation-item:hover {
  border-color: var(--accent-gold);
}

.annotation-item .anno-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.annotation-item .anno-note {
  font-size: 12px;
  color: var(--accent-blue);
  background: rgba(96,165,250,0.08);
  padding: 0.375rem 0.625rem;
  border-radius: 6px;
  line-height: 1.5;
}

.annotation-item .anno-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* AI chat dialog */
.ai-chat-dialog {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 420px;
  max-height: 500px;
  background: var(--bg-primary);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  z-index: 160;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  animation: chatSlideIn 0.2s ease;
}

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

.ai-chat-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 320px;
}

.ai-chat-msg {
  font-size: 13px;
  line-height: 1.7;
  padding: 0.625rem 0.875rem;
  border-radius: 10px;
  max-width: 90%;
}

.ai-chat-msg.user {
  background: rgba(96,165,250,0.12);
  color: var(--text-primary);
  align-self: flex-end;
}

.ai-chat-msg.assistant {
  background: var(--bg-card);
  color: var(--text-secondary);
  align-self: flex-start;
  border: 1px solid var(--border-glass);
}

.ai-chat-input {
  padding: 0.75rem;
  border-top: 1px solid var(--border-glass);
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.ai-chat-input input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  font-family: 'Noto Serif SC', serif;
}

.ai-chat-input input:focus {
  border-color: var(--accent-purple);
}

.ai-chat-input button {
  background: var(--accent-purple);
  border: none;
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: 'Noto Serif SC', serif;
  transition: opacity 0.2s;
}

.ai-chat-input button:hover {
  opacity: 0.85;
}

/* Note edit modal */
.note-edit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.note-edit-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  padding: 1.5rem;
}

.note-edit-box textarea {
  width: 100%;
  height: 120px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  padding: 0.75rem;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  font-family: 'Noto Serif SC', serif;
}

.note-edit-box textarea:focus {
  border-color: var(--accent-blue);
}

/* ==================== Exam (题库) ==================== */

/* 1. 题库主容器 */
.exam-container {
  max-width: 820px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  animation: fadeInUp 0.5s ease forwards;
}

/* 2. 题库头部 */
.exam-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-glass);
}
.exam-header-title {
  font-family: 'Playfair Display', 'Noto Serif SC', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}
.exam-header-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.exam-header-total {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.exam-header-total strong {
  color: var(--accent-gold);
  font-size: 1.125rem;
}

/* 3. AI 生成试卷按钮 */
.exam-generate-btn {
  background: var(--gradient-gold);
  color: var(--btn-primary-text);
  font-weight: 600;
  padding: 0.75rem 2rem;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  font-size: 15px;
  font-family: 'Noto Serif SC', serif;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}
.exam-generate-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
}
.exam-generate-btn:hover {
  transform: scale(1.03);
  box-shadow: 0 0 28px rgba(212,168,83,0.35);
}
.exam-generate-btn:hover::before {
  opacity: 1;
}
.exam-generate-btn:active {
  transform: scale(0.98);
}
.exam-generate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 4. 题型分类区块 */
.exam-category {
  margin-bottom: 2.5rem;
  padding-left: 1.25rem;
  border-left: 4px solid var(--border-glass);
  animation: fadeInUp 0.5s ease forwards;
}
.exam-category.cat-objective {
  border-left-color: #60A5FA;
}
.exam-category.cat-subjective {
  border-left-color: #A78BFA;
}
.exam-category.cat-analysis {
  border-left-color: #F59E0B;
}
.exam-category.cat-essay {
  border-left-color: #10B981;
}

/* 5. 分类标题 */
.exam-category-title {
  font-family: 'Playfair Display', 'Noto Serif SC', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.exam-category-title .cat-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.exam-category.cat-objective .cat-icon {
  background: rgba(96,165,250,0.12);
  color: #60A5FA;
}
.exam-category.cat-subjective .cat-icon {
  background: rgba(167,139,250,0.12);
  color: #A78BFA;
}
.exam-category.cat-analysis .cat-icon {
  background: rgba(245,158,11,0.12);
  color: #F59E0B;
}
.exam-category.cat-essay .cat-icon {
  background: rgba(16,185,129,0.12);
  color: #10B981;
}

/* 6. 单道题目卡片 */
.exam-question-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 1.25rem 1.375rem;
  margin-bottom: 1rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.exam-question-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-card);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 0;
}
.exam-question-card > * {
  position: relative;
  z-index: 1;
}
.exam-question-card:hover {
  border-color: var(--border-glass-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}
.exam-question-card:hover::before {
  opacity: 0.5;
}

/* 7. 题号 */
.exam-question-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-gold-dim);
  color: var(--accent-gold);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  font-family: 'Playfair Display', serif;
}

/* 8. 题型标签 */
.exam-question-type {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 0.2rem 0.625rem;
  border-radius: 6px;
  letter-spacing: 0.03em;
  white-space: nowrap;
  line-height: 1.4;
}
.exam-question-type.type-choice {
  background: rgba(96,165,250,0.12);
  color: #60A5FA;
}
.exam-question-type.type-fill {
  background: rgba(167,139,250,0.12);
  color: #A78BFA;
}
.exam-question-type.type-judge {
  background: rgba(251,191,36,0.12);
  color: #FBBF24;
}
.exam-question-type.type-short {
  background: rgba(167,139,250,0.12);
  color: #A78BFA;
}
.exam-question-type.type-analysis {
  background: rgba(245,158,11,0.12);
  color: #F59E0B;
}
.exam-question-type.type-essay {
  background: rgba(16,185,129,0.12);
  color: #10B981;
}

/* 9. 分值显示 */
.exam-question-score {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
  font-weight: 500;
}
.exam-question-score strong {
  color: var(--accent-gold);
  font-size: 14px;
}

/* 题目头部行 */
.exam-question-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.75rem;
}

/* 10. 题目文本 */
.exam-question-text {
  font-size: 15px;
  color: var(--text-primary);
  line-height: 1.85;
  margin-bottom: 0.875rem;
  padding-left: 0;
}

/* 11. 选项列表 */
.exam-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-left: 0;
}

/* 12. 单个选项 */
.exam-option {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.625rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border-glass);
  background: transparent;
  cursor: pointer;
  transition: all 0.25s ease;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.exam-option:hover {
  border-color: var(--border-glass-hover);
  background: var(--bg-card-hover);
}
.exam-option-prefix {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--border-glass-hover);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all 0.25s;
  margin-top: 1px;
}

/* 13. 用户选中的选项 */
.exam-option.selected {
  border-color: rgba(212,168,83,0.4);
  background: var(--accent-gold-dim);
}
.exam-option.selected .exam-option-prefix {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: var(--btn-primary-text);
}

/* 14. 答题输入框 */
.exam-answer-input {
  width: 100%;
  min-height: 80px;
  max-height: 160px;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border-glass);
  background: var(--bg-main);
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Noto Serif SC', serif;
  line-height: 1.7;
  resize: vertical;
  transition: border-color 0.3s, box-shadow 0.3s;
  box-sizing: border-box;
}
.exam-answer-input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(167,139,250,0.1);
}
.exam-answer-input::placeholder {
  color: var(--text-muted);
}

/* 15. 提交区域 */
.exam-submit-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-glass);
}

/* 16. 提交按钮 */
.exam-submit-btn {
  background: var(--gradient-gold);
  color: var(--btn-primary-text);
  font-weight: 600;
  padding: 0.75rem 2.5rem;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  font-size: 15px;
  font-family: 'Noto Serif SC', serif;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.exam-submit-btn:hover {
  transform: scale(1.03);
  box-shadow: 0 0 24px rgba(212,168,83,0.3);
}
.exam-submit-btn:active {
  transform: scale(0.98);
}
.exam-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 17. 得分徽章 */
.exam-score-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 1rem;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
}
.exam-score-badge.badge-excellent {
  background: rgba(16,185,129,0.12);
  color: #10B981;
  border: 1px solid rgba(16,185,129,0.25);
}
.exam-score-badge.badge-good {
  background: rgba(96,165,250,0.12);
  color: #60A5FA;
  border: 1px solid rgba(96,165,250,0.25);
}
.exam-score-badge.badge-pass {
  background: rgba(251,191,36,0.12);
  color: #FBBF24;
  border: 1px solid rgba(251,191,36,0.25);
}
.exam-score-badge.badge-fail {
  background: rgba(248,113,113,0.12);
  color: #F87171;
  border: 1px solid rgba(248,113,113,0.25);
}

/* 18. AI 评分结果卡片 */
.exam-result-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 2rem;
  margin-top: 1.5rem;
  animation: fadeInUp 0.5s ease forwards;
  position: relative;
  overflow: hidden;
}
.exam-result-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-gold);
}
.exam-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.exam-result-title {
  font-family: 'Playfair Display', 'Noto Serif SC', serif;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* 19. 得分数字 */
.exam-result-score {
  font-family: 'Playfair Display', serif;
  font-size: 2.5rem;
  font-weight: 900;
  line-height: 1;
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.exam-result-score-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* 20. 评分详情 */
.exam-result-detail {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
  padding: 1rem;
  background: rgba(167,139,250,0.04);
  border-radius: 10px;
  border: 1px solid rgba(167,139,250,0.1);
  margin-top: 1rem;
}
.exam-result-detail p {
  margin-bottom: 0.5rem;
}
.exam-result-detail p:last-child {
  margin-bottom: 0;
}
.exam-result-detail strong {
  color: var(--accent-gold);
}

/* 21. 加载动画 */
.exam-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 14px;
}
.exam-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(167,139,250,0.15);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: aiSpin 0.8s linear infinite;
}
.exam-loading-text {
  font-size: 13px;
  color: var(--text-secondary);
  animation: glowPulse 2s ease-in-out infinite;
}

/* 22. 章节选择下拉框 */
.exam-chapter-select {
  padding: 0.5rem 2.25rem 0.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: 'Noto Serif SC', serif;
  transition: all 0.3s;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239CA3AF' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
}
.exam-chapter-select:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(167,139,250,0.1);
}
.exam-chapter-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* 23. 答题进度条 */
.exam-progress-bar {
  background: rgba(167,139,250,0.1);
  border-radius: 9999px;
  overflow: hidden;
  height: 6px;
  margin-bottom: 1.5rem;
  position: relative;
}
.exam-progress-fill {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-blue));
  transition: width 0.5s ease;
  position: relative;
}
.exam-progress-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-blue);
  box-shadow: 0 0 8px rgba(96,165,250,0.5);
}
.exam-progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 12px;
  color: var(--text-muted);
}

/* 24. 计时器显示 */
.exam-timer {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.875rem;
  border-radius: 9999px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  font-size: 13px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  font-family: 'Playfair Display', serif;
  letter-spacing: 0.05em;
  transition: all 0.3s;
}
.exam-timer.timer-warning {
  border-color: rgba(248,113,113,0.3);
  color: var(--accent-red);
  background: rgba(248,113,113,0.06);
}
.exam-timer-icon {
  font-size: 14px;
  opacity: 0.7;
}

/* Exam responsive */
@media (max-width: 768px) {
  .exam-container {
    padding: 1rem 0.75rem;
  }
  .exam-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .exam-question-card {
    padding: 1rem;
    border-radius: 12px;
  }
  .exam-question-text,
  .exam-options,
  .exam-answer-input {
    padding-left: 0;
  }
  .exam-result-score {
    font-size: 2rem;
  }
  .exam-result-card {
    padding: 1.25rem;
  }
  .exam-submit-area {
    flex-direction: column;
  }
  .exam-generate-btn {
    width: 100%;
    justify-content: center;
  }
  .exam-submit-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ==================== Performance: Reduce Motion ==================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .bg-blob {
    filter: blur(40px);
  }
  .glass, .nav-glass {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}
