/* ==============================
   VARIABLES & RESET
   ============================== */
:root {
  --primary: #e63946;
  --primary-dark: #c1121f;
  --primary-light: #ff6b6b;
  --secondary: #1d3557;
  --accent: #457b9d;
  --accent-light: #a8dadc;
  --success: #2ecc71;
  --warning: #f39c12;
  --danger: #e74c3c;
  --bg: #0f1117;
  --bg-card: #1a1d2e;
  --bg-card2: #232640;
  --text: #e8eaf6;
  --text-muted: #8b90bb;
  --border: #2d3166;
  --glow: 0 0 20px rgba(230, 57, 70, 0.3);
  --glow-blue: 0 0 20px rgba(69, 123, 157, 0.3);
  --radius: 16px;
  --radius-sm: 8px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ==============================
   BACKGROUND ANIMATED
   ============================== */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 20% 20%, rgba(230, 57, 70, 0.05) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 80%, rgba(69, 123, 157, 0.05) 0%, transparent 50%);
  animation: bgPulse 8s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

@keyframes bgPulse {
  from { transform: scale(1) rotate(0deg); }
  to { transform: scale(1.1) rotate(5deg); }
}

/* ==============================
   NAVBAR
   ============================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 17, 23, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
}

.navbar-brand .logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: var(--glow);
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
}

.navbar-nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  transition: var(--transition);
}

.navbar-nav a:hover, .navbar-nav a.active {
  color: var(--text);
  background: var(--bg-card2);
}

/* ==============================
   CONTAINERS
   ============================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: 1;
}

.page { padding: 2rem 0 4rem; }

/* ==============================
   HERO
   ============================== */
.hero {
  text-align: center;
  padding: 5rem 1rem 3rem;
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(230, 57, 70, 0.1);
  border: 1px solid rgba(230, 57, 70, 0.3);
  color: var(--primary-light);
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  animation: fadeInDown 0.6s ease;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1rem;
  animation: fadeInUp 0.6s ease 0.1s both;
}

.hero h1 span {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto 2rem;
  animation: fadeInUp 0.6s ease 0.2s both;
}

/* ==============================
   CARDS
   ============================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: var(--primary);
  box-shadow: var(--glow);
  transform: translateY(-4px);
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: 0;
  transition: var(--transition);
}

.card:hover::before { opacity: 1; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* Formation Card */
.formation-card {
  cursor: pointer;
  text-decoration: none;
  display: block;
  color: inherit;
}

.formation-card .icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}

.formation-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.formation-card .sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.formation-card .meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-primary {
  background: rgba(230, 57, 70, 0.15);
  color: var(--primary-light);
  border: 1px solid rgba(230, 57, 70, 0.3);
}

.badge-blue {
  background: rgba(69, 123, 157, 0.15);
  color: var(--accent-light);
  border: 1px solid rgba(69, 123, 157, 0.3);
}

.badge-green {
  background: rgba(46, 204, 113, 0.15);
  color: #6ee7a0;
  border: 1px solid rgba(46, 204, 113, 0.3);
}

/* ==============================
   BUTTONS
   ============================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 15px rgba(230, 57, 70, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(230, 57, 70, 0.5);
}

.btn-secondary {
  background: var(--bg-card2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary-light);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text-muted);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent-light);
}

.btn-success {
  background: linear-gradient(135deg, #27ae60, #1e8449);
  color: white;
}

.btn-lg {
  padding: 0.9rem 2rem;
  font-size: 1.05rem;
  border-radius: var(--radius);
}

.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
}

/* ==============================
   CHAPTER GRID
   ============================== */
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.chapter-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  color: inherit;
}

.chapter-card:hover {
  border-color: var(--accent);
  box-shadow: var(--glow-blue);
  transform: translateX(6px);
}

