/* Digital SAT practice chrome — Bluebook-like exam surface (not an official College Board product). */
:root {
  --bb-navy: #1b365d;
  --bb-header: #16324f;
  --bb-header-deep: #0e2236;
  --bb-paper: #ffffff;
  --bb-stage: #e6ebf0;
  --bb-ink: #1a2330;
  --bb-muted: #4a5b6a;
  --bb-line: #c5d0da;
  --bb-line-strong: #8ea0b0;
  --bb-select: #0b6e99;
  --bb-select-bg: #dceef6;
  --bb-good: #0d7a3e;
  --bb-good-bg: #e6f6ec;
  --bb-bad: #b42318;
  --bb-bad-bg: #fdecec;
  --bb-warn: #b54708;
  --bb-warn-bg: #fff4e5;
  --bb-flag: #c2410c;
  --bb-focus: #2b6cb0;
  --bb-shadow: 0 8px 24px rgba(15, 34, 54, 0.16);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --font: "Segoe UI", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bb-stage);
  color: var(--bb-ink);
}
body:has(.test-shell.is-on) {
  height: 100dvh;
  overflow: hidden;
}
button, input { font: inherit; }
button, a, input, [role="button"] { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
button:focus-visible,
a:focus-visible,
input:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid #7eb6e0;
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 120;
  background: #fff;
  color: var(--bb-ink);
  padding: 10px 14px;
  border-radius: 4px;
  box-shadow: var(--bb-shadow);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

/* ——— Directions / start ——— */
.start-screen {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--bb-stage);
}
.start-top {
  background: var(--bb-header);
  color: #fff;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 16px;
}
.start-top__mod {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.01em;
}
.start-top a {
  color: #d7e6f2;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}
.start-top a:hover { color: #fff; }
.start-body {
  overflow: auto;
  padding: 28px 20px 40px;
}
.start-panel {
  max-width: 760px;
  margin: 0 auto;
  background: var(--bb-paper);
  border: 1px solid var(--bb-line);
  padding: 32px 36px 36px;
}
.brand-logo { display: inline-flex; align-items: center; text-decoration: none; }
.brand-logo img { display: block; width: 150px; height: 75px; object-fit: contain; }
.hub-link {
  display: inline-block;
  margin-top: 10px;
  color: #175cd3;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}
h1 {
  font-size: 1.75rem;
  line-height: 1.2;
  margin: 16px 0 10px;
  color: var(--bb-ink);
  font-weight: 700;
}
.lead {
  font-size: 16px;
  line-height: 1.55;
  color: var(--bb-muted);
  margin: 0 0 16px;
}
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 18px; }
.pill {
  background: #f3f6f8;
  border: 1px solid var(--bb-line);
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 650;
  color: #344054;
}
.instructions, .selection-note {
  padding: 14px 16px;
  border: 1px solid var(--bb-line);
  line-height: 1.55;
  font-size: 14px;
  margin-top: 12px;
}
.instructions { background: #fbfcfe; color: var(--bb-muted); }
.selection-note { background: #f4f9ff; color: #344054; }
.primary {
  min-height: 44px;
  border: 0;
  background: var(--bb-navy);
  color: #fff;
  padding: 10px 18px;
  border-radius: 4px;
  font-weight: 700;
  box-shadow: none;
}
.primary:hover { background: #142a4a; }
.primary:active { transform: scale(0.98); }
.primary:disabled { background: #8ea0b0; transform: none; }

/* ——— Exam shell ——— */
.test-shell {
  display: none;
  height: 100dvh;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--bb-stage);
  overflow: hidden;
}
.test-shell.is-on { display: grid; }
.test-shell.is-reviewing,
.test-shell.is-analyzing { grid-template-rows: auto minmax(0, 1fr); }
.test-shell.is-analyzing .bb-tool,
.test-shell.is-analyzing .bb-timer-wrap { display: none; }

.bb-top {
  background: var(--bb-header);
  color: #fff;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px 0 16px;
  z-index: 20;
}
.bb-top__left, .bb-top__right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.topbar-brand {
  display: inline-flex;
  align-items: center;
  margin-right: 8px;
  background: #fff;
  padding: 3px 7px;
  border-radius: 3px;
}
.topbar-brand img {
  display: block;
  width: 78px;
  height: 32px;
  object-fit: contain;
}
.bb-mod {
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
}
.bb-tool {
  min-height: 40px;
  min-width: 40px;
  border: 1px solid transparent;
  background: transparent;
  color: #fff;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.bb-tool:hover, .bb-tool[aria-pressed="true"] { background: rgba(255,255,255,0.12); }
.bb-tool svg { flex: none; }
.bb-timer-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 4px;
  padding-left: 10px;
  border-left: 1px solid rgba(255,255,255,0.18);
}
.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.04em;
  min-width: 4.4ch;
}
.timer.warning { color: #ffd79a; }
.timer.danger { color: #ffb4b0; }
.timer.is-hidden { visibility: hidden; }

.exam-stage {
  min-width: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 20px 16px 28px;
}

.exam-frame {
  max-width: 920px;
  margin: 0 auto;
}

.intro-strip { display: none; }

.question-card {
  display: none;
  background: var(--bb-paper);
  border: 1px solid var(--bb-line);
  padding: 22px 24px 26px;
}
.question-card.is-current { display: block; }
.q-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.q-num {
  display: inline-block;
  margin-right: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--bb-ink);
}
.q-domain { font-size: 13px; color: var(--bb-muted); }
.q-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--bb-muted);
  background: #f2f4f7;
  border-radius: 4px;
  padding: 5px 8px;
  white-space: nowrap;
}
.test-shell:not(.is-analyzing) .q-id { display: none; }
.question-image-wrap {
  border: 1px solid #e4e8ed;
  background: #fff;
  overflow: hidden;
}
.question-image {
  display: block;
  width: 100%;
  height: auto;
  cursor: zoom-in;
}
.image-help {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 8px 0 0;
  color: var(--bb-muted);
  font-size: 12px;
}
.image-help svg { flex: none; }

.response-area { padding-top: 18px; }
.answer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 360px;
}
.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  min-height: 48px;
}
.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.choice span {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 48px;
  border: 2px solid var(--bb-navy);
  border-radius: 999px;
  background: #fff;
  color: var(--bb-ink);
  font-weight: 700;
  font-size: 16px;
  transition: background 150ms var(--ease-out), color 150ms var(--ease-out), border-color 150ms var(--ease-out);
}
.choice input:checked + span {
  border-color: var(--bb-select);
  background: var(--bb-select);
  color: #fff;
}
.choice.is-eliminated span {
  opacity: 0.45;
  text-decoration: line-through;
}
.choice.is-eliminated input:checked + span { opacity: 1; }
.eliminate {
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--bb-line);
  background: #fff;
  color: var(--bb-muted);
  border-radius: 4px;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  display: none;
}
.eliminator-on .eliminate { display: inline-flex; align-items: center; justify-content: center; }
.eliminate:hover { border-color: var(--bb-bad); color: var(--bb-bad); }

