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

:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #12122a;
  --bg-card: #1a1a3e;
  --bg-card-hover: #222255;
  --bg-option: #16163a;
  --bg-option-hover: #1e1e4a;
  --bg-option-selected: #0d2b5e;
  --accent-primary: #00b4d8;
  --accent-secondary: #0077b6;
  --accent-glow: rgba(0, 180, 216, 0.3);
  --accent-gradient: linear-gradient(135deg, #00b4d8, #0077b6);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #1e293b;
  --border-accent: rgba(0, 180, 216, 0.3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(0, 180, 216, 0.2);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(0, 119, 182, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(0, 180, 216, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(16, 185, 129, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 0 auto;
  padding: 40px 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ==================== LOGO SECTION ==================== */
.logo-section {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 50px;
}

.logo-box {
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-xl);
  padding: 40px 60px;
  text-align: center;
  box-shadow: var(--shadow-glow);
  width: 100%;
  max-width: 420px;
  position: relative;
  overflow: hidden;
}

.logo-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
}

.logo-img {
  width: 100px;
  height: 100px;
  margin: 0 auto 20px;
  padding: 4px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-primary);
  box-shadow: 0 0 20px rgba(0, 180, 216, 0.3);
  display: block;
}

.logo-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.logo-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 3px;
  font-weight: 500;
}

/* ==================== FORM SECTION ==================== */
.selection-form {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.select-wrapper {
  position: relative;
}

.custom-select {
  width: 100%;
  padding: 16px 50px 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: all 0.3s ease;
  outline: none;
}

.custom-select:hover:not(:disabled) {
  border-color: var(--accent-primary);
  background: var(--bg-card-hover);
}

.custom-select:focus:not(:disabled) {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.custom-select:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.custom-select option {
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 10px;
}

.select-arrow {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--text-secondary);
  pointer-events: none;
  transition: transform 0.3s ease;
}

.custom-select:focus + .select-arrow {
  border-top-color: var(--accent-primary);
  transform: translateY(-50%) rotate(180deg);
}

.chapter-info {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(0, 180, 216, 0.06);
  border: 1px solid rgba(0, 180, 216, 0.15);
  border-radius: var(--radius-sm);
  margin-top: 6px;
}

.chapter-info svg {
  width: 18px;
  height: 18px;
  stroke: var(--accent-primary);
  flex-shrink: 0;
  margin-top: 1px;
}

.chapter-info span {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ==================== START BUTTON ==================== */
.start-button {
  width: 100%;
  padding: 18px 32px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 180, 216, 0.3);
  margin-top: 10px;
  position: relative;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.start-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: left 0.5s ease;
}

.start-button:hover:not(:disabled)::before {
  left: 100%;
}

.start-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 180, 216, 0.4);
}

.start-button:active:not(:disabled) {
  transform: translateY(0);
}

.start-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2.5;
}

/* ==================== FOOTER ==================== */
.footer {
  margin-top: auto;
  padding-top: 40px;
  text-align: center;
}

.footer p {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==================== QUIZ PAGE ==================== */
.quiz-container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  min-height: 100vh;
}

.quiz-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.quiz-sidebar {
  position: sticky;
  top: 20px;
  height: fit-content;
}

/* Header Bar */
.quiz-header {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
}

.quiz-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quiz-info .subject-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.quiz-info .chapter-name {
  font-size: 13px;
  color: var(--accent-primary);
  font-weight: 500;
}

.quiz-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.timer-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  text-align: center;
}

.timer-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 4px;
}

.timer-value {
  font-size: 24px;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: var(--accent-primary);
  letter-spacing: 2px;
}

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

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

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

