/* ----------------------------------------------------
   MOSEA - ICE BLUE / FROST SLATE DELUXE THEME
   Mobile & Desktop Optimized Layout System
   ---------------------------------------------------- */

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

:root {
  /* Light Frost Theme Palette */
  --bg-main: #f0f4f8;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-header: rgba(240, 244, 248, 0.96);
  --bg-sidebar: #ffffff;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  
  --border-light: #e2e8f0;
  --border-focus: #38bdf8;
  
  /* Primary Ice Accents */
  --primary: #0ea5e9;
  --primary-hover: #0284c7;
  --primary-light: #e0f2fe;
  --cyan-accent: #0891b2;
  --gradient-ice: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
  
  /* Status Colors */
  --correct-bg: #ecfdf5;
  --correct-border: #10b981;
  --correct-text: #065f46;
  
  --wrong-bg: #fff1f2;
  --wrong-border: #f43f5e;
  --wrong-text: #9f1239;
  
  --unanswered-bg: #f1f5f9;
  --unanswered-border: #cbd5e1;
  --unanswered-text: #64748b;
  
  --shadow-sm: 0 1px 3px rgba(14, 165, 233, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(14, 165, 233, 0.08);
  --shadow-lg: 0 8px 20px -4px rgba(14, 165, 233, 0.12);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  /* Deep Glacier Dark Theme Palette */
  --bg-main: #0b1329;
  --bg-card: #162032;
  --bg-card-hover: #1e2d42;
  --bg-header: rgba(11, 19, 41, 0.96);
  --bg-sidebar: #162032;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;
  
  --border-light: #1e293b;
  --border-focus: #38bdf8;
  
  --primary-light: rgba(14, 165, 233, 0.18);
  
  --correct-bg: rgba(16, 185, 129, 0.15);
  --correct-border: #10b981;
  --correct-text: #34d399;
  
  --wrong-bg: rgba(244, 63, 94, 0.15);
  --wrong-border: #f43f5e;
  --wrong-text: #fb7185;
  
  --unanswered-bg: #1e293b;
  --unanswered-border: #334155;
  --unanswered-text: #94a3b8;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 20px -4px rgba(0, 0, 0, 0.6);
}

/* Custom Scrollbar - Matching Theme 100% */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-main);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
  background: var(--unanswered-border);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--unanswered-border) var(--bg-main);
}

/* Global Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  font-family: var(--font-family);
  font-size: 16px;
  background-color: var(--bg-main);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.15s ease, color 0.15s ease;
}

/* Progress Bar Bar */
.progress-bar-wrapper {
  width: 100%;
  height: 4px;
  background: var(--border-light);
  position: relative;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--gradient-ice);
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Header & Navigation */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-light);
  padding: 0.65rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  text-decoration: none;
  letter-spacing: 0.04em;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: var(--gradient-ice);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 3px 10px rgba(14, 165, 233, 0.3);
  flex-shrink: 0;
}

.brand-title {
  background: var(--gradient-ice);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-grow: 1;
  justify-content: flex-end;
}

.select-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-grow: 1;
  max-width: 480px;
  justify-content: flex-end;
}

.custom-select {
  background-color: var(--bg-card);
  color: var(--text-main);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

#subjectSelect {
  flex: 1 1 auto;
  min-width: 180px;
}

#chapterSelect {
  flex: 0 0 auto;
  min-width: 105px;
  max-width: 125px;
}

.custom-select:hover, .custom-select:focus {
  border-color: var(--primary);
}

/* Action Buttons & Pills */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  user-select: none;
  min-height: 40px;
}

.btn-primary {
  background: var(--gradient-ice);
  color: white;
  box-shadow: 0 3px 10px rgba(14, 165, 233, 0.25);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-outline {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-light);
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1.5px solid var(--border-light);
  color: var(--text-main);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

/* Toolbar & Filters */
.toolbar-bar {
  max-width: 1400px;
  margin: 0.75rem auto 0;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.mode-switcher {
  display: flex;
  background: var(--bg-card);
  padding: 0.2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.mode-btn {
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.825rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 36px;
}

.mode-btn.active {
  background: var(--gradient-ice);
  color: white;
  box-shadow: 0 2px 6px rgba(14, 165, 233, 0.2);
}

.filter-pills {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg-card);
  padding: 0.2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  overflow-x: auto;
}

.filter-pill {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  min-height: 36px;
}

.filter-pill.active {
  background: var(--primary-light);
  color: var(--primary-hover);
  font-weight: 700;
}

/* Modern iOS-Style Toggle Switch */
.toggle-switch-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--bg-card);
  padding: 0.25rem 0.75rem 0.25rem 0.4rem;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border-light);
  cursor: pointer;
  user-select: none;
  box-shadow: var(--shadow-sm);
  min-height: 38px;
  transition: border-color 0.15s ease;
}

