/* radiologytrainee.org — Exam mode (/exam/) */
.page-exam .wrap { max-width: 1400px; }
.exam-setup fieldset { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); padding: 14px 18px 18px; margin: 16px 0; min-width: 0; }
.ex-legend { padding: 0 6px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .1em; font-size: .8rem; }
.ex-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 12px; }
.ex-mode { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-2); cursor: pointer; }
.ex-mode:has(input:checked) { border-color: var(--accent); background: rgba(94,200,240,.07); }
.ex-mode > span { display: grid; gap: 4px; }
.ex-mode input, .ex-check input, .ex-station input, .ex-pick-item input { width: 1.15em; height: 1.15em; margin-top: .25em; accent-color: var(--accent); flex: none; }
.ex-station-actions { display: flex; gap: 8px; margin: 4px 0 10px; }
.ex-station-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 8px; }
.ex-station { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-2); cursor: pointer; }
.ex-station input { margin-top: 0; }
.ex-station:has(input:checked) { border-color: var(--accent); }
.ex-st-name { flex: 1; font-weight: 600; }
.ex-st-n { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.ex-station-empty { opacity: .55; cursor: not-allowed; }
.ex-station-empty .ex-st-n { font-style: italic; }
.ex-opt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 14px 20px; align-items: start; }
.ex-field { display: grid; gap: 6px; font-weight: 600; }
.ex-field select { font: inherit; font-weight: 400; background: var(--bg-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; max-width: 14em; }
.ex-check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.ex-pick { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.ex-pick summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.ex-pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 6px 14px; }
.ex-pick-item { display: flex; gap: 8px; align-items: flex-start; font-size: .93rem; cursor: pointer; }
.ex-start-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 20px 0 8px; }

/* ---------- self-test run ---------- */
.ex-bar { position: sticky; top: 0; z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 12px 18px; flex-wrap: wrap;
  margin: 0 -20px; padding: 10px 20px; background: rgba(10,13,18,.96); border-bottom: 1px solid var(--border); backdrop-filter: blur(8px); }
body.exam-running .site-header { position: static; }
.ex-bar-info p { margin: 0; }
.ex-progress { font-weight: 700; font-size: 1.05rem; }
.ex-progress:focus { outline: none; }
.ex-clocks { display: flex; align-items: flex-end; gap: 14px; }
.ex-clock { display: grid; justify-items: center; padding: 4px 14px; border-radius: 12px; border: 2px solid var(--border); background: var(--panel); transition: border-color .3s, background-color .3s; }
.ex-clock-k { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.ex-clock-v { font: 800 2.6rem/1.05 ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; color: var(--ok); }
.ex-clock-sm { border-width: 1px; padding: 3px 10px; }
.ex-clock-sm .ex-clock-v { font-size: 1.15rem; color: var(--text); font-weight: 700; }
.ex-clock.amber { border-color: var(--amber); background: rgba(242,184,75,.10); }
.ex-clock.amber .ex-clock-v { color: var(--amber); }
.ex-clock.red { border-color: #ff5d5d; background: rgba(255,93,93,.12); }
.ex-clock.red .ex-clock-v { color: #ff7b7b; }
.ex-clock.pulse { animation: expulse 1.2s ease-in-out infinite; }
@keyframes expulse { 50% { box-shadow: 0 0 0 7px rgba(255,93,93,.22); } }
.ex-bar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ex-paused { margin: 12px 0; display: flex; gap: 12px; align-items: center; }
.ex-dim { filter: blur(14px) brightness(.5); pointer-events: none; user-select: none; }
.ex-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, 1fr); gap: 22px; align-items: start; margin-top: 16px; }
.ex-films .films { margin: 0; }
.ex-films .film-btn img { max-height: calc(100vh - 190px); }
.ex-films .films-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.ex-side .stem { margin-top: 0; }
.ex-qh { margin: 14px 0 0; font-size: 1.1rem; }
.ex-qs { margin-top: 10px; }
.ex-note-in { display: block; width: 100%; margin-top: 4px; font: inherit; font-size: .95rem; color: var(--text); background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; resize: vertical; min-height: 3.2em; }
.ex-note-in:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px rgba(94,200,240,.25); }

