/* Exam controls share HTH's warm dark palette; the question stays quiet. */
body.timed-exam-open { overflow:hidden; }
.timed-exam {
 --te-bg:var(--bg,#0e0c08); --te-surface:var(--surface,#181410); --te-raised:var(--surface2,#201c16);
 --te-ink:var(--text,#ede5d6); --te-muted:var(--text2,#9a9082); --te-line:var(--border2,#46403a);
 --te-accent:var(--lantern,#f0b050); --te-orange:var(--amber-lt,#e4aa58); --te-green:var(--green,#72b88a);
 color:var(--te-ink); background:var(--te-bg); color-scheme:dark; border:0; padding:0; margin:0;
 width:100%; max-width:none; height:100dvh; max-height:none; font:16px/1.55 system-ui,sans-serif;
}
.timed-exam[open] { display:flex; flex-direction:column; overflow:hidden; }
.timed-exam::backdrop { background:#0e0c08c9; }
.timed-exam * { box-sizing:border-box; }
.timed-exam button,.timed-exam select,.timed-exam input { font:inherit; color:inherit; }
.timed-exam button:where(:not(.rv-opt-btn):not(.a1-glossary-term)) { padding:.55rem .85rem; border:1px solid var(--te-line); border-radius:7px; background:var(--te-surface); cursor:pointer; min-height:42px; }
.timed-exam button:hover:not(:disabled):where(:not(.rv-opt-btn):not(.a1-glossary-term)) { background:var(--te-raised); border-color:var(--te-accent); }
.timed-exam button:focus-visible,.timed-exam select:focus-visible,.timed-exam input:focus-visible,.timed-exam summary:focus-visible { outline:3px solid var(--te-accent); outline-offset:3px; }
.timed-exam button:disabled { cursor:default; }
.timed-exam button:disabled:not(.te-option) { opacity:.5; }
.te-header { display:flex; flex-shrink:0; align-items:center; justify-content:space-between; gap:20px; padding:16px 28px; border-bottom:1px solid var(--te-line); background:var(--te-surface); z-index:3; }
.te-header>div:first-child { display:flex; align-items:center; gap:16px; }
.te-header>div:first-child strong { font-family:var(--font-ui,system-ui,sans-serif); letter-spacing:.12em; color:var(--te-accent); }
.te-clock { display:flex; align-items:center; gap:12px; margin-left:auto; font-variant-numeric:tabular-nums; }
.te-clock span { color:var(--te-muted); font-size:12px; text-transform:uppercase; letter-spacing:.08em; }
.te-clock strong { font-size:25px; min-width:80px; text-align:right; }
.te-clock .time-low { color:var(--peach,#f0a070); }
.te-tools { display:flex; gap:12px; align-items:center; }
.te-tools details { position:relative; }
.te-tools summary { cursor:pointer; }
.te-calculator { position:absolute; top:40px; right:0; background:var(--te-surface); padding:20px; border:1px solid var(--te-line); border-radius:8px; box-shadow:0 8px 24px #0008; width:250px; display:grid; gap:10px; }
.te-calculator label { display:grid; gap:4px; font-size:13px; }
.te-calculator input,.te-calculator select { width:100%; padding:8px; border:1px solid var(--te-line); background:var(--te-bg); }
.te-calculator output { font-size:22px; overflow-wrap:anywhere; }
.te-save-status { flex-shrink:0; padding:8px 28px; min-height:38px; font-size:12px; color:var(--te-muted); background:var(--te-surface); }
.te-save-status button { font-size:12px; margin-left:8px; min-height:30px; padding:4px 9px; }
.te-layout { display:grid; grid-template-columns:100px minmax(0,1fr); width:100%; margin:0 auto; flex:1; min-height:0; }
.te-rail { overflow-y:auto; overscroll-behavior:contain; border-right:1px solid var(--te-line); padding:20px 10px; scrollbar-width:thin; scrollbar-color:var(--te-line) transparent; }
.te-rail-label { display:block; color:var(--te-muted); text-align:center; font-size:10px; text-transform:uppercase; letter-spacing:.07em; margin-bottom:18px; }
.te-rail>div { display:grid; grid-template-columns:44px; justify-content:center; gap:14px; }
.timed-exam .te-dot { position:relative; border-radius:50%; padding:0; width:44px; height:44px; min-height:44px; font-size:13px; background:transparent; border-color:var(--te-muted); }
.timed-exam .te-dot.answered { background:var(--te-ink); color:var(--te-bg); border-color:var(--te-ink); }
.timed-exam .te-dot.flagged { border:2px solid var(--te-orange); }
.timed-exam .te-dot.current { outline:2px solid var(--te-accent); outline-offset:4px; }
.te-flag-mark { position:absolute; right:-5px; top:-11px; color:var(--te-orange); background:var(--te-bg); font-size:15px; line-height:17px; border-radius:4px; }
.te-rail small { display:block; margin-top:24px; font-size:10px; color:var(--te-muted); }
.te-question { min-width:0; overflow-y:auto; overscroll-behavior:contain; padding:35px clamp(20px,5vw,80px); }
.te-question-heading { display:flex; align-items:center; justify-content:space-between; gap:15px; margin-bottom:26px; font-size:13px; color:var(--te-muted); }
.te-question-heading button[aria-pressed=true] { color:var(--te-orange); border-color:var(--te-orange); }
.te-stem { font-size:18px; line-height:1.75; white-space:pre-wrap; margin-bottom:28px; overflow-wrap:anywhere; }
.te-options { display:grid; gap:10px; }
.te-option-row { display:flex; align-items:stretch; gap:9px; }
.timed-exam .te-option { display:flex; align-items:center; gap:14px; flex:1; min-width:0; text-align:left; padding:14px 17px; white-space:pre-wrap; overflow-wrap:anywhere; }
.te-letter { flex:0 0 26px; text-align:center; font-size:13px; border:1px solid var(--te-line); border-radius:50%; line-height:25px; }
.timed-exam .te-option.selected { border:2px solid var(--te-accent); padding:13px 16px; background:var(--amber-dim,rgba(200,145,58,.13)); }
.te-option.selected .te-letter { background:var(--te-accent); color:var(--te-bg); border-color:var(--te-accent); }
.te-option-row.crossed .te-option>span:nth-child(2) { text-decoration:line-through; color:var(--te-muted); }
.timed-exam .te-cross { flex:0 0 46px; background:transparent; color:var(--te-muted); }
.te-option.correct { box-shadow:inset 4px 0 var(--te-green); }
.te-option strong { margin-left:auto; font-size:11px; }
.timed-exam .te-clear { border:0; background:transparent; font-size:12px; margin-top:8px; }
.te-navigation { display:flex; justify-content:flex-end; gap:10px; flex-wrap:wrap; padding-top:30px; margin-top:20px; border-top:1px solid var(--te-line); }
.timed-exam button[data-action=finish],.timed-exam button[data-action=confirm-submit],.te-setup button[data-action=begin],.te-setup button[data-action=prepare] { background:var(--te-accent); color:var(--te-bg); border-color:var(--te-accent); }
.timed-exam button[data-action=finish]:hover,.timed-exam button[data-action=confirm-submit]:hover,.te-setup button[data-action=begin]:hover,.te-setup button[data-action=prepare]:hover { background:var(--te-orange); }
.te-setup { width:100%; max-width:780px; margin:4vh auto; padding:25px; overflow-y:auto; }
.te-setup h1,.te-finish-dialog p { margin:12px 0; }
.te-finish-dialog h1 { font:500 clamp(28px,4vw,40px)/1.2 Georgia,serif; }
.te-eyebrow { font-size:12px; letter-spacing:.13em; text-transform:uppercase; color:var(--te-accent); }
.te-settings { display:flex; flex-wrap:wrap; gap:20px; margin:28px 0; }
.te-settings label { display:grid; gap:6px; font-size:13px; }
.te-settings select, .te-settings input { color:var(--te-ink); font:inherit; padding:10px; border:1px solid var(--te-line); border-radius:6px; background:var(--te-surface); max-width:100%; }
.te-muted { color:var(--te-muted); font-size:13px; }
.te-notice { padding:14px; border-left:3px solid var(--te-orange); background:var(--amber-dim,rgba(200,145,58,.13)); }
.te-result { display:flex; flex-shrink:0; align-items:center; gap:22px; padding:18px 30px; border-bottom:1px solid var(--te-line); flex-wrap:wrap; }
.te-result>strong { font:42px Georgia,serif; color:var(--te-accent); }
.te-result>span { font-size:14px; }
.te-result>div { margin-left:auto; display:flex; gap:5px; flex-wrap:wrap; }
.te-result button[aria-pressed=true] { border-color:var(--te-accent); background:var(--te-raised); }
.te-explanation { margin-top:30px; padding-top:20px; border-top:1px solid var(--te-line); }
.te-explanation p { white-space:pre-wrap; }
.te-explanation button { margin:5px 8px 5px 0; }
.timed-exam.te-finish-dialog { width:calc(100% - 32px); max-width:520px; height:fit-content; max-height:calc(100dvh - 32px); margin:auto; padding:28px; overflow-y:auto; border:1px solid var(--te-line); border-radius:12px; background:var(--te-surface); box-shadow:0 24px 90px #0009; }
.te-finish-dialog p { margin:12px 0; }
.te-finish-dialog h1 { font-size:30px; margin:0; }
.te-finish-dialog footer { display:flex; justify-content:flex-end; flex-wrap:wrap; gap:10px; margin-top:16px; }
@media(max-width:700px) {
 .te-header { gap:10px; padding:12px; flex-wrap:wrap; }
 .te-header>div:first-child { gap:8px; font-size:13px; }
 .te-clock { gap:6px; }
 .te-clock span { display:none; }
 .te-clock strong { font-size:22px; min-width:62px; }
 .te-tools { font-size:12px; gap:8px; }
 .te-layout { grid-template-columns:64px minmax(0,1fr); }
 .te-rail { padding:14px 5px; }
 .te-rail-label,.te-rail small { display:none; }
 .te-question { padding:20px 12px; }
 .te-question-heading { align-items:flex-start; flex-direction:column; gap:8px; margin-bottom:20px; }
 .te-stem { font-size:16px; }
 .te-option-row { gap:5px; }
 .timed-exam .te-option { padding:12px 8px; gap:8px; }
 .timed-exam .te-option.selected { padding:11px 7px; }
 .timed-exam .te-cross { flex-basis:36px; padding:4px; }
 .te-navigation { gap:7px; }
 .te-save-status { padding:8px 12px; }
 .te-result { padding:12px; gap:12px; }
 .te-result>div { margin-left:0; }
 .te-setup { margin:2vh auto; padding:20px; }
}


/* Q1 feedback uses the existing option/reveal/synthesis styles. */
.te-q1-review { max-width:1000px; margin:0 auto; }
.te-q1-review .question-stem { font-size:18px; line-height:1.65; margin-bottom:24px; white-space:pre-wrap; }
.te-q1-review .round-review-options { display:block; }
.te-q1-review .rv-opt-btn { width:100%; margin:8px 0 0; }
.te-review-choice-label { font-size:11px; margin-left:auto; }
.te-q1-review .rv-rationale { margin-top:24px; }
.te-q1-review [data-review-reference] { margin-top:20px; }
.te-q1-review .source-slide-inline-host iframe { width:100%; height:65vh; border:0; }
.te-q1-review .study-ref-body { overflow-wrap:anywhere; }

.timed-exam button[data-action=light][aria-pressed=true] { border-color:var(--te-accent); color:var(--te-accent); }
.te-ready { max-width:560px; }
.te-ready h1 { font-size:28px; }
.te-ready .te-settings { margin:20px 0; }
.te-viewing-time { font-variant-numeric:tabular-nums; margin-top:-12px; }

.te-settings input { width: 8rem; }

.te-save-status[hidden] { display:none; }

/* Setup reuses the dashboard card chooser panel; the running exam stays full-screen. */
.timed-exam.te-setup-dialog {
 width:min(520px,calc(100% - 32px)); height:fit-content; max-height:calc(100dvh - 32px);
 margin:auto; overflow-y:auto; background:transparent; border-radius:14px;
}
.timed-exam.te-setup-dialog::backdrop { background:rgba(0,0,0,.42); backdrop-filter:blur(2px); }
.te-setup-dialog .te-setup-panel { width:100%; flex:0 0 auto; }
.te-setup-dialog .te-header { padding:0; margin-bottom:20px; border:0; background:transparent; gap:12px; flex-wrap:nowrap; }
.te-setup-dialog .te-header>div:first-child strong { display:none; }
.te-setup-dialog .te-header>div:first-child span { font-family:var(--font-ui,system-ui,sans-serif); font-size:1rem; font-weight:800; }
.te-setup-dialog .te-tools { margin-left:auto; }
.te-setup-dialog button[data-action=close] { padding:0; min-height:28px; width:28px; border:0; background:transparent; font-size:24px; color:var(--te-muted); }
.te-setup-dialog .te-setup { max-width:none; margin:0; padding:0; overflow:visible; }
.te-setup-dialog .te-save-status { padding:0; margin:0 0 16px; background:transparent; }
.te-setup-dialog .te-settings { display:grid; grid-template-columns:minmax(90px,1fr) minmax(0,1.7fr); gap:16px; }
.te-setup-dialog .te-settings input,.te-setup-dialog .te-settings select { width:100%; min-width:0; }
body.reading-light .te-setup-panel { background:var(--te-surface); border-color:var(--te-line); }

/* Cumulative term challenges reuse the familiar exam surface. */
.te-ready select[name="exam-time-adjustment"] { margin: .5rem 0 .5rem .6rem; max-width: 100%; }
.te-break { text-align: center; }
.te-break [data-break-clock] { display: inline-block; min-width: 4ch; font-variant-numeric: tabular-nums; }
.te-elapsed { color: var(--te-muted, #b3a792); white-space: nowrap; font-variant-numeric: tabular-nums; }
.te-block-review { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0; }
.te-block-review [aria-current="page"] { border-color: #d4b16a; }
.te-term.te-setup-dialog .te-header { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px 10px; }
.te-term.te-setup-dialog .te-header > div:first-child { min-width: 0; }
.te-term.te-setup-dialog .te-header > div:first-child span { font-size: .88rem; line-height: 1.4; overflow-wrap: anywhere; }
.te-term.te-setup-dialog .te-header > .te-elapsed { grid-column: 1; grid-row: 2; }
.te-term.te-setup-dialog .te-header > .te-tools { grid-column: 2; grid-row: 1 / span 2; margin-left: 0; align-self: start; }
