/* =============================================
   MathPath Cambridge - Dark Orange Theme
   ============================================= */

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a28;
  --bg-card-hover: #222235;
  --bg-input: #0d0d18;
  --orange-primary: #ff6b00;
  --orange-light: #ff9a3c;
  --orange-dark: #cc4400;
  --orange-glow: rgba(255, 107, 0, 0.25);
  --orange-border: rgba(255, 107, 0, 0.35);
  --gold: #ffd700;
  --green: #00e676;
  --red: #ff4444;
  --blue: #4fc3f7;
  --purple: #ce93d8;
  --text-primary: #f0f0f0;
  --text-secondary: #aaa8c0;
  --text-muted: #6b6980;
  --border-color: rgba(255, 107, 0, 0.2);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-orange: 0 0 30px rgba(255, 107, 0, 0.15);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

*, *::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-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--orange-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--orange-primary); }

/* ---- NAVBAR ---- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
}
.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.1rem;
}
.logo-icon { font-size: 1.5rem; }
.logo-text { color: var(--orange-primary); letter-spacing: -0.5px; }
.logo-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  align-self: flex-end;
  padding-bottom: 2px;
}
.nav-links {
  display: flex;
  gap: 8px;
}
.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
}
.nav-links a:hover { color: var(--orange-primary); background: var(--orange-glow); }
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-color);
  color: var(--orange-primary);
  font-size: 1.2rem;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.mobile-menu {
  display: none;
  flex-direction: column;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 24px;
}
.mobile-menu a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
  font-weight: 500;
}
.mobile-menu a:last-child { border-bottom: none; }
.mobile-menu.open { display: flex; }

/* ---- MAIN CONTENT ---- */
.main-content { min-height: calc(100vh - 64px); }

/* ---- HERO ---- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 80px 24px;
  text-align: center;
  background: radial-gradient(ellipse at 50% 0%, rgba(255,107,0,0.12) 0%, transparent 70%);
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ff6b00' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--orange-glow);
  border: 1px solid var(--orange-border);
  color: var(--orange-light);
  padding: 6px 16px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 24px;
  text-transform: uppercase;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1px;
  margin-bottom: 16px;
}
.hero h1 .highlight {
  background: linear-gradient(135deg, var(--orange-primary), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 40px;
  line-height: 1.7;
}
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
  margin-top: 40px;
}
.stat-item { text-align: center; }
.stat-num {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--orange-primary);
  display: block;
}
.stat-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* Floating math symbols */
.hero-floaters {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.floater {
  position: absolute;
  font-size: 1.5rem;
  opacity: 0.08;
  animation: floatAnim 6s ease-in-out infinite;
}

@keyframes floatAnim {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(10deg); }
}

/* ---- SECTION ---- */
.section { padding: 60px 24px; }
.section-inner { max-width: 1280px; margin: 0 auto; }
.section-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}
.section-title .emoji { margin-right: 8px; }
.section-sub {
  color: var(--text-secondary);
  margin-bottom: 40px;
  font-size: 0.95rem;
}

/* ---- YEAR CARDS ---- */
.year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}
.year-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-decoration: none;
  color: var(--text-primary);
  transition: var(--transition);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.year-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--orange-primary), var(--orange-light));
  transform: scaleX(0);
  transition: var(--transition);
  transform-origin: left;
}
.year-card:hover { background: var(--bg-card-hover); border-color: var(--orange-border); transform: translateY(-4px); box-shadow: var(--shadow-orange); }
.year-card:hover::before { transform: scaleX(1); }
.year-emoji { font-size: 2.5rem; }
.year-name { font-size: 1.1rem; font-weight: 700; color: var(--orange-primary); }
.year-desc { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.5; }
.year-badge {
  display: inline-flex;
  gap: 4px;
  background: var(--orange-glow);
  border: 1px solid var(--orange-border);
  color: var(--orange-light);
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 100px;
  font-weight: 600;
  margin-top: auto;
}

