/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;600;700&display=swap');

/* ── Reset & Variables ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0d0f14;
  --surface:    #161922;
  --surface-2:  #1e2130;
  --surface-3:  #252a38;
  --accent:     #4f8ef7;
  --accent-dim: rgba(79,142,247,.15);
  --green:      #3ecf8e;
  --green-dim:  rgba(62,207,142,.15);
  --red:        #f76f6f;
  --red-dim:    rgba(247,111,111,.15);
  --orange:     #f79f4f;
  --orange-dim: rgba(247,159,79,.15);
  --text:       #e8eaf0;
  --text-muted: #7c8299;
  --border:     #252a38;
  --radius:     10px;
  --radius-sm:  6px;
  --font:       'Sora', -apple-system, sans-serif;
  --mono:       'JetBrains Mono', monospace;
  --sidebar-w:  260px;
  --header-h:   56px;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Screens ── */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

/* ── Loading Overlay ── */
.loading-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(13,15,20,.85);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px;
  backdrop-filter: blur(4px);
}
.loading-overlay.hidden { display: none; }
.loading-msg { color: var(--text-muted); font-size: .9rem; }

@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--surface-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ── ══════════════════════════════════════════════════ ── */
/* ── SCREEN 1: Access Code ── */
/* ── ══════════════════════════════════════════════════ ── */

#screen-code {
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.code-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,.4);
}

.code-logo {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -.5px;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.code-logo svg { width: 24px; height: 24px; }

.code-card h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}
.code-card p {
  font-size: .9rem;
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.5;
}

.code-input-wrap {
  position: relative;
  margin-bottom: 12px;
}
#code-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 3px;
  text-align: center;
  text-transform: uppercase;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#code-input::placeholder { letter-spacing: 1px; font-size: .95rem; font-weight: 400; color: var(--text-muted); }
#code-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,142,247,.15); }

.code-error {
  color: var(--red);
  font-size: .85rem;
  min-height: 20px;
  margin-bottom: 16px;
  text-align: left;
}
.code-error.hidden { visibility: hidden; }

/* Exam info shown after validation */
.exam-info-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  text-align: left;
}
.exam-info-card.hidden { display: none; }
.exam-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .88rem;
  padding: 4px 0;
  color: var(--text-muted);
}
.exam-info-row span:last-child { color: var(--text); font-weight: 500; }

/* ── ══════════════════════════════════════════════════ ── */
/* ── Buttons ── */
/* ── ══════════════════════════════════════════════════ ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, transform .1s, opacity .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

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

.btn-ghost    { background: var(--surface-3); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled)    { background: var(--surface-2); }

.btn-green    { background: var(--green); color: #0d1a14; }
.btn-green:hover:not(:disabled)    { background: #5adc9f; }

.btn-danger   { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled)   { background: #fa8c8c; }

.btn-full { width: 100%; }
.btn-sm   { padding: 8px 14px; font-size: .82rem; }

/* ── ══════════════════════════════════════════════════ ── */
/* ── SCREEN 1b: Mode Selection ── */
/* ── ══════════════════════════════════════════════════ ── */

#screen-mode {
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.mode-container {
  width: 100%;
  max-width: 560px;
}

.mode-header {
  text-align: center;
  margin-bottom: 28px;
}
.mode-header h1 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.mode-header p {
  font-size: .88rem;
  color: var(--text-muted);
}
.mode-header .code-logo { justify-content: center; margin-bottom: 20px; }

.mode-cards {
  display: flex;
  gap: 14px;
  margin-bottom: 24px;
}

.mode-card {
  flex: 1;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 24px 18px;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s, transform .1s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-family: var(--font);
}
.mode-card:hover { border-color: var(--accent); background: var(--accent-dim); }
.mode-card.selected { border-color: var(--accent); background: var(--accent-dim); }
.mode-card:active { transform: scale(.98); }