/* Question Counter */
.question-counter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.question-counter .current-q {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.question-counter .total-q {
  font-size: 13px;
  color: var(--text-secondary);
}

.difficulty-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.difficulty-badge.easy {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.difficulty-badge.medium {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.difficulty-badge.hard {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Question Body */
.question-body {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 32px;
  min-height: 140px;
  box-shadow: var(--shadow-sm);
}

.question-text {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.8;
}

.question-text code {
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 15px;
  color: var(--accent-primary);
  border: 1px solid var(--border-color);
}

.question-text pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 16px 0;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 14px;
  color: #e2e8f0;
  overflow-x: auto;
  line-height: 1.7;
}

/* Options */
.options-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-card {
  background: var(--bg-option);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 24px;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.option-card:hover {
  background: var(--bg-option-hover);
  border-color: rgba(0, 180, 216, 0.4);
  transform: translateX(4px);
}

.option-card.selected {
  background: var(--bg-option-selected);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px var(--accent-primary), var(--shadow-glow);
}

.option-card.selected .option-letter {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.option-letter {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 10px;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-secondary);
  transition: all 0.25s ease;
}

.option-card.selected .option-letter {
  box-shadow: 0 0 12px rgba(0, 180, 216, 0.4);
}

.option-text {
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 400;
  line-height: 1.5;
}

.option-card.selected .option-text {
  color: var(--accent-primary);
}

/* Navigation Buttons */
.nav-buttons {
  display: flex;
  gap: 16px;
  padding-top: 8px;
}

.nav-btn {
  flex: 1;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.25s ease;
  border: 2px solid transparent;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.nav-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2.5;
}

.btn-prev {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.btn-prev:hover:not(:disabled) {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.btn-next {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.btn-next:hover:not(:disabled) {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.btn-submit {
  background: linear-gradient(135deg, var(--success), #059669);
  color: white;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(16, 185, 129, 0.4);
}

.nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none !important;
}

/* Question Navigator */
.question-navigator {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-md);
}

.nav-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.nav-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.nav-btn-num {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 2px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.nav-btn-num:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.nav-btn-num.current {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
  box-shadow: 0 0 12px rgba(0, 180, 216, 0.4);
}

.nav-btn-num.answered {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

.nav-btn-num.not-visited {
  background: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-muted);
}

.nav-btn-num.marked {
  background: rgba(168, 85, 247, 0.15);
  border-color: #a855f7;
  color: #a855f7;
}

/* Legend */
.nav-legend {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-dot.visited { background: var(--border-color); }
.legend-dot.current { background: var(--accent-primary); }
.legend-dot.answered { background: var(--success); }
.legend-dot.marked { background: #a855f7; }

/* Mark for Review */
.btn-mark {
  width: 100%;
  padding: 12px;
  margin-top: 16px;
  background: rgba(168, 85, 247, 0.1);
  border: 2px solid rgba(168, 85, 247, 0.3);
  border-radius: var(--radius-sm);
  color: #a855f7;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-mark:hover {
  background: rgba(168, 85, 247, 0.2);
  border-color: #a855f7;
}

.btn-mark.marked {
  background: rgba(168, 85, 247, 0.25);
  border-color: #a855f7;
  color: white;
}

/* ==================== MODAL ==================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

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

.modal-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-icon.warning {
  background: var(--warning-bg);
  border: 2px solid rgba(245, 158, 11, 0.3);
}

.modal-icon.warning svg {
  stroke: var(--warning);
}

.modal-icon svg {
  width: 28px;
  height: 28px;
  stroke-width: 2;
}

.modal h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.modal p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.6;
}

.modal-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin: 20px 0;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

.modal-stat {
  text-align: center;
}

.modal-stat .stat-value {
  font-size: 24px;
  font-weight: 700;
}

.modal-stat .stat-value.answered {
  color: var(--success);
}

.modal-stat .stat-value.unanswered {
  color: var(--danger);
}

.modal-stat .stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.modal-btn {
  flex: 1;
  padding: 14px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 2px solid transparent;
}

.modal-btn.cancel {
  background: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.modal-btn.cancel:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.modal-btn.confirm {
  background: linear-gradient(135deg, var(--success), #059669);
  color: white;
}

.modal-btn.confirm:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

/* ==================== RESULTS PAGE ==================== */
.results-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 40px 20px;
}

.results-header {
  text-align: center;
  margin-bottom: 40px;
}

.results-header h1 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 8px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.results-header p {
  color: var(--text-secondary);
  font-size: 15px;
}

.score-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.score-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent-gradient);
}

.score-circle {
  width: 160px;
  height: 160px;
  margin: 0 auto 24px;
  position: relative;
}

.score-circle svg {
  width: 160px;
  height: 160px;
  transform: rotate(-90deg);
}

.score-circle .bg-ring {
  fill: none;
  stroke: var(--bg-secondary);
  stroke-width: 10;
}

.score-circle .progress-ring {
  fill: none;
  stroke: var(--accent-primary);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.5s ease;
}

.score-circle .score-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-circle .score-percent {
  font-size: 36px;
  font-weight: 800;
  color: var(--text-primary);
}

.score-circle .score-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.score-message {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.score-detail {
  font-size: 14px;
  color: var(--text-secondary);
}

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

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

.stat-card .stat-number {
  font-size: 28px;
  font-weight: 800;
}

.stat-card .stat-number.correct {
  color: var(--success);
}

.stat-card .stat-number.incorrect {
  color: var(--danger);
}

.stat-card .stat-number.skipped {
  color: var(--warning);
}

.stat-card .stat-desc {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

.time-taken {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 24px;
  text-align: center;
  margin-bottom: 24px;
  color: var(--text-secondary);
  font-size: 14px;
}

.time-taken strong {
  color: var(--accent-primary);
}

.results-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.result-btn {
  padding: 14px 32px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-btn.primary {
  background: var(--accent-gradient);
  color: white;
  border: none;
  box-shadow: 0 4px 15px rgba(0, 180, 216, 0.3);
}

.result-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 180, 216, 0.4);
}

.result-btn.secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 2px solid var(--border-color);
}

.result-btn.secondary:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

/* ==================== RESPONSIVE — TABLET ==================== */
@media (max-width: 900px) {
  .quiz-container {
    grid-template-columns: 1fr;
  }

  .quiz-sidebar {
    position: static;
    order: -1;
  }

  .question-navigator {
    position: static;
  }

  .nav-grid {
    grid-template-columns: repeat(8, 1fr);
  }
}

/* ==================== RESPONSIVE — MOBILE ==================== */
@media (max-width: 600px) {
  /* --- Selection Page --- */
  .container {
    padding: 16px 14px;
    min-height: 100vh;
  }

  .logo-section {
    margin-bottom: 30px;
  }

  .logo-box {
    padding: 28px 20px;
  }

  .logo-img {
    width: 80px;
    height: 80px;
  }

  .logo-title {
    font-size: 20px;
  }

  .logo-subtitle {
    font-size: 11px;
    letter-spacing: 2px;
  }

  .selection-form {
    gap: 18px;
  }

  .custom-select {
    padding: 14px 44px 14px 16px;
    font-size: 15px;
  }

  .chapter-info {
    padding: 10px 12px;
    gap: 8px;
  }

  .chapter-info span {
    font-size: 12px;
  }

  .start-button {
    padding: 15px 28px;
    font-size: 16px;
  }

  /* --- Quiz Page --- */
  .quiz-container {
    padding: 12px 10px;
    gap: 14px;
  }

  .quiz-main {
    gap: 12px;
  }

  /* Header: stack subject + timer */
  .quiz-header {
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
  }

  .quiz-info .subject-name {
    font-size: 16px;
  }

  .quiz-info .chapter-name {
    font-size: 12px;
  }

  .timer-box {
    width: 100%;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .timer-label {
    margin-bottom: 0;
  }

  .timer-value {
    font-size: 20px;
  }

  /* Question counter */
  .question-counter {
    padding: 10px 16px;
  }

  .question-counter .current-q {
    font-size: 13px;
  }

  .difficulty-badge {
    padding: 3px 10px;
    font-size: 10px;
  }

  /* Question body */
  .question-body {
    padding: 18px 16px;
    min-height: 100px;
  }

  .question-text {
    font-size: 15px;
    line-height: 1.7;
  }

  .question-text pre {
    font-size: 12px;
    padding: 12px;
  }

  /* Options — bigger touch targets */
  .options-container {
    gap: 10px;
  }

  .option-card {
    padding: 14px 16px;
    gap: 12px;
    min-height: 52px;
  }

  .option-letter {
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 14px;
    border-radius: 8px;
  }

  .option-text {
    font-size: 14px;
  }

  /* Navigation buttons — full width, touch-friendly */
  .nav-buttons {
    gap: 10px;
  }

  .nav-btn {
    padding: 13px 16px;
    font-size: 14px;
    gap: 6px;
    min-height: 48px;
  }

  .nav-btn svg {
    width: 16px;
    height: 16px;
  }

  /* Question navigator — top bar on mobile */
  .quiz-sidebar {
    order: -1;
  }

  .question-navigator {
    padding: 14px;
  }

  .nav-title {
    font-size: 11px;
    margin-bottom: 10px;
    padding-bottom: 8px;
  }

  .nav-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }

  .nav-btn-num {
    font-size: 12px;
    min-height: 36px;
  }

  .nav-legend {
    margin-top: 10px;
    padding-top: 10px;
    gap: 5px;
  }

  .legend-item {
    font-size: 10px;
    gap: 6px;
  }

  .legend-dot {
    width: 8px;
    height: 8px;
  }

  .btn-mark {
    padding: 10px;
    margin-top: 10px;
    font-size: 12px;
    min-height: 40px;
  }

  /* Modal */
  .modal {
    padding: 24px 20px;
    width: 94%;
  }

  .modal h3 {
    font-size: 18px;
  }

  .modal p {
    font-size: 13px;
  }

  .modal-btn {
    padding: 12px;
    font-size: 14px;
    min-height: 48px;
  }

  /* Results page */
  .results-container {
    padding: 20px 14px;
  }

  .results-header h1 {
    font-size: 24px;
  }

  .results-header p {
    font-size: 13px;
  }

  .score-card {
    padding: 28px 20px;
  }

  .score-circle {
    width: 130px;
    height: 130px;
  }

  .score-circle svg {
    width: 130px;
    height: 130px;
  }

  .score-circle .score-percent {
    font-size: 30px;
  }

  .score-message {
    font-size: 16px;
  }

  .stats-grid {
    gap: 8px;
  }

  .stat-card {
    padding: 14px 8px;
  }

  .stat-card .stat-number {
    font-size: 22px;
  }

  .stat-card .stat-desc {
    font-size: 10px;
  }

  .time-taken {
    padding: 12px 16px;
    font-size: 13px;
  }

  .result-btn {
    padding: 13px 24px;
    font-size: 14px;
    justify-content: center;
  }

  .results-actions {
    gap: 10px;
  }
}

/* ==================== RESPONSIVE — SMALL MOBILE ==================== */
@media (max-width: 380px) {
  .logo-box {
    padding: 22px 16px;
  }

  .logo-img {
    width: 70px;
    height: 70px;
  }

  .logo-title {
    font-size: 18px;
  }

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

  .option-card {
    padding: 12px 14px;
    gap: 10px;
  }

  .option-letter {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 13px;
  }

  .option-text {
    font-size: 13px;
  }

  .nav-btn {
    padding: 12px 12px;
    font-size: 13px;
  }

  .quiz-container {
    padding: 8px 6px;
    gap: 10px;
  }
}

/* ==================== RESPONSIVE — LANDSCAPE MOBILE ==================== */
@media (max-height: 500px) and (orientation: landscape) {
  .quiz-container {
    padding: 8px 12px;
  }

  .quiz-header {
    flex-direction: row;
    padding: 10px 16px;
  }

  .question-body {
    padding: 14px 16px;
    min-height: 80px;
  }

  .question-text {
    font-size: 14px;
  }

  .option-card {
    padding: 10px 14px;
    min-height: 44px;
  }

  .nav-buttons {
    gap: 8px;
  }

  .nav-btn {
    padding: 10px 14px;
    min-height: 42px;
  }
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.quiz-main > * {
  animation: fadeIn 0.4s ease forwards;
}

.quiz-main > *:nth-child(1) { animation-delay: 0s; }
.quiz-main > *:nth-child(2) { animation-delay: 0.05s; }
.quiz-main > *:nth-child(3) { animation-delay: 0.1s; }
.quiz-main > *:nth-child(4) { animation-delay: 0.15s; }
.quiz-main > *:nth-child(5) { animation-delay: 0.2s; }

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

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