/* ==========================================================================
   MockTestVault — Modern Interactive Test Engine Stylesheet
   Designed for High-Speed CBT Simulation, Clean Readability, and A4 Printing
   ========================================================================== */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  
  --success: #10b981;
  --success-light: #ecfdf5;
  --success-border: #a7f3d0;
  --success-text: #065f46;
  
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --danger-border: #fecaca;
  --danger-text: #991b1b;
  
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --warning-border: #fde68a;
  --warning-text: #92400e;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
}

[data-theme="dark"] {
  --bg-primary: #090d16;
  --bg-surface: #111827;
  --bg-subtle: #1f2937;
  --text-primary: #f9fafb;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-color: #374151;
  
  --primary-light: rgba(59, 130, 246, 0.15);
  --primary-border: #1e3a8a;
  
  --success-light: rgba(16, 185, 129, 0.15);
  --success-border: #064e3b;
  --success-text: #34d399;
  
  --danger-light: rgba(239, 68, 68, 0.15);
  --danger-border: #7f1d1d;
  --danger-text: #f87171;
  
  --warning-light: rgba(245, 158, 11, 0.15);
  --warning-border: #78350f;
  --warning-text: #fbbf24;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Navigation Bar
   ========================================================================== */
.site-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 100%;
  margin: 0;
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-logo {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-text .vault-pill {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.brand-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Mode Switcher Toggle */
.mode-pill-group {
  display: flex;
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
}

.mode-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 20px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 5px;
}

.mode-btn.active {
  background: var(--bg-surface);
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.theme-toggle-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: transform 0.2s;
}

.theme-toggle-btn:hover {
  transform: scale(1.05);
}

.tool-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  transition: all 0.15s;
  user-select: none;
}

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

.tool-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ==========================================================================
   Breadcrumb Bar
   ========================================================================== */
.breadcrumb-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 8px 28px;
}

.breadcrumb-container {
  max-width: 100%;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb-bar a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb-bar a:hover {
  color: var(--primary);
}

.breadcrumb-bar .sep {
  opacity: 0.4;
}

.breadcrumb-bar .current {
  color: var(--text-primary);
  font-weight: 600;
}

/* ==========================================================================
   Google AdSense / Display Ad Wrappers (Zero CLS Architecture)
   ========================================================================== */
.ad-slot-wrapper {
  background: var(--bg-subtle);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}

.ad-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.ad-placeholder-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
}

.ad-placeholder-content .ad-icon {
  font-size: 1.1rem;
  opacity: 0.7;
}

.ad-placeholder-content .ad-text {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.ad-placeholder-content .ad-specs {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* Specific Zone Sizes */
.ad-zone-1-leaderboard {
  max-width: 1200px;
  min-height: 90px;
  margin: 16px auto 0;
  padding: 12px;
}

.ad-zone-2-sidebar {
  width: 100%;
  min-height: 250px;
  margin-top: 16px;
  padding: 16px;
}

.ad-zone-3-inline {
  width: 100%;
  min-height: 80px;
  margin: 18px 0;
  padding: 10px;
}

.ad-zone-4-results {
  max-width: 728px;
  min-height: 100px;
  margin: 24px auto;
  padding: 14px;
}

/* ==========================================================================
   Set Switcher Bar (Sets 1, 2, 3)
   ========================================================================== */
.set-switcher-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 28px;
}

.set-switcher-container {
  max-width: 100%;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.set-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.set-btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.set-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.set-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

.set-badge-count {
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.25);
  padding: 1px 6px;
  border-radius: 10px;
}

.set-btn:not(.active) .set-badge-count {
  background: var(--border-color);
  color: var(--text-muted);
}

/* ==========================================================================
   Exam Status Bar (Timer & Progress)
   ========================================================================== */
.exam-status-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 28px;
}

.status-container {
  max-width: 100%;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.timer-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

.timer-box.warning {
  background: var(--danger-light);
  border-color: var(--danger-border);
  color: var(--danger);
  animation: pulse 1s infinite;
}

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

.progress-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 450px;
}