.mode-card-icon { font-size: 1.8rem; line-height: 1; }
.mode-card-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
}
.mode-card-desc {
  font-size: .78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.mode-options {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 20px;
}

.mode-option-group { display: flex; flex-direction: column; gap: 8px; }
.mode-option-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.mode-domain-sel {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: .9rem;
  outline: none;
  cursor: pointer;
  transition: border-color .15s;
}
.mode-domain-sel:focus { border-color: var(--accent); }

.q-count-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.q-count-btn {
  padding: 8px 20px;
  background: var(--surface-3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.q-count-btn:hover   { border-color: var(--accent); color: var(--text); }
.q-count-btn.selected { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }

.mode-actions {
  display: flex;
  gap: 10px;
  justify-content: space-between;
}
.mode-actions .btn { flex: 1; }

/* ── ══════════════════════════════════════════════════ ── */
/* ── SCREEN 2: Exam Interface ── */
/* ── ══════════════════════════════════════════════════ ── */

#screen-exam { background: var(--bg); }

/* ── Exam Header ── */
.exam-header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}

.exam-logo {
  font-size: .95rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -.3px;
  white-space: nowrap;
}

.exam-title-badge {
  background: var(--accent-dim);
  color: var(--accent);
  font-size: .75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid rgba(79,142,247,.3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.header-spacer { flex: 1; }

.q-counter {
  font-family: var(--mono);
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.exam-timer {
  font-family: var(--mono);
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  min-width: 70px;
  text-align: center;
}
.exam-timer.warning { color: var(--orange); border-color: var(--orange); }
.exam-timer.danger  { color: var(--red);    border-color: var(--red); animation: pulse-timer 1s infinite; }

@keyframes pulse-timer { 0%,100% { opacity: 1; } 50% { opacity: .6; } }

.sidebar-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: none; /* shown on mobile */
}

/* ── Exam Layout ── */
.exam-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
  transition: transform .25s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.sidebar-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px;
  display: none;
}

/* Progress section */
.progress-section {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.progress-bar-wrap {
  height: 6px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 12px;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 99px;
  transition: width .3s ease;
  width: 0%;
}
.progress-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.stat-pill {
  font-size: .72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-pill.answered  { background: var(--accent-dim); color: var(--accent); }
.stat-pill.unanswered{ background: var(--surface-3);  color: var(--text-muted); }
.stat-pill.flagged   { background: var(--orange-dim); color: var(--orange); }

/* Navigator grid */
.navigator-section { padding: 16px; }
.navigator-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 10px;
}
.nav-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}
.nav-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-family: var(--mono);
  font-size: .62rem;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-muted);
  transition: background .12s, transform .1s;
  position: relative;
}
.nav-cell:hover { transform: scale(1.1); }
.nav-cell.current    { outline: 2px solid var(--accent); outline-offset: 1px; color: var(--text); }
.nav-cell.answered   { background: var(--accent-dim); color: var(--accent); }
.nav-cell.correct    { background: var(--green-dim); color: var(--green); }
.nav-cell.incorrect  { background: var(--red-dim);   color: var(--red); }
.nav-cell.flagged::after {
  content: '';
  position: absolute;
  top: 2px; right: 2px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--orange);
}

/* Domain coverage */
.domain-section { padding: 16px; border-top: 1px solid var(--border); }
.domain-item {
  margin-bottom: 10px;
}
.domain-item-label {
  display: flex;
  justify-content: space-between;
  font-size: .72rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.domain-item-bar { height: 3px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.domain-item-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }

/* ── Question Area ── */
.question-area {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px 100px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
}

.question-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.q-domain-badge {
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: .72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  border: 1px solid var(--border);
}
.q-diff-badge {
  font-size: .72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
}
.q-diff-badge.Easy   { background: var(--green-dim); color: var(--green); }
.q-diff-badge.Medium { background: var(--accent-dim); color: var(--accent); }
.q-diff-badge.Hard   { background: var(--red-dim); color: var(--red); }

.question-text {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  margin-bottom: 24px;
}

/* Answer options */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  text-align: left;
  width: 100%;
}
.option-card:hover:not(.locked) { border-color: var(--accent); background: var(--accent-dim); }
.option-card.selected { border-color: var(--accent); background: var(--accent-dim); }
.option-card.correct  { border-color: var(--green) !important; background: var(--green-dim) !important; }
.option-card.wrong    { border-color: var(--red) !important;   background: var(--red-dim) !important; opacity: .65; }
.option-card.locked   { cursor: default; }

