/* Practice Exam Center. Palette and type: SPEC 3.1. Layout: SPEC 3.2–3.5. */

:root {
  --accent: #5BB4E5;
  --accent-deep: #3E8FBF;
  --ink: #1F3A5F;
  --text: #333333;
  --muted: #6B7280;
  --btn: #E2E2E2;
  --btn-hover: #D4D4D4;
  --line: #DADDE2;
  --page: #FFFFFF;
  --hl: #FFF3A3;
  --ok: #2E7D4F;
  --bad: #B3261E;

  --slab: "Roboto Slab", Arial, Helvetica, sans-serif;
  --sans: "Open Sans", Arial, Helvetica, sans-serif;
  --wrap: 1100px;
  --gutter: 24px;
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--text); font: 15px/1.5 var(--sans); }
h1, h2, h3 { margin: 0; font-family: var(--slab); font-weight: 700; color: var(--ink); line-height: 1.25; }
p { margin: 0 0 .75em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.page > main { flex: 1 0 auto; }
.wrap { width: 100%; max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- header ---------- */

.topbar { border-top: 4px solid var(--accent); background: var(--page); }
.topbar-inner { display: flex; align-items: center; gap: 10px 48px; min-height: 76px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; flex: none; color: inherit; text-decoration: none; }
.brand img { width: 40px; height: 40px; flex: none; }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font: 700 17px/1.2 var(--sans); color: var(--ink); }
.brand-tag { font-size: 11.5px; line-height: 1.35; color: var(--accent-deep); }
.set-title { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 14px; font-weight: 700; color: var(--text); }

.close-btn {
  display: inline-flex; align-items: center; gap: 7px; flex: none; margin-left: auto;
  padding: 6px 4px; background: none; border: 0; border-radius: 2px;
  font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text);
}
.close-btn svg { width: 16px; height: 16px; flex: none; }
.close-btn:hover { color: var(--ink); }

/* Our own divider: a thin light-blue diagonal stripe, full width. */
.stripe {
  height: 6px;
  background: repeating-linear-gradient(135deg, var(--accent) 0 1.5px, transparent 1.5px 5px);
  opacity: .7;
}

/* ---------- footer ---------- */