.progress-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.progress-bar-track {
  flex: 1;
  height: 8px;
  background: var(--bg-subtle);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  width: 5%;
  transition: width 0.3s ease;
}

/* ==========================================================================
   Main Test Layout (Split Screen: Question + Palette) — Full Viewport
   ========================================================================== */
.test-layout {
  width: 100%;
  max-width: 100%;
  margin: 18px 0;
  padding: 0 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  flex: 1;
}

@media (max-width: 900px) {
  .test-layout {
    grid-template-columns: 1fr;
    padding: 0 16px;
  }
}

/* ==========================================================================
   Question Area Card
   ========================================================================== */
.question-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.meta-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 20px;
}

.badge-chapter {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.badge-subtopic {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.badge-type-ar {
  background: #fdf2f8;
  color: #db2777;
  border: 1px solid #fbcfe8;
}

[data-theme="dark"] .badge-type-ar {
  background: rgba(219, 39, 119, 0.15);
  color: #f472b6;
  border-color: #831843;
}

.question-text-box {
  margin-bottom: 24px;
}

.question-number {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.question-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
  white-space: pre-line;
}

/* Formatted Assertion-Reasoning Box */
.ar-highlight-box {
  background: var(--bg-subtle);
  border-left: 4px solid #db2777;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin-top: 10px;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Options Container */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.option-item {
  border: 1.5px solid var(--border-color);
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 0.98rem;
  color: var(--text-primary);
  user-select: none;
  position: relative;
}

.option-item:hover:not(.disabled) {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.12);
}

.option-text {
  flex: 1;
}

.option-shortcut {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 2px 7px;
  border-radius: 4px;
  opacity: 0.6;
}

.option-item.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.option-item.selected .option-shortcut {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  opacity: 1;
}

.option-key {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.option-item.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.option-item.selected .option-key {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Practice Mode Feedback States */
.option-item.correct {
  border-color: var(--success) !important;
  background: var(--success-light) !important;
  color: var(--success-text) !important;
}

.option-item.correct .option-key {
  background: var(--success) !important;
  color: #fff !important;
  border-color: var(--success) !important;
}

.option-item.wrong {
  border-color: var(--danger) !important;
  background: var(--danger-light) !important;
  color: var(--danger-text) !important;
}

.option-item.wrong .option-key {
  background: var(--danger) !important;
  color: #fff !important;
  border-color: var(--danger) !important;
}

/* Explanation & NCERT Citation Box */
.explanation-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--success);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-top: 16px;
  margin-bottom: 24px;
  display: none;
  animation: fadeIn 0.25s ease;
}

.explanation-box.active {
  display: block;
}

.explanation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--success-text);
}

.citation-tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--primary-border);
}

.explanation-text {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

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

/* Card Bottom Controls */
.card-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 12px;
}

.nav-btn {
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.nav-btn:hover:not(:disabled) {
  background: var(--bg-subtle);
  border-color: var(--primary);
  color: var(--primary);
}

.nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
}

.btn-review {
  background: var(--warning-light);
  color: var(--warning-text);
  border-color: var(--warning-border);
}

.btn-review.active {
  background: var(--warning);
  color: #fff;
  border-color: var(--warning);
}

.btn-submit-test {
  background: #10b981;
  color: #fff;
  border-color: #10b981;
}

.btn-submit-test:hover {
  background: #059669;
}

/* ==========================================================================
   Question Palette Sidebar (CBT Interface)
   ========================================================================== */
.palette-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 86px;
  height: fit-content;
}

.palette-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.palette-btn {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  position: relative;
}

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

.palette-btn.current {
  border-color: var(--primary) !important;
  outline: 2.5px solid var(--primary);
  outline-offset: 2px;
  z-index: 2;
}

/* TCS iON Official 5-State Statuses */
.palette-btn.answered {
  background: #10b981;
  color: #fff;
  border-color: #059669;
}

.palette-btn.not-answered {
  background: #ef4444;
  color: #fff;
  border-color: #dc2626;
}

.palette-btn.reviewed {
  background: #8b5cf6;
  color: #fff;
  border-color: #7c3aed;
  border-radius: 50%;
}