/* ---------- results ---------- */
.res-summary { margin: 8px 0 24px; }
.res-total { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; }
.res-total p { margin: 0; }
.res-big { font-size: 1.6rem; font-weight: 700; }
.res-big-n { font-size: 2.6rem; color: var(--amber); }
.res-tables { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: 16px; }
.res-table h2 { font-size: 1.05rem; margin: 18px 0 8px; }
.res-bar { display: inline-block; width: 80px; height: 8px; border-radius: 4px; background: var(--bg-2); vertical-align: middle; margin-left: 6px; overflow: hidden; }
.res-bar-fill { display: block; height: 100%; background: var(--amber); width: 0; }
.w1 { width: 10%; } .w2 { width: 20%; } .w3 { width: 30%; } .w4 { width: 40%; } .w5 { width: 50%; }
.w6 { width: 60%; } .w7 { width: 70%; } .w8 { width: 80%; } .w9 { width: 90%; } .w10 { width: 100%; }
.res-case { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; margin: 22px 0; }
.res-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.res-head h2 { margin: 0; }
.res-sub { font-size: .9rem; font-weight: 400; }
.res-score { margin: 0; font-weight: 700; color: var(--muted); }
.res-case-score { color: var(--amber); font-size: 1.4rem; }
.res-hist { margin: 12px 0 0; }
.res-films { margin: 12px 0; }
.res-films .film-btn img { max-height: 360px; }
.res-q { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.res-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 16px; align-items: start; }
.res-cols-ann { grid-template-columns: minmax(0, .9fr) minmax(0, 1.2fr) minmax(0, 1fr); }
.res-k { margin: 0 0 4px; font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); font-weight: 700; }
.res-notes { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.res-note-text { margin: 0; white-space: pre-wrap; }
.res-guide { list-style: none; padding: 0; margin: 6px 0; }
.res-guide li { margin: 6px 0; }
.res-pt { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; color: #d6e0ea; }
.res-pt input { width: 1.2em; height: 1.2em; margin-top: .2em; accent-color: var(--amber); flex: none; }
.res-pt .mk { margin-left: auto; padding-left: 8px; }
.res-pt:has(input:checked) span:first-of-type { color: var(--text); }
.res-cols .ann-svg { max-height: 50vh; }
.ex-credits { font-size: .82rem; color: var(--muted); margin-top: 14px; }

/* ---------- tutorial (projector) ---------- */
body.tut-active .site-header, body.tut-active .site-footer { display: none; }
body.tut-active main.wrap { max-width: none; padding: 0 14px; }
.tut-run { min-height: 100vh; background: var(--bg); }
.tut-run:fullscreen { overflow: auto; padding: 0 14px; }
.tut-bar { position: sticky; top: 0; z-index: 4; display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap;
  padding: 8px 0; background: rgba(10,13,18,.96); border-bottom: 1px solid var(--border); }
.tut-bar-info { font-weight: 700; font-size: 1.1rem; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.tut-bar-info .station-k { margin: 0; font-size: .85rem; }
.tut-controls { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tut-controls .btn[disabled] { opacity: .4; cursor: default; }
.tut-timer { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); }
.tut-timer-v { font: 800 1.5rem/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; color: var(--ok); }
.tut-timer.amber { border-color: var(--amber); } .tut-timer.amber .tut-timer-v { color: var(--amber); }
.tut-timer.red { border-color: #ff5d5d; } .tut-timer.red .tut-timer-v { color: #ff7b7b; }
.tut-timer.pulse { animation: expulse 1.2s ease-in-out infinite; }
.tut-help { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 8px 16px; margin: 8px 0; }
.tut-help p { margin: .3em 0; }
kbd { font: 600 .85em ui-monospace, Menlo, Consolas, monospace; padding: 1px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; background: var(--bg-2); }
.tut-main { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(340px, 1fr); gap: 18px; padding-top: 12px; align-items: start; }
.tut-stage { position: relative; }
.tut-stage .films { margin: 0; }
.tut-stage .film-btn img { max-height: calc(100vh - 130px); }
.tut-stage .films-2 .film-btn img { max-height: calc(100vh - 160px); }
.tut-stage .ann-svg { max-height: calc(100vh - 130px); }
.tut-stage.inverted img, .tut-stage.inverted svg image { filter: invert(1); }
.tut-ann-toggle { position: absolute; top: 10px; right: 10px; background: rgba(10,13,18,.85); }
.tut-side { font-size: 1.12rem; max-height: calc(100vh - 80px); overflow: auto; padding-right: 4px; }
.tut-side .stem { margin-top: 0; }
.tut-qs .q { padding: 12px 14px; }
.tut-current { border-color: var(--accent); }
.tut-ans { margin-top: 8px; border-top: 1px dashed var(--border); padding-top: 8px; font-size: 1rem; }
.tut-more { margin: 6px 0; }
.tut-ext { font-size: 1rem; }
.tut-notes { position: fixed; z-index: 6; top: 64px; right: 14px; bottom: 14px; width: min(520px, calc(100vw - 28px)); overflow: auto;
  background: #0d1218; border: 1px solid var(--amber); border-radius: var(--radius); padding: 10px 18px 18px; box-shadow: 0 10px 40px rgba(0,0,0,.6); font-size: .95rem; }
.tut-notes-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tut-notes-head h2 { margin: .4em 0; font-size: 1.1rem; color: var(--amber); }
.tut-note-q { margin: 10px 0; }

@media (max-width: 1000px) {
  .ex-grid, .tut-main { grid-template-columns: 1fr; }
  .tut-side { max-height: none; }
  .res-cols, .res-cols-ann { grid-template-columns: 1fr; }
  .ex-films .film-btn img { max-height: 60vh; }
}
@media (max-width: 640px) {
  .ex-bar { gap: 8px; padding: 8px 14px; margin: 0 -20px; }
  .ex-bar-info { flex: 1 1 auto; }
  .ex-clock-v { font-size: 2rem; }
  .ex-bar-actions { width: 100%; }
  .ex-bar-actions #ex-next { margin-left: auto; }
  .ex-mode { padding: 10px; }
  .res-case { padding: 12px 14px; }
  .tut-controls .btn { padding: 6px 9px; font-size: .85rem; }
}
@media (prefers-reduced-motion: reduce) {
  .ex-clock.pulse, .tut-timer.pulse { animation: none; box-shadow: 0 0 0 3px rgba(255,93,93,.35); }
}
@media print {
  .ex-bar, .tut-bar, .ex-again { display: none !important; }
}

/* ---------- one question at a time ---------- */
.ex-qbox { margin-top: 14px; }
.ex-qprog { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 8px; font-weight: 700; color: var(--accent); font-size: .95rem; }
.ex-qdots { display: inline-flex; gap: 6px; }
.ex-dot { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg-2); }
.ex-dot.done { background: var(--muted); border-color: var(--muted); }
.ex-dot.now { background: var(--accent); border-color: var(--accent); }
.ex-q .q-text { font-size: 1.12rem; }
.ex-q .ex-note-in { min-height: 8em; }
.ex-qnav { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.ex-qnav #ex-nextq { margin-left: auto; }

/* ---------- 20-mark results ---------- */
.res-qhead { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.res-qhead .q-text { margin: 0 0 8px; }
.res-qscore { margin: 0; font-weight: 700; color: var(--muted); white-space: nowrap; }
.res-q-n { color: var(--amber); font-size: 1.15rem; }
.res-unreached { opacity: .7; }
.res-unreached-msg { margin: 0; color: #ff9b9b; font-size: .92rem; }
.res-group-h { margin: 4px 0 2px; display: flex; justify-content: space-between; gap: 10px; color: #d6e0ea; }
.res-sub-list { margin: 2px 0 6px 1.6em; }
.res-capnote { margin: 8px 0 0; color: #ff9b9b; font-size: .9rem; font-weight: 600; }
.res-band { display: inline-block; margin-left: 6px; padding: 1px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; border: 1px solid var(--border); vertical-align: middle; }
.band-strong { color: #04201a; background: var(--ok); border-color: var(--ok); }
.band-pass { color: var(--ok); border-color: var(--ok); }
.band-borderline { color: var(--amber); border-color: var(--amber); }
.band-below { color: #ff9b9b; border-color: #ff7b7b; }
.res-passguide { flex-basis: 100%; margin-top: 4px !important; }
.res-pt input:disabled + span { color: var(--muted); }

/* exam mode: institution badge + source filter (assets/js/exam.js) */
.inst-badge { display: inline-block; margin-left: 8px; font-size: .78rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; color: #1a1033; background: #c9b6ff; vertical-align: middle; }
.ex-source { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 6px 0 14px; }
.ex-source label { display: inline-flex; gap: 6px; align-items: center; }
.draft-chip { display: inline-block; vertical-align: middle; padding: 1px 9px; border-radius: 999px; border: 1px solid var(--amber); color: var(--amber); font-size: .75rem; font-weight: 700; }
.ex-film-link { margin: 6px 0 12px; }

/* ---------- responsive exam view (14 Oct 2026): fill large / maximised monitors ---------- */
/* While a self-test is running the page widens with the window (up to 2600px), the films get most of the width and
   are scaled up to the space left under the sticky bar (small source images are enlarged, never cropped), and text
   grows a little on big screens. Click-to-enlarge (lightbox) is unchanged. */
body.exam-running.page-exam .wrap { max-width: min(2600px, 100%); padding: 0 clamp(16px, 2vw, 48px); }
body.exam-running.page-exam .ex-bar { margin: 0 calc(-1 * clamp(16px, 2vw, 48px)); padding-left: clamp(16px, 2vw, 48px); padding-right: clamp(16px, 2vw, 48px); }
.ex-grid { grid-template-columns: minmax(0, 1.75fr) minmax(320px, 1fr); }
.ex-films .film-btn { width: 100%; }
.ex-films .film-btn img { width: 100%; height: auto; max-height: max(320px, calc(100vh - 175px)); object-fit: contain; }
.ex-films .films-2 .film-btn img { max-height: max(280px, calc(100vh - 215px)); }
.ex-side { max-width: 52rem; }
@media (min-width: 1700px) {
  .ex-grid { grid-template-columns: minmax(0, 2fr) minmax(380px, 1fr); gap: 28px; }
  body.exam-running.page-exam .ex-side { font-size: 1.06rem; }
  body.exam-running.page-exam .ex-q .q-text { font-size: 1.2rem; }
}
@media (min-width: 2300px) {
  body.exam-running.page-exam .ex-side { font-size: 1.16rem; }
  body.exam-running.page-exam .ex-q .q-text { font-size: 1.32rem; }
  .ex-films .films-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
}
@media (max-width: 1000px) {
  .ex-grid { grid-template-columns: 1fr; }
  .ex-side { max-width: none; }
  .ex-films .film-btn img, .ex-films .films-2 .film-btn img { max-height: 70vh; }
}
