/* ============================================================
   Pathway GED — examination environment
   Deliberately calmer than the illustrated course: muted palette,
   no decoration, one job on screen: answer the test.
   ============================================================ */

/* ---------- library & report pages reuse course styles ---------- */
.test-card { padding: var(--sp-5) var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-3); }
.test-card .btn { align-self: flex-start; }
.test-card__row { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.test-card h3 { margin: 0; }
.test-dots { display: inline-flex; gap: 6px; }
.test-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--surface-2); border: 1.5px solid var(--line-strong); }
.test-dot.is-done { background: var(--brand); border-color: var(--brand); }
.test-dot.is-part { background: var(--warn); border-color: var(--warn); }
.subject-start {
  display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-4) var(--sp-5);
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
}
.subject-start .meta { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--ink-faint); }
.subject-start .grow { flex: 1; min-width: 0; }

/* ---------- exam shell ---------- */
.exam-shell {
  --exam-ink: var(--ink);
  --exam-soft: var(--ink-soft);
  --exam-line: var(--line);
  position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column;
  background: var(--paper); color: var(--exam-ink);
  font-size: calc(1rem * var(--exam-scale, 1));
}
.exam-top {
  flex: none; display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-5); border-bottom: 1px solid var(--exam-line);
  background: var(--surface);
}
.exam-top__test { font-family: var(--font-display); font-weight: 700; font-size: var(--text-sm); }
.exam-top__sub { font-size: var(--text-xs); color: var(--exam-soft); }
.exam-top__mid { margin: 0 auto; font-family: var(--font-mono); font-size: var(--text-sm); color: var(--exam-soft); }
.exam-timer {
  font-family: var(--font-mono); font-weight: 700; font-size: var(--text-md);
  padding: 4px 14px; border-radius: var(--r-full); background: var(--surface-2);
  cursor: pointer; border: none; color: inherit;
}
.exam-timer.is-low { background: var(--bad-tint); color: var(--bad); }
.exam-tools { display: flex; gap: var(--sp-2); align-items: center; }
.exam-tool {
  font: inherit; font-size: var(--text-xs); font-weight: 700; cursor: pointer;
  background: none; border: 1px solid var(--line-strong); color: var(--exam-soft);
  border-radius: var(--r-full); padding: 5px 12px;
}
.exam-tool:hover { background: var(--surface-2); }
.exam-tool[aria-pressed="true"] { background: var(--brand-tint); color: var(--brand-strong); border-color: var(--brand); }

.exam-body { flex: 1; overflow: hidden; display: flex; }
.exam-main { flex: 1; overflow-y: auto; padding: var(--sp-6) var(--sp-5) 120px; }
.exam-main__inner { max-width: 860px; margin: 0 auto; }

/* split pane for passages */
.exam-split { display: grid; grid-template-columns: 1fr 1fr; gap: 0; height: 100%; }
.exam-split > div { overflow-y: auto; padding: var(--sp-6) var(--sp-5) 120px; }
.exam-split .stim-pane { border-right: 1px solid var(--exam-line); background: var(--surface); }
.exam-pane-tabs { display: none; }
@media (max-width: 900px) {
  .exam-split { display: block; height: 100%; overflow-y: auto; }
  .exam-split > div { overflow: visible; padding-bottom: var(--sp-4); }
  .exam-split .stim-pane { border-right: none; border-bottom: 1px solid var(--exam-line); }
  .exam-split.is-tabbed > .stim-pane[hidden], .exam-split.is-tabbed > .q-pane[hidden] { display: none; }
  .exam-pane-tabs {
    display: flex; gap: var(--sp-2); padding: var(--sp-2) var(--sp-4);
    border-bottom: 1px solid var(--exam-line); background: var(--surface);
  }
}

.exam-bottom {
  flex: none; display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--exam-line); background: var(--surface);
}
.exam-bottom .spacer { flex: 1; }
.exam-bottom .btn { white-space: nowrap; }
@media (max-width: 560px) {
  .narrow-hide { display: none; }
  .exam-bottom { gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); }
  .exam-bottom .spacer { flex: 0 0 auto; }
}

