/* ==============================================================================================
   THE EXAM ROOM

   One question in focus, a navigator that reads as a grid rather than a run of digits, and answer
   options large enough to hit on a phone. Everything is scoped to .exam-session so nothing else on
   the platform inherits the exam room's tighter rhythm.
   ============================================================================================== */

.exam-session { display: grid; gap: 20px; }

.exam-header {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-radius: var(--radius-lg); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.exam-header-id h1 { margin: 2px 0 0; font-size: 24px; line-height: 1.2; }
.exam-header-id .eyebrow { margin: 0; }
.exam-header-clock {
  display: grid; grid-auto-flow: column; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: 999px; background: var(--surface-soft);
  border: 1px solid var(--line);
}
.exam-header-clock svg { width: 18px; height: 18px; }
.exam-header-clock strong { font-variant-numeric: tabular-nums; font-size: 26px; letter-spacing: .01em; }
.exam-header-clock span { font-size: 11px; color: var(--muted); }

/* Desktop: question on the left, timer and navigator held still on the right. */
.exam-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.exam-main { display: grid; gap: 16px; min-width: 0; }

.exam-card {
  padding: 32px 36px; border-radius: var(--radius-lg); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.exam-card-position {
  margin: 0 0 14px; font-size: 12px; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.exam-marked-flag {
  margin-left: 8px; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-warm); color: var(--warning); border: 1px solid currentColor;
  font-size: 10px; letter-spacing: .04em;
}

/* A readable measure. A 27-inch monitor is not an argument for 200-character lines. */
.exam-stem {
  margin: 0 0 26px; font-size: 21px; line-height: 1.55; font-weight: 650;
  max-width: 62ch; overflow-wrap: break-word;
}

.exam-options { display: grid; gap: 10px; }
.exam-option {
  display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: start; gap: 14px;
  width: 100%; padding: 16px 18px; text-align: left; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: var(--radius-md);
  background: var(--surface); color: var(--ink); font: inherit;
  transition: border-color .12s ease, background .12s ease, transform .08s ease;
}
.exam-option:hover { border-color: var(--brand-2); background: var(--surface-soft); }
.exam-option:active { transform: translateY(1px); }
.exam-option:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; }
.exam-option-key {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--surface-soft); border: 1px solid var(--line);
  font-weight: 800; font-size: 13px; color: var(--muted);
}
.exam-option-text { font-size: 16px; line-height: 1.5; overflow-wrap: break-word; padding-top: 4px; }
.exam-option.selected { border-color: var(--brand); background: var(--brand-soft); }
.exam-option.selected .exam-option-key { background: var(--brand); border-color: var(--brand); color: var(--surface); }

.exam-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.exam-controls #exam-next { margin-left: auto; }
.exam-controls .button.ghost { background: transparent; color: var(--muted); border: 1.5px solid var(--line); }
.exam-controls .button.ghost.active { color: var(--warning); border-color: currentColor; background: var(--surface-warm); }
.exam-controls .button:disabled { opacity: .45; cursor: not-allowed; }
.exam-controls #exam-prev svg { transform: rotate(180deg); }

.exam-aside { display: grid; gap: 14px; position: sticky; top: 16px; }
.exam-progress-box, .exam-nav-box {
  padding: 16px 18px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.exam-progress-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.exam-progress-head span {
  font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.exam-progress-head strong { font-variant-numeric: tabular-nums; font-size: 17px; }
.exam-progress-track { height: 7px; border-radius: 999px; background: var(--surface-soft); overflow: hidden; }
.exam-progress-track i {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: var(--brand); transition: width .2s ease;
}
.exam-progress-note { margin: 10px 0 0; font-size: 11px; color: var(--faint); }

.exam-nav-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.exam-nav-head span {
  font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.exam-nav-toggle { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; font-size: 12px; color: var(--brand); }
.exam-nav-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.exam-nav-cell {
  position: relative; aspect-ratio: 1; display: grid; place-items: center; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 9px; background: var(--surface);
  color: var(--muted); font: inherit; font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums; transition: border-color .1s ease, background .1s ease;
}
.exam-nav-cell:hover { border-color: var(--brand-2); }
.exam-nav-cell:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 1px; }
.exam-nav-cell.answered { background: var(--brand-soft); border-color: var(--brand-2); color: var(--brand); }
.exam-nav-cell.marked { border-color: var(--warning); color: var(--warning); }
.exam-nav-cell.marked::after {
  content: ""; position: absolute; top: 3px; right: 3px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--warning);
}
.exam-nav-cell.current { background: var(--brand); border-color: var(--brand); color: var(--surface); }
.exam-nav-box.collapsed .exam-nav-grid, .exam-nav-box.collapsed .exam-nav-legend { display: none; }

.exam-nav-legend {
  list-style: none; margin: 14px 0 0; padding: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px;
}
.exam-nav-legend li { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.exam-nav-legend i { width: 12px; height: 12px; border-radius: 4px; border: 1.5px solid var(--line); background: var(--surface); }
.exam-nav-legend .key-current { background: var(--brand); border-color: var(--brand); }
.exam-nav-legend .key-answered { background: var(--brand-soft); border-color: var(--brand-2); }
.exam-nav-legend .key-marked { border-color: var(--warning); }

.exam-submit-button { width: 100%; justify-content: center; }

/* Tablet: the sidebar moves under the question rather than squeezing it. */
@media (max-width: 1020px) {
  .exam-layout { grid-template-columns: minmax(0, 1fr); }
  .exam-aside { position: static; }
  .exam-nav-grid { grid-template-columns: repeat(10, 1fr); }
}

/* Phone: header, timer, question, options, controls. The navigator collapses out of the way. */
@media (max-width: 640px) {
  .exam-header { padding: 14px 16px; }
  .exam-header-id h1 { font-size: 19px; }
  .exam-header-clock { padding: 8px 12px; }
  .exam-header-clock strong { font-size: 21px; }
  .exam-card { padding: 22px 18px; }
  .exam-stem { font-size: 18px; margin-bottom: 20px; }
  .exam-option { padding: 14px; grid-template-columns: 30px minmax(0, 1fr); gap: 11px; }
  .exam-option-text { font-size: 15px; }
  .exam-controls { display: grid; grid-template-columns: 1fr 1fr; }
  .exam-controls #exam-mark { grid-column: 1 / -1; order: 3; }
  .exam-controls #exam-next { margin-left: 0; }
  .exam-nav-grid { grid-template-columns: repeat(8, 1fr); gap: 6px; }
}