.chapter-card .ch-icon {
  font-size: 2rem;
  width: 50px;
  height: 50px;
  background: var(--bg-card2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chapter-card .ch-info { flex: 1; }
.chapter-card .ch-num {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.chapter-card .ch-title {
  font-weight: 600;
  font-size: 0.95rem;
}

/* ==============================
   QUIZ
   ============================== */
#quiz-app { min-height: 70vh; }

.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.quiz-progress-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-card2);
  border-radius: 999px;
  overflow: hidden;
  min-width: 150px;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
  transition: width 0.5s ease;
  box-shadow: 0 0 10px var(--primary);
}

.quiz-counter {
  font-size: 0.9rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.quiz-score-live {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  color: var(--success);
}

.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 1.5rem;
  animation: slideInUp 0.4s ease;
}

.question-meta {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.question-text {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.options-grid {
  display: grid;
  gap: 0.75rem;
}

.option-btn {
  background: var(--bg-card2);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  color: var(--text);
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  line-height: 1.4;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(69, 123, 157, 0.1);
  transform: translateX(4px);
}

.option-btn .opt-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: var(--transition);
}

.option-btn.correct {
  border-color: var(--success);
  background: rgba(46, 204, 113, 0.1);
  animation: correctPulse 0.5s ease;
}

.option-btn.correct .opt-letter {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.option-btn.wrong {
  border-color: var(--danger);
  background: rgba(231, 76, 60, 0.1);
  animation: shake 0.4s ease;
}

.option-btn.wrong .opt-letter {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.option-btn:disabled { cursor: not-allowed; }

/* Explication */
.explanation-box {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  animation: fadeInUp 0.4s ease;
}

.explanation-box strong {
  color: var(--accent-light);
  display: block;
  margin-bottom: 0.3rem;
}

/* ==============================
   FLASHCARDS
   ============================== */
.flashcard-container {
  perspective: 1200px;
  width: 100%;
  max-width: 680px;
  margin: 0 auto 2rem;
  height: 320px;
}

.flashcard {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.flashcard.flipped { transform: rotateY(180deg); }

.flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.flashcard-front {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-card2));
  border: 2px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.flashcard-back {
  background: linear-gradient(135deg, #0d2137, #1a2744);
  border: 2px solid var(--accent);
  transform: rotateY(180deg);
  box-shadow: 0 20px 60px rgba(69, 123, 157, 0.2);
}

.flashcard-front .fc-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 1rem;
}

.flashcard-front .fc-question {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.5;
}

.flashcard-back .fc-label {
  font-size: 0.75rem;
  color: var(--accent-light);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 1rem;
}

.flashcard-back .fc-answer {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
}

.flashcard-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  animation: bounce 2s infinite;
}

.flashcard-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

/* ==============================
   RESULTS
   ============================== */
.result-screen {
  text-align: center;
  padding: 3rem 1rem;
  animation: fadeInUp 0.6s ease;
}

.result-circle {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  margin: 0 auto 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 2.5rem;
  font-weight: 800;
}

.result-circle svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.result-circle .result-num { position: relative; z-index: 1; }
.result-circle .result-label {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
}

.result-stars { font-size: 2rem; margin: 1rem 0; letter-spacing: 0.2rem; }
.result-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.result-sub { color: var(--text-muted); margin-bottom: 2rem; }

.result-breakdown {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 400px;
  margin: 0 auto 2rem;
  text-align: left;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.breakdown-row:last-child { border-bottom: none; }

/* ==============================
   STATS / LEADERBOARD
   ============================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}

.stat-card .stat-val {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary-light);
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.leaderboard { list-style: none; }

.leaderboard li {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  transition: var(--transition);
}

.leaderboard li:hover { border-color: var(--primary); }

.lb-rank {
  font-weight: 800;
  font-size: 1.1rem;
  width: 32px;
  text-align: center;
  color: var(--text-muted);
}

.lb-rank.gold { color: #f1c40f; }
.lb-rank.silver { color: #bdc3c7; }
.lb-rank.bronze { color: #e67e22; }

.lb-name { flex: 1; font-weight: 600; }

.lb-score {
  font-weight: 700;
  color: var(--success);
}

/* ==============================
   TABS
   ============================== */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
  flex-wrap: wrap;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0.6rem 1.25rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--primary-light);
  border-bottom-color: var(--primary);
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeInUp 0.3s ease; }

/* ==============================
   MODAL
   ============================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  animation: scaleIn 0.3s ease;
}

.modal h3 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.form-input, .form-select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
  transition: var(--transition);
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(69, 123, 157, 0.1);
}

/* ==============================
   TIMER
   ============================== */
.timer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: var(--transition);
}

.timer.warning { color: var(--warning); }
.timer.danger { color: var(--danger); animation: pulse 0.5s infinite; }

/* ==============================
   REVISION FICHES
   ============================== */
.fiche-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.fiche-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}

.fiche-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: var(--glow-blue);
}

.fiche-header {
  padding: 1.25rem;
  background: linear-gradient(135deg, var(--bg-card2), var(--bg-card));
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.fiche-icon {
  font-size: 1.8rem;
  width: 48px;
  height: 48px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fiche-body { padding: 1.25rem; }

.key-point {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.9rem;
}

.key-point:last-child { border-bottom: none; }

.key-point .kp-icon {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 0.4rem;
  flex-shrink: 0;
}

/* ==============================
   ANIMATIONS
   ============================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

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

@keyframes correctPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

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

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

@keyframes confetti {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confetti linear forwards;
  z-index: 9999;
  pointer-events: none;
}

/* ==============================
   SECTION TITLES
   ============================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.section-title {
  font-size: 1.4rem;
  font-weight: 700;
}

.section-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* ==============================
   PAGE TRANSITION
   ============================== */
.page-transition {
  animation: fadeInUp 0.4s ease;
}

/* ==============================
   LOADING
   ============================== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem;
  flex-direction: column;
  gap: 1rem;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==============================
   RESPONSIVE
   ============================== */
@media (max-width: 768px) {
  .navbar { padding: 0 1rem; }
  .navbar-nav { display: none; }
  .hero { padding: 3rem 1rem 2rem; }
  .chapter-grid { grid-template-columns: 1fr; }
  .quiz-header { flex-direction: column; align-items: stretch; }
  .flashcard-container { height: 260px; }
}

/* ==============================
   TOAST
   ============================== */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 9998;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  max-width: 300px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

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

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(50px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateX(50px); }
}

/* ==============================
   SCORE HISTORY TABLE
   ============================== */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th {
  text-align: left;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 2px solid var(--border);
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

tr:hover td { background: rgba(255,255,255,0.02); }

/* ==============================
   PROGRESS RING
   ============================== */
.progress-ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.progress-ring circle {
  fill: none;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease;
}

/* ==============================
   REVISION MODE CARD
   ============================== */
.mode-selector {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.mode-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.mode-card:hover {
  border-color: var(--primary);
  box-shadow: var(--glow);
}

.mode-card.selected {
  border-color: var(--primary);
  background: rgba(230, 57, 70, 0.08);
}

.mode-card .mode-icon { font-size: 2.5rem; margin-bottom: 0.75rem; display: block; }
.mode-card .mode-name { font-weight: 700; margin-bottom: 0.25rem; }
.mode-card .mode-desc { font-size: 0.8rem; color: var(--text-muted); }