.frq-wrap { max-width: 420px; }
.frq-wrap label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--bb-muted);
  margin-bottom: 6px;
}
.frq-wrap input[type="text"] {
  width: 100%;
  border: 2px solid var(--bb-navy);
  border-radius: 4px;
  padding: 12px 13px;
  outline: none;
  background: #fff;
}
.frq-wrap input:focus { box-shadow: 0 0 0 3px rgba(11, 110, 153, 0.18); }
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 56px);
  gap: 8px;
  margin-top: 12px;
}
.keypad button {
  min-height: 44px;
  border: 1px solid var(--bb-line-strong);
  background: #fff;
  border-radius: 4px;
  font-weight: 700;
  color: var(--bb-ink);
}
.keypad button:hover { background: #f3f6f8; }
.keypad button:active { background: var(--bb-select-bg); }

.status { margin-top: 12px; min-height: 22px; font-weight: 700; font-size: 14px; }
.status.good { color: var(--bb-good); }
.status.bad { color: var(--bb-bad); }
.status.blank { color: var(--bb-warn); }
.explanation { display: none; margin-top: 16px; border-top: 1px solid var(--bb-line); padding-top: 16px; }
.explanation.show { display: block; }
.coverage-box {
  background: #f4f9ff;
  border: 1px solid #d6e9ff;
  padding: 14px 15px;
  margin-bottom: 16px;
}
.coverage-kicker {
  font-size: 11px;
  letter-spacing: 0.06em;
  font-weight: 800;
  color: #175cd3;
  margin-bottom: 5px;
}
.architecture { font-weight: 800; color: var(--bb-ink); margin-bottom: 5px; }
.coverage-reason { font-size: 14px; line-height: 1.5; color: var(--bb-muted); }
.explanation-title { font-weight: 800; color: var(--bb-ink); font-size: 17px; }
.correct-answer { margin: 7px 0 12px; color: #344054; }
.rationale-img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #eaecf0;
  margin: 8px 0;
  background: #fff;
  cursor: zoom-in;
}

/* ——— Footer nav ——— */
.bb-bottom {
  background: #fff;
  border-top: 1px solid var(--bb-line);
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  z-index: 20;
}
.test-shell.is-reviewing .bb-bottom,
.test-shell.is-analyzing .bb-bottom { display: none; }
.bb-bottom__left, .bb-bottom__right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.qnav-btn, .mark-btn, .nav-btn {
  min-height: 44px;
  border-radius: 4px;
  font-weight: 700;
  padding: 8px 14px;
}
.qnav-btn {
  border: 1px solid var(--bb-line-strong);
  background: #fff;
  color: var(--bb-ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.qnav-btn[aria-expanded="true"] { border-color: var(--bb-select); background: var(--bb-select-bg); }
.qnav-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bb-line-strong);
}
.qnav-dot.is-answered { background: var(--bb-navy); }
.qnav-dot.is-marked { background: var(--bb-flag); }
.mark-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--bb-ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.mark-btn[aria-pressed="true"] { color: var(--bb-flag); background: #fff1e8; }
.nav-btn {
  border: 1px solid var(--bb-navy);
  background: #fff;
  color: var(--bb-navy);
  min-width: 88px;
}
.nav-btn.next {
  background: var(--bb-navy);
  color: #fff;
}
.nav-btn.next:hover { background: #142a4a; }
.nav-btn:hover:not(.next) { background: #f3f6f8; }

/* ——— Question map ——— */
.qmap {
  position: fixed;
  z-index: 40;
  left: 16px;
  bottom: 72px;
  width: min(420px, calc(100vw - 24px));
  background: #fff;
  border: 1px solid var(--bb-line);
  box-shadow: var(--bb-shadow);
  padding: 16px;
  display: none;
}
.qmap.open { display: block; }
.qmap__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.qmap__head h2 { margin: 0; font-size: 16px; }
.qmap__meta { margin: 4px 0 0; font-size: 13px; color: var(--bb-muted); }
.qmap__grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.qmap__cell {
  min-height: 44px;
  border: 1px solid var(--bb-line-strong);
  background: #fff;
  border-radius: 4px;
  font-weight: 700;
  color: var(--bb-ink);
  position: relative;
}
.qmap__cell.is-answered { background: #e8eef5; border-color: var(--bb-navy); }
.qmap__cell.is-current {
  outline: 3px solid var(--bb-select);
  outline-offset: 1px;
}
.qmap__cell.is-marked::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 5px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 8px solid var(--bb-flag);
}
.qmap__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--bb-muted);
}
.qmap__actions { margin-top: 14px; display: flex; justify-content: flex-end; }

/* ——— Review page ——— */
.review-page, .results { display: none; }
.review-page.show, .results.show { display: block; }
.review-page, .results {
  max-width: 920px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--bb-line);
  padding: 24px;
}
.review-page h2, .results h2 {
  margin: 0 0 8px;
  font-size: 1.5rem;
}
.review-lead, .score-sub {
  color: var(--bb-muted);
  line-height: 1.55;
  margin: 0 0 18px;
}
.review-list { display: grid; gap: 8px; }
.review-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid var(--bb-line);
  background: #fff;
  text-align: left;
  color: inherit;
  width: 100%;
}
.review-row:hover { background: #f6f8fa; }
.review-row strong { font-size: 15px; }
.review-row span { font-size: 13px; color: var(--bb-muted); }
.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

/* ——— Analysis ——— */
.score-big {
  font-size: 2.75rem;
  line-height: 1;
  font-weight: 800;
  color: var(--bb-ink);
}
.analysis-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}
.analysis-stat {
  border: 1px solid var(--bb-line);
  background: #f8fafc;
  padding: 12px;
}
.analysis-stat strong {
  display: block;
  color: var(--bb-ink);
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}
.analysis-stat span { font-size: 12px; color: var(--bb-muted); }
.insights {
  margin: 8px 0 20px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}
