/* ═══════════════════════════════════════════════════════════════════════
   master.css — techsillica Exam Engine
   Version 2.0 — All improvements applied
═══════════════════════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────────────────────────────────
   1.  CSS CUSTOM PROPERTIES — Light theme (default)
────────────────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Noto Sans Devanagari';
  font-style: normal;
  font-weight: 400;
  src: url('/assets/fonts/noto-devanagari-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Noto Sans Devanagari';
  font-style: normal;
  font-weight: 600;
  src: url('/assets/fonts/noto-devanagari-600.woff2') format('woff2');
}
body {
     then Noto Sans Devanagari (for Hindi), then a generic sans-serif. */
  font-family: 'Roboto', 'Noto Sans Devanagari', 'sans-serif';
}
:root {
  /* Brand */
  --blue-dark:        #1a4a76;
  --blue-mid:         #0056b3;
  --blue-light:       #e8f0fb;
  --gold:             #f39c12;
  --gold-light:       #fef9ee;

  /* Status */
  --green:            #1e8c45;
  --green-light:      #d4edda;
  --red:              #c0392b;
  --red-light:        #fdecea;
  --orange:           #e67e22;
  --purple:           #6f42c1;

  /* Neutrals */
  --grey-bg:          #f0f2f5;
  --grey-border:      #d0d7de;
  --grey-text:        #555e6b;
  --white:            #ffffff;
  --body-bg:          #f0f2f5;
  --body-color:       #222222;
  --card-bg:          #ffffff;
  --input-bg:         #ffffff;
  --header-bg:        #1a4a76;
  --sidebar-bg:       #ffffff;
  --panel-bg:         #ffffff;
  --section-bar-bg:   #ffffff;
  --timer-bg:         #1a4a76;
  --option-hover-bg:  #e8f0fb;
  --meta-row-bg:      #f0f2f5;

  /* Shadows */
  --shadow-sm:        0 1px 4px rgba(0,0,0,.08);
  --shadow-md:        0 3px 12px rgba(0,0,0,.12);
  --shadow-lg:        0 8px 32px rgba(0,0,0,.18);

  /* Radii */
  --radius-sm:        4px;
  --radius-md:        8px;
  --radius-lg:        12px;

  /* Typography */
  --font-main:        'Noto Sans','Segoe UI',Tahoma,Geneva,Verdana,sans-serif;
  --font-hindi:       'Noto Sans Devanagari','Mangal',sans-serif;

  /* Font scale — controlled by JS */
  --fs-base:          14px;

  /* Transition */
  --trans:            0.2s ease;

  /* Difficulty colours */
  --diff-easy:        #1e8c45;
  --diff-medium:      #e67e22;
  --diff-hard:        #c0392b;
}

/* ──────────────────────────────────────────────────────────────────────
   2.  DARK THEME
────────────────────────────────────────────────────────────────────── */
.theme-dark {
  --blue-dark:        #1e5c94;
  --blue-mid:         #4d9de0;
  --blue-light:       #1a2d45;
  --gold:             #f5a623;
  --gold-light:       #2d2410;

  --green:            #27ae60;
  --green-light:      #0d2b18;
  --red:              #e74c3c;
  --red-light:        #2b0d0d;

  --grey-bg:          #1a1d23;
  --grey-border:      #2d3340;
  --grey-text:        #8e99ad;
  --white:            #1e2229;
  --body-bg:          #12151a;
  --body-color:       #e2e8f0;
  --card-bg:          #1e2229;
  --input-bg:         #252b35;
  --header-bg:        #0d1520;
  --sidebar-bg:       #1e2229;
  --panel-bg:         #1e2229;
  --section-bar-bg:   #1e2229;
  --timer-bg:         #0d1520;
  --option-hover-bg:  #1a2d45;
  --meta-row-bg:      #1a1d23;

  --shadow-sm:        0 1px 4px rgba(0,0,0,.3);
  --shadow-md:        0 3px 12px rgba(0,0,0,.4);
}

/* ──────────────────────────────────────────────────────────────────────
   3.  FONT-SIZE SCALE CLASSES
────────────────────────────────────────────────────────────────────── */
.fs-sm  { --fs-base: 12px; }
.fs-md  { --fs-base: 14px; }   /* default */
.fs-lg  { --fs-base: 16px; }
.fs-xl  { --fs-base: 18px; }

/* ──────────────────────────────────────────────────────────────────────
   4.  RESET
────────────────────────────────────────────────────────────────────── */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  height: 100%; overflow: hidden;
  /* FIX #7: iOS Safari dynamic address bar — use dvh with 100% fallback */
  min-height: 100%;
  min-height: -webkit-fill-available;
  font-family: var(--font-main);
  font-size: var(--fs-base);
  background: var(--body-bg);
  color: var(--body-color);
  transition: background var(--trans), color var(--trans);
}

/* Global focus ring — accessible, visible */
:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* FIX #3: Reduced-motion: disable animations globally BUT preserve the
   timer danger pulse — it is a critical accessibility warning signal.
   Students who need reduced motion still need to see the timer turning
   red when a section is about to expire. */
@media (prefers-reduced-motion: reduce) {
  *:not(.timer-display):not(.q-timer-val),
  *:not(.timer-display)::before,
  *:not(.timer-display)::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  /* For the timer itself, keep the pulse but make it color-only (no opacity change) */
  @keyframes pulse { 0%,100%{opacity:1} 50%{opacity:1} }
}

/* ──────────────────────────────────────────────────────────────────────
   5.  TOP HEADER
────────────────────────────────────────────────────────────────────── */
.top-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 58px;
  background: var(--header-bg); border-bottom: 3px solid var(--gold);
  position: relative; z-index: 100; flex-shrink: 0;
  gap: 12px;
}

.header-left  { display: flex; align-items: center; flex-shrink: 0; }
.header-center{ display: flex; align-items: center; justify-content: center; flex: 1; min-width: 0; }
.header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.exam-logo { display: flex; align-items: center; gap: 12px; }