/* ---- TOPIC CARDS ---- */
.subject-section { margin-bottom: 48px; }
.subject-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}
.subject-emoji { font-size: 1.8rem; }
.subject-name { font-size: 1.3rem; font-weight: 700; }
.subject-count { color: var(--text-muted); font-size: 0.85rem; margin-left: auto; }
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.topic-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: var(--text-primary);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}
.topic-card:hover { background: var(--bg-card-hover); border-color: var(--orange-border); transform: translateY(-2px); box-shadow: var(--shadow); }
.topic-icon {
  font-size: 1.6rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--orange-glow);
  border-radius: var(--radius-sm);
}
.topic-name { font-size: 0.95rem; font-weight: 600; line-height: 1.3; }
.topic-desc { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.5; }
.topic-footer { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.difficulty-dots { display: flex; gap: 3px; }
.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: var(--transition);
}
.dot.active { background: var(--orange-primary); }
.topic-arrow {
  margin-left: auto;
  color: var(--orange-primary);
  font-size: 1.1rem;
  transition: var(--transition);
}
.topic-card:hover .topic-arrow { transform: translateX(4px); }

/* ---- LESSON PAGE ---- */
.lesson-hero {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-card) 100%);
  border-bottom: 1px solid var(--border-color);
  padding: 40px 24px;
}
.lesson-hero-inner { max-width: 900px; margin: 0 auto; }
.breadcrumb {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--orange-primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--text-muted); }
.lesson-title-wrap { display: flex; align-items: center; gap: 16px; }
.lesson-big-icon {
  font-size: 2.5rem;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--orange-glow);
  border: 1px solid var(--orange-border);
  border-radius: var(--radius);
  flex-shrink: 0;
}
.lesson-title { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 800; letter-spacing: -0.5px; }
.lesson-subtitle { color: var(--text-secondary); font-size: 0.9rem; margin-top: 6px; }

/* ---- CONTENT BLOCKS ---- */
.content-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px;
}
.content-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 32px;
  overflow-x: auto;
}
.tab-btn {
  flex: 1;
  min-width: max-content;
  padding: 10px 20px;
  background: none;
  border: none;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-main);
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text-primary); background: var(--bg-card); }
.tab-btn.active { background: var(--orange-primary); color: white; }
.tab-panel { display: none; animation: fadeIn 0.3s ease; }
.tab-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---- THEORY CONTENT ---- */
.theory-block {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
  line-height: 1.8;
}
.theory-block h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--orange-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.theory-block p { color: var(--text-secondary); margin-bottom: 12px; }
.theory-block p:last-child { margin-bottom: 0; }
.math-box {
  background: var(--bg-input);
  border: 1px solid var(--orange-border);
  border-left: 4px solid var(--orange-primary);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 16px 0;
  font-family: var(--font-mono);
  font-size: 1rem;
  overflow-x: auto;
}
.key-formula {
  background: linear-gradient(135deg, rgba(255,107,0,0.1), rgba(255,154,60,0.05));
  border: 1px solid var(--orange-border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 20px 0;
  text-align: center;
}
.key-formula-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--orange-primary);
  font-weight: 700;
  margin-bottom: 10px;
}
.example-block {
  background: rgba(0, 230, 118, 0.05);
  border: 1px solid rgba(0, 230, 118, 0.2);
  border-left: 4px solid var(--green);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 16px 0;
}
.example-block strong { color: var(--green); }
.steps-list {
  list-style: none;
  counter-reset: steps;
}
.steps-list li {
  counter-increment: steps;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}