.option-letter {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: background .15s, color .15s;
}
.option-card.selected .option-letter { background: var(--accent); color: #fff; }
.option-card.correct  .option-letter { background: var(--green);  color: #0d1a14; }
.option-card.wrong    .option-letter { background: var(--red);    color: #fff; }

.option-text {
  font-size: .9rem;
  line-height: 1.5;
  color: var(--text);
  padding-top: 3px;
}

/* Explanation panel */
.explanation-panel {
  margin-top: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  animation: fadeIn .2s ease;
}
.explanation-panel.hidden { display: none; }
.explanation-verdict {
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 12px;
  display: block;
}
.explanation-verdict.correct { color: var(--green); }
.explanation-verdict.wrong   { color: var(--red); }
.explanation-body { font-size: .85rem; line-height: 1.65; color: var(--text-muted); }
.explanation-body .rationale-line { margin-bottom: 6px; }
.explanation-body .rationale-line strong { color: var(--text); }
.explanation-body .rationale-correct strong { color: var(--green); }

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

/* Navigation controls */
.nav-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
}
.nav-controls .spacer { flex: 1; }

.btn-flag {
  background: none;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-family: var(--font);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.btn-flag:hover   { border-color: var(--orange); color: var(--orange); }
.btn-flag.flagged { border-color: var(--orange); color: var(--orange); background: var(--orange-dim); }

.btn-submit-exam {
  background: var(--green);
  color: #0d1a14;
  font-weight: 700;
}
.btn-submit-exam:hover { background: #5adc9f; }

/* ── ══════════════════════════════════════════════════ ── */
/* ── Modal: Submit Confirmation ── */
/* ── ══════════════════════════════════════════════════ ── */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(13,15,20,.8);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.modal-box h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 20px; }

.modal-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
}
.modal-stat {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}
.modal-stat-num {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
}
.modal-stat-label { font-size: .72rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.modal-stat.answered  .modal-stat-num { color: var(--accent); }
.modal-stat.remaining .modal-stat-num { color: var(--text-muted); }
.modal-stat.flagged   .modal-stat-num { color: var(--orange); }

.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }

/* ── ══════════════════════════════════════════════════ ── */
/* ── SCREEN 4: Results ── */
/* ── ══════════════════════════════════════════════════ ── */

#screen-results {
  align-items: center;
  padding: 40px 24px 80px;
  overflow-y: auto;
}

.results-container {
  width: 100%;
  max-width: 720px;
}

.results-header {
  display: flex;
  align-items: center;
  gap: 40px;
  margin-bottom: 36px;
}

/* Score ring */
.score-ring-wrap {
  position: relative;
  flex-shrink: 0;
  width: 140px;
  height: 140px;
}
.score-ring {
  width: 140px;
  height: 140px;
  transform: rotate(-90deg);
}
.score-ring-bg {
  fill: none;
  stroke: var(--surface-3);
  stroke-width: 10;
}
.score-ring-fill {
  fill: none;
  stroke: var(--green);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 314;
  stroke-dashoffset: 314;
  transition: stroke-dashoffset 1.2s cubic-bezier(.4,0,.2,1), stroke .3s;
}
.score-ring-fill.fail { stroke: var(--red); }
.score-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.score-pct {
  font-family: var(--mono);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.score-label { font-size: .7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }

/* Pass/fail & stats */
.results-right { flex: 1; min-width: 0; }
.pass-fail-badge {
  font-size: .9rem;
  font-weight: 700;
  padding: 8px 20px;
  border-radius: 99px;
  display: inline-block;
  margin-bottom: 20px;
}
.pass-fail-badge.pass { background: var(--green-dim); color: var(--green); border: 1px solid rgba(62,207,142,.3); }
.pass-fail-badge.fail { background: var(--red-dim);   color: var(--red);   border: 1px solid rgba(247,111,111,.3); }

.result-stats {
  display: flex;
  gap: 20px;
}
.result-stat { }
.result-stat-num {
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 700;
  display: block;
  color: var(--text);
}
.result-stat-label { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }

/* Domain breakdown */
.breakdown-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}
.breakdown-card h3 {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.breakdown-table { width: 100%; border-collapse: collapse; }
.breakdown-table th {
  text-align: left;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
}
.breakdown-table td { padding: 12px 20px; border-bottom: 1px solid var(--border); font-size: .88rem; }
.breakdown-table tr:last-child td { border-bottom: none; }
.breakdown-table tr:hover td { background: var(--surface-2); }
.breakdown-table .pct-cell {
  font-family: var(--mono);
  font-weight: 600;
}
.pct-pass { color: var(--green); }
.pct-fail { color: var(--red); }
.breakdown-bar-cell { width: 120px; }
.breakdown-bar-wrap { height: 4px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.breakdown-bar-fill { height: 100%; border-radius: 99px; transition: width .6s ease; }
.breakdown-bar-fill.pass { background: var(--green); }
.breakdown-bar-fill.fail { background: var(--red); }

/* Results actions */
.results-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
}

/* Review section */
.review-section { display: flex; flex-direction: column; gap: 16px; }
.review-section.hidden { display: none; }
.review-q-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
}
.review-q-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.review-q-num { font-family: var(--mono); font-size: .8rem; color: var(--text-muted); font-weight: 600; }
.review-verdict { font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; }
.review-verdict.correct { background: var(--green-dim); color: var(--green); }
.review-verdict.wrong   { background: var(--red-dim);   color: var(--red); }
.review-q-text { font-size: .9rem; line-height: 1.55; margin-bottom: 14px; }
.review-options { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.review-opt {
  display: flex;
  gap: 10px;
  font-size: .82rem;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.review-opt .opt-l { font-family: var(--mono); font-weight: 700; color: var(--text-muted); }
.review-opt.correct-opt { background: var(--green-dim); border-color: rgba(62,207,142,.3); color: var(--text); }
.review-opt.correct-opt .opt-l { color: var(--green); }
.review-opt.user-wrong  { background: var(--red-dim);   border-color: rgba(247,111,111,.3); }
.review-rationale { font-size: .8rem; line-height: 1.6; color: var(--text-muted); border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
.review-rationale strong { color: var(--text); }

/* ── ══════════════════════════════════════════════════ ── */
/* ── Utilities ── */
/* ── ══════════════════════════════════════════════════ ── */
.hidden { display: none !important; }

/* ── ══════════════════════════════════════════════════ ── */
/* ── Mobile / Responsive ── */
/* ── ══════════════════════════════════════════════════ ── */

@media (max-width: 768px) {
  /* Header */
  .exam-logo { display: none; }
  .exam-title-badge { max-width: 140px; font-size: .7rem; }
  .sidebar-toggle { display: flex; }

  /* Sidebar as drawer */
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0,0,0,.5);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }

  /* Sidebar overlay */
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    z-index: 99;
    background: rgba(13,15,20,.6);
  }
  .sidebar-overlay.open { display: block; }

  /* Question area */
  .question-area { padding: 16px 16px 100px; }
  .question-card { padding: 18px; }

  /* Nav controls */
  .nav-controls {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    border-radius: 0;
    border-left: none; border-right: none; border-bottom: none;
    z-index: 40;
    padding: 12px 16px;
    gap: 8px;
  }
  .btn-flag { padding: 10px 12px; }

  /* Results */
  .results-header { flex-direction: column; align-items: flex-start; gap: 20px; }
  .result-stats { flex-wrap: wrap; }
  .modal-stats { flex-direction: column; gap: 8px; }

  /* Nav grid denser on mobile */
  .nav-grid { grid-template-columns: repeat(10, 1fr); }
}

@media (max-width: 480px) {
  .code-card { padding: 32px 20px; }
  .modal-box { padding: 24px 20px; }
}