.logo-mark {
  background: var(--gold); color: var(--blue-dark);
  font-size: 1rem; font-weight: 800; letter-spacing: 1px;
  padding: 4px 10px; border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.logo-divider { width: 1px; height: 28px; background: rgba(255,255,255,.3); }
.logo-text    { display: flex; flex-direction: column; }
.logo-title   { color: #fff; font-size: 0.9rem; font-weight: 600; line-height: 1.2; }
.logo-subtitle{ color: rgba(255,255,255,.65); font-size: 0.75rem; }

.candidate-block { display: flex; align-items: center; gap: 10px; }

.candidate-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gold); color: var(--blue-dark);
  font-size: 0.85rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.candidate-info   { display: flex; flex-direction: column; }
.candidate-name   { color: #fff; font-size: 0.88rem; font-weight: 600; line-height: 1.2; }
.candidate-id     { color: rgba(255,255,255,.6); font-size: 0.72rem; }

/* Header icon buttons */
.hdr-icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; min-width: 36px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.25);
  color: #fff; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 1rem; transition: background var(--trans);
  font-family: var(--font-main);
}
.hdr-icon-btn:hover { background: rgba(255,255,255,.2); }

.lang-toggle {
  display: flex; align-items: center; gap: 6px;
  background: transparent; border: 1px solid rgba(255,255,255,.5);
  color: #fff; padding: 6px 14px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 0.82rem; font-family: var(--font-main);
  transition: background var(--trans), border-color var(--trans);
  white-space: nowrap;
}
.lang-toggle:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.8); }
.lang-icon { font-size: 1rem; }

/* ──────────────────────────────────────────────────────────────────────
   6.  FONT-SIZE TOOLBAR (appears below header when active)
────────────────────────────────────────────────────────────────────── */
.fs-toolbar {
  display: none; align-items: center; gap: 10px;
  padding: 6px 24px;
  background: var(--blue-dark); border-bottom: 1px solid rgba(255,255,255,.15);
  flex-shrink: 0; z-index: 91;
}
.fs-toolbar.visible { display: flex; }
.fs-label { color: rgba(255,255,255,.8); font-size: 0.75rem; margin-right: 4px; }
.fs-btn {
  padding: 4px 12px; border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,.4); background: transparent; color: #fff;
  cursor: pointer; font-size: 0.78rem; font-family: var(--font-main);
  transition: background var(--trans);
}
.fs-btn:hover     { background: rgba(255,255,255,.15); }
.fs-btn.fs-active { background: var(--gold); color: var(--blue-dark); border-color: var(--gold); font-weight: 700; }

/* ──────────────────────────────────────────────────────────────────────
   7.  SECTION BAR (tabs + timers)
────────────────────────────────────────────────────────────────────── */
.section-bar {
  display: flex; align-items: stretch;
  background: var(--section-bar-bg); border-bottom: 2px solid var(--grey-border);
  height: 52px; flex-shrink: 0; position: relative; z-index: 90;
  transition: background var(--trans), border-color var(--trans);
}

.section-tabs { display: flex; align-items: stretch; flex: 1; overflow-x: auto; }

.sec-tab {
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  padding: 0 20px; border: none; background: transparent;
  border-right: 1px solid var(--grey-border);
  cursor: pointer; font-family: var(--font-main);
  transition: background var(--trans); position: relative;
  white-space: nowrap; min-width: 160px;
  min-height: 44px; /* tap target */
}
.sec-tab:hover:not(.locked):not(.active) { background: var(--blue-light); }
.sec-tab.active    { background: var(--blue-light); border-bottom: 3px solid var(--blue-mid); margin-bottom: -2px; }
.sec-tab.completed { background: var(--green-light); }
.sec-tab.locked    { background: var(--meta-row-bg); opacity: .6; cursor: not-allowed; }
.sec-tab.locked::after { content: '🔒'; position: absolute; top: 4px; right: 8px; font-size: .7rem; }

.sec-name { font-size: .82rem; font-weight: 600; color: var(--blue-dark); line-height: 1.2; }
.sec-tab.active    .sec-name { color: var(--blue-mid); }
.sec-tab.locked    .sec-name { color: var(--grey-text); }
.sec-tab.completed .sec-name { color: var(--green); }
.sec-meta { font-size: .68rem; color: var(--grey-text); margin-top: 2px; }