/* question presentation */
.exam-qnum { font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 700; color: var(--exam-soft); margin-bottom: var(--sp-2); }
.exam-stim { font-size: var(--text-md); line-height: 1.7; }
.exam-stim h4 { margin-bottom: var(--sp-2); }
.exam-stim .src { font-size: var(--text-xs); color: var(--ink-faint); font-style: italic; margin-top: var(--sp-2); }
.exam-stim mark.hl { background: var(--warn-tint); box-shadow: inset 0 -2px 0 var(--warn); border-radius: 2px; padding: 0 1px; cursor: pointer; }
.exam-prompt { font-weight: 600; font-size: var(--text-md); margin: var(--sp-4) 0; }
.exam-opts { display: flex; flex-direction: column; gap: var(--sp-2); }
.exam-opt {
  display: flex; gap: var(--sp-3); align-items: flex-start; text-align: left; width: 100%;
  padding: var(--sp-3) var(--sp-4); border: 1.5px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); cursor: pointer; font: inherit; color: inherit;
}
.exam-opt:hover { border-color: var(--exam-soft); }
.exam-opt.is-picked { border-color: var(--brand); background: var(--brand-tint); }
.exam-opt__key {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--line-strong); font-family: var(--font-mono); font-weight: 700; font-size: var(--text-xs);
}
.exam-opt.is-picked .exam-opt__key { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

.exam-input {
  font: inherit; font-family: var(--font-mono); font-size: var(--text-lg);
  padding: 10px 16px; border-radius: var(--r-sm); border: 1.5px solid var(--line-strong);
  background: var(--surface); color: inherit; max-width: 240px;
}
.exam-input:focus-visible { border-color: var(--brand); }
select.exam-dd {
  font: inherit; font-size: var(--text-sm); font-weight: 600; padding: 4px 8px;
  border-radius: 8px; border: 1.5px solid var(--brand); background: var(--surface); color: inherit;
  margin: 0 2px; max-width: 100%;
}

/* drag & drop (with click-to-place alternative) */
.dd-items, .dd-targets { display: flex; flex-direction: column; gap: var(--sp-2); margin: var(--sp-3) 0; }
.dd-chip {
  padding: var(--sp-2) var(--sp-4); border-radius: var(--r-full); border: 1.5px solid var(--line-strong);
  background: var(--surface); font-weight: 600; cursor: grab; font: inherit; color: inherit; text-align: left;
}
.dd-chip.is-held { border-color: var(--brand); background: var(--brand-tint); }
.dd-chip.is-used { opacity: .35; cursor: default; }
.dd-target {
  display: flex; align-items: center; gap: var(--sp-3); min-height: 52px;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-sm); padding: var(--sp-2) var(--sp-4);
  background: var(--surface-2); cursor: pointer; font: inherit; color: inherit; text-align: left; width: 100%;
}
.dd-target .label { font-size: var(--text-xs); font-weight: 700; color: var(--exam-soft); min-width: 120px; }
.dd-target .filled { font-weight: 600; background: var(--brand-tint); border-radius: var(--r-full); padding: 2px 12px; }
.dd-target.is-armed { border-color: var(--brand); }

/* hotspot zones */
.hotspot-zones { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }

/* navigator drawer */
.exam-nav {
  position: absolute; right: 0; top: 0; bottom: 0; width: 300px; max-width: 88vw;
  background: var(--surface); border-left: 1px solid var(--exam-line); box-shadow: var(--shadow-2);
  padding: var(--sp-5); overflow-y: auto; z-index: 30;
}
.exam-nav h4 { margin-bottom: var(--sp-3); }
.nav-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--sp-2); }
.nav-cell {
  aspect-ratio: 1; border-radius: 10px; border: 1.5px solid var(--line-strong);
  background: var(--surface); font-family: var(--font-mono); font-weight: 700; font-size: var(--text-xs);
  cursor: pointer; color: inherit; position: relative; display: grid; place-items: center;
}
.nav-cell.is-answered { background: var(--brand-tint); border-color: var(--brand); }
.nav-cell.is-current { outline: 2px solid var(--ink); outline-offset: 1px; }
.nav-cell.is-flagged::after { content: "⚑"; position: absolute; top: -7px; right: -3px; color: var(--warn); font-size: 12px; }
.nav-legend { display: flex; flex-direction: column; gap: 6px; margin-top: var(--sp-4); font-size: var(--text-xs); color: var(--exam-soft); }

/* overlays: calculator, formula sheet, modal */
.exam-overlay {
  position: absolute; z-index: 40; background: var(--surface); border: 1px solid var(--exam-line);
  border-radius: var(--r-md); box-shadow: var(--shadow-2);
}
.exam-overlay__head {
  display: flex; align-items: center; padding: var(--sp-2) var(--sp-4);
  border-bottom: 1px solid var(--exam-line); cursor: move; font-weight: 700; font-size: var(--text-sm);
  gap: var(--sp-3);
}
.exam-overlay__head button { margin-left: auto; }
.calc { width: 300px; user-select: none; }
.calc__display {
  font-family: var(--font-mono); font-size: 1.35rem; text-align: right; padding: var(--sp-3) var(--sp-4);
  background: var(--surface-2); border-radius: var(--r-sm); margin: var(--sp-3); min-height: 54px;
  overflow-x: auto; white-space: nowrap;
}
.calc__expr { display: block; font-size: 0.75rem; color: var(--ink-faint); min-height: 1em; }
.calc__grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 0 var(--sp-3) var(--sp-3); }
.calc__grid button {
  font: inherit; font-family: var(--font-mono); font-weight: 600; font-size: var(--text-sm);
  padding: 10px 0; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; color: inherit;
}
.calc__grid button:hover { background: var(--surface-2); }
.calc__grid button.op { background: var(--surface-2); }
.calc__grid button.go { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.formula-sheet { width: 520px; max-width: 92vw; max-height: 70vh; overflow-y: auto; padding: var(--sp-4) var(--sp-5); }
.formula-sheet h5 { font-family: var(--font-display); margin: var(--sp-3) 0 var(--sp-1); }
.formula-sheet table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.formula-sheet td { padding: 4px 8px; border-bottom: 1px solid var(--line); }
.formula-sheet td.f { font-family: var(--font-mono); }

.exam-modal-back {
  position: absolute; inset: 0; background: rgba(0,0,0,.35); z-index: 50;
  display: grid; place-items: center; padding: var(--sp-5);
}
.exam-modal { background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-2); padding: var(--sp-6); max-width: 480px; width: 100%; }
.exam-modal h3 { margin-bottom: var(--sp-3); }
.exam-modal .q__actions { margin-top: var(--sp-5); }

