:root {
  /* Canvas Substrate & Surfaces */
  --bg: #F4FBF7;
  --card-bg: #FFFFFF;
  --surface-hover: #E8F5EE;
  --surface-active: #D9EFE3;

  /* Ink & Typography */
  --text: #0F1F17;
  --text-sub: #4B6358;
  --text-disabled: #8FA89B;

  /* Primary Brand Anchor */
  --primary: #059669;
  --primary-hover: #047857;
  --primary-light: #ECFDF5;

  /* CBT 4-State Examination Signals */
  --correct: #2E7D32;
  --correct-bg: #E8F5E9;
  --wrong: #C62828;
  --wrong-bg: #FFEBEE;
  --blue: #1565C0;
  --blue-bg: #E3F2FD;

  /* Structural Geometry */
  --border: #D1E7DD;
  --border-strong: #A3CFBD;
  --border-focus: #059669;
  --shadow: 0 2px 8px rgba(15, 31, 23, 0.08);
  --shadow-elevated: 0 6px 20px rgba(15, 31, 23, 0.12);
  --radius: 16px;
  --font: 'Noto Sans Devanagari', 'Nirmala UI', system-ui, -apple-system, Roboto, sans-serif;
}

.dark {
  /* Dark Mode Matrix */
  --bg: #0B1411;
  --card-bg: #13221C;
  --surface-hover: #1C332A;
  --surface-active: #234237;
  --text: #F2FBF6;
  --text-sub: #8FA89B;
  --text-disabled: #4B6358;
  --border: #1E382E;
  --border-strong: #2D5445;
  --border-focus: #10B981;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-elevated: 0 6px 24px rgba(0, 0, 0, 0.50);
  --primary: #10B981;
  --primary-light: #064E3B;
  --correct-bg: #1B3A1B;
  --wrong-bg: #3A1B1B;
  --blue-bg: #1B2A3A;
}

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

body {
  font-family: var(--font);
  font-size: 20px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  touch-action: manipulation;
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg);
  text-rendering: optimizeLegibility;
}

/* Custom scrollbars for Windows 11 Chromium browsers */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-sub);
}

button, .subject-card, .profile-card, .option-btn, .set-btn, .footer-btn, .action-btn, .exam-nav, .submit-btn, .back-btn, .hero-action-btn, .exam-tab-btn {
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

/* SCREENS */
.screen {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: 100px;
}
.screen.active {
  display: flex;
  flex-direction: column;
  animation: screenFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* HOME */
.home-header {
  text-align: center;
  padding: 24px 16px 8px;
  padding-top: calc(24px + env(safe-area-inset-top, 0px));
  position: relative;
}
.home-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.subtitle {
  color: var(--text-sub);
  font-size: 16px;
  margin-top: 4px;
}
.icon-btn {
  position: absolute;
  top: 20px;
  right: 16px;
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  padding: 8px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: transform 0.1s ease;
}
.icon-btn:active {
  transform: scale(0.92);
}

/* ─── EXAM SELECTOR SEGMENT BAR ─── */
.exam-selector-bar {
  display: flex;
  gap: 8px;
  padding: 4px 16px 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.exam-selector-bar::-webkit-scrollbar {
  display: none;
}
.exam-tab-btn {
  flex: 1;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 24px;
  border: 2px solid var(--border);
  background: var(--card-bg);
  color: var(--text-sub);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  transition: transform 0.1s cubic-bezier(0.18, 0.89, 0.32, 1.28), border-color 0.15s ease, background-color 0.15s ease;
  font-family: var(--font);
}
.exam-tab-btn:active {
  transform: scale(0.96);
}
.exam-tab-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 3px 10px rgba(5, 150, 105, 0.35);
}

/* ─── HERO ACTION SECTION (PRITI'S COMMAND CENTER) ─── */
.hub-hero-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 16px 8px;
}

.hero-action-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  min-height: 74px;
  box-shadow: var(--shadow);
  transition: transform 0.1s cubic-bezier(0.18, 0.89, 0.32, 1.28), border-color 0.15s ease;
  font-family: var(--font);
}
.hero-action-btn:active {
  transform: scale(0.97);
}