/* ──────────────────────────────────────────────────────────────────────
   8.  TIMER PANEL
────────────────────────────────────────────────────────────────────── */
.timer-panel {
  display: flex; align-items: center; padding: 0 18px; gap: 4px;
  background: var(--timer-bg); flex-shrink: 0;
}
.timer-block       { display: flex; flex-direction: column; align-items: center; min-width: 72px; }
.timer-label       { font-size: .62rem; color: rgba(255,255,255,.65); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 1px; }
.timer-display     { font-size: 1.15rem; font-weight: 700; color: #fff; letter-spacing: 1px; font-variant-numeric: tabular-nums; transition: color .3s; }
.timer-display.timer-warning { color: var(--gold); }
.timer-display.timer-danger  { color: #ff6b6b; animation: pulse 1s infinite; }
.timer-divider     { width: 1px; height: 28px; background: rgba(255,255,255,.2); margin: 0 10px; }

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }
@keyframes spin  { to { transform: rotate(360deg); } }

/* ──────────────────────────────────────────────────────────────────────
   9.  30-SECOND EXPIRY WARNING BANNER
────────────────────────────────────────────────────────────────────── */
.expiry-warning-banner {
  display: none; align-items: center; gap: 10px;
  background: #fff3cd; border-bottom: 2px solid var(--gold);
  padding: 7px 24px; font-size: .82rem; color: #664d03; flex-shrink: 0;
  animation: warningPulse 1s ease-in-out infinite;
}
.expiry-warning-banner.visible { display: flex; }
@keyframes warningPulse { 0%,100%{background:#fff3cd} 50%{background:#ffe08a} }

/* ──────────────────────────────────────────────────────────────────────
   10. SECTION LOCKED BANNER
────────────────────────────────────────────────────────────────────── */
.section-locked-banner {
  display: none; align-items: center; gap: 10px;
  background: var(--red-light); border-bottom: 2px solid var(--red);
  padding: 8px 24px; font-size: .82rem; color: #7b1c13; flex-shrink: 0;
}

/* ──────────────────────────────────────────────────────────────────────
   11. EXAM BODY
────────────────────────────────────────────────────────────────────── */
.exam-body {
  display: flex; flex: 1; overflow: hidden;
  height: calc(100vh - 58px - 52px);
}

/* When warning banners are visible, subtract their height */
body.has-locked-banner .exam-body   { height: calc(100vh - 58px - 52px - 38px); }
body.has-expiry-banner .exam-body   { height: calc(100vh - 58px - 52px - 38px); }
/* FIX #2: has-both-banners was never set by engine.js — replaced with compound selector */
body.has-locked-banner.has-expiry-banner .exam-body { height: calc(100vh - 58px - 52px - 76px); }
body.has-fs-toolbar    .exam-body   { height: calc(100vh - 58px - 52px - 38px); }
/* Combinations with fs-toolbar */
body.has-fs-toolbar.has-locked-banner .exam-body,
body.has-fs-toolbar.has-expiry-banner .exam-body { height: calc(100vh - 58px - 52px - 76px); }
body.has-fs-toolbar.has-locked-banner.has-expiry-banner .exam-body { height: calc(100vh - 58px - 52px - 114px); }

/* ──────────────────────────────────────────────────────────────────────
   12. QUESTION PANEL
────────────────────────────────────────────────────────────────────── */
.question-panel {
  flex: 1; display: flex; flex-direction: column;
  background: var(--panel-bg); border-right: 1px solid var(--grey-border);
  overflow-y: hidden;   /* FIX #8: removed !important — unnecessary with split-zone layout */
  transition: background var(--trans), border-color var(--trans);
}

.question-meta-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 24px; background: var(--meta-row-bg);
  border-bottom: 1px solid var(--grey-border); flex-shrink: 0; gap: 10px;
}
.question-id-tag { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.q-section-tag {
  background: var(--blue-dark); color: #fff;
  font-size: .7rem; font-weight: 700; letter-spacing: 1px;
  padding: 3px 8px; border-radius: var(--radius-sm);
}
.q-number-label { font-size: .85rem; font-weight: 600; color: var(--grey-text); }

/* Difficulty badge */
.difficulty-badge {
  font-size: .68rem; font-weight: 700; letter-spacing: .5px;
  padding: 2px 8px; border-radius: 20px; text-transform: uppercase;
}
.diff-easy   { background: #d4edda; color: var(--diff-easy); border: 1px solid var(--diff-easy); }
.diff-medium { background: #fdebd0; color: var(--diff-medium); border: 1px solid var(--diff-medium); }
.diff-hard   { background: var(--red-light); color: var(--diff-hard); border: 1px solid var(--diff-hard); }

/* Question-level timer */
.q-timer-block {
  display: none; align-items: center; gap: 5px;
  font-size: .78rem; font-weight: 600; color: var(--grey-text);
}
.q-timer-block.visible { display: flex; }
.q-timer-icon { font-size: .9rem; }
.q-timer-val  { font-variant-numeric: tabular-nums; min-width: 36px; text-align: right; }
.q-timer-val.warning { color: var(--orange); }
.q-timer-val.danger  { color: var(--red); animation: pulse 1s infinite; }

.question-marks-badge {
  display: flex; align-items: center; gap: 6px;
  font-size: .78rem; font-weight: 600;
  background: var(--card-bg); border: 1px solid var(--grey-border);
  padding: 4px 12px; border-radius: 20px; flex-shrink: 0;
}
.marks-positive { color: var(--green); }
.marks-sep      { color: var(--grey-border); }
.marks-negative { color: var(--red); }

/* ──────────────────────────────────────────────────────────────────────
   13. SPLIT-ZONE LAYOUT (top-zone / bottom-zone)
────────────────────────────────────────────────────────────────────── */
.q-top-zone {
  flex-shrink: 0; display: flex; flex-direction: column;
  max-height: 42%; overflow-y: auto;
  border-bottom: 2px solid var(--grey-border); background: var(--panel-bg);
  position: relative; /* for zoom button */
}
.q-top-zone:empty,
.q-top-zone.q-top-empty { display: none; }

.q-bottom-zone { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }

/* ──────────────────────────────────────────────────────────────────────
   14. PASSAGE BLOCK
────────────────────────────────────────────────────────────────────── */
.passage-block {
  margin: 16px 24px 0;
  border: 1px solid #c8d8ee; border-radius: var(--radius-md);
  background: var(--blue-light); overflow: hidden; flex-shrink: 0;
}
.theme-dark .passage-block { background: #1a2d45; border-color: #2d4a6e; }

.passage-label { background: #dce8f8; color: var(--blue-dark); font-size: .78rem; font-weight: 600; padding: 8px 16px; border-bottom: 1px solid #c8d8ee; }
.theme-dark .passage-label { background: #1e3a5f; border-color: #2d4a6e; }
.passage-text  { padding: 14px 16px; font-size: .88rem; line-height: 1.7; color: var(--body-color); max-height: 160px; overflow-y: auto; }

/* Zoom button on top-zone */
.zoom-btn {
  position: absolute; top: 6px; right: 10px;
  width: 32px; height: 32px; min-width: 32px;
  background: var(--blue-dark); color: #fff; border: none;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  z-index: 5; opacity: .75; transition: opacity var(--trans);
}
.zoom-btn:hover { opacity: 1; }

/* ──────────────────────────────────────────────────────────────────────
   15. QUESTION IMAGE WRAP
────────────────────────────────────────────────────────────────────── */
.question-image-wrap { margin: 16px 24px 0; text-align: center; flex-shrink: 0; position: relative; }
.question-image-wrap img {
  max-width: 100%; max-height: 220px;
  border: 1px solid var(--grey-border); border-radius: var(--radius-md);
  object-fit: contain; cursor: zoom-in;
  transition: transform .2s;
}

/* ──────────────────────────────────────────────────────────────────────
   16. QUESTION TEXT
────────────────────────────────────────────────────────────────────── */
.question-text-box { padding: 20px 24px 0; flex-shrink: 0; }
.question-text,.question-text-hi { font-size: 1rem; line-height: 1.75; color: var(--body-color); }
.question-text-hi { font-family: var(--font-hindi); }
/* FIX #9: Removed blanket !important on all children — parent declaration is sufficient
   and !important would override intentional inline styles in sanitised question content */
.question-text-hi { line-height: 1.9; }

/* ──────────────────────────────────────────────────────────────────────
   17. OPTIONS LIST
────────────────────────────────────────────────────────────────────── */
.options-list { padding: 16px 24px; display: flex; flex-direction: column; gap: 10px; flex: 1; }

.option-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px; min-height: 44px; /* tap target */
  border: 1.5px solid var(--grey-border); border-radius: var(--radius-md);
  cursor: pointer; transition: border-color .15s, background .15s;
  background: var(--card-bg); user-select: none;
}
.option-row:hover { background: var(--option-hover-bg); border-color: #a8c4e8; }
.option-row.selected { background: var(--blue-light); border-color: var(--blue-mid); }
.option-row input[type="radio"] { margin-top: 3px; transform: scale(1.2); cursor: pointer; flex-shrink: 0; accent-color: var(--blue-mid); }
.option-row input[type="radio"]:disabled { cursor: not-allowed; }
.option-alpha { font-weight: 700; color: var(--blue-mid); font-size: .9rem; min-width: 18px; flex-shrink: 0; margin-top: 1px; }
.option-text  { font-size: .92rem; line-height: 1.5; color: var(--body-color); }

/* ──────────────────────────────────────────────────────────────────────
   18. ACTION BAR
────────────────────────────────────────────────────────────────────── */
.action-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; border-top: 1.5px solid var(--grey-border);
  background: var(--meta-row-bg); flex-shrink: 0; gap: 10px; flex-wrap: wrap;
}
.action-left, .action-right { display: flex; gap: 10px; flex-wrap: wrap; }

/* ──────────────────────────────────────────────────────────────────────
   19. BUTTONS
────────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border: none; border-radius: var(--radius-sm);
  font-family: var(--font-main); font-size: .82rem; font-weight: 600;
  cursor: pointer; color: var(--white); min-height: 44px; /* tap target */
  transition: opacity .15s, transform .1s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover:not(:disabled):not([aria-disabled="true"]) { opacity: .88; transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,.15); }
.btn:active:not(:disabled):not([aria-disabled="true"]){ transform: translateY(0); }
.btn:disabled,
/* FIX #1: aria-disabled visual state — matches our engine.js + HTML accessibility fix */
.btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.btn-icon   { font-size: .9rem; }
.btn-review { background: var(--orange); }
.btn-clear  { background: var(--grey-text); }
.btn-prev   { background: #5a6a7e; }
.btn-save   { background: var(--blue-mid); }
.btn-submit { background: var(--red); width: 100%; justify-content: center; font-size: .9rem; padding: 11px; }

/* ──────────────────────────────────────────────────────────────────────
   20. SIDEBAR
────────────────────────────────────────────────────────────────────── */
.exam-sidebar {
  width: 260px; flex-shrink: 0;
  display: flex; flex-direction: column;
  background: var(--sidebar-bg); border-left: 1px solid var(--grey-border);
  overflow-y: auto;
  transition: background var(--trans), border-color var(--trans), transform .3s ease;
}

.palette-legend {
  padding: 10px 14px; border-bottom: 1px solid var(--grey-border);
  display: flex; flex-direction: column; gap: 5px;
  background: var(--meta-row-bg); flex-shrink: 0;
}
.legend-item { display: flex; align-items: center; gap: 8px; font-size: .74rem; color: var(--grey-text); }
.legend-dot  { width: 18px; height: 18px; border-radius: 4px; flex-shrink: 0; display: inline-block; }
.dot-answered        { background: var(--green); }
.dot-not-answered    { background: var(--red); }
.dot-review          { background: var(--orange); }
.dot-answered-review { background: var(--purple); }
.dot-not-visited     { background: #c8cdd4; }

.section-summary { padding: 10px 14px; border-bottom: 1px solid var(--grey-border); flex-shrink: 0; }
.summary-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--blue-dark); margin-bottom: 8px; }
.summary-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.summary-cell  { background: var(--meta-row-bg); border-radius: var(--radius-sm); padding: 6px 8px; display: flex; flex-direction: column; align-items: center; }
.summary-count { font-size: 1.05rem; font-weight: 700; color: var(--blue-dark); }
.summary-label { font-size: .65rem; color: var(--grey-text); margin-top: 1px; text-align: center; }

.palette-section { flex: 1; padding: 10px 14px; overflow-y: auto; }
.palette-section-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--blue-dark); margin-bottom: 8px; }
.palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 7px; }

.palette-btn {
  width: 100%; aspect-ratio: 1; border: 1.5px solid transparent; border-radius: 5px;
  font-size: .78rem; font-weight: 600; font-family: var(--font-main);
  cursor: pointer; transition: transform .12s, box-shadow .12s;
  display: flex; align-items: center; justify-content: center;
  min-height: 38px; /* accessible */
}
.palette-btn:hover           { transform: scale(1.08); box-shadow: var(--shadow-sm); }
.palette-btn.not-visited     { background: #dde1e7; color: #444; border-color: #c0c6ce; }
.palette-btn.answered        { background: var(--green);  color: #fff; border-color: var(--green); }
.palette-btn.not-answered    { background: var(--red);    color: #fff; border-color: var(--red); }
.palette-btn.marked          { background: var(--orange); color: #fff; border-color: var(--orange); }
.palette-btn.answered-marked { background: var(--purple); color: #fff; border-color: var(--purple); }
.palette-btn.active-question { outline: 3px solid var(--blue-mid); outline-offset: 1px; transform: scale(1.1); box-shadow: 0 0 8px rgba(0,86,179,.35); }

.submit-area { padding: 12px 14px; border-top: 1px solid var(--grey-border); flex-shrink: 0; background: var(--meta-row-bg); }
.submit-note { font-size: .68rem; color: var(--grey-text); text-align: center; margin-top: 6px; line-height: 1.4; }

/* Sidebar toggle button (mobile) */
.sidebar-toggle {
  display: none; position: fixed; bottom: 16px; right: 16px; z-index: 200;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--blue-mid); color: #fff; border: none;
  font-size: 1.3rem; cursor: pointer; box-shadow: var(--shadow-lg);
  align-items: center; justify-content: center;
}

/* ──────────────────────────────────────────────────────────────────────
   21. MODALS
────────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; backdrop-filter: blur(2px);
}
.modal-box {
  background: var(--card-bg); border-radius: var(--radius-md);
  box-shadow: 0 8px 40px rgba(0,0,0,.25);
  max-width: 520px; width: 92%; overflow: hidden;
}
.modal-header   { display: flex; align-items: center; gap: 12px; padding: 16px 22px; background: var(--blue-dark); color: #fff; }
.modal-header h2{ font-size: 1rem; font-weight: 600; }
.modal-icon     { font-size: 1.3rem; }
.modal-body     { padding: 20px 22px; font-size: .88rem; line-height: 1.6; color: var(--body-color); }
.modal-stats    { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-top: 16px; }
.mstat          { background: var(--meta-row-bg); border-radius: var(--radius-sm); padding: 10px 6px; text-align: center; display: flex; flex-direction: column; gap: 4px; }
.mstat span     { font-size: 1.3rem; font-weight: 700; color: var(--blue-dark); }
.mstat label    { font-size: .68rem; color: var(--grey-text); }
.modal-footer   { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--grey-border); background: var(--meta-row-bg); flex-wrap: wrap; }
.btn-modal-cancel  { background: var(--grey-text); }
.btn-modal-confirm { background: var(--blue-mid); }
.modal-timeup .modal-header { background: var(--red); }

/* Instructions modal */
.modal-instructions { max-width: 700px; }
.inst-logo     { background: var(--gold); color: var(--blue-dark); font-size: .95rem; font-weight: 800; letter-spacing: 1px; padding: 4px 10px; border-radius: var(--radius-sm); }
.inst-body     { max-height: 55vh; overflow-y: auto; }
.inst-list     { padding-left: 20px; display: flex; flex-direction: column; gap: 7px; font-size: .85rem; line-height: 1.6; }
.inst-list li  { padding-left: 4px; }
.inst-list ul  { margin-top: 6px; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.inst-marking  { margin-top: 18px; border: 1px solid var(--grey-border); border-radius: var(--radius-md); overflow: hidden; }
.marking-title { background: var(--blue-dark); color: #fff; font-size: .78rem; font-weight: 600; padding: 8px 14px; text-transform: uppercase; letter-spacing: .5px; }
.marking-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.marking-table th,.marking-table td { padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--grey-border); color: var(--body-color); }
.marking-table thead th { background: var(--blue-light); color: var(--blue-dark); font-weight: 700; }
.marking-table tr:last-child td { border-bottom: none; }
.marking-table .total-row td { background: var(--meta-row-bg); font-weight: 700; }
.inst-checkbox-label { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--body-color); cursor: pointer; }
.inst-checkbox-label input[type="checkbox"] { transform: scale(1.2); cursor: pointer; accent-color: var(--blue-mid); min-width: 18px; min-height: 18px; }

/* ──────────────────────────────────────────────────────────────────────
   22. LOADING OVERLAY
────────────────────────────────────────────────────────────────────── */
.loading-overlay {
  position: fixed; inset: 0; background: rgba(26,74,118,.94);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 2000; color: #fff;
}
.loading-spinner {
  width: 44px; height: 44px;
  border: 4px solid rgba(255,255,255,.2); border-top-color: var(--gold);
  border-radius: 50%; animation: spin .8s linear infinite; margin-bottom: 16px;
}
.loading-text { font-size: .9rem; color: rgba(255,255,255,.8); }

/* ──────────────────────────────────────────────────────────────────────
   23. ERROR STATE — full-screen, hides chrome
────────────────────────────────────────────────────────────────────── */
/* When error is shown, hide chrome elements */
body.is-error .section-bar,
body.is-error .exam-sidebar,
body.is-error .timer-panel,
body.is-error .section-locked-banner,
body.is-error .expiry-warning-banner,
body.is-error .fs-toolbar { display: none !important; }

body.is-error .exam-body {
  height: calc(100vh - 58px);
}

.error-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; padding: 40px; text-align: center;
  background: var(--card-bg);
}
.error-icon  { font-size: 3rem; }
.error-title { font-size: 1.2rem; font-weight: 700; color: var(--red); }
.error-msg   { font-size: .85rem; color: var(--grey-text); line-height: 1.6; max-width: 520px; }
.error-code  { font-family: monospace; background: var(--meta-row-bg); padding: 6px 12px; border-radius: 4px; color: var(--grey-text); font-size: .78rem; }
.error-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.btn-error-retry { background: var(--blue-mid); color: #fff; }
.btn-error-back  { background: var(--grey-text); color: #fff; }

/* ──────────────────────────────────────────────────────────────────────
   24. INLINE CHART
────────────────────────────────────────────────────────────────────── */
.chart-wrap     { padding: 16px 24px; background: var(--panel-bg); flex-shrink: 0; }
.chart-title    { font-size: .8rem; font-weight: 700; color: var(--blue-dark); text-align: center; margin-bottom: 4px; }
.chart-subtitle { font-size: .7rem; color: var(--grey-text); text-align: center; margin-bottom: 12px; }
.chart-svg-wrap { display: flex; justify-content: center; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.chart-svg-wrap svg { flex-shrink: 0; }
.chart-legend   { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center; margin-top: 12px; }
.legend-entry   { display: flex; align-items: center; gap: 5px; font-size: .72rem; color: var(--body-color); }
.legend-swatch  { width: 12px; height: 12px; border-radius: 2px; flex-shrink: 0; }
.chart-series-legend { display: flex; gap: 16px; justify-content: center; margin-top: 10px; }
.series-entry   { display: flex; align-items: center; gap: 5px; font-size: .72rem; color: var(--body-color); }

/* ──────────────────────────────────────────────────────────────────────
   25. MIO TWO-PANEL LAYOUT
────────────────────────────────────────────────────────────────────── */
.mio-wrap       { padding: 14px 24px 0; display: flex; flex-direction: column; gap: 10px; }
.mio-example    { background: var(--blue-light); border: 1px solid #c8d8ee; border-radius: var(--radius-md); overflow: hidden; }
.theme-dark .mio-example { background: #1a2d45; border-color: #2d4a6e; }
.mio-label      { background: #dce8f8; color: var(--blue-dark); font-size: .72rem; font-weight: 700; padding: 6px 14px; letter-spacing: .4px; text-transform: uppercase; }
.theme-dark .mio-label { background: #1e3a5f; }
.mio-steps      { padding: 10px 14px; font-family: 'Courier New',Courier,monospace; font-size: .82rem; line-height: 1.8; color: var(--body-color); overflow-x: auto; white-space: pre; }
.mio-new-input  { background: var(--gold-light); border: 2px solid var(--gold); border-radius: var(--radius-md); overflow: hidden; }
.theme-dark .mio-new-input { background: #2d2410; }
.mio-new-input .mio-label { background: var(--gold); color: var(--blue-dark); }
.mio-new-input .mio-steps { font-weight: 700; color: var(--body-color); font-size: .88rem; }

/* ──────────────────────────────────────────────────────────────────────
   26. CHEATING PREVENTION OVERLAY
────────────────────────────────────────────────────────────────────── */
.cheat-overlay {
  position: fixed; inset: 0; background: rgba(20,20,20,.97);
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 9999; color: #fff; text-align: center; padding: 40px;
}
.cheat-overlay.visible { display: flex; }
.cheat-icon  { font-size: 3rem; margin-bottom: 16px; }
.cheat-title { font-size: 1.3rem; font-weight: 800; color: #ff6b6b; margin-bottom: 10px; }
.cheat-msg   { font-size: .9rem; color: rgba(255,255,255,.8); line-height: 1.7; max-width: 500px; }
.cheat-count { font-size: .82rem; color: var(--gold); margin-top: 12px; font-weight: 700; }
.cheat-btn   { margin-top: 24px; padding: 12px 32px; background: var(--blue-mid); color: #fff; border: none; border-radius: var(--radius-sm); font-size: .9rem; font-weight: 700; cursor: pointer; font-family: var(--font-main); min-height: 44px; }
.cheat-btn:hover { background: #004494; }

/* ──────────────────────────────────────────────────────────────────────
   27. FULLSCREEN ENFORCEMENT OVERLAY
────────────────────────────────────────────────────────────────────── */
.fullscreen-overlay {
  position: fixed; inset: 0; background: rgba(10,20,40,.97);
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 9998; color: #fff; text-align: center; padding: 40px;
}
.fullscreen-overlay.visible { display: flex; }
.fs-overlay-icon  { font-size: 3.5rem; margin-bottom: 20px; }
.fs-overlay-title { font-size: 1.4rem; font-weight: 800; color: var(--gold); margin-bottom: 12px; }
.fs-overlay-msg   { font-size: .9rem; color: rgba(255,255,255,.8); max-width: 480px; line-height: 1.7; margin-bottom: 24px; }
.fs-overlay-btn   { padding: 12px 32px; background: var(--gold); color: var(--blue-dark); border: none; border-radius: var(--radius-sm); font-size: 1rem; font-weight: 700; cursor: pointer; font-family: var(--font-main); min-height: 44px; }
.fs-overlay-btn:hover { background: #e08e0b; }

/* ──────────────────────────────────────────────────────────────────────
   28. DIRECTION HEADER BAR
────────────────────────────────────────────────────────────────────── */
.direction-bar   { display: none; align-items: center; gap: 10px; background: var(--blue-dark); padding: 8px 24px; flex-shrink: 0; }
.direction-label { font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--gold); white-space: nowrap; flex-shrink: 0; }
.direction-text  { font-size: .82rem; font-weight: 600; color: #fff; line-height: 1.3; }

/* ──────────────────────────────────────────────────────────────────────
   29. PARTS LIST (vertical stacked parts in question text)
────────────────────────────────────────────────────────────────────── */
.parts-intro { font-size: 1rem; line-height: 1.75; color: var(--body-color); margin-bottom: 12px; }
.parts-list  { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.parts-list-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 14px; background: var(--blue-light);
  border: 1px solid #d4e2f5; border-left: 3px solid var(--blue-mid);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .92rem; line-height: 1.6; color: var(--body-color);
}
.theme-dark .parts-list-item { background: #1a2d45; border-color: #2d4a6e; }
.parts-list-item .part-label { font-weight: 700; color: var(--blue-mid); min-width: 28px; flex-shrink: 0; margin-top: 1px; }
.question-text-hi .parts-list-item { font-family: var(--font-hindi); font-size: .95rem; line-height: 1.9; }

/* ──────────────────────────────────────────────────────────────────────
   30. ZOOM LIGHTBOX (magnify diagrams / images)
────────────────────────────────────────────────────────────────────── */
.zoom-lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.92);
  display: none; align-items: center; justify-content: center;
  z-index: 5000; cursor: zoom-out; padding: 20px;
}
.zoom-lightbox.visible { display: flex; }
.zoom-lightbox img, .zoom-lightbox svg {
  max-width: 94vw; max-height: 90vh;
  border-radius: var(--radius-md); box-shadow: 0 10px 60px rgba(0,0,0,.6);
  background: #fff; padding: 12px;
}
.zoom-lightbox-close {
  position: absolute; top: 16px; right: 20px;
  width: 40px; height: 40px; background: rgba(255,255,255,.15); color: #fff;
  border: none; border-radius: 50%; font-size: 1.4rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.zoom-lightbox-close:hover { background: rgba(255,255,255,.3); }

/* ──────────────────────────────────────────────────────────────────────
   31. TOAST NOTIFICATIONS
────────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 4000;
  pointer-events: none; align-items: center;
}
.toast {
  background: #1e2229; color: #fff; padding: 10px 20px;
  border-radius: 20px; font-size: .82rem; font-weight: 500;
  box-shadow: var(--shadow-lg); pointer-events: none;
  animation: toastIn .3s ease, toastOut .3s ease 2.7s forwards;
  max-width: 340px; text-align: center;
}
.toast.toast-success { background: var(--green); }
.toast.toast-warn    { background: var(--orange); }
.toast.toast-error   { background: var(--red); }
@keyframes toastIn  { from { opacity:0; transform: translateY(12px); } to { opacity:1; transform: translateY(0); } }
@keyframes toastOut { from { opacity:1; } to { opacity:0; transform: translateY(-8px); } }

/* ──────────────────────────────────────────────────────────────────────
   32. PWA INSTALL BANNER
────────────────────────────────────────────────────────────────────── */
.pwa-banner {
  display: none; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--blue-dark); color: #fff;
  padding: 8px 20px; font-size: .82rem; flex-shrink: 0; z-index: 95;
}
.pwa-banner.visible { display: flex; }
.pwa-banner-msg { flex: 1; }
.pwa-banner-actions { display: flex; gap: 8px; }
.pwa-install-btn { padding: 5px 14px; background: var(--gold); color: var(--blue-dark); border: none; border-radius: var(--radius-sm); font-weight: 700; cursor: pointer; font-size: .78rem; font-family: var(--font-main); min-height: 32px; }
.pwa-dismiss-btn { padding: 5px 10px; background: transparent; color: rgba(255,255,255,.7); border: 1px solid rgba(255,255,255,.3); border-radius: var(--radius-sm); cursor: pointer; font-size: .78rem; font-family: var(--font-main); min-height: 32px; }
/* Firefox Scrollbar Standard */
* {
  scrollbar-width: thin; /* Makes it 5px-ish like your WebKit rule */
  scrollbar-color: #c0c6ce transparent; /* Thumb color, Track color */
}

/* Dark mode for Firefox */
.theme-dark * {
  scrollbar-color: #3d4455 transparent;
}

/* ──────────────────────────────────────────────────────────────────────
   33. SCROLLBAR
────────────────────────────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c0c6ce; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #9aa3ad; }
.theme-dark ::-webkit-scrollbar-thumb { background: #3d4455; }

/* ──────────────────────────────────────────────────────────────────────
   34. HIGH-CONTRAST OVERRIDES (system preference)
────────────────────────────────────────────────────────────────────── */
@media (prefers-contrast: more) {
  :root {
    --blue-mid:    #003d8f;
    --green:       #145e30;
    --red:         #8b0000;
    --grey-text:   #333;
    --grey-border: #666;
  }
  .option-row { border-width: 2px; }
  .btn { border: 2px solid rgba(0,0,0,.4); }
}

/* ══════════════════════════════════════════════════════════════════════
   35. RESPONSIVE — TABLET (≤900 px)
══════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {

  .exam-sidebar { width: 220px; }
  .sec-tab      { min-width: 120px; padding: 0 12px; }

  .candidate-info { display: none; }   /* save header space */

  .logo-subtitle  { display: none; }

}

/* ══════════════════════════════════════════════════════════════════════
   36. RESPONSIVE — MOBILE (≤768 px)
══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Header ─────────────────────────────────── */
  .top-header { padding: 0 12px; height: 52px; gap: 8px; }
  .logo-text  { display: none; }        /* keep just the logo mark */
  .logo-divider { display: none; }
  .candidate-block { display: none; }   /* remove candidate info */

  /* ── Section bar: stack sections vertically; timer slims ─── */
  .section-bar { height: auto; flex-wrap: wrap; }
  .section-tabs { height: 44px; }
  .sec-tab { min-width: 90px; padding: 0 10px; font-size: .72rem; }
  .sec-name { font-size: .72rem; }
  .sec-meta { display: none; }

  .timer-panel { padding: 0 10px; }
  .timer-block { min-width: 52px; }
  .timer-display { font-size: .95rem; }
  .timer-label   { font-size: .55rem; }

  /* ── Exam body: full-width question, sidebar hidden by default ── */
  .exam-body { position: relative; }
  .question-panel { border-right: none; }

  .exam-sidebar {
    position: fixed; right: 0; top: 0; bottom: 0;
    width: 260px; z-index: 300;
    transform: translateX(100%);
    box-shadow: var(--shadow-lg);
  }
  .exam-sidebar.sidebar-open { transform: translateX(0); }

  /* Sidebar backdrop */
  .sidebar-backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.45); z-index: 299;
  }
  .sidebar-backdrop.visible { display: block; }

  /* ── Show sidebar toggle FAB ─────────────────── */
  .sidebar-toggle { display: flex; }

  /* ── Question meta row ───────────────────────── */
  .question-meta-row { padding: 8px 14px; flex-wrap: wrap; gap: 6px; }
  .question-marks-badge { padding: 4px 10px; font-size: .72rem; }

  /* ── Passage ─────────────────────────────────── */
  .passage-block { margin: 10px 14px 0; }
  .passage-text  { font-size: .82rem; max-height: 120px; }

  /* ── Question text ───────────────────────────── */
  .question-text-box { padding: 14px 14px 0; }
  .question-text, .question-text-hi { font-size: .95rem; }

  /* ── Options ─────────────────────────────────── */
  .options-list { padding: 12px 14px; gap: 8px; }
  .option-row   { padding: 14px 12px; min-height: 52px; }   /* larger tap targets */

  /* ── Action bar: stack vertically ───────────── */
  .action-bar { flex-direction: column; padding: 10px 14px; gap: 8px; }
  .action-left,.action-right { width: 100%; justify-content: stretch; }
  .action-left  .btn,.action-right .btn { flex: 1; justify-content: center; min-height: 48px; }

  /* ── Modals ──────────────────────────────────── */
  .modal-stats { grid-template-columns: repeat(2,1fr); }
  .modal-footer { flex-direction: column-reverse; gap: 8px; }
  .modal-footer .btn { width: 100%; justify-content: center; }

  /* ── Error state ─────────────────────────────── */
  .error-state { padding: 24px 16px; }

  /* ── Top zone ────────────────────────────────── */
  .q-top-zone { max-height: 38%; }

  /* ── Fullscreen overlay ──────────────────────── */
  .fs-overlay-title { font-size: 1.1rem; }
  .fs-overlay-msg   { font-size: .82rem; }

}

/* ══════════════════════════════════════════════════════════════════════
   37. RESPONSIVE — SMALL MOBILE (≤480 px)
══════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {

  .top-header { height: 48px; }
  .logo-mark  { font-size: .85rem; padding: 3px 8px; }

  .section-bar { height: 40px; }
  .section-tabs { height: 40px; }
  .sec-tab { min-width: 80px; padding: 0 8px; }

  .btn { font-size: .78rem; padding: 8px 12px; }

  .option-row { min-height: 50px; padding: 12px 10px; }

  .modal-stats { grid-template-columns: repeat(2,1fr); }

  .palette-grid { grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 5px; }
}

/* ══════════════════════════════════════════════════════════════════════
   38. SHARED COMPONENTS
   FIX #4: Moved from inline <style> blocks in mains.html + prelims.html.
   FIX #5: .sr-only — shared screen-reader utility.
   Centralised here so changes only need to be made in one place.
══════════════════════════════════════════════════════════════════════ */

/* Screen-reader only utility */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}

/* Instructions modal: hint shown below the disabled Start button */
.start-btn-hint {
  font-size: 0.72rem;
  color: var(--grey-text);
  text-align: center;
  margin-top: 6px;
  display: block;
}

/* Engine load failure overlay (shown when engine.js fails to load) */
.engine-error {
  display: none;
  position: fixed; inset: 0;
  background: #fff;
  z-index: 9999;
  flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px; padding: 32px; text-align: center;
  font-family: var(--font-main);
}
.engine-error.show       { display: flex; }
.engine-error-icon       { font-size: 3rem; }
.engine-error-title      { font-size: 1.3rem; font-weight: 700; color: var(--red); }
.engine-error-msg        { font-size: 0.9rem; color: var(--grey-text); max-width: 480px; line-height: 1.6; }
.engine-error-btn {
  padding: 10px 24px; background: var(--blue-dark); color: #fff;
  border: none; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
  font-family: var(--font-main); min-height: 44px;
}
.engine-error-btn:hover { background: var(--blue-mid); }

/* Dark theme engine error */
.theme-dark .engine-error { background: var(--card-bg); }
.theme-dark .engine-error-title { color: #ff6b6b; }

/* ══════════════════════════════════════════════════════════════════════
   39. PRINT STYLES (hidden chrome, just question + options)
────────────────────────────────────────────────────────────────────── */
@media print {
  .top-header,.section-bar,.exam-sidebar,.action-bar,
  .cheat-overlay,.fullscreen-overlay,.loading-overlay,
  .toast-container,.pwa-banner,.modal-overlay { display: none !important; }
  body { overflow: auto; }
  .exam-body { height: auto; overflow: visible; }
  .question-panel { overflow: visible; }
  .q-top-zone,.q-bottom-zone { overflow: visible; max-height: none; }
}
/* ══════════════════════════════════════════════════════════════════════
   40. MAINS MODE — body.mains-mode overrides
   Applied automatically when MAINS_MODE = true in engine.js.
══════════════════════════════════════════════════════════════════════ */

/*
   Completed tabs in Mains Mode look distinct from completed tabs in
   Prelims Mode. In Prelims, completed tabs are green (you can go back).
   In Mains, completed tabs are grey with a strikethrough-style badge
   showing they are permanently closed.
*/
body.mains-mode .sec-tab.completed {
  background: var(--meta-row-bg);
  opacity: 0.55;
  cursor: not-allowed;
}

body.mains-mode .sec-tab.completed .sec-name {
  color: var(--grey-text);
  text-decoration: line-through;
  text-decoration-color: var(--grey-border);
}

/* Small "✓ Done" badge replaces the lock icon on completed tabs */
body.mains-mode .sec-tab.completed::after {
  content: '✓';
  position: absolute;
  top: 4px; right: 8px;
  font-size: 0.7rem;
  color: var(--green);
  font-weight: 800;
}

/*
   Future (not-yet-reached) section tabs in Mains Mode are visually
   distinct — slightly dimmed with a "pending" cursor.
   The .sec-tab:not(.active):not(.completed):not(.locked) selector
   targets only unvisited future tabs.
*/
body.mains-mode .sec-tab:not(.active):not(.completed):not(.locked) {
  opacity: 0.6;
  cursor: not-allowed;
}

body.mains-mode .sec-tab:not(.active):not(.completed):not(.locked)::after {
  content: '→';
  position: absolute;
  top: 4px; right: 8px;
  font-size: 0.7rem;
  color: var(--grey-text);
}

/*
   In Mains Mode the section-timer label is longer (e.g. "Reasoning Time")
   so we allow it to wrap naturally and shrink slightly on small screens.
*/
body.mains-mode .timer-label {
  font-size: 0.58rem;
  max-width: 80px;
  text-align: center;
  line-height: 1.3;
  word-break: break-word;
}

/* Dark theme compatible */
body.mains-mode.theme-dark .sec-tab.completed {
  background: var(--grey-bg);
}