.toggle-switch-wrapper.highlight-toggle {
  border-color: var(--primary);
}

.toggle-switch-wrapper:hover {
  border-color: var(--primary);
}

.toggle-switch-input {
  display: none;
}

.toggle-switch-slider {
  width: 36px;
  height: 20px;
  background-color: var(--unanswered-border);
  border-radius: 999px;
  position: relative;
  transition: background-color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.toggle-switch-slider::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toggle-switch-input:checked + .toggle-switch-slider {
  background: var(--gradient-ice);
}

.toggle-switch-input:checked + .toggle-switch-slider::before {
  transform: translateX(16px);
}

.toggle-switch-text {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.toggle-switch-input:checked ~ .toggle-switch-text {
  color: var(--text-main);
}

.exam-timer {
  display: none;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-card);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--primary);
  color: var(--primary);
  font-weight: 800;
  font-size: 0.9rem;
}

.exam-timer.urgent {
  border-color: var(--wrong-border);
  color: var(--wrong-text);
}

/* Main Layout Grid */
.main-wrapper {
  max-width: 1400px;
  width: 100%;
  margin: 0.85rem auto 3rem;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.25rem;
  align-items: start;
}

/* Questions Scroll Container */
.questions-container {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

/* Question Card Styling - Hardware Accelerated Isolation */
.question-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-light);
  padding: 1.25rem;
  box-shadow: var(--shadow-md);
  position: relative;
  contain: content;
  transform: translateZ(0);
  transition: border-color 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Active Highlighted Question Card - Ultra Smooth Ice Blue Border Glow */
.question-card.active {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3.5px rgba(14, 165, 233, 0.22), 0 8px 24px -4px rgba(14, 165, 233, 0.2) !important;
}

.question-card.active .question-number-tag {
  background: var(--gradient-ice) !important;
  color: white !important;
  box-shadow: 0 3px 8px rgba(14, 165, 233, 0.35);
}

.question-card.highlight {
  border-color: var(--primary) !important;
}

.question-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.question-number-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  background: var(--primary-light);
  color: var(--primary-hover);
  border-radius: var(--radius-full);
  font-size: 0.775rem;
  font-weight: 800;
  transition: background 0.3s cubic-bezier(0.16, 1, 0.3, 1), color 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.bookmark-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
}

.bookmark-btn.active {
  color: #f59e0b;
}

.question-text {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text-main);
  margin-bottom: 1rem;
}

/* Options Container */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-light);
  background: var(--bg-card);
  cursor: pointer;
  user-select: none;
  min-height: 48px;
  touch-action: manipulation;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.option-radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--unanswered-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.option-radio-inner {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: transparent;
  transform: scale(0);
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.option-key {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--text-muted);
  min-width: 20px;
}

.option-content {
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-main);
}

/* Option Selected State */
.option-item.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

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

.option-item.selected .option-radio-inner {
  background: white;
  transform: scale(1);
}

/* Practice Feedback States */
.option-item.is-correct {
  background: var(--correct-bg) !important;
  border-color: var(--correct-border) !important;
}

.option-item.is-correct .option-radio {
  border-color: var(--correct-border) !important;
  background: var(--correct-border) !important;
}

.option-item.is-correct .option-radio-inner {
  background: white !important;
  transform: scale(1) !important;
}

.option-item.is-correct .option-content,
.option-item.is-correct .option-key {
  color: var(--correct-text) !important;
  font-weight: 700;
}

.option-item.is-wrong {
  background: var(--wrong-bg) !important;
  border-color: var(--wrong-border) !important;
}

.option-item.is-wrong .option-radio {
  border-color: var(--wrong-border) !important;
  background: var(--wrong-border) !important;
}

.option-item.is-wrong .option-radio-inner {
  background: white !important;
  transform: scale(1) !important;
}

.option-item.is-wrong .option-content,
.option-item.is-wrong .option-key {
  color: var(--wrong-text) !important;
  font-weight: 700;
}

/* Explanation Box */
.explanation-box {
  margin-top: 0.85rem;
  padding: 0.75rem 1rem;
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 0.85rem;
  line-height: 1.45;
  display: none;
}

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

/* Question Footer Navigation */
.card-footer-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
}

.card-nav-btn {
  background: var(--bg-main);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 36px;
}

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