.hero-action-btn.primary {
  background: linear-gradient(135deg, #059669, #10B981);
  color: white;
  border-color: #047857;
  min-height: 84px;
}
.hero-action-btn.primary .hero-btn-title {
  color: white;
  font-size: 20px;
  font-weight: 700;
}
.hero-action-btn.primary .hero-btn-sub {
  color: #ECFDF5;
}

.hero-action-btn.secondary {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--card-bg), var(--primary-light));
}
.hero-action-btn.secondary .hero-btn-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.hero-action-btn.mistake-btn {
  border-color: var(--wrong);
  background: linear-gradient(135deg, var(--card-bg), var(--wrong-bg));
}
.hero-action-btn.mistake-btn .hero-btn-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--wrong);
}

.hero-btn-icon {
  font-size: 32px;
  min-width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hero-btn-content {
  flex: 1;
}
.hero-btn-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}
.hero-btn-sub {
  font-size: 14px;
  color: var(--text-sub);
  margin-top: 3px;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px 4px;
}
.section-heading {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.toggle-bank-btn {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  font-family: var(--font);
  transition: transform 0.1s ease;
}
.toggle-bank-btn:active {
  transform: scale(0.95);
}

.subject-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 12px 16px 16px;
  flex: 1;
}

.subject-card {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 12px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.18, 0.89, 0.32, 1.28), border-color 0.15s ease;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.subject-card:active {
  transform: scale(0.95);
  border-color: var(--primary);
}
.subject-card .emoji { font-size: 40px; }
.subject-card .name { font-size: 18px; font-weight: 600; }
.subject-card .count { font-size: 14px; color: var(--text-sub); }

/* FOOTER */
.home-footer {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  position: fixed;
  bottom: 0;
  width: 100%;
  background: var(--bg);
  border-top: 1px solid var(--border);
  z-index: 20;
}
.footer-btn {
  flex: 1;
  padding: 16px;
  font-size: 18px;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  min-height: 56px;
  transition: transform 0.1s cubic-bezier(0.18, 0.89, 0.32, 1.28), border-color 0.15s ease;
}
.footer-btn:active {
  transform: scale(0.96);
  border-color: var(--primary);
}

/* SUB HEADER */
.sub-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
}
.sub-header h2 {
  font-size: 22px;
  font-weight: 700;
}
.back-btn {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--primary);
  cursor: pointer;
  font-family: var(--font);
  font-weight: 700;
  padding: 8px;
  min-width: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: transform 0.1s ease;
}
.back-btn:active {
  transform: scale(0.94);
}
.back-btn.small {
  font-size: 24px;
  padding: 4px 8px;
  min-width: 40px;
  min-height: 40px;
}

/* SET LIST */
.set-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px;
}
.set-btn {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  font-family: var(--font);
  font-size: 18px;
  transition: transform 0.15s cubic-bezier(0.18, 0.89, 0.32, 1.28), border-color 0.15s ease;
  min-height: 64px;
  box-shadow: var(--shadow);
}
.set-btn:active {
  transform: scale(0.95);
  border-color: var(--primary);
}
.set-btn .set-num {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.set-btn .set-score {
  font-size: 14px;
  color: var(--text-sub);
  margin-top: 4px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.set-btn.done {
  border-color: var(--correct);
}

/* EXAM CBT TERMINAL (0-SCROLL 100DVH LOCK) */
.exam-header {
  position: sticky;
  top: 0;
  background: var(--card-bg);
  padding: 8px 16px 6px;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--border);
  z-index: 10;
}
.exam-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.exam-header-tools {
  display: flex;
  gap: 8px;
  align-items: center;
}
.exam-tool-btn {
  min-height: 38px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease, border-color 0.15s ease;
}
.exam-tool-btn:active {
  transform: scale(0.95);
  border-color: var(--primary);
}
.timer {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
  transition: color 0.3s ease;
}
.timer.timer-warning {
  color: #D97706 !important;
}
.timer.timer-danger {
  color: #DC2626 !important;
  animation: timerPulse 1s infinite alternate;
}
@keyframes timerPulse {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0.6; transform: scale(1.05); }
}