.palette-btn.answered-reviewed {
  background: #8b5cf6;
  color: #fff;
  border-color: #7c3aed;
  border-radius: 50%;
}

.palette-btn.answered-reviewed::after {
  content: '✓';
  position: absolute;
  bottom: -3px;
  right: -3px;
  width: 14px;
  height: 14px;
  background: #10b981;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--bg-surface);
}

.palette-btn.unvisited {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border-color: var(--border-color);
}

.palette-legend {
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dot-answered { background: #10b981; }
.dot-not-answered { background: #ef4444; }
.dot-reviewed { background: #8b5cf6; border-radius: 50%; }
.dot-answered-reviewed {
  background: #8b5cf6;
  border-radius: 50%;
  position: relative;
}
.dot-answered-reviewed::after {
  content: '';
  width: 5px;
  height: 5px;
  background: #10b981;
  border-radius: 50%;
}
.dot-unvisited { background: var(--bg-subtle); border: 1.5px solid var(--border-color); }
.dot-current { outline: 2px solid var(--primary); background: var(--bg-surface); }

/* ==========================================================================
   Scorecard & Results View
   ========================================================================== */
.scorecard-view {
  display: none;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 36px 32px;
  box-shadow: var(--shadow-md);
  margin: 24px 28px 40px 28px !important;
  max-width: calc(100% - 56px) !important;
  width: calc(100% - 56px) !important;
}

.scorecard-view.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.score-hero {
  text-align: center;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 28px;
}

.score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2563eb, #10b981);
  color: #fff;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.score-circle .score-num {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
}

.score-circle .score-total {
  font-size: 0.85rem;
  opacity: 0.85;
  font-weight: 600;
}

.score-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.score-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 500px;
  margin: 0 auto;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.stat-val {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.scorecard-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

/* Subtopic Mastery Breakdown Card */
.mastery-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 22px;
  margin-bottom: 32px;
}

.mastery-card-header {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mastery-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mastery-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mastery-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
}

.mastery-track {
  height: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
}

.mastery-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Review Filter Pills (Khan Academy / UWorld Style) */
.review-filters-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.review-filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-pill {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.filter-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.filter-pill.filter-wrong.active {
  background: #ef4444;
  border-color: #ef4444;
}

.filter-pill.filter-reviewed.active {
  background: #8b5cf6;
  border-color: #8b5cf6;
}

.filter-pill.filter-correct.active {
  background: #10b981;
  border-color: #10b981;
}

/* Question by Question Review List in Results */
.review-list-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.review-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 14px;
  background: var(--bg-surface);
}

.review-item.review-correct {
  border-left: 4px solid var(--success);
}

.review-item.review-wrong {
  border-left: 4px solid var(--danger);
}

.review-q-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 0.85rem;
  font-weight: 700;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  margin-top: auto;
  padding: 24px 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

.footer-container {
  max-width: 100%;
  margin: 0;
  padding: 0 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ==========================================================================
   Print Engine Stylesheet (@media print)
   Transforms interactive test into a clean 2-page A4 study guide
   ========================================================================== */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt;
  }
  
  .site-header,
  .exam-status-bar,
  .breadcrumb-bar,
  .set-switcher-bar,
  .ad-slot-wrapper,
  .palette-card,
  .card-action-bar,
  .scorecard-actions,
  .site-footer,
  .theme-toggle-btn,
  .mode-pill-group {
    display: none !important;
  }
  
  .test-layout {
    display: block !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  .print-only-header {
    display: block !important;
    border-bottom: 2px solid #000;
    padding-bottom: 10px;
    margin-bottom: 20px;
  }
  
  .print-only-header h1 {
    font-size: 16pt;
    font-weight: bold;
  }
  
  .print-only-header p {
    font-size: 9.5pt;
    color: #333;
  }
  
  .review-item {
    page-break-inside: avoid;
    border: 1px solid #ccc !important;
    margin-bottom: 12px !important;
    padding: 10px !important;
    background: #fff !important;
  }
  
  .explanation-box {
    display: block !important;
    background: #f9f9f9 !important;
    border: 1px solid #ddd !important;
  }
}

.print-only-header {
  display: none;
}