/* Sidebar Question Palette */
.sidebar-palette {
  position: sticky;
  top: 75px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  contain: content;
  transform: translateZ(0);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.palette-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.palette-title {
  font-size: 0.95rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.palette-stats {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 700;
}

.mobile-toggle-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.2rem;
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
}

.palette-btn {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--unanswered-bg);
  color: var(--unanswered-text);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.825rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.palette-btn.current-active {
  box-shadow: 0 0 0 2.5px rgba(14, 165, 233, 0.35) !important;
  border-color: var(--primary) !important;
  transform: scale(1.1);
  font-weight: 800;
  z-index: 2;
}

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

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

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

.palette-legend {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-dot.dot-unanswered { background: var(--unanswered-border); }
.legend-dot.dot-answered { background: var(--primary); }
.legend-dot.dot-correct { background: var(--correct-border); }
.legend-dot.dot-wrong { background: var(--wrong-border); }

/* Quick Answer Key Section */
.answer-key-section {
  display: none;
  flex-direction: column;
  gap: 0.6rem;
  padding-top: 0.85rem;
  border-top: 1.5px dashed var(--correct-border);
  margin-top: 0.35rem;
}

.answer-key-section.show {
  display: flex;
}

.answer-key-header {
  font-size: 0.85rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--correct-text);
}

.answer-key-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
}

.answer-key-btn {
  background: var(--correct-bg);
  color: var(--correct-text);
  border: 1.5px solid var(--correct-border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.2rem;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.825rem;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease, background-color 0.15s ease;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.12);
}

.answer-key-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.25);
}

.answer-key-btn:active {
  transform: scale(0.95);
}

/* Compact Floating Back-To-Top Button */
.btn-scroll-top {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gradient-ice);
  color: white;
  border: none;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
  z-index: 140;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.btn-scroll-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.btn-scroll-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(14, 165, 233, 0.45);
}

.btn-scroll-top:active {
  transform: scale(0.95);
}

/* Custom Reset Confirmation Modal Styling */
.confirm-modal-card {
  max-width: 360px;
  padding: 1.5rem;
  text-align: center;
}

.confirm-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.85rem;
  box-shadow: 0 3px 10px rgba(14, 165, 233, 0.2);
}

.confirm-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.confirm-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 1.25rem;
}

.confirm-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.confirm-actions .btn {
  flex: 1;
}

/* Score Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(11, 19, 41, 0.8);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.modal-backdrop.show {
  display: flex;
}

.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  max-width: 440px;
  width: 100%;
  padding: 1.75rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.modal-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gradient-ice);
  color: white;
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.modal-score {
  font-size: 2.75rem;
  font-weight: 800;
  background: var(--gradient-ice);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0.4rem 0;
}

.modal-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 1.25rem 0;
}

.stat-box {
  background: var(--bg-main);
  padding: 0.65rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.stat-val {
  font-size: 1.1rem;
  font-weight: 800;
}

.stat-label {
  font-size: 0.725rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.empty-notice {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-light);
  padding: 2.5rem 1.25rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-notice-icon {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

/* Responsive Design */
@media (max-width: 992px) {
  .main-wrapper {
    grid-template-columns: 1fr;
    padding-bottom: 70px;
  }

  .sidebar-palette {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    max-height: 60px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    z-index: 150;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    padding: 0.75rem 1.25rem;
    overflow: hidden;
    transition: max-height 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }
  
  .sidebar-palette.expanded {
    max-height: 480px;
    overflow-y: auto;
  }
  
  .mobile-toggle-btn {
    display: block;
  }
  
  .palette-grid {
    grid-template-columns: repeat(8, 1fr);
    padding-top: 0.5rem;
  }

  .answer-key-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .btn-scroll-top {
    bottom: 75px;
    right: 18px;
    width: 40px;
    height: 40px;
    font-size: 1.15rem;
  }
}

@media (max-width: 640px) {
  .header-container {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .brand {
    font-size: 1.2rem;
  }

  .header-controls {
    width: 100%;
    justify-content: space-between;
  }

  .select-wrapper {
    max-width: 100%;
    gap: 0.4rem;
  }

  #subjectSelect {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
  }

  #chapterSelect {
    flex: 0 0 auto;
    width: 95px;
    font-size: 0.8rem;
    padding: 0.4rem 0.5rem;
  }

  .toolbar-bar {
    gap: 0.5rem;
  }

  .mode-btn {
    padding: 0.35rem 0.65rem;
    font-size: 0.775rem;
  }

  .filter-pill {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
  }

  .question-card {
    padding: 1rem;
  }

  .question-text {
    font-size: 0.95rem;
  }

  .option-item {
    padding: 0.65rem 0.85rem;
  }

  .option-content {
    font-size: 0.85rem;
  }

  .palette-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .answer-key-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