.exam-section-badge {
  margin-top: 4px;
  padding: 3px 8px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  display: inline-block;
  border: 1px solid var(--border);
}
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin: 6px 0 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.25s ease-out;
}
.exam-counter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2px;
}
.exam-counter {
  font-size: 14px;
  color: var(--text-sub);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.exam-mark-badge {
  font-size: 12px;
  font-weight: 700;
  color: #B45309;
  background: #FEF3C7;
  border: 1px solid #FCD34D;
  padding: 2px 8px;
  border-radius: 6px;
}
.dark .exam-mark-badge {
  color: #FDE68A;
  background: #78350F;
  border-color: #92400E;
}

.exam-body {
  flex: 1;
  padding: 16px;
  padding-bottom: 160px;
  display: flex;
  flex-direction: column;
}
.question-box {
  font-size: 22px;
  font-weight: 600;
  padding: 16px 20px;
  margin-bottom: 16px;
  background: var(--primary-light);
  border-radius: var(--radius);
  border-left: 5px solid var(--primary);
  line-height: 1.6;
  word-break: break-word;
  box-shadow: var(--shadow);
}

.options-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.option-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  font-size: 20px;
  font-weight: 500;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  min-height: 68px; /* Strict 64px+ Ergonomic Touch Target */
  transition: transform 0.08s cubic-bezier(0.18, 0.89, 0.32, 1.28), border-color 0.15s ease, background-color 0.15s ease;
  word-break: break-word;
  line-height: 1.5;
  box-shadow: var(--shadow);
}
.option-btn:active {
  transform: scale(0.98);
}
.option-btn .opt-label {
  min-width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.option-btn.selected {
  border-color: var(--blue);
  background: var(--blue-bg);
  color: var(--blue);
  font-weight: 700;
}
.option-btn.selected .opt-label {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.option-btn.correct {
  border-color: var(--correct);
  background: var(--correct-bg);
  color: var(--correct);
  font-weight: 700;
}
.option-btn.correct .opt-label {
  background: var(--correct);
  color: white;
  border-color: var(--correct);
}

.option-btn.wrong {
  border-color: var(--wrong);
  background: var(--wrong-bg);
  color: var(--wrong);
  font-weight: 700;
}
.option-btn.wrong .opt-label {
  background: var(--wrong);
  color: white;
  border-color: var(--wrong);
}

.clear-choice-container {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}
.clear-choice-btn {
  background: none;
  border: none;
  color: var(--text-sub);
  font-size: 15px;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
  font-family: var(--font);
  text-decoration: underline;
  border-radius: 6px;
  min-height: 44px;
}
.clear-choice-btn:active {
  color: var(--wrong);
}

.exam-footer {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  position: fixed;
  bottom: 64px;
  width: 100%;
  background: var(--bg);
  border-top: 1px solid var(--border);
  z-index: 15;
}
.exam-nav {
  flex: 1;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  min-height: 54px;
  transition: transform 0.1s cubic-bezier(0.18, 0.89, 0.32, 1.28), border-color 0.15s ease;
}
.exam-nav:active {
  transform: scale(0.96);
}
.mark-btn {
  color: var(--primary);
  border-color: var(--primary);
}
.mark-btn.active-marked {
  background: #FEF3C7;
  border-color: #D97706;
  color: #B45309;
}
.dark .mark-btn.active-marked {
  background: #78350F;
  border-color: #92400E;
  color: #FDE68A;
}

.submit-btn {
  position: fixed;
  bottom: 0;
  width: 100%;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  font-size: 20px;
  font-weight: 700;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  min-height: 64px;
  z-index: 20;
  transition: transform 0.1s cubic-bezier(0.18, 0.89, 0.32, 1.28), background-color 0.15s ease;
}
.submit-btn:active {
  transform: scale(0.99);
  background-color: var(--primary-hover);
}

/* ─── MODALS (PALETTE & SUBMIT SUMMARY) ─── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}
.palette-sheet {
  background: var(--card-bg);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3);
  border-top: 2px solid var(--border);
}
.palette-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.palette-header h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.modal-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-sub);
  padding: 4px 8px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 8px;
}
.palette-legend {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}
.leg-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-sub);
}
.leg-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.leg-dot.answered { background: var(--correct); }
.leg-dot.marked { background: #D97706; }
.leg-dot.unattempted { background: var(--border); }
.palette-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  overflow-y: auto;
  max-height: 50vh;
  padding: 4px 2px 16px;
}
.pal-num-btn {
  min-height: 48px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
  transition: transform 0.08s ease;
}
.pal-num-btn:active {
  transform: scale(0.92);
}
.pal-num-btn.pal-answered {
  background: var(--correct-bg);
  border-color: var(--correct);
  color: var(--correct);
}
.pal-num-btn.pal-marked {
  background: #FEF3C7;
  border-color: #D97706;
  color: #B45309;
}
.pal-num-btn.pal-current {
  outline: 3px solid var(--blue);
  outline-offset: 1px;
}
.palette-footer-close {
  margin-top: 12px;
  min-height: 52px;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

/* ─── CBT SUBMISSION DIALOG ─── */
.submit-dialog {
  background: var(--card-bg);
  border-radius: 20px;
  width: calc(100% - 32px);
  max-width: 480px;
  margin: auto;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  border: 2px solid var(--border);
  text-align: center;
}
.submit-dialog-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.submit-dialog-sub {
  font-size: 15px;
  color: var(--text-sub);
  margin-bottom: 20px;
}
.submit-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}
.sub-stat-card {
  padding: 12px 6px;
  background: var(--surface-hover);
  border-radius: 10px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.sub-stat-card .sub-num {
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.sub-stat-card .sub-lbl {
  font-size: 11px;
  color: var(--text-sub);
  font-weight: 600;
}
.sub-stat-card.sub-stat-ans .sub-num { color: var(--correct); }
.sub-stat-card.sub-stat-skip .sub-num { color: var(--blue); }
.sub-stat-card.sub-stat-mark .sub-num { color: #D97706; }
.submit-dialog-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dialog-btn {
  min-height: 56px;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font);
  border: none;
  transition: transform 0.1s ease;
}
.dialog-btn:active {
  transform: scale(0.98);
}
.dialog-btn.primary {
  background: var(--primary);
  color: white;
}
.dialog-btn.secondary {
  background: var(--card-bg);
  border: 2px solid var(--border);
  color: var(--text);
}

/* ─── RESUME BANNER ON HOME ─── */
.resume-banner {
  margin: 12px 16px 4px;
  padding: 16px;
  background: linear-gradient(135deg, var(--card-bg), var(--primary-light));
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.resume-banner-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}
.resume-banner-sub {
  font-size: 14px;
  color: var(--text-sub);
}
.resume-banner-actions {
  display: flex;
  gap: 8px;
}
.resume-btn-resume {
  flex: 1;
  min-height: 48px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
}
.resume-btn-discard {
  min-height: 48px;
  padding: 0 16px;
  background: var(--card-bg);
  color: var(--text-sub);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}

/* ─── SENIOR LARGE FONT MODE ─── */
.large-font .question-box {
  font-size: 26px;
  line-height: 1.65;
}
.large-font .option-btn {
  font-size: 22px;
  min-height: 74px;
}
.large-font .option-btn .opt-label {
  min-width: 48px;
  height: 48px;
  font-size: 20px;
}

/* RESULTS */
.result-card {
  text-align: center;
  padding: 24px 16px;
}
.score-circle {
  font-size: 64px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.score-label {
  font-size: 20px;
  color: var(--text-sub);
  margin-top: 4px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.result-msg {
  font-size: 24px;
  font-weight: 700;
  margin-top: 8px;
  color: var(--primary);
}
.result-stats {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
}
.stat {
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  min-width: 90px;
  box-shadow: var(--shadow);
}
.stat.correct { background: var(--correct-bg); color: var(--correct); }
.stat.wrong { background: var(--wrong-bg); color: var(--wrong); }
.stat.skip { background: var(--blue-bg); color: var(--blue); }
.stat span {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.time-taken {
  margin-top: 14px;
  color: var(--text-sub);
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 16px;
}
.action-btn {
  padding: 16px;
  font-size: 18px;
  font-weight: 700;
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--primary);
  cursor: pointer;
  font-family: var(--font);
  min-height: 56px;
  box-shadow: var(--shadow);
  transition: transform 0.1s cubic-bezier(0.18, 0.89, 0.32, 1.28), background-color 0.15s ease;
}
.action-btn:active {
  transform: scale(0.97);
  background-color: var(--primary-light);
}
.action-btn.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* REVIEW */
.review-container {
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
}
.review-filter-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}
.review-filter-bar::-webkit-scrollbar {
  display: none;
}
.review-tab {
  flex-shrink: 0;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  color: var(--text-sub);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.review-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.review-list {
  padding: 4px 0;
}
.review-item {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  border-left: 5px solid var(--wrong);
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.review-item.review-correct {
  border-left-color: var(--correct);
}
.review-item.review-skipped {
  border-left-color: var(--blue);
}
.review-badge-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.review-status-tag {
  font-size: 13px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}
.review-status-tag.tag-correct {
  background: var(--correct-bg);
  color: var(--correct);
}
.review-status-tag.tag-wrong {
  background: var(--wrong-bg);
  color: var(--wrong);
}
.review-status-tag.tag-skipped {
  background: var(--blue-bg);
  color: var(--blue);
}
.review-item .rq {
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 10px;
  line-height: 1.5;
}
.review-item .ro {
  padding: 6px 0;
  font-size: 17px;
}
.review-item .ro.wrong-opt {
  color: var(--wrong);
  text-decoration: line-through;
  font-weight: 600;
}
.review-item .ro.right-opt {
  color: var(--correct);
  font-weight: 700;
}
.review-item .exp {
  margin-top: 10px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  padding: 10px 12px;
  background: var(--primary-light);
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* PROGRESS */
.progress-content {
  padding: 16px;
}
.prog-subject {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 2px solid var(--border);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.prog-subject h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}
.prog-bar-bg {
  height: 12px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin: 8px 0;
}
.prog-bar-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--primary), var(--correct));
  transition: width 0.5s ease-out;
}
.prog-stats {
  font-size: 14px;
  color: var(--text-sub);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ─── PROFILE SCREEN ─── */
.profile-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 32px 20px;
  padding-top: calc(32px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
  text-align: center;
}
.profile-title {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--primary);
  letter-spacing: -0.02em;
}
.profile-subtitle {
  font-size: 22px;
  color: var(--text-sub);
  margin-bottom: 40px;
  font-weight: 500;
}
.profile-cards {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 380px;
}
.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  border-radius: var(--radius);
  border: 3px solid var(--border);
  background: var(--card-bg);
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.18, 0.89, 0.32, 1.28), box-shadow 0.15s ease, border-color 0.15s ease;
  min-height: 130px;
  width: 100%;
  box-shadow: var(--shadow);
}
.profile-card:active {
  transform: scale(0.97);
}
.profile-card.primary {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--card-bg), var(--primary-light));
  box-shadow: var(--shadow-elevated);
}
.profile-card.secondary {
  opacity: 0.88;
}
.profile-emoji {
  font-size: 48px;
  margin-bottom: 8px;
}
.profile-name {
  font-size: 28px;
  font-weight: 700;
}
.profile-hint {
  font-size: 16px;
  color: var(--text-sub);
  margin-top: 4px;
}

/* ─── HOME STATS BAR ─── */
.home-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
}
.stats-row {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.stats-row::-webkit-scrollbar {
  display: none;
}
.stat-pill {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--border);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.card-progress {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
  width: 100%;
}
.card-prog-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), var(--correct));
  transition: width 0.5s ease-out;
}
.card-prog-text {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 2px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

@media (max-width: 360px) {
  body { font-size: 18px; }
  .subject-card .emoji { font-size: 32px; }
  .question-box { font-size: 20px; }
  .profile-emoji { font-size: 40px; }
  .profile-name { font-size: 24px; }
}

/* ─── DESKTOP / WIDE SCREEN RESPONSIVENESS (WINDOWS 11 / MAC) ─── */
@media (min-width: 600px) {
  body {
    display: flex;
    justify-content: center;
    background: #E2EFE9;
  }
  body.dark, .dark body {
    background: #070D0B;
  }
  .screen {
    max-width: 540px;
    width: 100%;
    margin: 0 auto;
    background: var(--bg);
    box-shadow: 0 0 32px rgba(15, 31, 23, 0.15);
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
  }
  .home-footer, .exam-footer, .submit-btn {
    max-width: 540px;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* ─── REDUCED MOTION (A11Y) ─── */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
