:root {
  color-scheme: light;
  /* Brand palette (assets/brand/README.md) */
  --navy: #0C2F5F;
  --navy-dark: #071E3D;
  --blue: #1688C8;
  --gold: #F2B632;
  --gold-dark: #A86B00;
  --gold-soft: #FDF4DC;
  --ink: var(--navy-dark);
  --ink-soft: #40536c;
  --muted: #6b7d92;
  --paper: #F7FAFC;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --line: #dce4ed;
  --line-strong: #bdcad8;
  --azure: var(--blue);
  --azure-dark: var(--navy);
  --azure-soft: #E7F3FA;
  --teal: var(--navy);
  --green: #147a43;
  --green-soft: #e6f5ec;
  --amber: #946200;
  --amber-soft: #fff5d9;
  --red: #bb2b2b;
  --red-soft: #fff0f0;
  --purple: #6847d4;
  --purple-soft: #f0ecff;
  --shadow: 0 18px 50px rgba(18, 43, 70, 0.09);
  --radius: 18px;
  --header-h: 56px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, Aptos, "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

button, select, input, textarea { font: inherit; }
button, label, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.hidden { display: none !important; }
.app-shell { min-height: 100vh; }

/* ---------- Header ---------- */
.site-header {
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) clamp(16px, 4vw, 64px) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  min-height: 44px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: auto;
  display: block;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; color: var(--navy); }
.brand strong .brand-vector { color: var(--gold); }
.brand small { display: none; color: var(--muted); font-size: 11px; margin-top: 1px; }
.header-meta { display: none; color: var(--muted); font-size: 13px; text-align: right; }

