/* Qareken SAT — Bluebook test runner (2025–26 look). Everything is scoped under .bb-root.
   Tools (calculator, reference, line reader, highlights) live in bluebook-tools.css at z-index 60–90;
   core popovers 94–99, screens 100–104, dialogs 110. */

html.bb-active,
html.bb-active body { height: 100%; overflow: hidden; overscroll-behavior: none; }
html.bb-active body { background: #fff; }

.bb-root {
  --bb-blue: #324DC7;
  --bb-blue-dark: #2840AE;
  --bb-ink: #1E1E1E;
  --bb-bar: #E6EDF8;
  --bb-bar-2: #DFE6F0;
  --bb-yellow: #FEDB00;
  --bb-yellow-dark: #F2D000;
  --bb-red: #C13145;
  --bb-timer-red: #C8102E;
  --bb-navy: #1A2264;
  --bb-qbar: #F0F0F0;
  --bb-divider: #CCCCCC;
  --bb-tooltip: #505050;
  --bb-faded: #8E8E8E;
  --bb-key: #1F7A3D;
  --bb-serif: "Noto Serif", Georgia, "Times New Roman", serif;
  --bb-sans: Roboto, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  /* Test content type: Noto Serif 15/24 (Technical Manual; addendum A2). Phones use 16px at the same 1.6 ratio. */
  --bb-content-size: 15px;
  --bb-content-lh: 1.6;
  --bb-header-h: 79px;
  --bb-footer-h: 73px;
  --bb-banner-h: 26px;
  --bb-safe-t: env(safe-area-inset-top, 0px);
  --bb-safe-b: env(safe-area-inset-bottom, 0px);
  --bb-safe-l: env(safe-area-inset-left, 0px);
  --bb-safe-r: env(safe-area-inset-right, 0px);
  /* Fills the visible viewport: 100dvh where supported; elsewhere (iOS < 15.4, Chrome < 108) top + bottom do,
     which follows the browser toolbars (100vh is taller than the visible area there and hid Back/Next under
     Safari's bottom bar). The runner's inline height for the on-screen keyboard overrides both. */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100dvh;
  z-index: 50;
  overflow: hidden;
  background: #fff;
  color: var(--bb-ink);
  color-scheme: light;
  font-family: var(--bb-sans);
  font-size: 16px;
  line-height: 1.4;
  text-align: left;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
.bb-root *, .bb-root *::before, .bb-root *::after { box-sizing: border-box; }
.bb-root [hidden] { display: none !important; }
:where(.bb-root) button { font-family: inherit; color: inherit; touch-action: manipulation; -webkit-appearance: none; appearance: none; }
.bb-root h1, .bb-root h2, .bb-root h3 { line-height: 1.25; }
.bb-root :focus { outline: none; }
.bb-root :focus-visible { outline: 2px solid var(--bb-blue); outline-offset: 2px; }

@keyframes bb-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes bb-dot { 0%, 80%, 100% { transform: scale(.55); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }

/* ───────────── Test screen frame ───────────── */
.bb-test {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  padding-left: var(--bb-safe-l);
  padding-right: var(--bb-safe-r);
  background: #fff;
}

.bb-header {
  flex: none;
  position: relative;
  height: calc(var(--bb-header-h) + var(--bb-safe-t));
  padding: calc(14px + var(--bb-safe-t)) 24px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  column-gap: 16px;
  background: linear-gradient(to bottom, var(--bb-bar) 0, var(--bb-bar) calc(100% - 25px), var(--bb-bar-2) 100%);
  user-select: none;
  -webkit-user-select: none;
}
.bb-header:focus-visible { outline-offset: -2px; }

.bb-h-left { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 9px; }
.bb-title {
  max-width: 100%;
  font-size: 19px;
  font-weight: 500;
  line-height: 24px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bb-dir-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 2px 2px;
  margin-left: -2px;
  border: 0;
  border-radius: 4px;
  background: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.bb-dir-btn::after { content: ""; position: absolute; top: -8px; right: -10px; bottom: -8px; left: -10px; }
.bb-chev { display: inline-flex; transition: transform .15s ease; }
.bb-dir-btn.is-open .bb-chev { transform: rotate(180deg); }

.bb-h-center { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 2px; min-width: 96px; }
.bb-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  font-size: 22px;
  font-weight: 700;
  line-height: 26px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}
.bb-timer-icon { display: inline-flex; color: var(--bb-ink); }
.bb-test.is-time-warn .bb-timer { color: var(--bb-timer-red); }
.bb-timer-toggle {
  position: relative;
  min-width: 50px;
  height: 22px;
  padding: 0 12px;
  border: 1px solid #444;
  border-radius: 999px;
  background: #fff;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.bb-timer-toggle::after { content: ""; position: absolute; top: -10px; right: -6px; bottom: -10px; left: -6px; }

.bb-h-right { display: flex; align-items: flex-start; justify-content: flex-end; gap: 14px; min-width: 0; }
.bb-tool {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 52px;
  padding: 2px 4px 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--bb-ink);
  cursor: pointer;
}
.bb-tool-icon { display: flex; align-items: center; justify-content: center; height: 26px; }
.bb-tool-label {
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 16px;
  white-space: nowrap;
}
.bb-tool.is-active .bb-tool-label { border-bottom-color: var(--bb-ink); }

/* 2025–26 black dashed rules */
.bb-rule {
  flex: none;
  height: 2px;
  background-color: var(--bb-bar-2);
  background-image: repeating-linear-gradient(to right, #000 0, #000 23px, transparent 23px, transparent 25px);
}
.bb-rule-footer { background-color: var(--bb-bar); }

.bb-banner {
  flex: none;
  height: var(--bb-banner-h);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  overflow: hidden;
  background: var(--bb-navy);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
  text-overflow: ellipsis;
  user-select: none;
  -webkit-user-select: none;
}

.bb-main { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; background: #fff; }

/* On-screen keyboard open (phones and iPads): give the field all the room (Back/Next return when it closes). */
.bb-root.bb-kb-open .bb-banner,
.bb-root.bb-kb-open .bb-rule-footer,
.bb-root.bb-kb-open .bb-footer { display: none; }

.bb-footer {
  flex: none;
  height: calc(var(--bb-footer-h) + var(--bb-safe-b));
  padding: 0 34px var(--bb-safe-b) 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 16px;
  background: var(--bb-bar);
  user-select: none;
  -webkit-user-select: none;
}
.bb-footer:focus-visible { outline-offset: -2px; }
.bb-f-left { min-width: 0; }
.bb-student { display: block; font-size: 19px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bb-f-center { display: flex; justify-content: center; min-width: 0; }
.bb-f-right { display: flex; justify-content: flex-end; gap: 12px; }
.bb-qnav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--bb-ink);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.bb-qnav-btn.is-open .bb-chev { transform: rotate(180deg); }
.bb-pill {
  min-width: 76px;
  height: 40px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--bb-blue);
  color: #fff;
  font-size: 15.5px;
  font-weight: 700;
  cursor: pointer;
}
.bb-pill.is-invisible { visibility: hidden; }

/* ───────────── Panes & split ───────────── */
.bb-pane {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #7F7F7F transparent;
}
.bb-pane:focus-visible { outline: 2px solid var(--bb-blue); outline-offset: -2px; }
.bb-pane::-webkit-scrollbar { width: 8px; height: 8px; }
.bb-pane::-webkit-scrollbar-thumb { background: #7F7F7F; border-radius: 4px; }
.bb-pane::-webkit-scrollbar-track { background: transparent; }

.bb-split { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: flex; --bb-div-size: 16px; }
.bb-split.is-vertical { flex-direction: column; --bb-div-size: 26px; }
.bb-split > .bb-pane-a { flex: 0 0 calc(var(--bb-ratio, 50%) - var(--bb-div-size) / 2); }
.bb-split > .bb-pane-b { flex: 1 1 0; }
.bb-split.max-a > .bb-pane-a,
.bb-split.max-b > .bb-pane-b { flex: 1 1 auto; }
.bb-split.max-a > .bb-pane-b,
.bb-split.max-b > .bb-pane-a { display: none; }
.bb-split.is-dragging { user-select: none; -webkit-user-select: none; }

.bb-divider { position: relative; flex: 0 0 var(--bb-div-size); touch-action: none; z-index: 2; }
.bb-divider:focus-visible { outline: 2px solid var(--bb-blue); outline-offset: -2px; }
.bb-split.is-horizontal > .bb-divider { margin: 9px 0 14px; cursor: col-resize; }
.bb-split.is-horizontal .bb-divider-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: var(--bb-divider);
}
.bb-split.is-horizontal .bb-divider-grip {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 30px;
  transform: translate(-50%, -50%);
  border-radius: 2px;
  background: #A3A3A3;
}
.bb-split.is-horizontal.is-dragging .bb-divider-line { background: #9A9A9A; }
.bb-expand {
  position: absolute;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #969696;
  box-shadow: 0 0 0 4px #F0F0F0, 0 1px 4px rgba(0, 0, 0, .25);
  cursor: pointer;
}
.bb-expand::before { content: ""; position: absolute; top: -5px; right: -5px; bottom: -5px; left: -5px; border-radius: 50%; }
.bb-split.is-horizontal .bb-expand { top: 4px; }
.bb-split.is-horizontal .bb-expand-a { right: calc(50% + 13px); }
.bb-split.is-horizontal .bb-expand-b { left: calc(50% + 14px); }
.bb-split.is-horizontal .bb-expand-a svg { transform: scaleX(-1); }

.bb-split.is-vertical > .bb-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: row-resize;
  border-top: 1px solid var(--bb-divider);
  border-bottom: 1px solid var(--bb-divider);
  background: #F3F3F3;
}
/* 44px touch target for the 26px drag strip (the expand buttons stay on top of it). */
.bb-split.is-vertical > .bb-divider::before { content: ""; position: absolute; left: 0; right: 0; top: -9px; bottom: -9px; }
.bb-split.is-vertical .bb-divider-line { display: none; }
.bb-split.is-vertical .bb-divider-grip { width: 40px; height: 5px; border-radius: 3px; background: #8E8E8E; }
.bb-split.is-vertical .bb-expand {
  top: 50%;
  width: 34px;
  height: 34px;
  transform: translateY(-50%);
  color: #444;
  box-shadow: 0 0 0 1px #D2D2D2, 0 1px 3px rgba(0, 0, 0, .2);
}
.bb-split.is-vertical .bb-expand-a { right: 54px; }
.bb-split.is-vertical .bb-expand-b { right: 10px; }

/* ───────────── Question content ───────────── */
.bb-passage {
  max-width: 54em;
  padding: 24px 32px 48px 24px;
  font-family: var(--bb-serif);
  font-size: var(--bb-content-size);
  line-height: var(--bb-content-lh);
  color: var(--bb-ink);
}
.bb-passage-inline { max-width: none; padding: 0; margin: 0 0 16px; }
.bb-question { padding: 24px 43px 48px 39px; }
/* Side-by-side split: keep content clear of the circular expand buttons that sit beside the divider. */
.bb-split.is-horizontal > .bb-pane-b .bb-question { padding-left: 58px; }
.bb-split.is-horizontal > .bb-pane-a .bb-passage { padding-right: 56px; }
.bb-single { position: absolute; top: 0; right: 0; bottom: 0; left: 0; }
.bb-pane-single { position: absolute; top: 0; right: 0; bottom: 0; left: 0; }
/* Math multiple-choice column: ~520px of content, as measured in Bluebook (research §1.6). */
.bb-single-col { width: 100%; max-width: 560px; margin: 0 auto; padding: 24px 20px 56px; }

.bb-qbar {
  position: relative;
  display: flex;
  align-items: stretch;
  height: 34px;
  margin-bottom: 16px;
  padding-bottom: 2px;
  background: var(--bb-qbar);
  user-select: none;
  -webkit-user-select: none;
}
.bb-qbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background-color: var(--bb-qbar);
  background-image: repeating-linear-gradient(to right, #000 0, #000 14px, transparent 14px, transparent 16px);
}
.bb-qnum {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 32px;
  padding: 0 7px;
  background: #000;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
}
.bb-qnum:focus-visible { outline-offset: 0; }
.bb-mark {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  background: none;
  font-size: 14px;
  color: var(--bb-ink);
  cursor: pointer;
}
.bb-mark::before { content: ""; position: absolute; left: 0; right: 0; top: -6px; bottom: -6px; } /* 44px tall target */
.bb-mark-icon { display: inline-flex; color: var(--bb-ink); }
.bb-mark.is-marked .bb-mark-icon { color: var(--bb-red); }
.bb-mark.is-marked .bb-bookmark path { fill: currentColor; }
.bb-mark.is-marked .bb-mark-label { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.bb-qbar-spacer { flex: 1 1 auto; }
.bb-abc {
  position: relative;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 25px;
  margin-right: 6px;
  padding: 0;
  border: 1.6px solid #000;
  border-radius: 5px;
  background: #fff;
  color: #000;
  cursor: pointer;
}
.bb-abc::before { content: ""; position: absolute; top: -8px; right: -7px; bottom: -8px; left: -7px; }
.bb-abc-glyph { position: relative; font-size: 10px; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.bb-abc-glyph::after {
  content: "";
  position: absolute;
  left: -3px;
  right: -3px;
  top: 50%;
  height: 1.5px;
  margin-top: -.75px;
  background: currentColor;
  transform: rotate(-24deg);
}
.bb-abc.is-active { background: var(--bb-blue); border-color: var(--bb-blue); color: #fff; }

.bb-qbody { min-width: 0; }
.bb-prompt { margin: 0 0 18px; font-family: var(--bb-serif); font-size: var(--bb-content-size); line-height: var(--bb-content-lh); color: var(--bb-ink); }

.bb-choices { display: flex; flex-direction: column; gap: 16px; }
.bb-choice-row { position: relative; display: flex; align-items: center; gap: 14px; }
.bb-choice {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 10px 14px 10px 12px;
  border: 1px solid #555;
  border-radius: 8px;
  background: #fff;
  font-family: var(--bb-serif);
  font-size: var(--bb-content-size);
  line-height: var(--bb-content-lh);
  color: var(--bb-ink);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.bb-choice:focus-visible { outline: 2px solid var(--bb-blue); outline-offset: 2px; }
.bb-choice-letter {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: 18px;
  border: 1.5px solid var(--bb-ink);
  border-radius: 50%;
  font-family: var(--bb-sans);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.bb-choice-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.bb-choice-row.is-selected .bb-choice { border-color: var(--bb-blue); box-shadow: inset 0 0 0 2px var(--bb-blue); }
.bb-choice-row.is-selected .bb-choice-letter { border-color: var(--bb-blue); background: var(--bb-blue); color: #fff; }
.bb-choice-row.is-eliminated .bb-choice { border-color: #B8B8B8; color: var(--bb-faded); }
.bb-choice-row.is-eliminated .bb-choice-letter { border-color: var(--bb-faded); color: var(--bb-faded); }
.bb-choice-row.is-eliminated .bb-choice img,
.bb-choice-row.is-eliminated .bb-choice svg { opacity: .4; }
.bb-choice-row.is-eliminated .bb-choice::after {
  content: "";
  position: absolute;
  left: -6px;
  right: -6px;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  background: var(--bb-ink);
  pointer-events: none;
}

.bb-elim {
  flex: none;
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-height: 40px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--bb-ink);
  cursor: pointer;
}
.bb-choices.is-elim-mode .bb-elim { display: flex; }
.bb-elim-letter {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1.5px solid var(--bb-ink);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.bb-elim-letter::after { content: ""; position: absolute; left: -4px; right: -4px; top: 50%; height: 1.5px; margin-top: -.75px; background: var(--bb-ink); }
.bb-elim-undo { display: none; font-size: 14.5px; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.bb-choice-row.is-eliminated .bb-elim-letter { display: none; }
.bb-choice-row.is-eliminated .bb-elim-undo { display: inline; }

/* SPR */
.bb-spr { margin-top: 4px; }
.bb-spr-field { display: flex; }
.bb-spr-input {
  width: 180px;
  max-width: 100%;
  height: 50px;
  padding: 0 14px;
  border: 1px solid #6E6E6E;
  border-radius: 8px;
  background: #fff;
  color: var(--bb-ink);
  font-family: var(--bb-sans);
  font-size: 20px;
  letter-spacing: .02em;
  -webkit-appearance: none;
  appearance: none;
}
.bb-spr-input:focus { outline: none; border-color: var(--bb-blue); box-shadow: 0 0 0 2px var(--bb-blue); }
.bb-spr-preview { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 48px; margin-top: 12px; font-size: 16px; }
.bb-spr-preview-label { font-weight: 700; }
.bb-spr-preview-val { font-family: var(--bb-serif); font-size: 19px; }
.bb-root .spr-frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 2px; font-size: .88em; line-height: 1.12; }
.bb-root .spr-num { padding: 0 3px 1px; border-bottom: 1.5px solid currentColor; }
.bb-root .spr-den { padding: 1px 3px 0; }

.bb-spr-dir { max-width: 54em; padding: 24px 28px 48px 24px; font-family: var(--bb-serif); font-size: var(--bb-content-size); line-height: var(--bb-content-lh); }
.bb-spr-dir-title { margin: 0 0 12px; font-family: var(--bb-sans); font-size: 18px; font-weight: 700; }
.bb-spr-dir-list { margin: 0 0 18px; padding-left: 1.3em; }
.bb-spr-dir-list li { margin-bottom: 6px; }
.bb-spr-examples { width: 100%; border-collapse: collapse; font-family: var(--bb-sans); font-size: 14px; line-height: 1.4; text-align: center; }
.bb-spr-examples caption { padding: 6px 0 8px; font-size: 14px; font-weight: 700; letter-spacing: .06em; text-align: center; }
.bb-spr-examples th,
.bb-spr-examples td { padding: 8px 6px; border: 1px solid var(--bb-ink); vertical-align: middle; }
.bb-spr-examples th { font-size: 13px; font-weight: 700; }
.bb-spr-ex-answer { font-family: var(--bb-serif); font-size: 17px; }

/* Admin preview answer key */
.bb-choice-row.is-key .bb-choice { border-color: var(--bb-key); box-shadow: inset 0 0 0 2px var(--bb-key); }
.bb-choice-row.is-key.is-selected .bb-choice { box-shadow: inset 0 0 0 2px var(--bb-blue), 0 0 0 2px var(--bb-key); }
.bb-choice-row.is-key .bb-choice::before {
  content: "Correct";
  position: absolute;
  top: -10px;
  right: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--bb-key);
  color: #fff;
  font: 700 11px/1 var(--bb-sans);
  letter-spacing: .02em;
}
.bb-key { margin-top: 24px; padding: 14px 16px; border: 1px solid #BFD8C7; border-radius: 8px; background: #F3FAF5; font-size: 15px; line-height: 1.5; }
.bb-key-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 8px; }
.bb-key-badge { padding: 5px 8px; border-radius: 4px; background: var(--bb-key); color: #fff; font: 700 11.5px/1 var(--bb-sans); letter-spacing: .06em; text-transform: uppercase; }
.bb-key-meta { font-size: 13px; color: #44524A; }
.bb-key-answer { margin: 0 0 6px; }
.bb-key-sub { margin: 10px 0 4px; font-weight: 700; }
.bb-key-expl { font-family: var(--bb-serif); }
.bb-key-none { margin: 0; color: #555; }

/* Zoomable figures */
.bb-root .bb-zoomable { cursor: zoom-in; }
.bb-root .bb-zoomable:focus-visible { outline: 2px solid var(--bb-blue); outline-offset: 3px; }

/* ───────────── Review page ───────────── */
.bb-pane-review { position: absolute; top: 0; right: 0; bottom: 0; left: 0; }
.bb-review-inner { max-width: 840px; margin: 0 auto; padding: 28px 20px 56px; text-align: center; }
.bb-review-title { margin: 0 0 14px; font-size: 30px; font-weight: 400; }
.bb-review-text { max-width: 640px; margin: 0 auto 26px; font-size: 16.5px; line-height: 1.5; }
.bb-review-text p { margin: 0 0 4px; }
.bb-review-card {
  max-width: 760px;
  margin: 0 auto;
  padding: 22px 32px 34px;
  border-radius: 8px;
  background: #fff;
  text-align: left;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .14), 0 0 0 1px rgba(0, 0, 0, .04);
}
.bb-review-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; }
.bb-review-card-title { margin: 0; font-size: 18px; font-weight: 700; }
.bb-review-rule { height: 1px; margin: 16px 0 28px; background: #BDBDBD; }

/* Question grids (navigator + review) */
.bb-qgrid { display: grid; }
.bb-qgrid-review { grid-template-columns: repeat(10, 40px); gap: 30px 28px; justify-content: center; }
.bb-qgrid-nav { grid-template-columns: repeat(10, 32px); gap: 26px 14px; justify-content: center; padding: 20px 4px 4px; }
.bb-qcell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 40px;
  padding: 0;
  border: 1px dashed #393939;
  border-radius: 2px;
  background: #fff;
  color: var(--bb-blue);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.bb-qgrid-nav .bb-qcell { height: 32px; }
.bb-qcell.is-answered { border: 1px solid var(--bb-blue); background: var(--bb-blue); color: #fff; }
.bb-qcell.is-current .bb-qcell-num { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.bb-qcell-pin { position: absolute; top: -22px; left: 50%; display: flex; color: var(--bb-ink); transform: translateX(-50%); pointer-events: none; }
.bb-qcell-flag { position: absolute; top: -6px; right: -5px; display: flex; color: var(--bb-red); pointer-events: none; }

.bb-legend { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 26px; font-size: 15px; }
.bb-legend-item { display: inline-flex; align-items: center; gap: 7px; }
.bb-legend-icon { display: inline-flex; }
.bb-legend-pin { color: var(--bb-ink); }
.bb-legend-flag { color: var(--bb-red); }

/* ───────────── Popovers / sheets ───────────── */
.bb-layer-catcher { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 94; background: transparent; }
.bb-layer-catcher.is-dim { background: rgba(30, 30, 30, .45); animation: bb-fade-in .15s ease; }
.bb-layer { position: absolute; z-index: 95; background: #fff; color: var(--bb-ink); }
.bb-layer.is-pop { border-radius: 10px; box-shadow: 0 8px 32px rgba(0, 0, 0, .25), 0 0 0 1px rgba(0, 0, 0, .06); animation: bb-fade-in .12s ease; }
.bb-layer-scroll { overflow: auto; overscroll-behavior: contain; border-radius: inherit; }
.bb-layer-caret {
  position: absolute;
  width: 18px;
  height: 18px;
  background: #fff;
  transform: translateX(-50%) rotate(45deg);
  pointer-events: none;
}
.bb-layer.is-above .bb-layer-caret { bottom: -8px; box-shadow: 3px 3px 4px rgba(0, 0, 0, .08); }
.bb-layer.is-below .bb-layer-caret { top: -8px; box-shadow: -2px -2px 3px rgba(0, 0, 0, .05); }
.bb-nav-layer.is-pop { width: min(520px, calc(100% - 16px)); }
.bb-more-layer.is-pop { width: 290px; }
.bb-layer.is-sheet {
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  max-height: 84%;
  padding-bottom: var(--bb-safe-b);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, .2);
  transition: transform .22s ease;
}
.bb-layer.is-sheet .bb-layer-scroll { flex: 1 1 auto; min-height: 0; }
.bb-layer.is-sheet.is-entering { transform: translateY(100%); }
.bb-layer.is-sheet.is-dragging { transition: none; }
.bb-sheet-grip { flex: none; display: flex; justify-content: center; padding: 10px 0 6px; cursor: grab; touch-action: none; }
.bb-sheet-grip span { width: 40px; height: 5px; border-radius: 3px; background: #C4C4C4; }

.bb-nav { padding: 18px 22px 20px; }
.bb-nav-head { position: relative; padding: 0 40px; text-align: center; }
.bb-nav-title { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.3; }
.bb-nav-x {
  position: absolute;
  top: -8px;
  right: -12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}
.bb-nav-rule { height: 1px; margin: 14px 0; background: #BDBDBD; }
.bb-nav-foot { display: flex; justify-content: center; margin-top: 22px; }
.bb-nav-review { min-height: 34px; padding: 0 20px; font-size: 15px; }

.bb-more-title { display: none; }
.bb-layer.is-sheet .bb-more-title { display: block; margin: 2px 20px 4px; font-size: 17px; font-weight: 700; }
.bb-menu { display: flex; flex-direction: column; padding: 8px 0; }
.bb-menu-item {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 54px;
  padding: 0 20px;
  border: 0;
  background: none;
  font-size: 16.5px;
  text-align: left;
  color: var(--bb-ink);
  cursor: pointer;
}
.bb-menu-item:focus-visible { outline: 2px solid var(--bb-blue); outline-offset: -2px; background: #F0F3FA; }
.bb-menu-icon { display: flex; justify-content: center; width: 24px; flex: none; }
.bb-menu-label { flex: 1 1 auto; }
.bb-menu-check { display: flex; width: 20px; color: var(--bb-blue); }

/* Bubbles (ABC tip, 5-minute alert) */
.bb-bubble {
  position: absolute;
  z-index: 96;
  max-width: min(320px, calc(100% - 16px));
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--bb-tooltip);
  color: #fff;
  font-size: 15px;
  line-height: 1.35;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
  pointer-events: none;
  animation: bb-fade-in .15s ease;
}
.bb-bubble-arrow { position: absolute; width: 12px; height: 12px; background: inherit; transform: translateX(-50%) rotate(45deg); }
.bb-bubble.is-below .bb-bubble-arrow { top: -5px; }
.bb-bubble.is-above .bb-bubble-arrow { bottom: -5px; }
.bb-bubble > span:first-child { position: relative; z-index: 1; }
.bb-timer-bubble { background: var(--bb-ink); font-weight: 700; white-space: nowrap; }

/* ───────────── Directions panel ───────────── */
.bb-dir-overlay {
  position: absolute;
  top: 107px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 97;
  display: flex;
  flex-direction: column;
  padding: 14px 40px 24px;
  background: rgba(30, 30, 30, .84);
  animation: bb-fade-in .15s ease;
}
.bb-dir-card {
  position: relative;
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  max-height: 100%;
  min-height: 0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .4);
}
.bb-dir-caret { position: absolute; top: -8px; width: 18px; height: 18px; border-radius: 2px; background: #fff; transform: rotate(45deg); }
.bb-dir-scroll { position: relative; flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 28px 36px 10px; }
.bb-dir-actions { flex: none; display: flex; justify-content: flex-end; padding: 14px 28px 22px; }
.bb-dir-heading { margin: 0 0 14px; font-size: 19px; font-weight: 500; letter-spacing: .02em; }
/* Our notice (not SAT text): after the directions, visibly separate. */
.bb-dir-notice { margin: 18px 0 4px; padding: 10px 14px; border: 1px solid #E3CC64; border-radius: 6px; background: #FFF7D1; font-size: 15px; line-height: 1.45; }
.bb-dir-section { font-family: var(--bb-serif); font-size: var(--bb-content-size); line-height: var(--bb-content-lh); }
.bb-dir-section p { margin: 0 0 12px; }
.bb-dir-section ul { margin: 0 0 14px; padding-left: 1.3em; }
.bb-dir-section li { margin-bottom: 4px; }
.bb-dir-section .bb-spr-examples { max-width: 640px; margin-top: 6px; }

/* ───────────── Buttons ───────────── */
.bb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.bb-btn:disabled { opacity: .6; cursor: default; }
.bb-btn-yellow { border-color: var(--bb-ink); background: var(--bb-yellow); color: var(--bb-ink); }
.bb-btn-blue { background: var(--bb-blue); color: #fff; }
.bb-btn-outline { border-color: var(--bb-blue); background: #fff; color: var(--bb-blue); }
.bb-btn-link { min-height: 40px; padding: 0 6px; border: 0; background: none; color: var(--bb-blue); text-decoration: underline; text-underline-offset: 3px; }
.bb-btn-lg { min-height: 46px; padding: 0 30px; font-size: 16.5px; }

/* ───────────── Dialogs ───────────── */
.bb-dialog-scrim {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 16px calc(16px + var(--bb-safe-b));
  background: rgba(30, 30, 30, .62);
  animation: bb-fade-in .15s ease;
}
.bb-dialog {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 100%;
  overflow: auto;
  padding: 32px 32px 26px;
  border-radius: 12px;
  background: #fff;
  color: var(--bb-ink);
  box-shadow: 0 16px 48px rgba(0, 0, 0, .35);
}
.bb-dialog-x {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}
.bb-dialog-alert {
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--bb-red);
  color: #fff;
  font: 700 26px/44px var(--bb-sans);
  text-align: center;
}
.bb-dialog-title { margin: 0 0 14px; padding-right: 32px; font-size: 24px; font-weight: 700; }
.bb-dialog.is-alert .bb-dialog-title { padding: 0 32px; text-align: center; }
.bb-dialog-body { font-size: 16px; line-height: 1.55; }
.bb-dialog-body p { margin: 0 0 12px; }
.bb-dialog-body p:last-child { margin-bottom: 0; }
.bb-dialog-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px 20px; margin-top: 24px; }
.bb-submit-steps { margin: 4px 0 14px; padding-left: 1.4em; }
.bb-submit-steps li { margin-bottom: 8px; }
.bb-submit-steps strong { display: block; }
.bb-submit-detail { margin: 0 0 6px; font-size: 13.5px; color: var(--bb-red); }
.bb-submit-detail:empty { display: none; }
.bb-submit-status { margin: 0; font-size: 14px; color: #555; }

/* ───────────── Screens ───────────── */
.bb-screen { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 100; overflow: auto; -webkit-overflow-scrolling: touch; }
.bb-loading,
.bb-transition {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #fff;
  text-align: center;
}
.bb-loader { display: inline-flex; gap: 8px; margin-bottom: 22px; }
.bb-loader span { width: 10px; height: 10px; border-radius: 50%; background: var(--bb-blue); animation: bb-dot 1s infinite ease-in-out; }
.bb-loader span:nth-child(2) { animation-delay: .15s; }
.bb-loader span:nth-child(3) { animation-delay: .3s; }
.bb-loading-text { margin: 0; font-size: 16px; color: #3A3A3A; }
.bb-transition-inner { max-width: 560px; }
.bb-transition-title { margin: 0 0 12px; font-size: 30px; font-weight: 400; }
.bb-transition-text { margin: 0; font-size: 17px; line-height: 1.55; color: #2B2B2B; }

.bb-message { display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--bb-bar); }
.bb-message-card { width: 100%; max-width: 520px; padding: 32px 28px; border-radius: 12px; background: #fff; text-align: center; box-shadow: 0 2px 14px rgba(0, 0, 0, .12); }
.bb-message-icon { width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 50%; background: var(--bb-red); color: #fff; font: 700 28px/48px var(--bb-sans); }
.bb-message-title { margin: 0 0 10px; font-size: 24px; font-weight: 500; }
.bb-message-text { margin: 0 0 22px; font-size: 16px; line-height: 1.5; color: #3A3A3A; }
.bb-message-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; width: 100%; }

.bb-timesup {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 104;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(30, 30, 30, .72);
  animation: bb-fade-in .2s ease;
}
.bb-timesup-card { max-width: 360px; padding: 28px 36px; border-radius: 12px; background: #fff; text-align: center; box-shadow: 0 16px 48px rgba(0, 0, 0, .35); }
.bb-timesup-icon { display: inline-flex; margin-bottom: 8px; color: var(--bb-timer-red); }
.bb-timesup-title { margin: 0 0 6px; font-size: 26px; font-weight: 700; }
.bb-timesup-text { margin: 0; font-size: 16px; color: #3A3A3A; }

/* Break (research §10.2) */
.bb-break { display: flex; flex-direction: column; background: var(--bb-ink); color: #fff; }
.bb-ubreak { z-index: 102; }
.bb-break-grid {
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: 52% minmax(0, 1fr);
  align-items: center;
  padding: calc(48px + var(--bb-safe-t)) 48px 24px 0;
}
.bb-break-left { display: flex; align-items: center; justify-content: center; padding: 0 24px; }
.bb-break-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 274px;
  min-height: 128px;
  padding: 14px 16px;
  border: 1px solid #fff;
  border-radius: 8px;
}
.bb-break-box-label { margin-bottom: 4px; font-size: 20px; font-weight: 700; }
.bb-break-clock { font-size: 72px; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bb-break-right { max-width: 580px; }
.bb-break-title { margin: 0 0 18px; font-size: 32px; font-weight: 500; }
.bb-break-lead { margin: 0 0 18px; font-size: 20px; line-height: 1.45; }
.bb-break-rules-title { margin: 0 0 8px; font-size: 18px; }
.bb-break-rules { margin: 0 0 26px; padding-left: 1.4em; font-size: 17px; line-height: 1.5; }
.bb-break-rules li { margin-bottom: 6px; }
.bb-break-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.bb-break-note { margin: 0; font-size: 14px; color: #CFCFCF; }
.bb-break-name { flex: none; padding: 0 24px calc(24px + var(--bb-safe-b)) 48px; font-size: 20px; font-weight: 500; }
.bb-break .bb-btn:focus-visible { outline-color: #fff; }

/* Finish screens (research §10.3) */
.bb-finish { display: flex; flex-direction: column; background: #fff; }
.bb-finish-bar {
  flex: none;
  display: flex;
  align-items: center;
  min-height: 64px;
  padding: calc(10px + var(--bb-safe-t)) 24px 10px;
  background: linear-gradient(to bottom, var(--bb-bar) calc(100% - 18px), var(--bb-bar-2));
}
.bb-finish-bar-title { font-size: 19px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-finish-main { flex: 1 0 auto; display: flex; flex-direction: column; align-items: center; padding: 40px 16px 28px; text-align: center; }
.bb-finish-title { margin: 0 0 24px; font-size: 28px; font-weight: 400; }
.bb-finish-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
  max-width: 520px;
  padding: 28px 28px 30px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .14), 0 0 0 1px rgba(0, 0, 0, .05);
}
.bb-finish-art { display: block; max-width: 100%; height: auto; }
.bb-finish-text { margin: 0; font-size: 17px; line-height: 1.5; }
.bb-finish-home { margin-top: 18px; }
.bb-finish-foot { flex: none; padding: 14px 24px calc(14px + var(--bb-safe-b)); background: var(--bb-bar); font-size: 18px; font-weight: 500; }

.bb-pv-card { max-width: 640px; }
.bb-pv-table-wrap { width: 100%; overflow-x: auto; }
.bb-pv-table { width: 100%; border-collapse: collapse; font-size: 14.5px; text-align: left; }
.bb-pv-table th,
.bb-pv-table td { padding: 10px 8px; border-bottom: 1px solid #E3E3E3; vertical-align: top; }
.bb-pv-table thead th { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #555; white-space: nowrap; }
.bb-pv-table tbody th { font-weight: 500; }
.bb-pv-table td { white-space: nowrap; font-variant-numeric: tabular-nums; }
.bb-pv-variant { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: var(--bb-bar); font-size: 11.5px; font-weight: 700; }
.bb-pv-jump { width: 100%; margin-top: 6px; text-align: left; }
.bb-pv-jump-title { margin: 0 0 10px; font-size: 15px; font-weight: 700; text-align: center; }
.bb-pv-jump-list { display: flex; flex-direction: column; gap: 8px; }
.bb-pv-jump-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border: 1px solid #C7CDD8;
  border-radius: 8px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}
.bb-pv-jump-label { font-size: 15px; font-weight: 700; }
.bb-pv-jump-sub { font-size: 13px; color: #555; }

/* ───────────── Figure zoom viewer ───────────── */
.bb-zoom { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 100; display: flex; flex-direction: column; background: rgba(20, 20, 20, .94); animation: bb-fade-in .15s ease; }
.bb-zoom-stage { position: relative; flex: 1 1 auto; overflow: hidden; touch-action: none; cursor: grab; }
.bb-zoom-stage:active { cursor: grabbing; }
.bb-zoom-content { position: absolute; top: 0; left: 0; transform-origin: 0 0; border-radius: 4px; background: #fff; box-shadow: 0 8px 30px rgba(0, 0, 0, .5); }
.bb-zoom-content img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; }
.bb-zoom-content svg { display: block; pointer-events: none; }
.bb-zoom-toolbar { position: absolute; top: calc(12px + var(--bb-safe-t)); right: calc(12px + var(--bb-safe-r)); display: flex; gap: 8px; }
.bb-zoom-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .95);
  color: var(--bb-ink);
  cursor: pointer;
}
.bb-zoom-close {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 16px 0 12px;
  border: 1px solid var(--bb-ink);
  border-radius: 999px;
  background: var(--bb-yellow);
  color: var(--bb-ink);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.bb-zoom-hint {
  position: absolute;
  bottom: calc(14px + var(--bb-safe-b));
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  color: #DDD;
  white-space: nowrap;
  pointer-events: none;
}

/* ───────────── Hover (pointer devices only, no sticky hover on phones) ───────────── */
@media (hover: hover) {
  .bb-dir-btn:hover > span:first-child { text-decoration: underline; }
  .bb-timer-toggle:hover { background: #F2F2F2; }
  .bb-tool:hover .bb-tool-label { text-decoration: underline; text-underline-offset: 2px; }
  .bb-qnav-btn:hover { background: #000; }
  .bb-pill:hover { background: var(--bb-blue-dark); }
  .bb-expand:hover { color: var(--bb-ink); }
  .bb-split.is-horizontal .bb-divider:hover .bb-divider-line { background: #9A9A9A; }
  .bb-mark:hover .bb-mark-label { text-decoration: underline; text-underline-offset: 3px; }
  .bb-choice:hover { border-color: #000; }
  .bb-choice-row.is-selected .bb-choice:hover { border-color: var(--bb-blue); }
  .bb-elim:hover .bb-elim-letter { background: #F0F0F0; }
  .bb-qcell:hover { box-shadow: 0 0 0 2px rgba(50, 77, 199, .35); }
  .bb-nav-x:hover, .bb-dialog-x:hover { background: #F0F0F0; }
  .bb-menu-item:hover { background: #F0F3FA; }
  .bb-btn-yellow:hover:not(:disabled) { background: var(--bb-yellow-dark); }
  .bb-btn-blue:hover:not(:disabled) { background: var(--bb-blue-dark); }
  .bb-btn-outline:hover:not(:disabled) { background: #F0F3FC; }
  .bb-btn-link:hover:not(:disabled) { color: var(--bb-blue-dark); }
  .bb-pv-jump-btn:hover { border-color: var(--bb-blue); background: #F5F7FD; }
  .bb-zoom-btn:hover { background: #fff; }
}

/* ───────────── Tablets / small laptops (760–1023px) ───────────── */
@media (max-width: 1023.98px) {
  .bb-root { --bb-header-h: 72px; --bb-footer-h: 66px; }
  .bb-header { padding: calc(12px + var(--bb-safe-t)) 16px 0; column-gap: 10px; }
  .bb-title { font-size: 17px; line-height: 22px; }
  .bb-h-left { gap: 8px; }
  /* A title too long for one line (set by the runner after measuring) wraps to two lines instead of being
     cut off; tighter metrics keep the title + Directions inside the 72px header. */
  .bb-header.is-title-wrap { padding-top: calc(9px + var(--bb-safe-t)); }
  .bb-header.is-title-wrap .bb-h-left { gap: 3px; }
  .bb-header.is-title-wrap .bb-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    white-space: normal;
    line-height: 20px;
  }
  .bb-header.is-title-wrap .bb-dir-btn { min-height: 20px; padding-top: 0; padding-bottom: 0; line-height: 20px; }
  .bb-h-center { gap: 7px; }
  .bb-h-right { gap: 6px; }
  .bb-tool { min-width: 46px; }
  .bb-tool-label { font-size: 11px; }
  .bb-footer { padding: 0 20px var(--bb-safe-b) 24px; }
  .bb-student { font-size: 17px; }
  .bb-passage { padding: 20px 22px 40px 20px; }
  .bb-question { padding: 20px 24px 40px; }
  .bb-spr-dir { padding: 20px 20px 40px; }
  .bb-review-card { padding: 20px 22px 28px; }
  .bb-qgrid-review { gap: 24px 18px; }
  .bb-dir-overlay { padding: 12px 20px 20px; }
  .bb-dir-scroll { padding: 24px 26px 8px; }
  .bb-break-grid { padding-right: 28px; }
  .bb-break-title { font-size: 28px; }
}

/* ───────────── Compact chrome: phones (portrait) and short landscape screens ───────────── */
@media (max-width: 759.98px), (max-height: 500px) {
  .bb-root { --bb-header-h: 60px; --bb-footer-h: 60px; --bb-banner-h: 20px; }
  .bb-header {
    align-items: center;
    padding: calc(4px + var(--bb-safe-t)) 8px 4px 12px;
    column-gap: 6px;
    background: linear-gradient(to bottom, var(--bb-bar) 0, var(--bb-bar) calc(100% - 14px), var(--bb-bar-2) 100%);
  }
  .bb-h-left { gap: 1px; }
  .bb-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    white-space: normal;
    font-size: 12.5px;
    line-height: 15px;
    overflow: hidden;
  }
  .bb-dir-btn { min-height: 20px; gap: 3px; padding: 1px 2px; font-size: 12px; }
  .bb-dir-btn::after { top: -12px; right: -10px; bottom: -12px; left: -10px; } /* 44px tall touch target */
  .bb-dir-btn .bb-chev svg { width: 12px; height: 12px; }
  .bb-h-center { gap: 3px; min-width: 62px; padding-top: 0; }
  .bb-timer { height: 22px; font-size: 18px; line-height: 22px; }
  .bb-timer-icon svg { width: 20px; height: 20px; }
  .bb-timer-toggle { min-width: 40px; height: 18px; padding: 0 9px; font-size: 10.5px; }
  .bb-timer-toggle::after { top: -12px; right: -8px; bottom: -14px; left: -8px; }
  .bb-h-right { gap: 0; }
  .bb-tool { justify-content: center; width: 44px; min-width: 40px; height: 44px; padding: 0; }
  .bb-tool-label { display: none; }
  .bb-tool-icon { height: auto; }
  .bb-tool.is-active::after { content: ""; position: absolute; left: 9px; right: 9px; bottom: 3px; height: 2px; border-radius: 1px; background: var(--bb-ink); }
  .bb-banner { font-size: 10px; letter-spacing: .06em; }
  .bb-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 10px var(--bb-safe-b); }
  .bb-f-left { display: none; }
  .bb-f-center { justify-content: flex-start; }
  .bb-qnav-btn { height: 42px; padding: 0 10px 0 12px; gap: 6px; font-size: 13.5px; }
  .bb-f-right { gap: 8px; }
  .bb-pill { min-width: 66px; height: 44px; padding: 0 16px; font-size: 15px; }
  /* The overlay spans .bb-test's padding box, so it adds the notch / home-indicator insets itself. */
  .bb-dir-overlay { padding: 10px max(8px, var(--bb-safe-r)) calc(8px + var(--bb-safe-b)) max(8px, var(--bb-safe-l)); }
  .bb-dir-scroll { padding: 18px 16px 6px; }
  .bb-dir-actions { padding: 10px 14px 14px; }
  .bb-dir-actions .bb-btn { min-height: 44px; }
  .bb-dir-heading { font-size: 17px; }
}

/* ───────────── Phones (portrait) ───────────── */
@media (max-width: 759.98px) {
  .bb-root { --bb-content-size: 16px; } /* 16/25.6: same 1.6 ratio, readable on a phone */
  .bb-passage { padding: 14px 16px 28px; }
  .bb-question { padding: 12px 14px 32px; }
  .bb-single-col { padding: 12px 14px 36px; }
  .bb-spr-dir { padding: 12px 16px 24px; }
  .bb-spr-dir-title { font-size: 16px; }
  .bb-spr-examples { font-size: 13px; }
  .bb-spr-examples th { font-size: 12px; }
  .bb-qbar { margin-bottom: 12px; }
  .bb-mark { padding: 0 8px; font-size: 13.5px; }
  .bb-abc { width: 34px; height: 28px; margin-right: 5px; }
  .bb-choices { gap: 12px; }
  .bb-choice-row { gap: 0; }
  .bb-choice { min-height: 50px; padding: 10px 12px 10px 10px; }
  .bb-choice-letter { margin-right: 12px; }
  .bb-choices.is-elim-mode .bb-choice { padding-right: 56px; }
  .bb-elim {
    position: absolute;
    top: 50%;
    right: 4px;
    z-index: 2;
    width: 48px;
    min-height: 44px;
    transform: translateY(-50%);
  }
  .bb-choice-row.is-eliminated .bb-elim-undo { padding: 2px 4px; border-radius: 4px; background: #fff; }
  .bb-spr-input { width: 100%; max-width: 240px; }
  .bb-test.is-spr-focus .bb-split-spr.is-vertical > .bb-pane-a,
  .bb-test.is-spr-focus .bb-split-spr.is-vertical > .bb-divider { display: none; }

  .bb-review-inner { padding: 18px 12px 32px; }
  .bb-review-title { margin-bottom: 10px; font-size: 24px; }
  .bb-review-text { margin-bottom: 18px; font-size: 15px; }
  .bb-review-card { padding: 16px 14px 22px; }
  .bb-review-card-head { flex-direction: column; align-items: flex-start; }
  .bb-review-card-title { font-size: 16px; }
  .bb-review-rule { margin: 12px 0 22px; }
  .bb-qgrid-review { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px 12px; }
  .bb-qgrid-review .bb-qcell { height: 44px; }
  .bb-qgrid-nav { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 28px 12px; padding: 22px 2px 4px; }
  .bb-qgrid-nav .bb-qcell { height: 44px; }
  .bb-legend { gap: 6px 16px; font-size: 13.5px; }
  .bb-nav { padding: 4px 16px 16px; }
  .bb-nav-head { padding: 0 40px 0 0; text-align: left; }
  .bb-nav-title { font-size: 16px; }
  .bb-nav-x { top: -10px; right: -8px; }
  .bb-nav-review { width: 100%; max-width: 320px; min-height: 44px; }
  .bb-menu-item { min-height: 54px; }

  .bb-dialog { padding: 26px 20px 20px; }
  .bb-dialog-title { font-size: 20px; }
  .bb-dialog-actions { gap: 10px; }
  .bb-dialog-actions .bb-btn { flex: 1 1 auto; min-height: 46px; }

  .bb-break-grid { grid-template-columns: minmax(0, 1fr); align-items: start; gap: 26px; padding: calc(28px + var(--bb-safe-t)) 18px 16px; }
  .bb-break-left { padding: 0; }
  .bb-break-box { width: 100%; max-width: 300px; min-height: 112px; }
  .bb-break-box-label { font-size: 17px; }
  .bb-break-clock { font-size: 56px; }
  .bb-break-title { font-size: 24px; }
  .bb-break-lead { font-size: 16.5px; }
  .bb-break-rules-title { font-size: 16px; }
  .bb-break-rules { font-size: 15.5px; }
  .bb-break-actions { align-items: stretch; width: 100%; }
  .bb-break-actions .bb-btn { min-height: 48px; }
  .bb-break-name { padding: 0 18px calc(18px + var(--bb-safe-b)); font-size: 16px; }

  .bb-finish-bar { min-height: 52px; padding-left: 16px; padding-right: 16px; }
  .bb-finish-bar-title { font-size: 15px; }
  .bb-finish-main { padding: 26px 14px 20px; }
  .bb-finish-title { font-size: 24px; }
  .bb-finish-card { padding: 22px 16px 24px; }
  .bb-finish-card .bb-btn { width: 100%; }
  .bb-finish-foot { font-size: 15px; }
  .bb-transition-title { font-size: 24px; }
  .bb-transition-text { font-size: 15.5px; }
  .bb-message-actions .bb-btn { flex: 1 1 auto; min-height: 46px; }
  .bb-zoom-hint { white-space: normal; width: calc(100% - 32px); text-align: center; }
}

@media (max-width: 340px) {
  .bb-qgrid-review,
  .bb-qgrid-nav { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .bb-qnav-btn { font-size: 12.5px; padding: 0 8px 0 10px; }
  .bb-pill { min-width: 58px; padding: 0 12px; }
}

/* Short landscape screens (phones included: only portrait phones stack the split, env.js STACK_MQ)
   keep the side-by-side split but need tighter content. */
@media (max-height: 500px) and (orientation: landscape) {
  .bb-passage, .bb-question, .bb-spr-dir { padding-top: 14px; }
  .bb-single-col { padding-top: 14px; }
  .bb-split.is-horizontal > .bb-divider { margin: 4px 0 6px; }
  .bb-split.is-horizontal .bb-expand { top: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .bb-root *,
  .bb-root *::before,
  .bb-root *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .bb-loader span { animation: none !important; opacity: .85; }
}

/* Headings/regions focused programmatically (tabindex=-1) for screen readers don't need a visible ring. */
.bb-root [tabindex="-1"]:focus:not(:focus-visible) { outline: none; }
.bb-root h1[tabindex="-1"]:focus, .bb-root h2[tabindex="-1"]:focus, .bb-root h3[tabindex="-1"]:focus { outline: none; }