.site-footer { margin-top: 36px; padding: 14px 0 20px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.fs-notice { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.fs-notice img { width: 32px; height: 32px; flex: none; }
.fs-notice p { margin: 0; }
.fs-notice b { color: var(--text); }
.disclaimer { margin: 0; text-align: center; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px; background: var(--btn); border: 1px solid #C6C9CE; border-radius: 2px;
  font-size: 12.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text);
  text-decoration: none;
}
.btn:hover { background: var(--btn-hover); }
.btn:active { background: #C9C9C9; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--ink); font-weight: 700; }
.btn-accent:hover { background: var(--accent); box-shadow: inset 0 0 0 2px var(--accent-deep); }
.btn-accent:active { background: #4FA9DC; }

/* Gray CONTINUE with an arrow-shaped right edge. The shape is drawn by
   ::before so the focus ring can still wrap the whole button. */
.btn-continue {
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center;
  height: 52px; min-width: 132px; padding: 0 40px 0 22px;
  background: none; border: 0; border-radius: 0;
  font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text);
}
.btn-continue::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--btn);
  clip-path: polygon(0 8px, calc(100% - 18px) 8px, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, calc(100% - 18px) calc(100% - 8px), 0 calc(100% - 8px));
}
.btn-continue:hover::before { background: var(--btn-hover); }
.btn-continue:active::before { background: #C9C9C9; }

/* ---------- exam: info row ---------- */

.info-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; padding-top: 24px; }
.q-counter { font-size: 20px; white-space: nowrap; }
.q-counter:focus { outline: none; }
.info-tools { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.timer { margin-right: 4px; font-size: 12.5px; line-height: 1.6; text-align: right; white-space: nowrap; }
.timer .val { padding: 0 2px; border-radius: 2px; font-variant-numeric: tabular-nums; }
.timer .val.low { background: #CFE8F7; }
.btn-pause { min-width: 64px; height: 42px; padding: 0 12px; font-size: 12px; font-weight: 600; }

.calc-toggle {
  display: inline-grid; place-items: center; width: 46px; height: 46px; padding: 0;
  background: none; border: 1px solid transparent; border-radius: 4px; color: var(--accent);
}
.calc-toggle svg { width: 33px; height: 38px; }
.calc-toggle:hover { color: var(--accent-deep); }
.calc-toggle[aria-pressed="true"] { border-color: var(--accent); background: #EEF7FC; }

/* ---------- exam: question ---------- */

.question { padding-top: 20px; }
.stem { font-size: 16px; font-weight: 600; line-height: 1.55; overflow-wrap: anywhere; }
.stem p { margin: 0 0 .6em; }
.stem > :last-child { margin-bottom: 0; }
/* A picture in a question, like a medication label */
.stem img { display: block; max-width: 100%; height: auto; margin: 12px 0 4px; }
.instruction { margin: 8px 0 0; font-size: 16px; font-weight: 600; }
.help { margin: 6px 0 0; font-size: 14px; color: var(--muted); }

/* Row of small spaced dots: mostly light gray with some accent blue. */
.dots {
  height: 8px; margin: 20px 0 22px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='8'%3E%3Cg fill='%23A7ADB5'%3E%3Ccircle cx='12' cy='4' r='2.4'/%3E%3Ccircle cx='36' cy='4' r='2.4'/%3E%3Ccircle cx='84' cy='4' r='2.4'/%3E%3Ccircle cx='108' cy='4' r='2.4'/%3E%3Ccircle cx='132' cy='4' r='2.4'/%3E%3Ccircle cx='180' cy='4' r='2.4'/%3E%3Ccircle cx='204' cy='4' r='2.4'/%3E%3C/g%3E%3Cg fill='%235BB4E5'%3E%3Ccircle cx='60' cy='4' r='2.4'/%3E%3Ccircle cx='156' cy='4' r='2.4'/%3E%3Ccircle cx='228' cy='4' r='2.4'/%3E%3C/g%3E%3C/svg%3E") left center repeat-x;
}

.choices { display: flex; flex-direction: column; gap: 6px; }
.opt {
  display: flex; align-items: flex-start; gap: 14px; padding: 9px 12px;
  border: 1px solid transparent; border-radius: 2px; cursor: pointer;
  font-size: 15px; line-height: 1.45;
}
/* Like ATI: the answer just clicked gets a thin outline box. Clicking
   anywhere else removes the box; the dot or check mark stays. */
.opt:focus-within { border-color: var(--accent); box-shadow: 0 1px 3px rgba(31, 58, 95, .08); }
.opt-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* Gray, slightly raised radios and checkboxes like the reference. */
.ctl {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 20px; height: 20px; margin: 1px 0 0;
  border: 1px solid #8F959E; background: linear-gradient(#FFFFFF, #DCDEE2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9); cursor: pointer;
}
.ctl[type="radio"] { border-radius: 50%; }
.ctl[type="checkbox"] { border-radius: 3px; }
.opt:hover .ctl:not(:disabled), .cell:hover .ctl:not(:disabled) { border-color: #5F6670; }
.ctl[type="radio"]:checked {
  background: radial-gradient(circle, #2B2B2B 0 4px, transparent 4.5px), linear-gradient(#FFFFFF, #DCDEE2);
}
.ctl[type="checkbox"]:checked {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M4.5 10.5l3.5 3.5 7.5-8' fill='none' stroke='%23222' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat, linear-gradient(#FFFFFF, #DCDEE2);
}
.ctl:disabled { cursor: default; }
/* "Select 3" reached: the other choices wait until one is cleared. */
.opt.capped { cursor: default; }
.opt.capped .ctl { opacity: .45; }

/* Crossing out a choice (a study aid): right-click it, or its "abc" button. */
.opt-line { display: flex; align-items: center; gap: 4px; }
.opt-line > .opt { flex: 1 1 auto; min-width: 0; }
.strike-btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 30px; padding: 0;
  background: none; border: 1px solid transparent; border-radius: 3px; font-size: 12px; color: #8F959E; cursor: pointer;
}
.strike-btn:hover, .strike-btn:focus-visible { color: var(--ink); background: #F3F5F7; border-color: var(--line); }
.strike-btn[aria-pressed="true"] { color: var(--ink); background: #ECEEF1; border-color: #C6C9CE; }
.strike-icon { font-weight: 700; letter-spacing: .03em; text-decoration: line-through; text-decoration-thickness: 2px; }
.opt.crossed .opt-text { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.opt.crossed .ctl { opacity: .5; }

.exam-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 28px; }

/* Paused: the question is hidden behind the pause alert. */
.exam.is-paused .question { visibility: hidden; }

/* ---------- case study (SPEC 3.3) ---------- */

.case-layout { display: grid; grid-template-columns: minmax(0, 46fr) minmax(0, 54fr); align-items: start; }
.case-panel {
  display: flex; flex-direction: column; min-height: 320px; max-height: calc(100vh - 210px);
  padding-right: 28px;
}
.case-intro { margin: 0 0 12px; font-size: 14px; }
/* The line under the tabs is an inset shadow, so the chosen tab's underline
   covers it without sticking out of the row. (Sticking out by 1px made
   Windows browsers show a scroll bar beside the tabs.) */
.tabs { display: flex; flex: none; overflow-x: auto; margin-bottom: 16px; box-shadow: inset 0 -1px 0 var(--line); }
.tab {
  flex: none; padding: 8px 14px 9px;
  background: none; border: 0; border-bottom: 3px solid transparent; border-radius: 0;
  font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--ink); font-weight: 700; }
/* The exhibit scrolls on its own, under the tabs. */
.tabpanel { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 2px 6px 12px 2px; font-size: 14px; line-height: 1.6; }
.tabpanel:focus { outline: none; }
.tabpanel:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.tabpanel h4 { margin: 0 0 12px; font-size: 15px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.tabpanel p { margin: 0 0 .8em; }
.tabpanel ul, .tabpanel ol { margin: 0 0 .8em; padding-left: 22px; }
.table-wrap { overflow-x: auto; margin: 0 0 1em; }
.tabpanel table { min-width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tabpanel th, .tabpanel td { padding: 6px 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.tabpanel th { background: #F3F5F7; }
.case-question { min-width: 0; padding-left: 28px; border-left: 1px solid var(--line); }

/* ---------- ordered response ---------- */

.order { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.order.order-key { grid-template-columns: minmax(0, 1fr); max-width: 560px; }
.order-box { background: #fff; border: 1px solid #C6C9CE; border-radius: 3px; }
.order-title { margin: 0; padding: 8px 12px; background: #F3F5F7; border-bottom: 1px solid #C6C9CE; font: 700 14px var(--sans); color: var(--ink); }
.order-list { display: grid; align-content: start; gap: 8px; min-height: 150px; margin: 0; padding: 10px; list-style: none; }
.order-list.over { background: #EEF7FC; outline: 2px dashed var(--accent); outline-offset: -6px; }
.order-item { display: flex; align-items: center; gap: 8px; min-height: 44px; background: #fff; border: 1px solid #A9B0B9; border-radius: 3px; cursor: grab; }
.order-item.placed { padding: 4px 6px 4px 10px; }
.order-item.dragging { opacity: .5; }
div.order-text { flex: 1; min-height: 42px; padding: 10px; font-size: 15px; line-height: 1.4; cursor: pointer; }
div.order-text:hover:not([aria-disabled]) { background: #F3F8FC; }
div.order-text[aria-disabled] { cursor: default; }
span.order-text { flex: 1; font-size: 15px; }
.order-num { min-width: 1.6em; font-weight: 700; color: var(--ink); }
.order-ctls { display: flex; flex: none; gap: 4px; }
.order-ctl { width: 32px; height: 32px; padding: 0; background: var(--btn); border: 1px solid #C6C9CE; border-radius: 3px; font-size: 12px; line-height: 1; }
.order-ctl:hover:not(:disabled) { background: var(--btn-hover); }
.order-ctl:disabled { opacity: .35; cursor: default; }
.order-empty { padding: 12px 4px; font-size: 14px; color: var(--muted); }

/* ---------- fill in the blank ---------- */

.fill { display: flex; align-items: center; gap: 10px; }
.fill-input { width: 9em; padding: 8px 10px; border: 1px solid #8F959E; border-radius: 3px; font-size: 16px; font-variant-numeric: tabular-nums; }
.fill-unit { font-weight: 600; }

/* ---------- hot spot ---------- */

.hotspot { position: relative; display: inline-block; max-width: 100%; line-height: 0; cursor: crosshair; }
.hotspot.locked { cursor: default; }
.hotspot img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); user-select: none; -webkit-user-select: none; }
.hotspot-marker {
  position: absolute; width: 24px; height: 24px; margin: -12px 0 0 -12px;
  background: rgba(91, 180, 229, .45); border: 3px solid var(--ink); border-radius: 50%;
  box-shadow: 0 0 0 2px #fff; pointer-events: none;
}

/* ---------- matrix ---------- */

.matrix-wrap { overflow-x: auto; }
.matrix { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.matrix th, .matrix td { padding: 8px 12px; border: 1px solid #C6C9CE; }
.matrix thead th { background: #F3F5F7; font-weight: 700; text-align: center; vertical-align: bottom; }
.matrix thead th.row-head { text-align: left; }
.matrix tbody th { font-weight: 400; text-align: left; }
.matrix td { width: 1%; padding: 0; text-align: center; }
.matrix tbody tr:hover > * { background: #F8FAFB; }
.cell { display: flex; align-items: center; justify-content: center; min-width: 104px; min-height: 44px; padding: 8px; cursor: pointer; }
.cell:focus-within { box-shadow: inset 0 0 0 1px var(--accent); }

/* ---------- drop-down and drag-and-drop sentences ---------- */

.cloze-text { font-size: 16px; line-height: 2.6; }
.blank-select {
  max-width: 100%; margin: 0 4px; padding: 5px 30px 5px 10px; vertical-align: middle;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23333' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center / 12px;
  border: 1px solid #8F959E; border-radius: 3px;
  appearance: none; -webkit-appearance: none; font-size: 15px; line-height: 1.4; cursor: pointer;
}
.token-bank { display: flex; flex-wrap: wrap; gap: 8px; min-height: 58px; margin-bottom: 18px; padding: 12px; background: #F8FAFB; border: 1px dashed #A9B0B9; border-radius: 4px; }
.token { padding: 7px 12px; background: #fff; border: 1px solid #8F959E; border-radius: 3px; font-size: 15px; font-weight: 600; line-height: 1.4; cursor: grab; }
.token:hover:not([aria-disabled]) { border-color: var(--accent-deep); }
.token[aria-pressed="true"] { background: #DCEEF9; border-color: var(--accent-deep); box-shadow: 0 0 0 2px var(--accent); }
.drop {
  display: inline-flex; align-items: center; justify-content: center; min-width: 8.5em; min-height: 36px;
  margin: 0 4px; padding: 3px 12px; vertical-align: middle;
  background: #fff; border: 1px dashed #8F959E; border-radius: 3px;
  font-size: 15px; font-weight: 600; line-height: 1.3; color: var(--ink); cursor: pointer;
}
.drop.filled { background: #EEF7FC; border-style: solid; border-color: var(--accent); }
.dragdrop.picking .drop { border-color: var(--accent); }
.drop.over, .dragdrop.picking .drop:hover { background: #DCEEF9; border-color: var(--accent-deep); }

/* ---------- highlight ---------- */

.passage { padding: 14px 16px; background: #fff; border: 1px solid #C6C9CE; border-radius: 3px; font-size: 15px; line-height: 2; }
.hl { padding: 2px 1px; border-radius: 2px; cursor: pointer; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.hl:hover { background: #EEF1F4; }
.hl[aria-pressed="true"] { background: var(--hl); box-shadow: inset 0 -2px 0 #E6CF4D; }
.hl[aria-disabled="true"] { cursor: default; }

/* ---------- bow tie (SPEC 5.1) ---------- */

.bt-diagram { display: grid; grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr) 44px minmax(0, 1fr); row-gap: 4px; }
.bt-head { grid-row: 1; margin: 0; font-size: 13px; font-weight: 700; text-align: center; color: var(--ink); }
.bt-head-left, .bt-left { grid-column: 1; }
.bt-head-mid, .bt-mid { grid-column: 3; }
.bt-head-right, .bt-right { grid-column: 5; }
.bt-col { grid-row: 2; display: grid; grid-template-rows: repeat(var(--n), minmax(0, 1fr)); align-items: center; }
.bt-lines { grid-row: 2; }
.bt-lines-left { grid-column: 2; }
.bt-lines-right { grid-column: 4; }
.bt-lines svg { display: block; width: 100%; height: 100%; }
.bt-lines line { stroke: #9AA1AA; stroke-width: 2; vector-effect: non-scaling-stroke; }
.bt-slot {
  width: 100%; min-height: 72px; margin: 8px 0; padding: 8px 10px;
  background: #fff; border: 2px dashed #9AA1AA; border-radius: 6px;
  font-size: 14px; font-weight: 600; line-height: 1.3; color: var(--ink);
}
.bt-slot.filled { background: #EEF7FC; border-style: solid; border-color: var(--accent); }
.bt-lists { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 20px; margin-top: 20px; }
.bt-list-title { margin: 0 0 8px; font: 700 14px var(--sans); color: var(--ink); }
.bt-opts { display: grid; gap: 6px; }
.bt-opt { width: 100%; padding: 8px 10px; background: #fff; border: 1px solid #C6C9CE; border-radius: 3px; font-size: 14px; line-height: 1.35; text-align: left; }
.bt-opt:hover:not(:disabled) { border-color: var(--accent); }
.bt-opt[aria-pressed="true"] { background: #EEF7FC; border-color: var(--accent); }
.bt-opt[aria-pressed="true"]::before { content: "✓ "; font-weight: 700; color: var(--ink); }
.bt-opt:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- alerts (SPEC 3.4) ---------- */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000; overflow-y: auto;
  display: flex; justify-content: center; align-items: flex-start; padding: 14px 12px;
  background: rgba(0, 0, 0, .32);
}
.modal {
  width: max-content; min-width: min(360px, 100%); max-width: min(560px, 100%);
  padding: 16px 20px 18px; background: #fff; border-radius: 2px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .28);
}
.modal:focus { outline: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.modal-title { font-size: 22px; }
.modal .close-btn { margin-left: 0; font-size: 12px; }
.modal-msg { margin-top: 4px; font-size: 13.5px; }
.modal-msg p { margin: 0 0 .5em; }
.modal-msg > :last-child { margin-bottom: 0; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* Reporting a problem with a question (SPEC 11.6): the line under a rationale, and its dialog. */
.report-line { margin: 14px 0 0; font-size: 13.5px; }
.link-btn.report-btn { color: var(--muted); }
.link-btn.report-btn:hover:not([aria-disabled=true]) { color: var(--ink); }
.link-btn.report-btn[aria-disabled=true] { color: var(--ok); text-decoration: none; cursor: default; }
.report-form { width: min(470px, 100%); font-size: 14px; }
.report-reasons { margin: 6px 0 4px; padding: 0; border: 0; }
.report-reasons .field-label { margin-top: 4px; }
.choice-line.report-reason { flex-wrap: nowrap; align-items: flex-start; margin: 5px 0; font-size: 14px; }
.report-note { min-height: 76px; margin-top: 4px; font-size: 15px; }
.report-form .field-help { margin-top: 4px; }

/* The host's Reports page. */
.report-list { max-width: 980px; border-top: 1px solid var(--line); }
.report-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.report-stem { margin: 0 0 6px; overflow-wrap: anywhere; }
.report-reasons-list, .report-notes { margin: 0 0 6px; padding-left: 20px; font-size: 14px; }
.report-notes li { margin: 2px 0; }
.report-date, .report-meta { font-size: 13px; color: var(--muted); }
.report-meta { margin: 0 0 8px; }

/* ---------- toasts ---------- */

.toasts {
  position: fixed; left: 50%; bottom: 24px; z-index: 1200; transform: translateX(-50%);
  display: grid; gap: 8px; width: max-content; max-width: calc(100vw - 32px); pointer-events: none;
}
.toast { padding: 10px 16px; border-radius: 4px; background: var(--ink); color: #fff; font-size: 14px; box-shadow: 0 4px 16px rgba(0, 0, 0, .25); }

/* ---------- calculator (SPEC 7) ---------- */

.calc {
  position: fixed; top: 0; left: 0; z-index: 900; width: 248px;
  background: #fff; border: 1px solid #B9BEC6; border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .22); user-select: none; -webkit-user-select: none;
}
.calc:focus { outline: none; }
.calc:focus-visible { outline: 3px solid var(--accent); }
.calc-head {
  display: flex; align-items: center; justify-content: space-between; padding: 5px 5px 5px 12px;
  background: #F1F3F5; border-bottom: 1px solid var(--line); border-radius: 6px 6px 0 0;
  cursor: move; touch-action: none;
}
.calc-head h2 { font-size: 14px; font-weight: 600; }
.calc-x { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; background: none; border: 0; border-radius: 4px; font-size: 16px; }
.calc-x:hover { background: var(--btn); }
.calc-screen { margin: 10px 10px 8px; padding: 4px 10px 6px; background: #F8FAFB; border: 1px solid var(--line); border-radius: 4px; text-align: right; }
.calc-expr { min-height: 18px; font-size: 12px; color: var(--muted); }
.calc-out { overflow: hidden; font-size: 24px; font-weight: 600; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0 10px 10px; }
.calc-keys button { height: 40px; padding: 0; background: var(--btn); border: 1px solid #C6C9CE; border-radius: 3px; font-size: 16px; font-weight: 600; }
.calc-keys button:hover, .calc-keys button.pressed { background: var(--btn-hover); }
.calc-keys .op { background: #DCEEF9; border-color: #A9D3EC; }
.calc-keys .op:hover, .calc-keys .op.pressed { background: #C6E3F5; }
.calc-keys .eq { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.calc-keys .eq:hover, .calc-keys .eq.pressed { box-shadow: inset 0 0 0 2px var(--accent-deep); }

/* ---------- exam: practice mode, going back, review grid ---------- */

.counter-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.mode-tag { padding: 3px 10px; background: #EEF7FC; border: 1px solid #BFE1F4; border-radius: 12px; font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.nav-left { display: flex; gap: 10px; margin-right: auto; }
.btn-nav, .btn-flag, .btn-save { min-height: 42px; }
.btn-flag svg { flex: none; color: var(--muted); }
.btn-flag[aria-pressed="true"] { background: var(--hl); border-color: #D9C55A; }
.btn-flag[aria-pressed="true"] svg { color: var(--ink); }
/* Save (SPEC 11.7): the bookmark fills in once the question is saved. */
.btn-save svg { flex: none; color: var(--muted); }
.btn-save[aria-pressed="true"] { background: #DCEEF9; border-color: var(--accent-deep); }
.btn-save[aria-pressed="true"] svg { color: var(--ink); }
.btn-save[aria-pressed="true"] svg path { fill: currentColor; }

.grid-intro { margin: 0 0 4px; font-size: 15px; }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 10px; max-width: 760px; margin: 16px 0 12px; padding: 0; list-style: none; }
.qtile {
  position: relative; display: flex; align-items: center; justify-content: center; width: 100%; height: 54px;
  background: #fff; border: 1px solid #A9B0B9; border-radius: 4px; font-size: 16px; font-weight: 700; color: var(--ink);
}
.qtile.answered { background: #EEF7FC; border-color: var(--accent); }
.qtile.unanswered { border-style: dashed; }
.qtile:hover { border-color: var(--accent-deep); }
.qtile.flagged svg { position: absolute; top: 4px; right: 5px; }
.grid-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--muted); }
.grid-legend .qtile.sample { display: inline-block; width: 18px; height: 14px; }
.grid-legend svg { color: var(--ink); }

/* Text size setting (SPEC 4.3) */
.exam[data-text-size="large"] .question { zoom: 1.12; }
.exam[data-text-size="larger"] .question { zoom: 1.25; }

/* ---------- answers and rationales (practice mode and review) ---------- */

.feedback { margin-top: 26px; padding: 14px 18px 16px; background: #FAFBFC; border: 1px solid var(--line); border-left: 5px solid var(--muted); border-radius: 3px; }
.feedback:focus { outline: none; }
.feedback:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.feedback.is-correct { border-left-color: var(--ok); }
.feedback.is-partial { border-left-color: var(--accent-deep); }
.feedback.is-wrong { border-left-color: var(--bad); }
.feedback.is-key { border-left-color: var(--ok); }
.feedback-result { margin: 0 0 10px; font-size: 15.5px; }
.feedback.is-correct .feedback-result b { color: var(--ok); }
.feedback.is-wrong .feedback-result b { color: var(--bad); }
.feedback-title { margin: 0 0 6px; font-size: 17px; }
.rationale { font-size: 15px; line-height: 1.6; }
.rationale p { margin: 0 0 .7em; }
.rationale > :last-child { margin-bottom: 0; }

/* ✓ and ✗ marks: green for correct, red for incorrect (review only, SPEC 3.1). */
.mark { display: inline-flex; align-items: center; gap: 4px; flex: none; padding: 1px 9px; border-radius: 11px; font-size: 13px; font-weight: 700; line-height: 1.6; white-space: nowrap; }
.mark.ok { background: #EEF7F1; color: var(--ok); }
.mark.bad { background: #FCECEA; color: var(--bad); }
.opt.reviewed { cursor: default; }
.opt.reviewed .mark { align-self: center; margin-left: auto; }
.opt.is-key, .order-item.is-key, .matrix td.is-key, .drop.is-key, .bt-slot.is-key { background: #F2F9F4; border-color: #8CC5A1; }
.opt.is-wrong, .order-item.is-wrong, .matrix td.is-wrong, .drop.is-wrong, .bt-slot.is-wrong { background: #FDF3F2; border-color: #E2A39C; }
.matrix td.is-key, .matrix td.is-wrong { border-color: #C6C9CE; }
.order-item .mark { margin-left: auto; }
.cell-mark { margin-left: 8px; font-size: 15px; font-weight: 700; }
.cell-mark.ok { color: var(--ok); }
.cell-mark.bad { color: var(--bad); }
.key-note { margin: 10px 0 0; font-size: 14.5px; }
.review-legend { margin: 10px 0 0; font-size: 13.5px; color: var(--muted); }
.blank-mark { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 6px 0 2px; line-height: 1.5; vertical-align: middle; }
.key-inline, .key-inline b { font-size: 14px; color: var(--ok); }
.hl.hl-right { background: #D9F0E1; box-shadow: inset 0 -2px 0 var(--ok); }
.hl.hl-wrong { background: #FBDDD9; box-shadow: inset 0 -2px 0 var(--bad); }
.hl.hl-missed { outline: 2px dashed var(--ok); outline-offset: 1px; }
.hl-legend .hl { padding: 1px 4px; }
.hotspot-region { position: absolute; background: rgba(46, 125, 79, .18); border: 2px dashed var(--ok); pointer-events: none; }
.bt-mark { display: block; margin-top: 6px; }
.bt-key { margin-top: 18px; padding: 12px 16px; background: #FAFBFC; border: 1px solid var(--line); border-radius: 3px; }
.bt-key p { margin: 0 0 4px; font-size: 14.5px; }

/* ---------- homepage, setup, and results ---------- */

.home, .setup, .results, .saved-page, .plain-page { padding-top: 28px; }
.page-title { font-size: 26px; }
.lead { margin: 6px 0 22px; color: var(--muted); }
.crumb { margin: 0 0 10px; font-size: 14px; }
.section-title { margin: 0 0 10px; padding: 0; font: 700 19px/1.3 var(--slab); color: var(--ink); }

.banner {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 20px;
  margin-bottom: 22px; padding: 12px 16px; background: #F2F9FD; border: 1px solid var(--accent); border-left-width: 5px;
}
.banner p { margin: 0; }
.banner-detail { margin-top: 2px !important; font-size: 14px; color: var(--muted); }
.banner-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.set-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.set-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.set-row h3 { font-size: 18px; }
.set-desc { margin: 4px 0 2px; }
.set-meta { margin: 0; font-size: 13px; color: var(--muted); }
.set-history { margin: 6px 0 0; font-size: 13.5px; color: var(--muted); }
.set-history b { color: var(--text); }
.set-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* The exam or unit a set is for, above its title (SPEC 11). */
.set-exam { margin: 0 0 5px; }
.tag { display: inline-block; padding: 1px 10px; background: #EEF7FC; border: 1px solid #BFE1F4; border-radius: 12px; font-size: 12.5px; font-weight: 600; line-height: 1.6; color: var(--ink); }

/* Class tabs (SPEC 11): the exhibit tabs, larger, with the code and term
   above the class name. The chosen tab isn't bolder, so tabs don't change
   width when another one is chosen. */
.class-tabs { margin-bottom: 0; }
.class-tab { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 10px 22px 11px; text-align: left; white-space: normal; }
.class-tab[aria-selected="true"] { font-weight: 600; }
.class-code { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.class-term::before { content: " · "; }
.class-name { font-size: 16px; }
/* Practice exams, then study guides (SPEC 11). */
.home-section { margin-top: 24px; }
.home-section + .home-section { margin-top: 34px; }
.empty-note { margin: 0; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); }
/* Saved questions (SPEC 11.7): the homepage link, and the Saved questions page. */
.home-saved { margin: -6px 0 22px; }
.saved-link svg { flex: none; }
.saved-class { margin-top: 26px; }
.saved-class .section-title { margin-bottom: 12px; }
.saved-set { margin-bottom: 18px; border: 1px solid var(--line); border-radius: 4px; }
.saved-set-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; padding: 14px 16px; background: #F7FBFE; }
.saved-set-head h3 { font-size: 18px; }
.saved-list { margin: 0; padding: 0; list-style: none; }
.saved-item { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 20px; padding: 12px 16px; border-top: 1px solid var(--line); }
.saved-info { flex: 1 1 360px; min-width: 0; }
.saved-text { margin: 0 0 2px; }
.saved-item.is-gone .saved-text, .saved-set.is-gone h3 { color: var(--muted); }
.problems { margin-top: 28px; padding: 14px 18px 16px; background: #FFF8F0; border: 1px solid #E9C9A8; }
.problems h2 { margin-bottom: 6px; font-size: 18px; }
.problems-lead { margin: 0 0 6px; font-size: 14px; }
.problem-file { margin-top: 14px; }
.problem-file h3 { margin: 0 0 6px; font: 700 15px/1.4 var(--sans); color: var(--text); }
.problem-file code, .problem-code { font-family: Consolas, "Courier New", monospace; }
.problems ul { margin: 0; padding-left: 20px; }
.problem-file li { margin-bottom: 6px; font-size: 14.5px; overflow-wrap: anywhere; }
.problem-code { margin: 6px 0 2px; padding: 8px 10px; overflow-x: auto; background: #fff; border: 1px solid #E9C9A8; border-radius: 3px; font-size: 13px; line-height: 1.5; white-space: pre; }

.setup-box { max-width: 760px; margin: 0 0 24px; padding: 14px 18px; background: #F7FBFE; border: 1px solid var(--line); border-left: 5px solid var(--accent); }
.setup-lead { margin: 0 0 6px; font-size: 16px; }
.setup-box ul { margin: 0; padding-left: 20px; font-size: 14.5px; }
.custom-note { margin: 0; font-size: 14px; color: var(--muted); }
.setting { min-width: 0; margin: 0; padding: 0; border: 0; }
.setting legend { margin-bottom: 6px; padding: 0; font-weight: 700; color: var(--ink); }
.choice-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin: 6px 0; font-size: 14.5px; cursor: pointer; }
.choice-line .ctl { margin: 0; }
.num-input { width: 5.5em; padding: 6px 8px; border: 1px solid #8F959E; border-radius: 3px; font-size: 15px; }
.setting-note { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.setup-problem { margin: 0 0 12px; font-weight: 600; color: var(--bad); }
.setup-problem:empty { display: none; }
.btn-big { min-height: 48px; padding: 0 32px; font-size: 14px; }
.btn-ink { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 700; }
.btn-ink:hover { background: #2B4D79; }
.btn-ink:active { background: #18304F; }

/* The setup page (SPEC 4.1–4.3): a card per mode, each with its own Start,
   and Change settings, which opens the settings panel. */
.setup-meta { margin: 2px 0 0; font-size: 14.5px; color: var(--muted); }
.setup-meta b { color: var(--ink); }
.setup .set-about { max-width: 760px; margin: 10px 0 0; }
.about-btn { display: none; }
.mode-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; max-width: 760px; margin: 22px 0 0; }
.mode-card { display: flex; flex-direction: column; padding: 18px 20px 20px; background: #fff; border: 2px solid var(--line); border-radius: 8px; }
.mode-practice { background: #F2F9FD; border-color: #A9D3EC; }
.mode-head { display: flex; align-items: center; gap: 12px; }
.mode-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 42px; height: 42px; border-radius: 10px; background: var(--accent); color: #fff; }
.mode-exam .mode-icon { background: var(--ink); }
.mode-title { font-size: 19px; }
.mode-facts { margin: 2px 0 0; font-size: 14.5px; font-weight: 700; color: var(--ink); }
.mode-desc { flex: 1 0 auto; margin: 12px 0 16px; font-size: 14.5px; }
.btn-start { width: 100%; min-height: 46px; font-size: 13.5px; }
.settings-open { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 760px; margin: 16px 0 8px; padding: 10px 14px; background: #fff; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); text-align: left; }
.settings-open:hover { border-color: #A9D3EC; }
.settings-open .mode-icon { width: 36px; height: 36px; background: #EEF1F4; color: var(--ink); }
.settings-text { display: flex; flex: 1; flex-direction: column; }
.settings-text span { font-size: 13px; color: var(--muted); }
.settings-open > svg { flex: none; color: #9AA3AF; }

/* The settings panel: segments, a number box with − and +, rows that open,
   and switches, with Start kept in view at the bottom. */
.settings-sheet { width: min(560px, 100%); max-height: calc(100vh - 28px); overflow-y: auto; }
.ready-sheet .setup-box { margin: 12px 0 0; }
.settings-panel { display: grid; gap: 16px; margin-top: 12px; font-size: 14.5px; }
.panel-top { display: flex; align-items: center; gap: 12px; }
.panel-top .setting { flex: 1; }
.reset-btn { flex: none; }
.segs { display: flex; gap: 4px; padding: 4px; background: #EEF1F4; border-radius: 10px; }
.seg { position: relative; display: flex; flex: 1 1 0; min-width: 0; }
.seg-input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg span { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; min-height: 38px; padding: 4px 6px; border-radius: 7px; font-weight: 600; line-height: 1.2; text-align: center; color: #4B5563; }
.seg-input:checked + span { background: #fff; color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(15, 23, 42, .18); }
.seg-input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 1px; }
.seg small { font-size: 12px; font-weight: 400; }
.seg-large span { font-size: 16px; }
.seg-larger span { font-size: 18px; }
.count-row { display: flex; align-items: center; gap: 10px; }
.stepper { display: inline-flex; overflow: hidden; border: 1px solid #8F959E; border-radius: 8px; }
.step-btn { width: 42px; min-height: 40px; padding: 0; background: #F3F5F7; border: 0; font-size: 20px; line-height: 1; color: var(--ink); }
.step-btn:disabled { color: #B8BDC5; cursor: not-allowed; }
.stepper .num-input { width: 4.2em; border: 0; border-left: 1px solid #C6C9CE; border-right: 1px solid #C6C9CE; border-radius: 0; font-weight: 700; text-align: center; }
.count-of { color: var(--muted); }
.picks { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 6px; }
.pick { padding: 4px 12px; background: #F3F5F7; border: 1px solid var(--line); border-radius: 14px; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.pick[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.custom-minutes { display: flex; align-items: center; gap: 8px; margin-top: -8px; }
.filter-rows > details { border-top: 1px solid #E5E7EB; }
.filter-rows > details:last-child { border-bottom: 1px solid #E5E7EB; }
.filter-row > summary { display: flex; align-items: center; gap: 10px; padding: 11px 2px; list-style: none; font-weight: 700; color: var(--ink); cursor: pointer; }
.filter-row > summary::-webkit-details-marker { display: none; }
.row-val { margin-left: auto; font-weight: 400; color: var(--muted); }
.filter-row > summary svg { flex: none; color: #9AA3AF; transition: transform .15s; }
.filter-row[open] > summary svg { transform: rotate(90deg); }
.filter-list { padding: 0 2px 10px; }
.filter-list .choice-line { flex-wrap: nowrap; align-items: flex-start; }
.filter-list .choice-line .ctl { margin-top: 1px; }
.filter-list .link-btn { margin-top: 4px; }
.switches { display: grid; }
.switch-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 2px; border-top: 1px solid #EEF0F3; color: var(--ink); cursor: pointer; }
.switch-line:first-child { border-top: 0; }
.switch {
  flex: none; width: 44px; height: 26px; margin: 0; border-radius: 13px; appearance: none; -webkit-appearance: none; cursor: pointer;
  background: #C9CED6 radial-gradient(circle at 13px 50%, #fff 9px, transparent 10px);
}
.switch:checked { background: var(--accent-deep) radial-gradient(circle at calc(100% - 13px) 50%, #fff 9px, transparent 10px); }
.switch:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.panel-actions { position: sticky; bottom: -18px; margin: 0 -20px -18px; padding: 10px 20px 18px; background: #fff; box-shadow: 0 -6px 16px rgba(31, 58, 95, .06); }
.panel-actions .setup-problem { margin: 0 0 8px; }

.notice { max-width: 760px; padding: 10px 14px; background: #FFF8E1; border: 1px solid #E8D48A; }
.score-card { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; width: fit-content; max-width: 100%; margin-bottom: 14px; padding: 18px 24px; border: 1px solid var(--line); border-top: 4px solid var(--accent); }
.score-card p { margin: 0 0 4px; }
.score-big { margin: 0 !important; font: 700 46px/1.1 var(--slab); color: var(--ink); }
.note { max-width: 760px; font-size: 14px; color: var(--muted); }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 30px; }
.perf-section { margin-bottom: 26px; }
.table-scroll { max-width: 760px; overflow-x: auto; }
.perf { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.perf th, .perf td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.perf thead th { font-size: 13px; font-weight: 700; color: var(--muted); }
.perf tbody th { font-weight: 600; }
.perf .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar-cell { width: 38%; min-width: 150px; }
.bar { display: flex; align-items: center; gap: 10px; }
.bar-track { flex: 1; height: 10px; overflow: hidden; background: #E7EBEF; border-radius: 5px; }
.bar-fill { display: block; height: 100%; background: var(--accent); }
.bar-pct { min-width: 3.2em; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- group study (SPEC 6) ---------- */

.banner-live { border-color: var(--accent-deep); }
.live-dot { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: var(--accent-deep); box-shadow: 0 0 0 3px #CFE8F7; vertical-align: 0; }
.group-page, .host { padding-top: 28px; }
.link-btn {
  padding: 0; background: none; border: 0; border-radius: 2px;
  font-weight: 600; color: var(--accent-deep); text-decoration: underline; text-underline-offset: 2px;
}
.link-btn:hover { color: var(--ink); }

/* Forms: joining, host sign-in, starting a session */
.join-card { display: grid; gap: 6px; max-width: 460px; }
.field { display: grid; gap: 6px; }
.field-label { margin-top: 8px; font-weight: 700; color: var(--ink); }
.field-help { margin: 0; font-size: 13.5px; color: var(--muted); }
.text-input { width: 100%; min-height: 42px; padding: 8px 11px; background: #fff; border: 1px solid #8F959E; border-radius: 3px; font-size: 16px; }
.form-problem { margin: 4px 0 0; font-weight: 600; color: var(--bad); }
.form-problem:empty { display: none; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 14px; }

/* "Reconnecting…": a small pill at the top of the screen while the internet is down */
.reconnecting {
  position: fixed; top: 10px; left: 50%; z-index: 1100; transform: translateX(-50%);
  display: flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 4px 10px;
  width: max-content; max-width: calc(100vw - 24px); padding: 7px 16px;
  background: var(--ink); border-radius: 18px; box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
  font-size: 14px; font-weight: 600; color: #fff;
}
.reconnecting .link-btn { color: #CFE8F7; }
.reconnecting .link-btn:hover { color: #fff; }
.reconnecting-dot { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--accent); }

/* The countdown, in the exam timer's spot (one line: no pause in group study) */
.timer.countdown { margin-right: 0; font-size: 13.5px; }

/* The student's question screen */
.group-who { margin: 8px 0 0; font-size: 13.5px; color: var(--muted); }
.group-who b { color: var(--text); }
.group-actions { justify-content: space-between; }
.group-status { margin: 0 auto 0 0; font-weight: 600; color: var(--ink); }
.group-time { font-size: 14px; font-weight: 700; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
/* Locked in: the choices not picked fade, and nothing looks clickable. */
.question.is-locked .opt { cursor: default; }
.question.is-locked .opt:not(:has(.ctl:checked)) { opacity: .7; }
.offline { max-width: none; margin: 16px 0 0; }

/* How the group answered */
.dist { margin-top: 18px; padding: 14px 18px 16px; background: #fff; border: 1px solid var(--line); border-radius: 3px; }
.dist-title { margin: 0 0 2px; font-size: 17px; }
.dist-count { margin: 0 0 10px; font-size: 13.5px; color: var(--muted); }
.dist-rows { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.dist-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(140px, 36%) 2.2em; align-items: center; gap: 4px 12px; font-size: 14.5px; }
.dist-label { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; overflow-wrap: anywhere; }
.dist-n { font-size: 13px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.dist-row.kind-key .bar-fill, .dist-row.kind-full .bar-fill { background: var(--ok); }
.dist-row.kind-none .bar-fill { background: var(--bad); }
.dist-row.kind-part .bar-fill { background: var(--accent-deep); }

/* The student's results */
.results-note:not(:empty) { margin-bottom: 18px; }
.group-review { margin: 0; padding: 0; list-style: none; }
.group-review-item { padding: 22px 0 26px; border-top: 1px solid var(--line); }
.review-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.review-q { font-size: 18px; }
.group-review .question { padding-top: 14px; }
.case-details { max-width: 860px; margin-top: 12px; border: 1px solid var(--line); border-radius: 3px; }
.case-details > summary { padding: 9px 14px; font-weight: 700; color: var(--ink); cursor: pointer; }
.case-details[open] > summary { border-bottom: 1px solid var(--line); }
.exhibits { padding: 4px 14px 6px; font-size: 14px; line-height: 1.6; }
.exhibit { padding: 10px 0 2px; }
.exhibit + .exhibit { border-top: 1px dashed var(--line); }
.exhibit-title { margin: 0 0 8px; font: 700 15px var(--sans); color: var(--ink); }
.exhibit-body p { margin: 0 0 .8em; }
.exhibit-body ul, .exhibit-body ol { margin: 0 0 .8em; padding-left: 22px; }
.exhibit-body h4 { margin: 0 0 8px; font-size: 14px; }
.exhibit-body table { min-width: 100%; border-collapse: collapse; font-size: 13.5px; }
.exhibit-body th, .exhibit-body td { padding: 6px 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.exhibit-body th { background: #F3F5F7; }

/* The host console */
.host-page { --wrap: 1360px; }
/* Its menu: Group study, Study guides (SPEC 11.2). Underlined like the tabs. */
.host-menu { display: flex; flex-wrap: wrap; margin: 0 0 24px; box-shadow: inset 0 -1px 0 var(--line); }
.host-menu-link {
  padding: 9px 20px 10px; border-bottom: 3px solid transparent;
  font-size: 15px; font-weight: 600; color: var(--muted); text-decoration: none;
}
.host-menu-link:hover { color: var(--ink); }
.host-menu-link[aria-current="page"] { border-bottom-color: var(--accent); color: var(--ink); font-weight: 700; }
.menu-count { display: inline-block; min-width: 20px; margin-left: 7px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; vertical-align: 1px; }
.host-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.host-bar-tools { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 10px 18px; margin-left: auto; }
.host-controls { display: flex; flex-wrap: wrap; gap: 10px; }
.host-countdown { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; font-size: 14px; font-weight: 600; }
.short-select { width: auto; min-height: 36px; padding: 4px 8px; font-size: 14px; }
.btn-small { min-height: 34px; padding: 0 10px; font-size: 11.5px; }
.host-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; gap: 28px; }
.host-main { min-width: 0; }
.host-tools { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 20px; padding-top: 12px; }
.host-set { font-size: 13.5px; color: var(--muted); }
.key-toggle { font-weight: 600; }
.host-question { padding-top: 12px; }
.key-banner { margin: 0 0 14px; padding: 6px 12px; background: #FFF8E1; border: 1px solid #E8D48A; font-size: 13.5px; font-weight: 700; }
.host-rationale { border-left-color: var(--accent-deep); }
.host-side { position: sticky; top: 12px; display: grid; gap: 14px; padding-top: 18px; }
.side-box { padding: 14px 16px; border: 1px solid var(--line); border-radius: 3px; }
.side-title { margin: 0 0 2px; font-size: 17px; }
.side-count { margin: 0 0 10px; font-size: 13.5px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 3px 11px; background: #fff; border: 1px solid #C6C9CE; border-radius: 14px; font-size: 13.5px; overflow-wrap: anywhere; }
.chip.answered { background: #EEF7FC; border-color: var(--accent); }
.chip-check { font-weight: 700; color: var(--ink); }
.host-side .dist { margin-top: 0; }
.host-side .dist-row { grid-template-columns: minmax(0, 1fr) 2.2em; }
.host-side .dist-label { grid-column: 1 / -1; }
.host-account { margin: 28px 0 0; font-size: 13.5px; color: var(--muted); }
.host-start { display: grid; gap: 18px; max-width: 560px; }
.uid-panel { max-width: 640px; }
.uid-panel p { margin: 0 0 8px; }
.uid-row { display: flex; flex-wrap: wrap; gap: 10px; }
.uid-box { flex: 1 1 260px; width: auto; font-family: Consolas, "Courier New", monospace; }
.steps { max-width: 760px; margin: 0; padding-left: 22px; }
.steps li { margin-bottom: 8px; }
.steps code { padding: 1px 4px; background: #F3F5F7; border-radius: 3px; font-family: Consolas, "Courier New", monospace; font-size: 14px; overflow-wrap: anywhere; }
.summary-scroll { max-width: 980px; }
.summary-num { font-weight: 700; color: var(--ink); }
.summary-stem { font-weight: 400; }
.summary .bar-cell { width: 30%; }
.muted { color: var(--muted); }

/* The host's study guides page (SPEC 11.2): the upload form, then what's on the site. */
.host-card { padding: 16px 20px 20px; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 3px; }
.guide-form { display: grid; gap: 4px; max-width: 640px; margin-bottom: 34px; }
.guide-form .section-title { margin-bottom: 2px; }
.optional { font-weight: 400; color: var(--muted); }
.file-input { width: 100%; padding: 8px; background: #F7FBFE; border: 1px dashed #8F959E; border-radius: 3px; font-size: 14.5px; }
.file-input::file-selector-button {
  margin-right: 12px; min-height: 34px; padding: 0 14px; background: var(--btn); border: 1px solid #C6C9CE; border-radius: 2px;
  font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text); cursor: pointer;
}
.file-input::file-selector-button:hover { background: var(--btn-hover); }
.own-work { flex-wrap: nowrap; align-items: flex-start; margin-top: 14px; font-size: 14px; }
.own-work .ctl { flex: none; margin-top: 3px; }
.upload-progress { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-top: 12px; font-size: 14px; font-weight: 600; color: var(--ink); }
.upload-bar { flex: 1 1 200px; max-width: 360px; height: 10px; overflow: hidden; background: #E7EBEF; border: 0; border-radius: 5px; -webkit-appearance: none; appearance: none; }
.upload-bar::-webkit-progress-bar { background: #E7EBEF; }
.upload-bar::-webkit-progress-value { background: var(--accent); }
.upload-bar::-moz-progress-bar { background: var(--accent); }
.guide-admin { max-width: 980px; }
.usage-note { margin: 0 0 6px; font-size: 13.5px; color: var(--muted); }
.guide-class { margin-top: 22px; }
.guide-class-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 8px; }
.guide-class-title { font-size: 17px; }
.guide-class .field-help { margin-bottom: 8px; }
.guide-admin .set-row h4 { margin: 0; font: 700 17px/1.25 var(--slab); color: var(--ink); }
.guide-editor { padding: 14px 16px 16px; background: #F7FBFE; border-bottom: 1px solid var(--line); }
.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 18px; }
.editor-grid .wide { grid-column: 1 / -1; }
textarea.text-input { min-height: 84px; resize: vertical; }

/* The host's question sets page (SPEC 11.3): every set by class, each with an Edit form. */
.set-admin { max-width: 980px; }
.set-class { margin-top: 22px; }
.set-class:first-child { margin-top: 0; }
.set-class-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 8px; }
.set-class-title { font-size: 17px; }
.set-flags { margin-top: 3px; color: var(--ink); }
.set-editor { padding: 14px 16px 16px; background: #F7FBFE; border-bottom: 1px solid var(--line); }
.count-field { min-width: 0; margin: 8px 0 0; padding: 0; border: 0; } /* the margin lines its legend up with the labels beside it */
.count-field .choice-line { margin: 2px 0; }
.set-editor .field-help { margin-top: 2px; }
.show-line { margin-top: 12px; }
.console-tools { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.new-set-form { display: grid; gap: 4px; max-width: 760px; margin-bottom: 26px; }
.btn-small { min-height: 32px; padding: 0 12px; font-size: 11.5px; }

/* The order students see sets and guides in (SPEC 11.4): a grip to drag, and ▲ ▼. */
.set-class-links { display: inline-flex; flex-wrap: wrap; gap: 4px 16px; }
.orderable > li.set-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px 18px; }
.order-tools { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.order-tools .order-ctl { width: 30px; height: 24px; font-size: 11px; }
.order-grip { width: 30px; padding: 2px 0; font-size: 18px; line-height: 1; text-align: center; color: var(--muted); cursor: grab; user-select: none; }
.order-grip:hover { color: var(--ink); }
.orderable > li.dragging { opacity: .4; }
.orderable > li.drop-before { box-shadow: inset 0 3px 0 var(--accent); }
.orderable > li.drop-after { box-shadow: inset 0 -3px 0 var(--accent); }

/* The host's Student view (SPEC 11.4): a button in the console's menu, and one back. */
.host-menu .student-view { align-self: center; margin-left: auto; }
.host-pill {
  position: fixed; right: 16px; bottom: 16px; z-index: 1050; padding: 9px 16px;
  background: var(--ink); border-radius: 20px; box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
  font-size: 14px; font-weight: 600; color: #fff; text-decoration: none;
}
.host-pill:hover, .host-pill:focus-visible { background: #0B1B2B; color: #fff; }

/* One set's questions (SPEC 11.3, part 2): the draft, the list, and the question form. */
.q-page-meta { margin: 0 0 4px; }
.draft-box { max-width: 980px; margin: 14px 0 18px; padding: 12px 16px; background: #F7FBFE; border: 1px solid #BFE1F4; border-left: 4px solid var(--accent); border-radius: 3px; }
.draft-box.has-draft { background: #FFF8E1; border-color: #E8D48A; border-left-color: #C99A1E; }
.draft-box p { margin: 0 0 6px; }
.draft-box .form-actions { margin-top: 8px; }
.draft-problems ul { margin: 4px 0 8px; padding-left: 20px; font-weight: 600; color: var(--bad); }
.q-list { max-width: 980px; margin: 0; padding: 0; list-style: none; }
.q-row { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.q-row.is-hidden .q-row-info { opacity: .6; }
.q-row-info { flex: 1 1 420px; min-width: 0; }
.q-row-head { margin: 0 0 3px; font-size: 14px; color: var(--muted); }
.q-row-head b { color: var(--ink); }
.q-row-stem { margin: 0; overflow-wrap: anywhere; }
.q-row-note { flex-basis: 100%; margin: 0; font-size: 13px; color: var(--muted); }
.q-source { max-width: 980px; margin-top: 16px; }
.badge { display: inline-block; margin-left: 8px; padding: 0 8px; border-radius: 10px; font-size: 12px; font-weight: 700; line-height: 1.7; vertical-align: 1px; }
.badge-new { background: #E3F4E8; color: #1D6B34; }
.badge-changed { background: #FFF1CC; color: #7A5600; }
.badge-hidden { background: #ECEEF1; color: #4A5260; }
.q-editor { display: grid; gap: 4px; max-width: 980px; margin: 4px 0 16px; padding: 14px 18px 18px; background: #F7FBFE; border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 3px; }
.q-editor .section-title { margin-bottom: 2px; }
.qe-fixed { margin: 0; padding: 8px 0; font-weight: 600; }
.edit-list { display: grid; gap: 6px; margin: 4px 0 8px; padding: 0; list-style: none; }
.edit-item { display: flex; align-items: center; gap: 8px; }
.edit-item .ctl { flex: none; margin: 0; }
.edit-item .text-input { flex: 1 1 auto; min-width: 0; min-height: 38px; padding: 6px 10px; font-size: 15px; }
.matrix-key { overflow-x: auto; }
.matrix-key-table { margin: 4px 0; border-collapse: collapse; background: #fff; }
.matrix-key-table th, .matrix-key-table td { padding: 6px 10px; border: 1px solid var(--line); font-size: 14px; text-align: center; }
.matrix-key-table th[scope="row"] { font-weight: 600; text-align: left; }
.blank-editor { min-width: 0; margin: 10px 0 0; padding: 8px 12px 10px; background: #fff; border: 1px solid var(--line); border-radius: 3px; }
.blank-editor legend { padding: 0 4px; font-weight: 700; color: var(--ink); }
.qe-problems ul { margin: 8px 0 0; padding-left: 20px; font-weight: 600; color: var(--bad); }
.qe-preview { margin-top: 14px; padding: 14px 16px; background: #fff; border: 1px dashed #8F959E; border-radius: 3px; }
.qe-preview-title { margin: 0 0 8px; font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }

/* Part 3: questions in order, case studies, hot spot pictures and boxes, highlight phrases. */
.orderable > li.q-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px 18px; }
.orderable > li.q-row .q-row-note { grid-column: 2 / -1; }
.q-list-title { margin-top: 6px; }
.case-studies { max-width: 980px; margin: 0 0 22px; }
.case-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.case-row { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.exhibit-list { display: grid; gap: 10px; margin: 4px 0 0; padding: 0; list-style: none; }
.exhibit-editor fieldset { display: grid; gap: 2px; min-width: 0; margin: 0; padding: 6px 12px 12px; background: #fff; border: 1px solid var(--line); border-radius: 3px; }
.exhibit-editor legend { padding: 0 4px; font-weight: 700; color: var(--ink); }
.exhibit-editor .order-ctls { margin-top: 8px; }
.ce-content { font-size: 15px; line-height: 1.5; }
.ce-example { margin: 2px 0 6px; padding: 8px 10px; background: #fff; border: 1px solid var(--line); border-radius: 3px; font-size: 13px; white-space: pre-wrap; }
.file-input { max-width: 100%; padding: 6px 0; font-size: 14.5px; }
.qe-stage { position: relative; display: inline-block; justify-self: start; max-width: 100%; margin: 4px 0; line-height: 0; background: #fff; border: 1px solid var(--line); }
.qe-picture { display: block; max-width: 100%; height: auto; user-select: none; -webkit-user-select: none; }
.qe-picture.is-loading { min-width: 240px; min-height: 160px; background: #F3F5F7; }
.qe-boxes { position: absolute; inset: 0; cursor: crosshair; touch-action: none; }
.qe-box { position: absolute; background: rgba(46, 125, 79, .16); border: 2px dashed var(--ok); cursor: move; }
.qe-box.picked { background: rgba(46, 125, 79, .28); border-style: solid; }
.qe-box-num { position: absolute; left: 0; top: 0; padding: 1px 5px; font-size: 11px; font-weight: 700; line-height: 1.3; color: #fff; background: var(--ok); }
.qe-box-handle { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; background: #fff; border: 2px solid var(--ok); border-radius: 2px; cursor: nwse-resize; }
.qe-box-list { display: grid; gap: 6px; margin: 4px 0; padding: 0; list-style: none; }
.qe-box-actions { margin: 2px 0 4px; }
.qe-box-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 6px 10px; background: #fff; border: 1px solid var(--line); border-radius: 3px; font-size: 14px; }
.qe-box-row.picked { border-color: var(--ok); }
.qe-box-field { display: inline-flex; align-items: center; gap: 6px; }
.qe-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 6px; }
.qe-thumb { width: 108px; height: 80px; padding: 4px; background: #fff; border: 1px solid var(--line); border-radius: 3px; cursor: pointer; }
.qe-thumb:hover, .qe-thumb:focus-visible { border-color: var(--accent-deep); }
.qe-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.qe-phrases { display: grid; gap: 4px; margin: 4px 0; padding: 0; list-style: none; }
.qe-phrases li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 14px; padding: 2px 10px; background: #fff; border: 1px solid var(--line); border-radius: 3px; }
.qe-phrases li.qe-phrase-none { padding: 8px 10px; color: var(--muted); }
.qe-phrases li.qe-phrase-problem { padding: 8px 10px; font-weight: 600; color: var(--bad); }
.qe-phrase-note:empty { display: none; }
.qe-bowtie > .field-help:first-child { margin-top: 12px; }
.picture-missing { margin: 6px 0 0; font-size: 14px; font-weight: 600; color: var(--bad); }
.hotspot img.is-loading { min-width: 240px; min-height: 160px; background: #F3F5F7; }

/* ---------- small screens ---------- */

/* The host's side panel moves under the question. */
@media (max-width: 1000px) {
  .host-layout { grid-template-columns: minmax(0, 1fr); }
  .host-side { position: static; }
}

/* Case studies stack, with the case on top. */
@media (max-width: 820px) {
  .case-layout { grid-template-columns: minmax(0, 1fr); }
  .case-panel { min-height: 0; max-height: none; margin-bottom: 16px; padding: 0 0 16px; border-bottom: 1px solid var(--line); }
  .tabpanel { overflow: visible; }
  .case-question { padding-left: 0; border-left: 0; }
}

@media (max-width: 700px) {
  :root { --gutter: 16px; }
  .topbar-inner { flex-wrap: wrap; min-height: 0; gap: 6px 16px; }
  .brand-tag { display: none; }
  .set-title { order: 3; flex-basis: 100%; font-size: 13px; }
  .info-row { padding-top: 16px; }
  .info-tools { flex-wrap: wrap; justify-content: flex-end; }
  .q-counter { font-size: 18px; }
  .stem, .instruction { font-size: 15.5px; }
  .opt { padding: 9px 8px; gap: 12px; }
  .modal-head { align-items: flex-start; gap: 14px; }
  .modal-title { font-size: 20px; }
  .cell { min-width: 84px; }
  /* Set and guide rows, and saved questions: the buttons always go under the text. */
  .set-row, .saved-set-head, .saved-item { flex-direction: column; align-items: flex-start; }
  .saved-info { flex-basis: auto; }
  .orderable > li.set-row, .orderable > li.q-row { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
  .orderable > li.set-row .set-actions, .orderable > li.q-row .set-actions { grid-column: 2; }
  .host-menu .student-view { margin: 6px 0 8px; }
  /* Class tabs share the width, long names wrap, and the term gets its own line. */
  .class-tab { flex: 1 1 0; min-width: 96px; padding: 8px 10px 10px; }
  .class-code { font-size: 11px; letter-spacing: .04em; }
  .class-term { display: block; }
  .class-term::before { content: none; }
  .class-name { font-size: 14.5px; }
  .order, .bt-lists, .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .host-card { padding: 14px 14px 16px; }
  .host-menu-link { flex: 1 1 0; padding: 9px 10px 10px; text-align: center; }
  .nav-left { width: 100%; }
  .exam-actions { flex-wrap: wrap; }
  /* Results tables: drop the question count and shrink the bars so the score fits. */
  .perf .q-col { display: none; }
  .perf th, .perf td { padding: 8px 6px; }
  .bar-cell { width: 42%; min-width: 0; }
  .bar { gap: 6px; }
  .bar-pct { min-width: 2.8em; }
  /* Group study: answer bars go under their labels; host buttons wrap; the
     status line sits above the time left and the Lock in button. */
  .dist-row { grid-template-columns: minmax(0, 1fr) 2.2em; }
  .dist-label { grid-column: 1 / -1; }
  .host-bar-tools { justify-content: flex-start; margin-left: 0; }
  .group-status { flex-basis: 100%; }
  .group .info-tools { margin-left: auto; }
  .group-who .link-btn { padding: 6px 2px; }
  /* The bow tie becomes a simple list: actions, condition, parameters. */
  .bt-diagram { grid-template-columns: minmax(0, 1fr); }
  .bt-lines { display: none; }
  .bt-head, .bt-col { grid-column: 1; grid-row: auto; }
  .bt-col { grid-template-rows: none; }
  .bt-head-left { order: 1; }
  .bt-left { order: 2; }
  .bt-head-mid { order: 3; }
  .bt-mid { order: 4; }
  .bt-head-right { order: 5; }
  .bt-right { order: 6; }
}

/* ---------- phones (SPEC 11.8) ---------- */

/* Pieces only phones show. The heading row on the homepage keeps the
   spacing the heading had alone. */
.m-top, .c-phone, .sheet-grip, .sheet-shade, .chart-card, .chart-back, .cell-col, .timer svg,
.swipe-hint, .saved-chip, .more-details, .meta-phone { display: none; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 0 0 10px; }
.section-head .section-title { margin: 0; }

@media (max-width: 700px) {
  /* Homepage: the title and intro are for screen readers only, the class
     tabs show just the class names (swipe between them), each set is a card
     with its description under More details, and Saved sits by the heading. */
  .home { padding-top: 14px; }
  .home > .page-title { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .home > .lead, .home-saved { display: none; }
  .classes { overflow-x: clip; }
  .class-tab { min-width: 0; align-items: center; padding: 10px 6px 11px; text-align: center; }
  .class-code { display: none; }
  .class-name { font-size: 14.5px; line-height: 1.25; }
  .class-tab[aria-selected="true"] .class-name { font-weight: 700; }
  .swipe-hint { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 7px 0 0; font-size: 12px; color: var(--muted); }
  .dots-row { display: inline-flex; gap: 5px; }
  .dot { width: 6px; height: 6px; border-radius: 50%; background: #C6C9CE; }
  .dot.on { background: var(--accent-deep); }
  .home-section { margin-top: 18px; }
  .home-section + .home-section { margin-top: 28px; }
  .section-head { margin-bottom: 12px; }
  .saved-chip {
    display: inline-flex; align-items: center; gap: 5px; flex: none; padding: 5px 12px;
    background: #EEF7FC; border: 1px solid #BFE1F4; border-radius: 15px;
    font-size: 13px; font-weight: 600; color: var(--ink); text-decoration: none; white-space: nowrap;
  }
  .home-section .set-list { display: grid; gap: 12px; border-top: 0; }
  .home-section .set-row { gap: 10px; padding: 14px 16px 12px; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 3px rgba(31, 58, 95, .06); }
  .home-section .set-row:not(.guide-row) .set-desc { display: none; margin: 6px 0 4px; }
  .home-section .set-row.show-details .set-desc { display: block; }
  .meta-wide { display: none; }
  .meta-phone, .show-details .meta-wide { display: inline; }
  .show-details .meta-phone { display: none; }
  .home-section .set-actions { align-items: center; gap: 8px 14px; }
  .home-section .set-actions .btn-accent { min-width: 116px; min-height: 44px; border-radius: 8px; font-size: 13.5px; }
  .more-details { display: inline-flex; align-items: center; gap: 5px; padding: 10px 2px; background: none; border: 0; font-size: 14px; font-weight: 600; color: var(--accent-deep); }
  .more-details::after { content: "▾"; font-size: 11px; }
  .more-details[aria-expanded="true"]::after { content: "▴"; }

  /* The setup page (idea 1): the description under About this set, the
     mode cards one above the other with big Start buttons, and the
     settings panel sliding up with Start pinned at its bottom. */
  .crumb-code { display: none; }
  .about-btn { display: inline-flex; align-items: center; gap: 5px; margin: 4px 0 0; padding: 4px 0; background: none; border: 0; font-size: 14px; font-weight: 600; color: var(--accent-deep); }
  .about-btn::after { content: "▾"; font-size: 11px; }
  .about-btn[aria-expanded="true"]::after { content: "▴"; }
  .setup .set-about { display: none; margin: 4px 0 0; }
  .setup.show-about .set-about { display: block; }
  .mode-cards { grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 14px; }
  .mode-card { padding: 15px 16px 16px; border-width: 1.5px; border-radius: 16px; }
  .mode-icon { width: 44px; height: 44px; border-radius: 12px; }
  .mode-desc { margin: 10px 0 12px; }
  .btn-start { min-height: 50px; border-radius: 12px; font-size: 16px; letter-spacing: .01em; text-transform: none; }
  .settings-open { margin-top: 10px; padding: 12px 2px; border: 0; }
  .settings-sheet.modal { max-height: 92vh; }
  .settings-sheet .panel-actions {
    bottom: calc(-16px - env(safe-area-inset-bottom)); margin: 0 -16px calc(-16px - env(safe-area-inset-bottom));
    padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 16px rgba(31, 58, 95, .06);
  }
  .ready-sheet .modal-actions { flex-direction: row-reverse; }

  /* The exam (idea 2): a top bar with Close, the question chip, and icons;
     a slim row with the mode or the time left; one big button at the
     bottom; and the answer and rationale as a sheet over the question. */
  .taking { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .taking.has-sheet { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
  .taking .topbar { display: none; }
  .taking .m-top { display: block; position: sticky; top: 0; z-index: 40; background: #fff; border-top: 4px solid var(--accent); }
  .m-top-row { display: flex; align-items: center; gap: 2px; padding: 8px 8px 8px 12px; }
  .m-close { display: grid; place-items: center; flex: none; width: 38px; height: 38px; padding: 0; background: #F1F3F5; border: 0; border-radius: 50%; color: var(--ink); }
  .m-chip {
    flex: 0 1 auto; min-width: 0; height: 38px; margin: 0 auto 0 8px; padding: 0 14px;
    overflow: hidden; background: #F2F9FD; border: 1px solid #BFE1F4; border-radius: 19px;
    font-size: 14px; font-weight: 700; color: var(--ink); text-overflow: ellipsis; white-space: nowrap;
  }
  .m-chip-arrow { margin-left: 6px; font-size: 12px; }
  .m-icon { display: grid; place-items: center; flex: none; width: 40px; height: 40px; padding: 0; background: none; border: 1px solid transparent; border-radius: 10px; color: var(--muted); }
  .m-icon svg { width: 18px; height: 18px; }
  .m-icon[aria-pressed="true"] { background: #DCEEF9; border-color: var(--accent-deep); color: var(--ink); }
  .m-flag[aria-pressed="true"] { background: var(--hl); border-color: #D9C55A; }
  .m-save[aria-pressed="true"] svg path { fill: currentColor; }
  .m-calc { color: var(--accent); }
  .m-calc svg { width: 21px; height: 24px; }
  .m-progress { height: 3px; background: #E7EBEF; }
  .m-progress > span { display: block; width: 0; height: 100%; background: var(--accent); transition: width .2s; }
  .taking .info-row { gap: 8px; padding-top: 12px; }
  .taking .q-counter { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .taking .calc-toggle { display: none; }
  .taking .timer { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--ink); }
  .taking .timer svg { display: inline-block; margin-right: 5px; vertical-align: -2px; }
  .taking .timer b, .taking .timer > div + div { display: none; }
  .taking .btn-pause { min-width: 0; height: 32px; padding: 0 10px; font-size: 11px; }
  .taking .question { padding-top: 14px; }
  .taking .exam-actions {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 34; flex-wrap: nowrap; gap: 10px;
    margin: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: #fff; box-shadow: 0 -1px 0 var(--line), 0 -6px 16px rgba(31, 58, 95, .06);
  }
  .taking.on-grid .m-flag, .taking.on-grid .m-save { display: none; }
  .taking .exam-actions .nav-left { width: auto; margin: 0; }
  .taking .exam-actions .btn-flag, .taking .exam-actions .btn-save { display: none; }
  .taking .exam-actions .nav-left:not(:has(.btn-nav:not([hidden]))) { display: none; }
  .taking .btn-nav { flex-direction: column; gap: 2px; width: 64px; min-height: 52px; padding: 0; border-radius: 10px; font-size: 11px; letter-spacing: 0; text-transform: none; }
  .taking .btn-nav::before { content: "◀"; font-size: 13px; line-height: 1; }
  .taking .exam-actions > .btn { flex: 1 1 0; min-height: 52px; padding: 0 10px; border-radius: 10px; }
  .taking .btn-continue {
    flex: 1 1 auto; height: 52px; min-width: 0; padding: 0 16px; background: var(--ink); border-radius: 10px;
    font-size: 15.5px; letter-spacing: .01em; text-transform: none; color: #fff;
  }
  .taking .btn-continue::before { display: none; }
  .taking .btn-continue:active { background: #16304F; }
  .taking .btn-continue.is-next { background: var(--accent); color: var(--ink); }
  .taking .btn-continue.is-next::after { content: "→"; margin-left: 8px; }
  .taking .c-wide { display: none; }
  .taking .c-phone { display: inline; }
  .taking .feedback {
    position: fixed; left: 0; right: 0; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 33;
    max-height: 66vh; overflow-y: auto; overscroll-behavior: contain;
    margin: 0; padding: 0 18px 18px; background: #fff; border: 0; border-radius: 18px 18px 0 0;
    box-shadow: 0 -8px 28px rgba(0, 0, 0, .18);
  }
  .taking .sheet-grip {
    display: block; position: sticky; top: 0; z-index: 1; width: calc(100% + 36px); height: 28px;
    margin: 0 -18px 4px; padding: 0; background: #fff; border: 0; border-radius: 18px 18px 0 0;
  }
  .taking .sheet-grip > span { display: block; width: 44px; height: 5px; margin: 0 auto; border-radius: 3px; background: #C6C9CE; }
  .taking .feedback-result { font-size: 16px; }
  .taking .feedback.is-folded { overflow: hidden; cursor: pointer; }
  .taking .feedback.is-folded > :not(.sheet-grip, .feedback-result) { display: none; }
  .taking .feedback.is-folded .feedback-result { margin: 0; }
  .taking .feedback.is-folded .feedback-result::after { content: "Rationale ▴"; float: right; margin-left: 10px; font-size: 13.5px; font-weight: 700; color: var(--accent-deep); }
  .taking.sheet-open .sheet-shade { display: block; position: fixed; inset: 0; z-index: 32; background: rgba(15, 30, 50, .35); }

  /* Choices are cards. */
  .choices { gap: 8px; }
  .opt { padding: 12px; border-color: var(--line); border-radius: 10px; }
  .opt:not(.reviewed):has(.ctl:checked) { background: #F2F9FD; border-color: var(--accent); }

  /* Case studies (idea 3): a Client chart card above the question; Open
     shows the exhibits full screen, with Back to the question at the bottom. */
  .case-panel { margin-bottom: 16px; padding: 14px 16px; background: #F2F9FD; border: 1px solid #BFE1F4; border-radius: 12px; }
  .chart-card { display: flex; align-items: center; gap: 10px; }
  .chart-card > svg { flex: none; width: 26px; height: 26px; color: var(--accent-deep); }
  .chart-name { flex: 1 1 auto; min-width: 0; }
  .chart-title { margin: 0; font: 700 16px/1.3 var(--slab); color: var(--ink); }
  .chart-tabs { margin: 1px 0 0; font-size: 12.5px; line-height: 1.35; color: var(--muted); }
  .chart-open { flex: none; min-height: 36px; padding: 0 18px; background: var(--accent); border-color: var(--accent); border-radius: 18px; font-weight: 700; color: var(--ink); }
  .case-panel .case-intro { margin: 10px 0 0; font-size: 14px; }
  .case-panel:not(.is-open) > .tabs, .case-panel:not(.is-open) > .tabpanel { display: none; }
  .case-panel.is-open { position: fixed; inset: 0; z-index: 60; display: flex; margin: 0; padding: 0; background: #fff; border: 0; border-radius: 0; }
  .case-panel.is-open .chart-card { flex: none; padding: 12px 16px 10px; border-top: 4px solid var(--accent); }
  .case-panel.is-open .chart-open, .case-panel.is-open .case-intro { display: none; }
  .case-panel.is-open .tabs { flex-wrap: wrap; gap: 8px; margin: 0; padding: 2px 16px 12px; overflow: visible; }
  .case-panel.is-open .tab { padding: 6px 14px; background: #F2F9FD; border: 1px solid #BFE1F4; border-radius: 18px; }
  .case-panel.is-open .tab[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
  .case-panel.is-open .tabpanel { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px 20px; border-top: 1px solid var(--line); font-size: 15px; }
  .case-panel.is-open .chart-back {
    display: block; flex: none; min-height: 52px; margin: 0 16px calc(12px + env(safe-area-inset-bottom));
    background: var(--ink); border: 0; border-radius: 10px; font-size: 15.5px; font-weight: 700; color: #fff;
  }

  /* Highlight (idea 3): each line with phrases is a card; a card with one
     phrase can be tapped anywhere. */
  .passage { padding: 0; background: none; border: 0; font-size: 15.5px; line-height: 1.7; }
  .hl-line { margin: 0 0 6px; }
  .hl-line.has-hl { margin-bottom: 8px; padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
  .hl-line.one-hl { cursor: pointer; }
  .hl-line.one-hl:has(.hl[aria-pressed="true"]) { background: #FFFBEA; border-color: #E6CF4D; }
  .hl { padding: 3px 1px; }
  /* No hover on phones, so a faint dotted line shows what can be tapped. */
  .hl[role="button"]:not([aria-pressed="true"]) { text-decoration: underline dotted #9AA1AA; text-decoration-thickness: 1.5px; text-underline-offset: 5px; }

  /* Matrix (idea 3): one card per row, with a button per column. */
  .matrix-wrap { overflow: visible; }
  .matrix, .matrix tbody, .matrix th, .matrix td { display: block; }
  .matrix thead { display: none; }
  .matrix tbody { display: grid; gap: 10px; }
  .matrix tbody tr { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
  .matrix tbody th { flex: 1 1 100%; padding: 0 0 2px; border: 0; font-size: 15px; }
  .matrix td { flex: 1 1 auto; width: auto; border: 0; }
  .matrix tbody tr:hover > * { background: none; }
  .matrix td.is-key, .matrix td.is-wrong { background: none; }
  .cell { justify-content: flex-start; gap: 8px; min-width: 0; min-height: 46px; padding: 8px 12px; background: #F3F5F7; border: 1px solid #C6C9CE; border-radius: 8px; }
  .cell-col { display: inline; font-size: 14px; font-weight: 600; line-height: 1.25; text-align: left; }
  .cell:has(.ctl:checked) { background: #DCEEF9; border-color: var(--accent-deep); }
  .matrix td.is-key .cell { background: #F2F9F4; border-color: #8CC5A1; }
  .matrix td.is-wrong .cell { background: #FDF3F2; border-color: #E2A39C; }
  .cell-mark { margin-left: auto; }

  /* The list of questions slides up from the bottom. */
  .modal-sheet { align-items: flex-end; padding: 0; }
  .modal-sheet .modal { width: 100%; min-width: 0; max-width: none; max-height: 86vh; overflow-y: auto; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; }
  .nav-counts { margin: 0 0 4px; color: var(--muted); }
  .nav-note { margin: 0; font-size: 13.5px; color: var(--muted); }
  .nav-grid { grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 8px; margin: 12px 0 4px; }
  .nav-grid .qtile { height: 44px; font-size: 15px; }
  .nav-grid .qtile.flagged { background: var(--hl); border-color: #D9C55A; }
  .nav-grid .qtile.current { background: var(--ink); border-color: var(--ink); border-style: solid; color: #fff; }
  .nav-grid .qtile.current svg { color: #fff; }
  .modal-sheet .modal-actions .btn { flex: 1 1 auto; min-height: 48px; border-radius: 10px; }
}

/* Keeps a focused question or button out from under the exam's bars, and
   toasts above the big button. Text size: the question's parts grow, but not
   the boxes pinned to the screen (the bottom bar, the sheet, the open chart),
   since browsers misplace pinned boxes inside a zoomed one. */
@media (max-width: 700px) {
  html:has(.taking) { scroll-padding: 64px 0 96px; }
  body:has(.taking) .toasts { bottom: calc(88px + env(safe-area-inset-bottom)); }
  .exam[data-text-size] .question { zoom: 1; }
  .exam[data-text-size="large"] :is(.question, .case-question) > :not(.case-layout, .taking .exam-actions, .taking .feedback),
  .exam[data-text-size="large"] :is(.case-panel, .taking .feedback) > :not(.sheet-grip) { zoom: 1.12; }
  .exam[data-text-size="larger"] :is(.question, .case-question) > :not(.case-layout, .taking .exam-actions, .taking .feedback),
  .exam[data-text-size="larger"] :is(.case-panel, .taking .feedback) > :not(.sheet-grip) { zoom: 1.25; }
}

@media (max-width: 700px) and (prefers-reduced-motion: no-preference) {
  .class-panel[data-slide="left"] { animation: from-right .22s ease-out; }
  .class-panel[data-slide="right"] { animation: from-left .22s ease-out; }
  @keyframes from-right { from { opacity: .4; transform: translateX(36px); } }
  @keyframes from-left { from { opacity: .4; transform: translateX(-36px); } }
  .taking .feedback:not(.is-folded) { animation: sheet-up .2s ease-out; }
  .modal-sheet .modal { animation: sheet-up .2s ease-out; }
  @keyframes sheet-up { from { transform: translateY(40px); opacity: .6; } }
}

/* ---------- motion and high contrast ---------- */

@media (prefers-reduced-motion: no-preference) {
  .modal { animation: modal-in .15s ease-out; }
  @keyframes modal-in { from { opacity: 0; transform: translateY(-6px); } }
  .reconnecting-dot { animation: blink 1s ease-in-out infinite alternate; }
  @keyframes blink { to { opacity: .25; } }
}

@media (forced-colors: active) {
  .ctl { appearance: auto; -webkit-appearance: auto; background: none; border: 0; box-shadow: none; }
  .hl[aria-pressed="true"], .token[aria-pressed="true"], .bt-opt[aria-pressed="true"], .strike-btn[aria-pressed="true"],
  .drop.filled, .bt-slot.filled, .tab[aria-selected="true"], .btn-flag[aria-pressed="true"], .btn-save[aria-pressed="true"],
  .qtile.answered, .seg-input:checked + span { outline: 2px solid Highlight; }
  .switch { appearance: auto; -webkit-appearance: auto; background: none; }
  .opt:focus-within { outline: 2px solid Highlight; }
  .btn-continue { border: 1px solid ButtonText; }
  .tabs { border-bottom: 1px solid CanvasText; }
}
