/* ============================================================
   DSA for AI/ML — Full Design System
   Dark theme, Indigo-Violet accent, Inter font
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Variables ──────────────────────────────────────────── */
:root {
  --bg: #0a0a0f;
  --bg2: #0f0f17;
  --card: #13131a;
  --card2: #1a1a24;
  --border: #ffffff0f;
  --border-hover: #ffffff22;

  --text: #e8e8f0;
  --text-muted: #888899;
  --text-dim: #55556a;

  --indigo: #6366f1;
  --violet: #8b5cf6;
  --blue: #3b82f6;
  --emerald: #10b981;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --cyan: #06b6d4;
  --orange: #f97316;

  --gradient: linear-gradient(135deg, var(--indigo), var(--violet));
  --gradient-glow: linear-gradient(135deg, #6366f133, #8b5cf633);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --shadow: 0 4px 24px #00000040;
  --shadow-card: 0 2px 12px #00000060;

  --font: 'Inter', sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;

  --transition: 0.2s ease;
}

/* Phase Colors */
.phase-1 { --phase-color: #3b82f6; --phase-bg: #3b82f618; }
.phase-2 { --phase-color: #8b5cf6; --phase-bg: #8b5cf618; }
.phase-3 { --phase-color: #10b981; --phase-bg: #10b98118; }
.phase-4 { --phase-color: #f59e0b; --phase-bg: #f59e0b18; }
.phase-5 { --phase-color: #f43f5e; --phase-bg: #f43f5e18; }
.phase-6 { --phase-color: #06b6d4; --phase-bg: #06b6d418; }
.phase-7 { --phase-color: #a78bfa; --phase-bg: #a78bfa18; }
.phase-8 { --phase-color: #f97316; --phase-bg: #f9731618; }
.phase-9 { --phase-color: #ec4899; --phase-bg: #ec489918; }
.phase-10 { --phase-color: #84cc16; --phase-bg: #84cc1618; }
.phase-11 { --phase-color: #6366f1; --phase-bg: #6366f118; }

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: var(--font); }
ul, ol { list-style: none; }
img { max-width: 100%; }
code, pre { font-family: var(--mono); }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: #333345; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #44445a; }

/* ── Typography ─────────────────────────────────────────────── */
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; line-height: 1.2; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }
p { color: var(--text-muted); line-height: 1.8; }

/* ── Layout Utilities ───────────────────────────────────────── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.gap-4 { gap: 16px; } .gap-6 { gap: 24px; } .gap-8 { gap: 32px; }
.grid { display: grid; }

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #0a0a0fcc;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
}
.logo-icon {
  width: 36px; height: 36px;
  background: var(--gradient);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.nav-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.nav-progress-bar {
  width: 120px;
  height: 6px;
  background: var(--card2);
  border-radius: 999px;
  overflow: hidden;
}
.nav-progress-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 999px;
  transition: width 0.5s ease;
}
.nav-actions { display: flex; align-items: center; gap: 8px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
}
.btn-ghost {
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--card2); border-color: var(--border-hover); color: var(--text); }
.btn-primary {
  background: var(--gradient);
  color: white;
  font-weight: 600;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

/* ── Hero Section ───────────────────────────────────────────── */
.hero {
  padding: 80px 0 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -100px; left: 50%;
  transform: translateX(-50%);
  width: 600px; height: 400px;
  background: radial-gradient(ellipse, #6366f118 0%, transparent 70%);
  pointer-events: none;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--indigo);
  background: #6366f112;
  color: var(--indigo);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 24px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.hero h1 { margin-bottom: 16px; }
.hero h1 span { background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero p { font-size: 1.1rem; max-width: 580px; margin: 0 auto 40px; }
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
}
.hero-stat { text-align: center; }
.hero-stat-num {
  font-size: 2rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}
.hero-stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* ── Overall Progress ───────────────────────────────────────── */
.overall-progress {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 32px 0;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.progress-info { flex: 1; min-width: 200px; }
.progress-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 8px; }
.progress-bar-wrap {
  height: 10px;
  background: var(--bg2);
  border-radius: 999px;
  overflow: hidden;
  flex: 1;
  min-width: 200px;
}
.progress-bar-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 999px;
  transition: width 0.6s ease;
  position: relative;
}
.progress-bar-fill::after {
  content: '';
  position: absolute;
  right: 0; top: 0;
  width: 20px; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4));
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0% { opacity: 0; }
  50% { opacity: 1; }
  100% { opacity: 0; }
}
.progress-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Phase Section ──────────────────────────────────────────── */
.phase-section {
  margin-bottom: 48px;
}
.phase-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.phase-badge {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--phase-bg);
  color: var(--phase-color);
  border: 1px solid var(--phase-color)40;
}
.phase-title { font-size: 1.15rem; font-weight: 700; flex: 1; }
.phase-count { font-size: 0.8rem; color: var(--text-muted); }

/* ── Chapter Grid ───────────────────────────────────────────── */
.chapters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ── Chapter Card ───────────────────────────────────────────── */
.chapter-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.chapter-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: var(--phase-color);
  opacity: 0;
  transition: opacity var(--transition);
}
.chapter-card:hover {
  border-color: var(--phase-color)50;
  background: var(--card2);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.chapter-card:hover::before { opacity: 1; }
.chapter-card.completed {
  border-color: var(--emerald)30;
  background: #10b98108;
}
.chapter-card.completed::before {
  background: var(--emerald);
  opacity: 1;
}

.chapter-num {
  font-size: 0.75rem;
  color: var(--phase-color);
  font-weight: 600;
  font-family: var(--mono);
  margin-bottom: 6px;
}
.chapter-title-card {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}
.chapter-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chapter-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}
.chapter-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.tag {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  background: var(--phase-bg);
  color: var(--phase-color);
}
.chapter-check {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.chapter-check.done {
  background: var(--emerald);
  color: white;
}
.chapter-check.pending {
  border: 1.5px solid var(--border-hover);
  color: var(--text-dim);
}

/* ── Chapter Page ───────────────────────────────────────────── */
.chapter-layout {
  display: flex;
  gap: 32px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px;
  align-items: flex-start;
}

/* Sidebar */
.sidebar {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
}
.sidebar-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.sidebar-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 12px;
}
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.sidebar-nav-item:hover { background: var(--card2); color: var(--text); }
.sidebar-nav-item.active { background: var(--gradient-glow); color: var(--indigo); font-weight: 500; }
.sidebar-phase-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Chapter Content */
.chapter-content {
  flex: 1;
  min-width: 0;
}
.chapter-header {
  margin-bottom: 40px;
}
.chapter-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.chapter-meta .phase-badge { font-size: 0.7rem; }
.chapter-num-large {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.chapter-title-page {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 800;
  margin-bottom: 12px;
  line-height: 1.25;
}
.chapter-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 600px;
}

/* Content Sections */
.content-section {
  margin-bottom: 40px;
}
.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.section-icon {
  width: 32px; height: 32px;
  background: var(--gradient-glow);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.section-title { font-size: 1.05rem; font-weight: 600; }

.prose {
  color: var(--text-muted);
  line-height: 1.8;
  font-size: 0.95rem;
}
.prose p { margin-bottom: 12px; }
.prose strong { color: var(--text); font-weight: 600; }
.prose em { color: var(--indigo); font-style: normal; font-weight: 500; }
.prose ul { padding-left: 0; }
.prose ul li {
  padding-left: 20px;
  position: relative;
  margin-bottom: 6px;
}
.prose ul li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--indigo);
  font-size: 0.8rem;
  top: 2px;
}

/* Info Box */
.info-box {
  padding: 16px 20px;
  border-radius: var(--radius);
  border-left: 3px solid;
  margin: 16px 0;
  font-size: 0.9rem;
}
.info-box.blue { background: #3b82f610; border-color: var(--blue); color: #93c5fd; }
.info-box.amber { background: #f59e0b10; border-color: var(--amber); color: #fcd34d; }
.info-box.emerald { background: #10b98110; border-color: var(--emerald); color: #6ee7b7; }
.info-box.violet { background: #8b5cf610; border-color: var(--violet); color: #c4b5fd; }

/* Code Block */
.code-wrap {
  position: relative;
  margin: 16px 0;
}
.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1e1e2e;
  border: 1px solid var(--border);
  border-bottom: none;
  padding: 8px 16px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.code-lang {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--mono);
  display: flex;
  align-items: center;
  gap: 6px;
}
.code-lang-dot {
  width: 8px; height: 8px;
  background: #3b82f6;
  border-radius: 50%;
}
.copy-btn {
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  transition: all var(--transition);
}
.copy-btn:hover { background: var(--card2); color: var(--text); }
.copy-btn.copied { color: var(--emerald); border-color: var(--emerald)50; }

pre.code-block {
  background: #1e1e2e;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 20px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.7;
  margin: 0;
}

/* Complexity Table */
.complexity-table-wrap { overflow-x: auto; margin: 16px 0; }
.complexity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.complexity-table th {
  background: var(--card2);
  padding: 10px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.complexity-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.complexity-table tr:last-child td { border-bottom: none; }
.complexity-table tr:hover td { background: var(--card2); }
.complexity-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
}
.complexity-badge.green { background: #10b98120; color: #6ee7b7; }
.complexity-badge.yellow { background: #f59e0b20; color: #fcd34d; }
.complexity-badge.red { background: #f43f5e20; color: #fca5a5; }
.complexity-badge.blue { background: #3b82f620; color: #93c5fd; }

/* Practice Problems */
.problem-list { display: flex; flex-direction: column; gap: 12px; }
.problem-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: border-color var(--transition);
}
.problem-item:hover { border-color: var(--border-hover); }
.problem-difficulty {
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
  margin-top: 2px;
}
.problem-difficulty.easy { background: #10b98120; color: #6ee7b7; }
.problem-difficulty.medium { background: #f59e0b20; color: #fcd34d; }
.problem-difficulty.hard { background: #f43f5e20; color: #fca5a5; }
.problem-body {}
.problem-title { font-size: 0.9rem; font-weight: 600; margin-bottom: 4px; }
.problem-desc { font-size: 0.82rem; color: var(--text-muted); }

/* Key Takeaways */
.takeaway-list {
  display: grid;
  gap: 10px;
}
.takeaway-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}
.takeaway-icon {
  width: 24px; height: 24px;
  background: var(--gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
  margin-top: 1px;
}
.takeaway-text { color: var(--text-muted); line-height: 1.6; }
.takeaway-text strong { color: var(--text); }

/* Visualizer Container */
.visualizer-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.visualizer-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.viz-btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all var(--transition);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.viz-btn:hover { border-color: var(--border-hover); color: var(--text); background: var(--card2); }
.viz-btn.primary { background: var(--gradient); color: white; border: none; }
.viz-btn.primary:hover { opacity: 0.9; }
.viz-speed {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.viz-speed input[type="range"] {
  width: 80px;
  accent-color: var(--indigo);
}
.visualizer-canvas {
  width: 100%;
  display: block;
  background: var(--bg2);
}
.visualizer-log {
  padding: 10px 16px;
  font-size: 0.8rem;
  color: var(--indigo);
  font-family: var(--mono);
  border-top: 1px solid var(--border);
  min-height: 36px;
}
.visualizer-stats {
  display: flex;
  gap: 16px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
}
.viz-stat-item { color: var(--text-muted); }
.viz-stat-item span { color: var(--text); font-weight: 600; font-family: var(--mono); }

/* Mark Complete Button */
.mark-complete-section {
  margin-top: 48px;
  padding: 32px;
  background: var(--gradient-glow);
  border: 1px solid var(--indigo)30;
  border-radius: var(--radius-lg);
  text-align: center;
}
.mark-complete-section h3 { font-size: 1.1rem; margin-bottom: 8px; }
.mark-complete-section p { font-size: 0.875rem; margin-bottom: 20px; }
.mark-complete-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: var(--gradient);
  color: white;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.95rem;
  transition: all var(--transition);
}
.mark-complete-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px #6366f140; }
.mark-complete-btn.done {
  background: linear-gradient(135deg, var(--emerald), #059669);
}

/* Navigation Arrows */
.chapter-nav {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-top: 40px;
}
.chapter-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition);
  max-width: 45%;
}
.chapter-nav-btn:hover { border-color: var(--border-hover); color: var(--text); background: var(--card2); }
.chapter-nav-btn.next { text-align: right; flex-direction: row-reverse; }
.chapter-nav-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); display: block; }
.chapter-nav-title { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Search */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 32px;
  transition: border-color var(--transition);
}
.search-bar:focus-within { border-color: var(--indigo)60; }
.search-icon { color: var(--text-dim); font-size: 0.9rem; }
.search-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--font);
  width: 100%;
}
.search-input::placeholder { color: var(--text-dim); }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast-icon { font-size: 1rem; }

/* Loading */
.loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  flex-direction: column;
  gap: 16px;
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--indigo);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty/Not found */
.not-found {
  text-align: center;
  padding: 80px 24px;
}
.not-found h2 { margin-bottom: 12px; }
.not-found p { margin-bottom: 24px; }

/* Responsive */
@media (max-width: 900px) {
  .chapter-layout { flex-direction: column; padding: 20px 16px; }
  .sidebar { width: 100%; position: static; }
  .hero { padding: 48px 0 32px; }
  .chapters-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .container { padding: 0 16px; }
  .chapters-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 24px; }
  .hero h1 { font-size: 1.7rem; }
  .chapter-nav { flex-direction: column; }
  .chapter-nav-btn { max-width: 100%; }
}

/* Hljs override */
.hljs { background: transparent !important; padding: 0 !important; }

/* Utility */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.text-gradient { background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