.steps-list li:last-child { border-bottom: none; }
.steps-list li::before {
  content: counter(steps);
  background: var(--orange-primary);
  color: white;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ---- CANVAS / VISUAL TOOLS ---- */
.tool-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}
.tool-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}
.tool-header-icon { color: var(--orange-primary); font-size: 1.2rem; }
.tool-body { padding: 24px; }
.canvas-wrap {
  position: relative;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 16px;
}
canvas { display: block; width: 100%; max-width: 100%; }
.controls-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}
.ctrl-group { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 120px; }
.ctrl-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.ctrl-input, .ctrl-select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font-main);
  outline: none;
  transition: var(--transition);
  width: 100%;
}
.ctrl-input:focus, .ctrl-select:focus { border-color: var(--orange-primary); box-shadow: 0 0 0 3px var(--orange-glow); }
.ctrl-input[type="range"] { padding: 4px 0; cursor: pointer; accent-color: var(--orange-primary); }
.result-box {
  background: var(--bg-input);
  border: 1px solid var(--orange-border);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  min-height: 60px;
  color: var(--orange-light);
  line-height: 1.6;
}
.result-box .calc-step { color: var(--text-secondary); font-size: 0.82rem; }
.result-box .calc-answer { color: var(--green); font-size: 1.1rem; font-weight: 700; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  font-family: var(--font-main);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--orange-primary); color: white; }
.btn-primary:hover { background: var(--orange-dark); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(255,107,0,0.4); }
.btn-secondary { background: var(--bg-card); border: 1px solid var(--border-color); color: var(--text-secondary); }
.btn-secondary:hover { border-color: var(--orange-primary); color: var(--orange-primary); }
.btn-ghost { background: transparent; border: 1px solid var(--orange-border); color: var(--orange-primary); }
.btn-ghost:hover { background: var(--orange-glow); }
.btn-icon { padding: 8px 12px; }
.btn-sm { padding: 7px 14px; font-size: 0.82rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }

/* ---- QUIZ ---- */
.quiz-wrap { max-width: 800px; margin: 0 auto; padding: 40px 24px; }
.quiz-progress-bar {
  background: var(--bg-card);
  border-radius: 100px;
  height: 6px;
  margin-bottom: 32px;
  overflow: hidden;
}
.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange-primary), var(--orange-light));
  border-radius: 100px;
  transition: width 0.5s ease;
}
.quiz-counter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.quiz-counter-text { font-size: 0.82rem; color: var(--text-muted); }
.score-badge {
  background: var(--orange-glow);
  border: 1px solid var(--orange-border);
  color: var(--orange-light);
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 700;
}
.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 24px;
  animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
.q-number {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--orange-primary);
  font-weight: 700;
  margin-bottom: 16px;
}
.q-text {
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.6;
  margin-bottom: 24px;
}
.q-latex {
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  margin-bottom: 20px;
  font-size: 1.2rem;
  overflow-x: auto;
}
.options-grid { display: flex; flex-direction: column; gap: 10px; }
.option-btn {
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px 20px;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-primary);
  font-size: 0.92rem;
  font-family: var(--font-main);
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}
.option-btn:hover:not(:disabled) { border-color: var(--orange-primary); background: var(--orange-glow); }
.option-btn.selected { border-color: var(--orange-primary); background: rgba(255,107,0,0.12); }
.option-btn.correct { border-color: var(--green); background: rgba(0,230,118,0.1); color: var(--green); }
.option-btn.wrong { border-color: var(--red); background: rgba(255,68,68,0.1); color: var(--red); }
.option-btn:disabled { cursor: default; }
.option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
  transition: var(--transition);
}
.option-btn.correct .option-letter { background: var(--green); border-color: var(--green); color: white; }
.option-btn.wrong .option-letter { background: var(--red); border-color: var(--red); color: white; }
.option-btn.selected .option-letter { background: var(--orange-primary); border-color: var(--orange-primary); color: white; }

.explanation-box {
  background: rgba(255,215,0,0.06);
  border: 1px solid rgba(255,215,0,0.2);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-top: 16px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  animation: fadeIn 0.3s ease;
  display: none;
}
.explanation-box.show { display: block; }
.explanation-box strong { color: var(--gold); }

.quiz-nav { display: flex; gap: 12px; justify-content: space-between; flex-wrap: wrap; }

/* ---- RESULTS ---- */
.results-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  text-align: center;
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes popIn { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }
.result-emoji { font-size: 4rem; margin-bottom: 16px; display: block; }
.result-score-big {
  font-size: 4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--orange-primary), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 8px;
}
.result-msg { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 32px; }