.insights li {
  padding: 10px 12px;
  border: 1px solid var(--bb-line);
  background: #fbfcfe;
  font-size: 14px;
  line-height: 1.45;
}
.insights li strong { display: block; margin-bottom: 2px; }
.time-chart { display: grid; gap: 6px; margin: 8px 0 20px; }
.time-row {
  display: grid;
  grid-template-columns: 36px 1fr 64px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.time-bar {
  height: 10px;
  background: #e8edf2;
  position: relative;
}
.time-bar > i {
  display: block;
  height: 100%;
  transform-origin: left center;
  background: var(--bb-navy);
}
.time-bar.is-good > i { background: var(--bb-good); }
.time-bar.is-bad > i { background: var(--bb-bad); }
.time-bar.is-blank > i { background: var(--bb-warn); }
.analysis-table-wrap { overflow: auto; border: 1px solid var(--bb-line); }
.analysis-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.analysis-table th, .analysis-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--bb-line);
  text-align: left;
  white-space: nowrap;
}
.analysis-table th {
  background: #f4f6f8;
  font-size: 12px;
  color: var(--bb-muted);
  font-weight: 700;
}
.analysis-table tbody tr { cursor: pointer; }
.analysis-table tbody tr:hover { background: #f6f8fa; }
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}
.tag-good { background: var(--bb-good-bg); color: var(--bb-good); }
.tag-bad { background: var(--bb-bad-bg); color: var(--bb-bad); }
.tag-blank { background: var(--bb-warn-bg); color: var(--bb-warn); }
.tag-slow { background: #eef2ff; color: #3730a3; }
.tag-fast { background: #ecfeff; color: #155e75; }
.tag-rushed { background: #fff1f2; color: #9f1239; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.result-link, .secondary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  border: 1px solid var(--bb-line-strong);
  background: #fff;
  color: #344054;
  padding: 10px 14px;
  border-radius: 4px;
  font-weight: 700;
  text-decoration: none;
}

/* ——— Overlays ——— */
.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  background: rgba(8, 15, 31, 0.92);
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.image-viewer.open { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 12px; }
.image-viewer__bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #fff; }
.image-viewer__title { margin: 0; font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-viewer__close {
  min-width: 48px;
  min-height: 48px;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 4px;
  background: #fff;
  color: var(--bb-ink);
  font-weight: 700;
}
.image-viewer__canvas { overflow: auto; overscroll-behavior: contain; background: #fff; }
.image-viewer__image { display: block; width: auto; max-width: none; height: auto; min-width: min(900px, calc(100vw - 32px)); margin: 0 auto; }
body.viewer-open { overflow: hidden; }

.drawer, .sheet {
  position: fixed;
  z-index: 50;
  background: #fff;
  border: 1px solid var(--bb-line);
  box-shadow: var(--bb-shadow);
  display: none;
}
.drawer.open, .sheet.open { display: flex; flex-direction: column; }
.drawer {
  top: 56px;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
}
.sheet {
  inset: 8vh 16px auto;
  max-width: 640px;
  margin: auto;
  max-height: 84vh;
}
.panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--bb-line);
  background: var(--bb-header);
  color: #fff;
}
.panel-bar h2 { margin: 0; font-size: 15px; }
.panel-bar button {
  min-height: 36px;
  border: 1px solid rgba(255,255,255,0.3);
  background: transparent;
  color: #fff;
  border-radius: 4px;
  padding: 0 10px;
  font-weight: 650;
}
.panel-body { padding: 16px; overflow: auto; }
.calc-frame {
  flex: 1;
  border: 0;
  width: 100%;
  min-height: 0;
  background: #f7f7f7;
}
.ref-list { margin: 0; padding-left: 18px; line-height: 1.55; font-size: 14px; }
.ref-list li + li { margin-top: 8px; }

.five-min {
  position: fixed;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: none;
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: var(--bb-shadow);
}
.five-min.show { display: block; }

.locked .choice, .locked input, .locked .keypad button, .locked .eliminate { pointer-events: none; }

@media (max-width: 800px) {
  h1 { font-size: 1.45rem; }
  .start-panel { padding: 22px 18px; }
  .bb-tool-label { display: none; }
  .question-card { padding: 16px 14px 20px; }
  .analysis-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qmap__grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .bb-bottom { flex-wrap: wrap; padding: 8px 10px 10px; }
  .bb-bottom__left { flex: 1 1 100%; justify-content: space-between; }
  .mark-btn { padding-inline: 8px; }
  .review-row { grid-template-columns: 48px 1fr; }
  .review-row em { grid-column: 1 / -1; font-style: normal; font-size: 12px; color: var(--bb-muted); }
}
@media (max-width: 520px) {
  .keypad { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bb-timer-wrap { padding-left: 6px; }
  .timer { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .primary, .choice span, .time-bar > i { transition: none; }
}
@media print {
  .bb-top, .bb-bottom, .start-screen, .qmap, .drawer, .sheet, .five-min, .image-viewer { display: none !important; }
  .test-shell, .test-shell.is-on { display: block !important; height: auto; }
  .results, .question-card, .explanation.show { display: block !important; }
  body { background: #fff; }
}