/* check-your-work / break / instructions */
.exam-center { max-width: 640px; margin: 0 auto; padding: var(--sp-10) var(--sp-5); }
.cyw-stats { display: flex; gap: var(--sp-6); margin: var(--sp-5) 0; flex-wrap: wrap; }
.cyw-stats .stat { text-align: center; }
.cyw-stats .stat .n { font-family: var(--font-display); font-weight: 800; font-size: var(--text-2xl); }
.cyw-stats .stat .l { font-size: var(--text-xs); color: var(--exam-soft); }

/* ER editor */
.er-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 0; height: 100%; }
@media (max-width: 900px) { .er-wrap { display: flex; flex-direction: column; overflow-y: auto; } .er-wrap > div { overflow: visible !important; } }
.er-wrap .er-src { overflow-y: auto; padding: var(--sp-6) var(--sp-5); border-right: 1px solid var(--exam-line); background: var(--surface); }
.er-wrap .er-edit { overflow-y: auto; padding: var(--sp-5); display: flex; flex-direction: column; }
.er-edit textarea {
  flex: 1; min-height: 320px; width: 100%; resize: vertical; font: inherit; font-size: var(--text-md);
  line-height: 1.7; padding: var(--sp-4); border-radius: var(--r-sm); border: 1.5px solid var(--line-strong);
  background: var(--surface); color: inherit;
}
.er-edit textarea:focus-visible { border-color: var(--brand); }
.er-meta {
  display: flex; gap: var(--sp-4); align-items: baseline; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: var(--text-xs); color: var(--exam-soft);
  padding: var(--sp-2) 0;
}
.er-meta > :first-child { flex: none; font-weight: 700; color: var(--exam-ink); }
.er-meta > :last-child { flex: 1; min-width: 220px; }

/* results */
.report-band { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-6); align-items: center; padding: var(--sp-6); }
@media (max-width: 560px) { .report-band { grid-template-columns: 1fr; justify-items: center; text-align: center; } }
.readiness { display: inline-flex; padding: 6px 16px; border-radius: var(--r-full); font-weight: 700; font-size: var(--text-sm); }
.readiness--strong { background: var(--good-tint); color: var(--good); }
.readiness--almost { background: var(--warn-tint); color: var(--warn); }
.readiness--review { background: var(--bad-tint); color: var(--bad); }
.skill-bars { display: flex; flex-direction: column; gap: var(--sp-3); }
.skill-bars .row { display: grid; grid-template-columns: 180px 1fr 52px; gap: var(--sp-3); align-items: center; font-size: var(--text-sm); }
@media (max-width: 560px) { .skill-bars .row { grid-template-columns: 110px 1fr 46px; } }
.skill-bars .pct { font-family: var(--font-mono); text-align: right; color: var(--exam-soft); }

.review-item { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); padding: var(--sp-5); margin-bottom: var(--sp-4); }
.review-item .verdict { font-weight: 700; font-size: var(--text-sm); }
.review-item .verdict.ok { color: var(--good); }
.review-item .verdict.no { color: var(--bad); }
.review-stim { background: var(--surface-2); border-radius: var(--r-sm); padding: var(--sp-4); margin: var(--sp-3) 0; font-size: var(--text-sm); }
.review-stim mark { background: var(--warn-tint); box-shadow: inset 0 -2px 0 var(--warn); border-radius: 2px; }

/* full-test completion panels */
.result-panels {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
@media (max-width: 640px) { .result-panels { grid-template-columns: 1fr; } }
.result-panel {
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-5); border: 1px solid var(--line);
  border-left: 4px solid var(--accent, var(--brand));
  border-radius: var(--r-md); background: var(--surface); color: var(--ink);
}
.result-panel:hover { text-decoration: none; box-shadow: var(--shadow-1); }
.result-panel .name { font-weight: 700; font-size: var(--text-sm); line-height: 1.3; }
.result-panel .score { font-family: var(--font-display); font-weight: 800; font-size: var(--text-xl); line-height: 1; }
.result-panel .score .of { font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 400; color: var(--ink-faint); margin-left: 4px; }

/* journey dots */
.journey-row { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line); }
.journey-row .t { width: 80px; font-weight: 700; font-size: var(--text-sm); }

@media (max-width: 720px) {
  .exam-top { flex-wrap: wrap; gap: var(--sp-2); }
  .exam-top__mid { order: 3; width: 100%; margin: 0; }
  .exam-nav { width: 100%; max-width: none; }
}