/* ---- TOOLS PAGE ---- */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}
.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
}
.tool-card:hover { border-color: var(--orange-border); box-shadow: var(--shadow-orange); }
.tool-card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
}
.tool-card-icon { font-size: 1.8rem; }
.tool-card-title { font-weight: 700; font-size: 1rem; }
.tool-card-sub { font-size: 0.8rem; color: var(--text-muted); }
.tool-card-body { padding: 20px 24px; }

/* ---- PROGRESS ---- */
.progress-overview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}
.prog-stat {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.prog-stat-num { font-size: 2rem; font-weight: 800; color: var(--orange-primary); }
.prog-stat-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }
.progress-history { list-style: none; }
.history-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.history-topic { font-weight: 600; flex: 1; min-width: 150px; }
.history-score { color: var(--orange-primary); font-weight: 700; }
.history-date { color: var(--text-muted); font-size: 0.8rem; margin-left: auto; }

/* ---- BACK BUTTON / BREADCRUMB NAV ---- */
.page-back { margin-bottom: 24px; }

/* ---- KATEX OVERRIDE ---- */
.katex { color: var(--text-primary); font-size: 1.05rem; }
.katex-display { margin: 16px 0 !important; }
.katex-display > .katex { color: var(--orange-light); }
.math-box .katex { color: var(--orange-light); }

/* ---- NOTIFICATION TOAST ---- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--orange-border);
  border-radius: var(--radius);
  padding: 14px 20px;
  color: var(--text-primary);
  font-size: 0.9rem;
  z-index: 9999;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  max-width: 320px;
  box-shadow: var(--shadow);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* ---- TABLE ---- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 16px 0;
}
th {
  background: var(--bg-secondary);
  color: var(--orange-primary);
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  border-bottom: 2px solid var(--orange-border);
}
td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-card); }

/* ---- BADGES ---- */
.badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
}
.badge-orange { background: var(--orange-glow); color: var(--orange-light); border: 1px solid var(--orange-border); }
.badge-green { background: rgba(0,230,118,0.1); color: var(--green); border: 1px solid rgba(0,230,118,0.2); }
.badge-blue { background: rgba(79,195,247,0.1); color: var(--blue); border: 1px solid rgba(79,195,247,0.2); }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-toggle { display: block; }
  .hero { padding: 50px 16px; }
  .section { padding: 40px 16px; }
  .year-grid { grid-template-columns: repeat(2, 1fr); }
  .topic-grid { grid-template-columns: 1fr; }
  .quiz-wrap { padding: 20px 16px; }
  .question-card { padding: 20px; }
  .content-wrap { padding: 24px 16px; }
  .controls-row { flex-direction: column; }
  .quiz-nav { flex-direction: column; }
  .results-card { padding: 32px 20px; }
}
@media (max-width: 480px) {
  .year-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 24px; }
  .content-tabs { gap: 2px; }
  .tab-btn { padding: 8px 12px; font-size: 0.8rem; }
}

/* ---- ANIMATIONS ---- */
.pulse-orange {
  animation: pulseOrange 2s ease-in-out infinite;
}
@keyframes pulseOrange {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,107,0,0.4); }
  50% { box-shadow: 0 0 0 12px rgba(255,107,0,0); }
}
.spin { animation: spin 2s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Number line style */
.number-line {
  position: relative;
  height: 60px;
  margin: 20px 0;
  display: flex;
  align-items: center;
}
.number-line-track {
  width: 100%;
  height: 3px;
  background: var(--border-color);
  position: relative;
}
.number-line-point {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--orange-primary);
  top: 50%;
  transform: translate(-50%, -50%);
  transition: left 0.3s ease;
  z-index: 2;
}
.number-line-label {
  position: absolute;
  font-size: 0.7rem;
  color: var(--text-muted);
  top: calc(50% + 12px);
  transform: translateX(-50%);
}

/* Tip box */
.tip-box {
  display: flex;
  gap: 12px;
  background: rgba(79,195,247,0.06);
  border: 1px solid rgba(79,195,247,0.2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 16px 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.tip-icon { color: var(--blue); font-size: 1.1rem; flex-shrink: 0; }

/* ---- GRID NAV ---- */
.grid-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}
.grid-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--orange-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.grid-nav a:hover { border-color: var(--orange-primary); background: var(--orange-glow); }