.view { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.setup-view { padding: 30px 0 130px; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  margin-bottom: 30px;
}

.eyebrow::before { content: ""; display: inline-block; width: 16px; height: 3px; margin-right: 8px; vertical-align: middle; border-radius: 2px; background: var(--gold); }
.eyebrow, .step-label {
  margin: 0 0 12px;
  color: var(--navy);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 16px; font-size: clamp(32px, 8vw, 66px); line-height: 1.05; letter-spacing: -0.04em; }
h2 { margin-bottom: 18px; font-size: 19px; line-height: 1.25; letter-spacing: -0.02em; }
.hero-copy { max-width: 700px; margin-bottom: 0; color: var(--ink-soft); font-size: 15px; line-height: 1.65; }

.hero-status {
  padding: 18px 20px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: end;
  gap: 0 12px;
  background: var(--ink);
  color: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.status-number { display: block; font-size: 38px; line-height: 1; font-weight: 750; letter-spacing: -0.05em; color: var(--gold); }
.status-label { color: #c4d5e7; font-size: 12px; }
.status-rule { display: none; height: 1px; margin: 20px 0 16px; background: rgba(255,255,255,.18); }
.status-detail { grid-column: 1 / -1; margin-top: 10px; font-size: 12px; color: #dbe8f3; }

.resume-banner {
  margin-bottom: 20px;
  padding: 16px 18px;
  display: flex;
  align-items: stretch;
  flex-direction: column;
  gap: 14px;
  background: var(--azure-soft);
  border: 1px solid #b9ddf6;
  border-radius: 14px;
}
.resume-banner strong, .resume-banner span { display: block; }
.resume-banner span { margin-top: 2px; color: var(--ink-soft); font-size: 13px; }

.setup-section {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(24, 53, 84, 0.04);
}
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.setup-columns { margin-top: 22px; display: grid; grid-template-columns: 1fr; gap: 22px; align-items: stretch; }
.setup-columns .setup-section { height: 100%; }

.domain-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.domain-card { position: relative; cursor: pointer; }
.domain-card input { position: absolute; opacity: 0; pointer-events: none; }
.domain-card-body {
  min-height: 128px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color .16s, background .16s, transform .16s, box-shadow .16s;
}
.domain-card:hover .domain-card-body { transform: translateY(-2px); border-color: var(--line-strong); }
.domain-card input:checked + .domain-card-body { background: var(--azure-soft); border-color: var(--azure); box-shadow: inset 0 0 0 1px var(--azure); }
.domain-card input:focus-visible + .domain-card-body { outline: 3px solid var(--blue); outline-offset: 2px; }
.domain-number { display: flex; align-items: center; justify-content: space-between; color: var(--navy); font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.domain-check { width: 24px; height: 24px; border: 1px solid var(--line-strong); border-radius: 50%; background: white; position: relative; flex: 0 0 auto; }
.domain-card input:checked + .domain-card-body .domain-check { background: var(--azure); border-color: var(--azure); }
.domain-card input:checked + .domain-card-body .domain-check::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: white; font-size: 13px; }
.domain-card h3 { margin: 18px 0 10px; font-size: 15px; line-height: 1.35; }
.domain-meta { margin-top: auto; display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.bank-status { margin-top: 9px; color: var(--amber); font-size: 10px; font-weight: 750; }
.bank-status.reviewed { color: var(--green); }

.text-button, .flag-button, .icon-button {
  min-height: 44px;
  padding: 4px 6px;
  display: inline-flex;
  align-items: center;
  border: 0;
  background: transparent;
  color: var(--azure-dark);
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
}
.text-button:hover, .flag-button:hover { color: var(--navy); text-decoration: underline; }
.icon-button {
  width: 44px;
  height: 44px;
  min-height: 44px;
  justify-content: center;
  color: var(--ink);
  font-size: 20px;
}

.field-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.field > span, fieldset legend { display: block; margin-bottom: 7px; color: var(--ink-soft); font-size: 12px; font-weight: 750; }
.field select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  background: white;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
}
fieldset { margin: 22px 0 0; padding: 0; border: 0; }
.access-view { min-height: calc(100vh - var(--header-h) - 120px); display: grid; place-items: center; padding: 40px 16px; }
.access-view.hidden { display: none; }
.access-card { width: min(100%, 500px); padding: 28px 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.access-card .eyebrow { margin-top: 18px; }
.access-card h1 { margin: 8px 0 12px; font-size: clamp(26px, 8vw, 44px); line-height: 1.05; }
.access-card > p:not(.eyebrow), .access-card > small { color: var(--muted); }
.access-card form { margin-top: 24px; text-align: left; }
.access-mark { width: 72px; height: auto; }
.access-actions { margin-top: 18px; display: flex; flex-direction: column-reverse; align-items: stretch; gap: 10px; }
.access-actions .button { width: 100%; }
.access-actions [role="alert"] { color: var(--red); font-size: 12px; }
.access-card > small { display: block; margin-top: 24px; }
.segmented-control { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segmented-control label { cursor: pointer; position: relative; }
.segmented-control input { position: absolute; opacity: 0; }
.segmented-control span { min-height: 68px; padding: 12px; display: flex; flex-direction: column; justify-content: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.segmented-control input:checked + span { border-color: var(--azure); background: var(--azure-soft); box-shadow: inset 0 0 0 1px var(--azure); }
.segmented-control input:focus-visible + span { outline: 3px solid var(--blue); }
.segmented-control strong, .segmented-control small { display: block; }
.segmented-control small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.check-row { display: flex; gap: 8px; flex-wrap: wrap; }
.check-row label, .type-card { cursor: pointer; position: relative; }
.check-row input, .type-card input { position: absolute; opacity: 0; }
.check-row span { min-height: 44px; padding: 10px 13px; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-soft); color: var(--ink-soft); font-size: 12px; }
.check-row input:checked + span { color: var(--azure-dark); border-color: #9fd0f2; background: var(--azure-soft); }

.switch-row { margin-top: 22px; padding-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); cursor: pointer; }
.switch-row span strong, .switch-row span small { display: block; }
.switch-row span strong { font-size: 13px; }
.switch-row span small { color: var(--muted); font-size: 11px; }
.switch-row input { position: absolute; opacity: 0; }
.switch-row i { width: 44px; height: 26px; padding: 3px; border-radius: 99px; background: var(--line-strong); transition: .16s; flex: 0 0 auto; }
.switch-row i::after { content: ""; display: block; width: 20px; height: 20px; border-radius: 50%; background: white; box-shadow: 0 1px 4px rgba(0,0,0,.2); transition: transform .16s; }
.switch-row input:checked + i { background: var(--azure); }
.switch-row input:checked + i::after { transform: translateX(18px); }

.type-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.type-card span { min-height: 56px; padding: 12px 13px; display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); transition: .16s; }
.type-card input:checked + span { border-color: #9fd0f2; background: var(--azure-soft); box-shadow: inset 3px 0 var(--azure); }
.type-card input:focus-visible + span { outline: 3px solid var(--blue); }
.type-icon { color: var(--azure); font-size: 18px; text-align: center; }
.type-name { font-size: 12px; font-weight: 750; }
.type-count { color: var(--muted); font-size: 11px; }
.availability-note { min-height: 24px; margin-top: 14px; color: var(--muted); font-size: 12px; }

.start-panel {
  margin-top: 22px;
  padding: 18px 20px max(18px, env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  background: var(--ink);
  color: white;
  border-radius: var(--radius);
}
.start-panel strong, .start-panel span { display: block; }
.start-panel > div > span { color: #b8c9da; font-size: 12px; margin-top: 3px; }
.start-panel .button { width: 100%; }

.button {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 750;
  font-size: 13px;
  transition: transform .12s, background .12s, border-color .12s;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: .5; cursor: not-allowed; }
.button.primary { color: white; background: var(--navy); border-color: var(--navy); }
.button.primary:hover:not(:disabled) { background: var(--navy-dark); border-color: var(--navy-dark); }
.button.secondary { color: var(--ink); background: white; border-color: var(--line-strong); }
.button.secondary:hover:not(:disabled) { background: var(--surface-soft); }
.button.large { min-height: 50px; padding: 0 23px; font-size: 14px; }
.button.danger-link { margin-top: auto; color: var(--red); background: transparent; border-color: #e9b9b9; }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; }
.button-row.compact .button { min-height: 40px; padding: 0 14px; }

/* Exam */
.exam-view { width: 100%; }
.exam-statusbar { min-height: 62px; padding: 10px 15px; display: grid; grid-template-columns: 96px 1fr 64px; align-items: center; gap: 12px; background: var(--ink); color: white; }
.progress-copy span, .progress-copy small { display: block; }
.progress-copy span { font-size: 12px; font-weight: 750; }
.progress-copy small { color: #b6c8d9; font-size: 10px; }
.progress-track { height: 5px; background: rgba(255,255,255,.14); border-radius: 10px; overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--gold); transition: width .25s; }
.timer { display: flex; justify-content: flex-end; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; font-size: 13px; }
.timer-dot { width: 7px; height: 7px; border-radius: 50%; background: #58d68d; flex: 0 0 auto; }
.timer.warning .timer-dot { background: #ffca57; }
.timer.danger .timer-dot { background: #ff6b6b; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.exam-layout { min-height: calc(100vh - var(--header-h) - 62px); display: grid; grid-template-columns: 1fr; }
.question-nav {
  display: none;
  position: fixed;
  top: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  bottom: 0;
  left: 0;
  width: min(290px, 86vw);
  padding: 22px 18px max(22px, env(safe-area-inset-bottom, 0px));
  flex-direction: column;
  background: white;
  box-shadow: 12px 0 40px rgba(0,0,0,.16);
  z-index: 60;
  overflow-y: auto;
}
.question-nav.open { display: flex; }
.nav-title { display: flex; justify-content: space-between; align-items: center; }
.nav-legend { margin: 14px 0 20px; display: flex; gap: 14px; color: var(--muted); font-size: 10px; }
.nav-legend span { display: inline-flex; align-items: center; gap: 5px; }
.nav-legend i { width: 8px; height: 8px; border-radius: 2px; background: var(--line-strong); }
.nav-legend i.answered { background: var(--azure); }
.nav-legend i.flagged { background: var(--amber); }
.nav-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 24px; }
.nav-question { aspect-ratio: 1; min-height: 44px; padding: 0; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); color: var(--ink-soft); cursor: pointer; font-size: 12px; position: relative; }
.nav-question.answered { color: white; background: var(--navy); border-color: var(--navy); }
.nav-question.current { box-shadow: 0 0 0 2px white, 0 0 0 4px var(--ink); }
.nav-question.flagged::after { content: ""; position: absolute; right: 2px; top: 2px; width: 6px; height: 6px; border-radius: 50%; background: #ffca57; border: 1px solid white; }
.nav-question.correct { background: var(--green); border-color: var(--green); color: white; }
.nav-question.incorrect { background: var(--red); border-color: var(--red); color: white; }

.question-workspace { width: calc(100% - 24px); margin: 0 auto; padding: 18px 0 40px; }
.question-toolbar { min-height: 34px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.question-tags { display: none; }
.tag { padding: 4px 8px; border: 1px solid var(--line); border-radius: 5px; background: white; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.tag.difficulty-advanced { color: var(--purple); background: var(--purple-soft); border-color: #cfc3f8; }
.tag.difficulty-intermediate { color: var(--azure-dark); background: var(--azure-soft); border-color: #acd4ef; }
.tag.difficulty-foundational { color: var(--green); background: var(--green-soft); border-color: #b4ddc4; }
.flag-button[aria-pressed="true"] { color: var(--amber); }

.question-card { min-height: 420px; padding: 20px 16px; background: white; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.question-kicker { margin-bottom: 18px; color: var(--navy); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.scenario { margin: 0 0 20px; padding: 14px 16px; border-left: 3px solid var(--blue); background: var(--azure-soft); color: var(--ink-soft); font-size: 14px; }
.scenario strong { color: var(--teal); }
.question-prompt { margin: 0 0 8px; font-size: clamp(19px, 5.5vw, 28px); line-height: 1.3; letter-spacing: -0.02em; }
.instruction { margin: 0 0 22px; color: var(--muted); font-size: 13px; }

.option-list { display: grid; gap: 10px; }
.option-row { width: 100%; min-height: 44px; padding: 14px 16px; display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; text-align: left; color: var(--ink); background: white; border: 1px solid var(--line-strong); border-radius: 10px; cursor: pointer; }
.option-row:hover:not(:disabled) { border-color: var(--azure); background: #f8fcff; }
.option-letter { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; font-size: 12px; font-weight: 800; }
.multiple-response .option-letter { border-radius: 6px; }
.option-row.selected { border-color: var(--azure); background: var(--azure-soft); box-shadow: inset 3px 0 var(--azure); }
.option-row.selected .option-letter { color: white; background: var(--navy); border-color: var(--navy); }
.option-row.correct { border-color: #83c49f; background: var(--green-soft); box-shadow: inset 3px 0 var(--green); }
.option-row.correct .option-letter { color: white; background: var(--green); border-color: var(--green); }
.option-row.incorrect { border-color: #e3a3a3; background: var(--red-soft); box-shadow: inset 3px 0 var(--red); }
.option-row.incorrect .option-letter { color: white; background: var(--red); border-color: var(--red); }

.yes-no-table { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.yes-no-table th, .yes-no-table td { padding: 11px 8px; border-bottom: 1px solid var(--line); }
.yes-no-table tr:last-child td { border-bottom: 0; }
.yes-no-table th { background: var(--surface-soft); color: var(--muted); font-size: 11px; text-align: center; }
.yes-no-table th:first-child { text-align: left; }
.yes-no-table td { font-size: 13px; }
.yes-no-table td:not(:first-child) { width: 58px; text-align: center; }
.yes-no-table label { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line-strong); border-radius: 50%; cursor: pointer; }
.yes-no-table input { position: absolute; opacity: 0; }
.yes-no-table input:checked + span { width: 24px; height: 24px; display: grid; place-items: center; color: white; background: var(--navy); border-radius: 50%; }
.yes-no-table tr.correct { background: var(--green-soft); }
.yes-no-table tr.incorrect { background: var(--red-soft); }

.ordering-list { display: grid; gap: 9px; counter-reset: order; }
.ordering-item { counter-increment: order; display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 12px; background: white; border: 1px solid var(--line-strong); border-radius: 10px; }
.ordering-item::before { content: counter(order); width: 28px; height: 28px; display: grid; place-items: center; color: white; background: var(--ink); border-radius: 7px; font-size: 12px; font-weight: 800; }
.ordering-item[draggable="true"] { cursor: grab; }
.ordering-item.dragging { opacity: .45; }
.ordering-item.correct { border-color: #83c49f; background: var(--green-soft); }
.ordering-item.incorrect { border-color: #e3a3a3; background: var(--red-soft); }
.reorder-controls { display: flex; gap: 5px; }
.reorder-controls button { width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); cursor: pointer; font-size: 16px; }

.matching-list { display: grid; gap: 10px; }
.matching-row { display: grid; grid-template-columns: 1fr; gap: 7px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.matching-row .arrow { color: var(--muted); text-align: center; transform: rotate(90deg); }
.matching-row select { width: 100%; min-height: 44px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 7px; background: white; }
.matching-row.correct { background: var(--green-soft); border-color: #83c49f; }
.matching-row.incorrect { background: var(--red-soft); border-color: #e3a3a3; }

.hot-area { padding: 14px; display: grid; gap: 7px; background: var(--navy-dark); border-radius: 11px; }
.hot-region { padding: 13px; display: grid; grid-template-columns: 28px 1fr; gap: 10px; text-align: left; color: #e8f0f8; background: #15283d; border: 1px solid #29455f; border-radius: 7px; cursor: pointer; font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; min-height: 44px; }
.hot-region .region-label { color: #77c7ff; font-weight: 800; }
.hot-region.selected { background: #173d58; border-color: #52b8fa; box-shadow: inset 3px 0 #52b8fa; }
.hot-region.correct { background: #143c29; border-color: #45b879; }
.hot-region.incorrect { background: #482222; border-color: #dc6a6a; }

.case-study-panel { margin-bottom: 24px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.case-study-title { padding: 13px 16px; background: var(--ink); color: white; font-size: 14px; }
.case-study-body { display: grid; grid-template-columns: 1fr; }
.case-section { padding: 16px; }
.case-section + .case-section { border-left: 0; border-top: 1px solid var(--line); }
.case-section.full { grid-column: 1 / -1; border-top: 1px solid var(--line); border-left: 0; background: var(--surface-soft); }
.case-section h3 { margin: 0 0 7px; color: var(--teal); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.case-section p, .case-section ul { margin: 0; color: var(--ink-soft); font-size: 12px; }
.case-section ul { padding-left: 18px; }

.feedback-panel { margin-top: 24px; padding: 18px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-soft); }
.feedback-panel.correct { background: var(--green-soft); border-color: #9bd1b2; }
.feedback-panel.incorrect { background: var(--red-soft); border-color: #e4b0b0; }
.feedback-title { margin: 0 0 8px; font-size: 15px; }
.feedback-panel p { margin-bottom: 10px; font-size: 13px; }
.feedback-panel ul { margin: 8px 0 0; padding-left: 20px; font-size: 12px; }
.feedback-panel a { color: var(--azure-dark); }
.validation-message { min-height: 22px; margin: 10px 4px 0; color: var(--red); font-size: 12px; }

.question-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin: 16px 0 0;
  padding: 12px 0 max(12px, env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column-reverse;
  align-items: stretch;
  gap: 10px;
  background: var(--paper);
  border-top: 1px solid var(--line);
}
.action-right { display: flex; gap: 9px; }
.action-right .button { flex: 1; }
#finish-exam { display: none; }
.mobile-only { display: inline-flex; }

/* Results */
.results-view { padding: 26px 0 50px; }
.results-hero { padding: 24px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 22px; background: var(--ink); color: white; border-radius: var(--radius); }
.results-hero h1 { margin-bottom: 10px; font-size: 34px; }
.results-hero p:not(.eyebrow) { margin: 0; color: #c3d2e1; }
.score-ring { width: 140px; height: 140px; flex: 0 0 auto; display: grid; place-content: center; text-align: center; border-radius: 50%; background: conic-gradient(var(--gold) var(--score-angle, 0deg), rgba(255,255,255,.14) 0); position: relative; }
.score-ring::before { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: var(--ink); }
.score-ring strong, .score-ring span { position: relative; display: block; }
.score-ring strong { font-size: 34px; letter-spacing: -.05em; }
.score-ring span { color: #b8c9da; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.results-grid { margin-top: 20px; display: grid; grid-template-columns: 1fr; gap: 20px; }
.result-panel, .review-section, .feedback-section { padding: 20px; background: white; border: 1px solid var(--line); border-radius: var(--radius); }
.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.metric { padding: 14px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; }
.metric strong, .metric span { display: block; }
.metric strong { font-size: 20px; letter-spacing: -.03em; }
.metric span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.breakdown-row { margin-bottom: 14px; }
.breakdown-label { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px; font-size: 12px; }
.breakdown-label span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.breakdown-bar { height: 7px; overflow: hidden; background: var(--line); border-radius: 10px; }
.breakdown-bar span { display: block; height: 100%; background: var(--azure); }
.review-section { margin-top: 20px; }
.review-filter { color: var(--ink-soft); font-size: 12px; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.review-list { display: grid; gap: 10px; }
.review-item { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.review-item summary { padding: 14px 16px; display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; cursor: pointer; list-style: none; min-height: 44px; }
.review-item summary::-webkit-details-marker { display: none; }
.review-result { font-size: 11px; font-weight: 800; text-transform: uppercase; }
.review-result.correct { color: var(--green); }
.review-result.incorrect { color: var(--red); }
.review-prompt { font-size: 13px; }
.review-chevron { display: none; }
.review-body { padding: 0 16px 18px; color: var(--ink-soft); font-size: 12px; }
.review-answer { margin-bottom: 8px; }
.review-answer strong { color: var(--ink); }
.review-body a { color: var(--azure-dark); }
.results-actions { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.results-actions .button { width: 100%; }

.feedback-section { margin-top: 20px; display: grid; grid-template-columns: 1fr; gap: 20px; }
.feedback-section h2 { margin-bottom: 8px; }
.feedback-section > div > p:last-child { margin-bottom: 0; color: var(--ink-soft); font-size: 13px; }
.feedback-section form { display: grid; gap: 14px; }
.feedback-field { display: grid; gap: 7px; color: var(--ink-soft); font-size: 12px; font-weight: 750; }
.feedback-field select, .feedback-field textarea {
  width: 100%;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
}
.feedback-field select { min-height: 44px; }
.feedback-field textarea { resize: vertical; line-height: 1.5; }
.feedback-actions { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
.feedback-actions .button { width: 100%; }
#feedback-status { color: var(--ink-soft); font-size: 12px; }
#feedback-status.success { color: var(--green); }
#feedback-status.error { color: var(--red); }

.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 max(24px, env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 11px;
}

/* ---------- Offline shell ---------- */
.offline-view { min-height: 100dvh; display: grid; place-items: center; padding: 40px 16px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Exam picker */
.exam-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.exam-picker.loading { opacity: .6; pointer-events: none; }
.exam-chip { display: grid; gap: 4px; padding: 14px 16px; text-align: left; color: var(--ink); background: white; border: 1px solid var(--line-strong); border-radius: 10px; cursor: pointer; }
.exam-chip:hover { border-color: var(--azure); background: #f8fcff; }
.exam-chip.active { border-color: var(--azure); background: var(--azure-soft); box-shadow: inset 3px 0 var(--azure); }
.exam-chip strong { font-size: 15px; letter-spacing: .02em; }
.exam-chip span { font-size: 13px; }
.exam-chip small { color: var(--muted); font-size: 11px; }

/* Dropdown and fill-in-the-blank */
.blank-template { font-size: 16px; line-height: 2.4; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.blank-select, .blank-input { display: inline-block; vertical-align: baseline; min-height: 44px; margin: 2px 4px; padding: 0 10px; font: inherit; font-size: 14px; line-height: 1.4; color: var(--ink); background: white; border: 1px solid var(--line-strong); border-radius: 7px; }
.blank-select { max-width: 100%; }
.blank-input { width: 12em; max-width: 100%; border-bottom-width: 2px; }
.blank-input:focus, .blank-select:focus { outline: 2px solid var(--azure); outline-offset: 1px; }
.blank-select.correct, .blank-input.correct { background: var(--green-soft); border-color: #83c49f; }
.blank-select.incorrect, .blank-input.incorrect { background: var(--red-soft); border-color: #e3a3a3; }
.blank-note { margin: 8px 0 0; color: var(--muted); font-size: 12px; }

/* ---------- Access badge (app header) ---------- */
.header-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.access-badge { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-soft); font-size: 12px; }
.access-badge-email { min-width: 0; max-width: 32vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: var(--ink); }
.access-badge-expiry { display: none; color: var(--muted); white-space: nowrap; }
.access-badge a { min-height: 44px; display: inline-flex; align-items: center; color: var(--navy); font-weight: 700; text-decoration: none; white-space: nowrap; }
.access-card form .feedback-field + .feedback-field { margin-top: 14px; }
.access-card small a { color: var(--navy); }
#access-status.error, #trial-status.error, #issue-status.error, #settings-status.error { color: var(--red); }
#issue-status.success, #settings-status.success { color: var(--green); }

/* ---------- Install control ---------- */

/* ---------- Landing page ---------- */
.landing-body .site-header { position: static; }
.landing-nav { display: flex; align-items: center; gap: 10px; }
.landing-nav > a:not(.button) { display: none; color: var(--ink-soft); font-size: 14px; font-weight: 600; text-decoration: none; }
.landing-nav > a:not(.button):hover { color: var(--navy); }
.landing-nav .button { padding: 0 12px; font-size: 12px; }
.landing { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 36px 0 30px; }
.landing-hero { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: start; margin-bottom: 50px; }
.landing-hero h1 { margin: 10px 0 16px; font-size: clamp(32px, 9vw, 62px); line-height: 1.02; letter-spacing: -0.035em; }
.landing-hero .hero-copy { margin-bottom: 22px; }
.landing-hero .button-row { display: flex; flex-direction: column; gap: 10px; }
.landing-hero .button-row .button { width: 100%; }
.landing-section { margin-bottom: 50px; }
.landing-section h2 { margin: 6px 0 20px; font-size: clamp(24px, 6vw, 36px); letter-spacing: -0.03em; }
.feature-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.feature-card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.feature-number { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--azure-soft); color: var(--navy); font-weight: 800; }
.feature-card h3 { margin: 14px 0 8px; font-size: 16px; }
.feature-card p { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.6; }
.exam-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.exam-card { display: flex; flex-direction: column; gap: 8px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.exam-card.muted-card { opacity: .7; }
.exam-code { margin: 0; color: var(--navy); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.exam-card h3 { margin: 0; font-size: 19px; }
.exam-card .muted { margin: 0; font-size: 13px; }
.exam-meta { display: flex; gap: 14px; margin: 8px 0 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.exam-card .button { align-self: stretch; text-align: center; }
.muted { color: var(--muted); }
.trial-section { display: grid; grid-template-columns: 1fr; gap: 28px; padding: 22px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.trial-form { display: grid; gap: 16px; }
.trial-form .field-grid.two { display: grid; grid-template-columns: 1fr; gap: 16px; }
.trial-form input[type="text"], .trial-form input[type="email"], .feedback-field input[type="text"], .feedback-field input[type="email"], .feedback-field input[type="number"] {
  width: 100%; min-height: 44px; padding: 10px 12px; color: var(--ink); background: var(--surface-soft); border: 1px solid var(--line-strong); border-radius: 9px;
}
.consent { display: flex; gap: 10px; align-items: flex-start; color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.consent input { margin-top: 3px; width: 20px; height: 20px; flex: 0 0 auto; }
.trial-success { padding: 24px 20px; border-radius: 16px; background: var(--green-soft); }
.trial-success h3 { margin: 0 0 8px; color: var(--green); }
.trial-success .button { width: 100%; text-align: center; }
.landing-footer .footer-brand strong { color: var(--ink); }

/* ---------- Admin portal ---------- */
.admin-view { padding: 24px 0 50px; }
.admin-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
.stat-card { padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.stat-value { display: block; font-size: 28px; font-weight: 750; letter-spacing: -0.04em; }
.stat-label { color: var(--muted); font-size: 12px; }
.admin-tabs { display: flex; gap: 2px; margin-bottom: 16px; border-bottom: 1px solid var(--line); overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; mask-image: linear-gradient(to right, #000 88%, transparent); }
.admin-tab { min-height: 44px; padding: 12px 10px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--ink-soft); font-weight: 650; font-size: 13px; white-space: nowrap; cursor: pointer; }
.admin-tab.active { color: var(--navy); border-bottom-color: var(--gold); }
.pill { display: inline-block; min-width: 20px; padding: 1px 7px; border-radius: 999px; background: var(--gold-soft); color: var(--navy); font-size: 11px; text-align: center; }
.admin-form { display: grid; gap: 16px; margin-top: 18px; }
.admin-form .field-grid.two, .admin-form .field-grid.three { display: grid; grid-template-columns: 1fr; gap: 16px; }
.admin-form fieldset { margin: 0; padding: 0; border: 0; }
.admin-form legend { padding: 0; margin-bottom: 7px; }
.admin-form input[type="text"], .admin-form input[type="email"], .admin-form input[type="number"] { min-height: 44px; }
.check-row { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 0; font-size: 13px; font-weight: 600; color: var(--ink); }
.feedback-field.inline { display: flex; align-items: center; gap: 10px; }
.feedback-field.inline select { width: auto; min-height: 44px; }

/* Admin tables collapse to cards below the tablet breakpoint. */
.table-wrap { margin-top: 14px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table thead { display: none; }
.admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; width: 100%; }
.admin-table tr {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.admin-table tr:last-child { margin-bottom: 0; }
.admin-table td { padding: 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table td:first-child { padding-top: 0; }
.admin-table td:last-child { padding-bottom: 0; border-bottom: 0; }
.admin-table td.wrap { max-width: none; white-space: normal; }
.admin-table td[data-label]::before {
  content: attr(data-label);
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.admin-table td.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-table td.actions .button { flex: 1; min-width: 120px; }
.admin-table code { font-size: 12px; background: var(--surface-soft); padding: 2px 6px; border-radius: 6px; }
.admin-table .button { min-height: 40px; padding: 0 12px; font-size: 12px; }
.status-chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: capitalize; background: var(--surface-soft); color: var(--ink-soft); }
.status-chip.pending { background: var(--amber-soft); color: var(--amber); }
.status-chip.approved, .status-chip.active, .status-chip.resent { background: var(--green-soft); color: var(--green); }
.status-chip.declined, .status-chip.revoked, .status-chip.expired { background: var(--red-soft); color: var(--red); }

/* =====================================================================
   Progressive enhancement — tablet and desktop (mobile-first min-width)
   ===================================================================== */

@media (min-width: 600px) {
  .feature-grid, .admin-stats { grid-template-columns: 1fr 1fr; }
  .exam-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}

@media (min-width: 700px) {
  .admin-tabs { mask-image: none; }
  :root { --header-h: 76px; }
  .site-header { padding-left: clamp(20px, 4vw, 64px); padding-right: clamp(20px, 4vw, 64px); }
  .brand small { display: block; }
  .header-meta { display: block; }
  .setup-view { padding: 58px 0 72px; }
  .hero { grid-template-columns: minmax(0, 1fr) 250px; gap: 60px; align-items: end; margin-bottom: 52px; }
  h1 { letter-spacing: -0.045em; }
  .hero-copy { font-size: 18px; }
  .hero-status { grid-template-columns: none; padding: 24px; gap: 0; }
  .status-number { font-size: 50px; }
  .status-label { font-size: 13px; }
  .status-rule { display: block; }
  .status-detail { grid-column: auto; margin-top: 0; }
  .resume-banner { flex-direction: row; align-items: center; justify-content: space-between; padding: 18px 20px; }
  .setup-section { padding: 28px; }
  .setup-columns { grid-template-columns: 0.9fr 1.1fr; }
  .domain-grid { grid-template-columns: repeat(2, 1fr); }
  .domain-card:last-child { grid-column: 1 / -1; }
  .domain-card-body { min-height: 145px; }
  .type-grid { grid-template-columns: repeat(2, 1fr); }
  .field-grid { grid-template-columns: 1fr 1fr; }
  .access-view { min-height: calc(100vh - var(--header-h) - 94px); padding: 64px 20px; }
  .access-card { padding: 44px; }
  .access-actions { flex-direction: row; align-items: center; justify-content: space-between; }
  .access-actions .button { width: auto; }
  .start-panel { flex-direction: row; align-items: center; justify-content: space-between; padding: 20px 24px; }
  .start-panel .button { width: auto; }
  .exam-statusbar { height: 58px; padding: 0 clamp(20px, 4vw, 64px); grid-template-columns: 160px 1fr 110px; gap: 24px; }
  .exam-layout { min-height: calc(100vh - var(--header-h) - 58px); }
  .question-workspace { width: min(900px, calc(100% - 48px)); padding: 30px 0 50px; }
  .question-toolbar { align-items: center; }
  .question-tags { display: flex; }
  .question-card { padding: clamp(24px, 4vw, 42px); min-height: 520px; }
  .question-actions { position: static; margin-top: 18px; padding: 0; flex-direction: row; justify-content: space-between; background: none; border-top: 0; }
  .action-right { flex: 0 0 auto; }
  .action-right .button { flex: 0 0 auto; }
  #finish-exam { display: inline-flex; }
  .matching-row { grid-template-columns: minmax(0, 1fr) 28px minmax(180px, .65fr); gap: 12px; }
  .matching-row .arrow { transform: none; }
  .case-study-body { grid-template-columns: 1fr 1fr; }
  .case-section + .case-section { border-left: 1px solid var(--line); border-top: 0; }
  .results-view { padding: 56px 0 80px; }
  .results-hero { flex-direction: row; align-items: center; justify-content: space-between; text-align: left; padding: 38px; }
  .results-hero h1 { font-size: 44px; }
  .score-ring { width: 170px; height: 170px; }
  .result-panel, .review-section, .feedback-section { padding: 28px; }
  .review-item summary { grid-template-columns: 72px 1fr auto; }
  .review-chevron { display: block; }
  .review-body { padding-left: 100px; }
  .results-actions { flex-direction: row; justify-content: flex-end; }
  .results-actions .button { width: auto; }
  .feedback-section { grid-template-columns: .75fr 1.25fr; gap: 34px; }
  .feedback-actions { flex-direction: row; justify-content: space-between; align-items: center; }
  .feedback-actions .button { width: auto; }
  .site-footer { flex-direction: row; justify-content: space-between; align-items: center; }
  .blank-select, .blank-input { min-height: 36px; }
  .yes-no-table td:not(:first-child) { width: 76px; }
  .yes-no-table label { width: 34px; height: 34px; }
  .yes-no-table input:checked + span { width: 22px; height: 22px; }
  .reorder-controls button { width: 30px; height: 30px; font-size: 13px; }
  .landing-nav > a:not(.button) { display: inline; }
  .landing { padding: 64px 0 40px; }
  .landing-hero { grid-template-columns: 1.4fr 0.6fr; gap: 40px; align-items: center; margin-bottom: 80px; }
  .landing-hero .button-row { flex-direction: row; flex-wrap: wrap; }
  .landing-hero .button-row .button { width: auto; }
  .landing-section { margin-bottom: 80px; }
  .trial-section { grid-template-columns: 0.8fr 1.2fr; padding: 40px; }
  .trial-form .field-grid.two { grid-template-columns: 1fr 1fr; }
  .trial-success .button { width: auto; }
  .admin-form .field-grid.two { grid-template-columns: 1fr 1fr; }
  .header-right { gap: 18px; }
  .access-badge { padding: 6px 12px; gap: 10px; }
  .access-badge-email { max-width: none; }
  .access-badge-expiry { display: inline; }

  /* Admin tables become real tables again once there's room. */
  .table-wrap { overflow-x: auto; }
  .admin-table thead { display: table-header-group; }
  .admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: revert; width: auto; }
  .admin-table th { text-align: left; padding: 10px 12px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; border-bottom: 1px solid var(--line); }
  .admin-table tr { margin-bottom: 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
  .admin-table td { padding: 12px; border-bottom: 1px solid var(--line); }
  .admin-table td.wrap { max-width: 360px; white-space: normal; }
  .admin-table td.actions { display: table-cell; white-space: nowrap; }
  .admin-table td.actions .button { flex: none; min-width: 0; }
  .admin-table td[data-label]::before { content: none; }
}

@media (min-width: 900px) {
  .feature-grid, .admin-stats { grid-template-columns: repeat(4, 1fr); }
  .landing-hero, .trial-section { grid-template-columns: 1.4fr 0.6fr; }
  .trial-section { grid-template-columns: 0.8fr 1.2fr; }
  .admin-form .field-grid.three { grid-template-columns: 1fr 160px 1fr; }
}

@media (min-width: 980px) {
  .domain-grid { grid-template-columns: repeat(5, 1fr); }
  .domain-card:last-child { grid-column: auto; }
  .setup-columns { grid-template-columns: .9fr 1.1fr; }
  .exam-layout { grid-template-columns: 264px minmax(0, 1fr); }
  .question-nav {
    display: flex;
    position: static;
    top: auto;
    bottom: auto;
    left: auto;
    width: auto;
    padding: 26px 22px;
    box-shadow: none;
    border-right: 1px solid var(--line);
    z-index: auto;
  }
  .nav-grid { grid-template-columns: repeat(5, 1fr); }
  .mobile-only { display: none; }
  .results-grid, .feedback-section { grid-template-columns: .75fr 1.25fr; }
}

a.button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
