/* =====================================================================
   LAYOUT — header, frame, hero, grids, footer, test/review surfaces
   Editorial split hero, single-column frame, persistent header.
   ===================================================================== */

/* Persistent header ------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(242, 244, 236, 0.92);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(11, 23, 36, 0.08);
}
.header-inner {
  max-width: var(--frame-wide);
  margin: 0 auto;
  height: var(--header-h);
  padding: 0 var(--space-5);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-6);
  align-items: center;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-18);
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { color: var(--ink); text-decoration: none; }
.brand-mark {
  width: 40px; height: 40px;
  flex: 0 0 40px;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--navy);
  color: var(--paper-bright);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.brand-mark svg { display: block; width: 100%; height: 100%; }
.brand-label { display: inline-flex; flex-direction: column; gap: 3px; min-width: 0; }
.brand-label > span { line-height: 1; }
.brand-label small {
  color: var(--slate);
  font-family: var(--font-sans);
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}
.site-footer .brand-label small { color: rgba(251, 252, 247, 0.68); }

.primary-nav {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
}
.primary-nav a {
  padding: 8px 14px;
  border-radius: 6px;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: var(--fs-15);
  text-decoration: none;
  transition: background var(--motion-fast), color var(--motion-fast);
}
.primary-nav a:hover { background: var(--paper-deep); color: var(--ink); text-decoration: none; }
.primary-nav a[aria-current="page"] { color: var(--ink); background: var(--paper-deep); }

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
.mobile-nav-only { display: none; }
.primary-nav .mobile-nav-action {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.nav-toggle {
  display: none;
}
@media (max-width: 820px) {
  .header-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-3);
  }
  .brand { grid-column: 1; grid-row: 1; align-self: center; }
  .header-actions { display: none; }
  .primary-nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    background: var(--paper);
    border-bottom: 1px solid rgba(11, 23, 36, 0.08);
    padding: var(--space-5);
    flex-direction: column;
    align-items: stretch;
    transform: translateY(-110%);
    transition: transform var(--motion);
    gap: 0;
    grid-column: 1 / -1;
  }
  .primary-nav[data-open="true"] { transform: translateY(0); }
  .primary-nav a { padding: var(--space-3) var(--space-4); border-radius: 8px; font-size: var(--fs-18); }
  .primary-nav .mobile-nav-only { display: block; }
  .primary-nav .mobile-nav-action { width: 100%; padding: var(--space-3) var(--space-4); border-radius: 8px; font-size: var(--fs-18); }
  .primary-nav .mobile-nav-action:hover { background: var(--paper-deep); color: var(--ink); }
  .nav-toggle {
    display: inline-flex;
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    width: 44px; height: 44px;
    align-items: center; justify-content: center;
    background: transparent;
    border: 1px solid rgba(11, 23, 36, 0.16);
    border-radius: 8px;
    cursor: pointer;
  }
  .nav-toggle::before {
    content: '';
    width: 18px; height: 2px;
    background: var(--ink);
    box-shadow: 0 -6px 0 var(--ink), 0 6px 0 var(--ink);
  }
}

/* Site main + frame ----------------------------------------------------- */
.site-main {
  outline: none;
}
.site-main:focus { outline: none; }

.frame { max-width: var(--frame); margin: 0 auto; padding: 0 var(--space-5); }
.frame-wide { max-width: var(--frame-wide); margin: 0 auto; padding: 0 var(--space-5); }

/* Editorial hero (catalog landing) -------------------------------------- */
.hero {
  padding: var(--space-9) 0 var(--space-8);
  position: relative;
}
.hero-grid {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: var(--space-7);
  align-items: end;
}
@media (max-width: 920px) { .hero-grid { grid-template-columns: 1fr; gap: var(--space-6); } }

.hero h1 {
  font-size: clamp(2.5rem, 5vw + 1rem, 5rem);
  letter-spacing: -0.035em;
  line-height: 1.04;
  margin-bottom: var(--space-4);
  font-weight: 600;
}
.hero .lede {
  font-size: var(--fs-20);
  color: var(--ink-soft);
  max-width: 56ch;
  line-height: 1.55;
}
.hero .lede strong { color: var(--ink); }

.hero-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: var(--space-5);
}

.hero-side {
  border-left: var(--rule);
  padding-left: var(--space-5);
  font-family: var(--font-display);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
@media (max-width: 920px) {
  .hero-side { border-left: 0; border-top: var(--rule); padding: var(--space-5) 0 0; }
}
.score-poster {
  position: relative;
  overflow: hidden;
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--ink);
  color: var(--paper-bright);
  box-shadow: 10px 10px 0 rgba(23, 58, 89, 0.14);
}
.score-poster::after {
  content: '';
  position: absolute;
  width: 180px;
  height: 180px;
  right: -86px;
  top: -86px;
  border: 1px solid rgba(251, 252, 247, 0.24);
  border-radius: 50%;
  box-shadow: 0 0 0 22px rgba(251, 252, 247, 0.04), 0 0 0 44px rgba(251, 252, 247, 0.04);
}
.score-poster-top,
.score-poster-foot {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(251, 252, 247, 0.64);
}
.score-poster-score {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: var(--space-5) 0 var(--space-4);
}
.score-poster-score .number {
  font-family: var(--font-display);
  font-size: clamp(4rem, 8vw, 6.5rem);
  font-weight: 700;
  line-height: 0.88;
  letter-spacing: -0.08em;
}
.score-poster-score .label {
  max-width: 7ch;
  font-family: var(--font-display);
  font-size: var(--fs-18);
  line-height: 1.05;
  color: rgba(251, 252, 247, 0.78);
}
.score-poster-sections {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid rgba(251, 252, 247, 0.18);
}
.score-poster-section {
  display: grid;
  gap: 2px;
}
.score-poster-section .score-value {
  font-family: var(--font-display);
  font-size: var(--fs-24);
  font-weight: 600;
}
.score-poster-section .score-label {
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(251, 252, 247, 0.6);
}
.score-poster-foot {
  justify-content: flex-start;
  margin-top: var(--space-4);
  color: rgba(251, 252, 247, 0.52);
  letter-spacing: 0.08em;
}
.live-stat {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 8px;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid rgba(11, 23, 36, 0.14);
  border-radius: 999px;
  background: rgba(251, 252, 247, 0.64);
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--slate);
}
.live-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(47, 122, 86, 0.12);
}
.live-stat .live-value { color: var(--ink); font-weight: 700; }
.live-stat .live-note { color: var(--slate); letter-spacing: 0; text-transform: none; }
.hero-side-fact { margin-top: var(--space-2); }
.hero-side .glyph {
  font-size: var(--fs-72);
  line-height: 1;
  letter-spacing: -0.04em;
  font-weight: 600;
}
.hero-side .caption {
  font-family: var(--font-sans);
  font-size: var(--fs-13);
  color: var(--slate);
  margin-top: var(--space-3);
  letter-spacing: 0.04em;
}

/* Grids (page primitives) ---------------------------------------------- */
.grid-3 {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 920px) { .grid-3 { grid-template-columns: 1fr; } }

.grid-2 {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

/* Category rail */
.category-rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-5);
}
.category-rail button {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid rgba(11, 23, 36, 0.16);
  background: var(--paper-bright);
  color: var(--ink);
  font-weight: 500;
  font-size: var(--fs-14);
  white-space: nowrap;
}
.category-rail button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper-bright);
  border-color: var(--ink);
}

/* Editor + sidebar layout ---------------------------------------------- */
.workspace {
  display: grid;
  grid-template-columns: 14rem 1fr;
  gap: var(--space-7);
  padding: var(--space-7) 0;
}
.workspace-side {
  position: sticky;
  top: calc(var(--header-h) + var(--space-4));
  align-self: start;
  border-right: var(--rule-hair);
  padding-right: var(--space-5);
}
.workspace-side h4 {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--slate);
  margin-bottom: var(--space-4);
}
.workspace-side a {
  display: block;
  padding: 10px 0;
  font-size: var(--fs-15);
  color: var(--ink-soft);
  border-bottom: var(--rule-hair);
}
.workspace-side a:hover { color: var(--ink); text-decoration: none; }
.workspace-side a[aria-current="page"] { color: var(--ink); font-weight: 600; }
@media (max-width: 920px) {
  .workspace { grid-template-columns: 1fr; }
  .workspace-side { position: static; border-right: 0; border-bottom: var(--rule-hair); padding: 0 0 var(--space-5); }
}

/* Work area (test, review) ---------------------------------------------- */
.test-shell {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--header-h));
  background: #e8eef0;
}
.test-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-4);
  padding: 14px var(--space-6);
  border-bottom: 1px solid rgba(251, 252, 247, 0.16);
  background: var(--navy);
  color: var(--paper-bright);
}
.test-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--paper-bright);
}
.test-timer {
  font-family: var(--font-mono);
  font-size: var(--fs-20);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--paper-bright);
  padding: 8px 16px;
  border-radius: 999px;
  justify-self: center;
}
.test-header > .btn { justify-self: end; color: var(--paper-bright); border-color: var(--paper-bright); }
.test-header > .btn:hover { background: var(--paper-bright); color: var(--navy); }
.test-body {
  display: grid;
  grid-template-columns: 19rem minmax(0, 1fr);
  gap: var(--space-6);
  width: min(100%, 112rem);
  margin: 0 auto;
  padding: var(--space-5) var(--space-6) var(--space-7);
  flex: 1;
  min-height: 0;
}
@media (max-width: 920px) {
  .test-shell { min-height: calc(100vh - var(--header-h)); }
  .test-body { grid-template-columns: 1fr; overflow: visible; padding: var(--space-4); }
  .test-nav, .test-question { max-height: none; overflow: visible; }
}
.test-nav {
  background: var(--paper-bright);
  border: 1px solid rgba(11, 23, 36, 0.12);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  overflow-y: auto;
  max-height: 100%;
  min-width: 0;
  box-shadow: var(--shadow-sm);
}
.test-nav-header { display: flex; align-items: end; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.test-nav-header .eyebrow { margin-bottom: 6px; }
.test-nav-header h2 { font-size: var(--fs-24); }
.test-nav-count { color: var(--slate); font-family: var(--font-mono); font-size: var(--fs-13); white-space: nowrap; }
.test-focus-label { display: grid; gap: 6px; color: var(--slate); font-size: var(--fs-12); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.test-focus-select { padding: 10px 12px; font-size: var(--fs-14); }
.test-nav-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-top: var(--space-4); padding-bottom: var(--space-4); border-bottom: var(--rule-hair); }
.test-nav-filter { border: 1px solid var(--mist); border-radius: 999px; background: transparent; color: var(--ink-soft); padding: 7px 10px; font: inherit; font-size: var(--fs-12); font-weight: 700; cursor: pointer; transition: background var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast); }
.test-nav-filter:hover { border-color: var(--navy); color: var(--ink); }
.test-nav-filter[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper-bright); }
.test-nav-hint { margin: var(--space-4) 0 var(--space-3); color: var(--slate); font-size: var(--fs-13); }
.nav-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.nav-cell { position: relative; min-width: 0; min-height: 44px; display: flex; align-items: center; justify-content: center; border: 1px solid rgba(11, 23, 36, 0.18); border-radius: var(--radius-sm); background: var(--paper-bright); color: var(--ink); font: inherit; font-family: var(--font-mono); font-size: var(--fs-13); font-weight: 700; cursor: pointer; transition: background var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast), transform var(--motion-fast); }
.nav-cell:hover { border-color: var(--navy); transform: translateY(-1px); }
.nav-cell.answered { background: var(--sky); border-color: rgba(23, 58, 89, 0.28); }
.nav-cell.flagged { box-shadow: inset 0 -3px 0 var(--warn); }
.nav-cell.bookmarked { border-color: var(--navy); }
.nav-cell.current { background: var(--ink); border-color: var(--ink); color: var(--paper-bright); outline: 3px solid var(--sky); outline-offset: 2px; }
.nav-cell-number { line-height: 1; }
.nav-cell-markers { position: absolute; top: 5px; right: 5px; display: inline-flex; gap: 2px; color: var(--navy); }
.nav-cell.current .nav-cell-markers { color: var(--paper-bright); }
.nav-cell-markers .test-icon { width: 10px; height: 10px; }
.test-nav-empty { grid-column: 1 / -1; padding: var(--space-5) var(--space-3); border: 1px dashed var(--mist); border-radius: var(--radius-sm); color: var(--slate); font-size: var(--fs-13); text-align: center; }
.test-nav-legend { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-4); color: var(--slate); font-size: var(--fs-12); }
.test-nav-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--navy); }
.test-nav-legend .test-icon { width: 13px; height: 13px; }
.test-nav-controls { display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: 6px; margin-top: var(--space-5); }
.test-nav-controls .btn { min-width: 0; padding-left: 8px; padding-right: 8px; font-size: var(--fs-12); }
.test-submit { margin-top: var(--space-3); }
.test-question { background: var(--paper-bright); border: 1px solid var(--mist); border-radius: var(--radius-lg); padding: clamp(24px, 4vw, 56px); overflow-y: auto; max-height: 100%; min-width: 0; box-shadow: var(--shadow-sm); }
.question-stem { font-size: var(--fs-18); line-height: 1.6; max-width: 72ch; }
.question-stem p { margin-bottom: var(--space-5); }
.question-stem img, .question-stem svg, .question-stem canvas { max-width: 100%; margin: var(--space-3) 0; }
.question-stem .q-table { width: 100%; margin: var(--space-5) 0; border-collapse: collapse; font-size: var(--fs-16); }
.question-stem .q-table td, .question-stem .q-table th { padding: 10px 12px; border: 1px solid var(--mist); vertical-align: top; }
.question-text-region { user-select: text; -webkit-user-select: text; }
.choices { display: grid; gap: var(--space-3); margin: var(--space-6) 0 0; padding: 0; border: 0; min-width: 0; }
.choices legend { padding: 0; }

@media (max-width: 600px) {
  .test-header { grid-template-columns: minmax(0, 1fr) auto; padding: 12px var(--space-4); }
  .test-header > .btn { grid-column: 1 / -1; justify-self: stretch; }
  .test-question { padding: var(--space-5) var(--space-4); }
  .test-nav { padding: var(--space-4); }
  .test-nav-controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .choice-with-input { grid-template-columns: 22px 36px minmax(0, 1fr); gap: var(--space-3); padding: 14px 12px; }
  .choice:not(.choice-with-input) { grid-template-columns: 36px minmax(0, 1fr); }
  .choice-letter { width: 36px; height: 36px; }
}

.q-navigator {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 6px;
  margin-top: var(--space-3);
}
.q-navigator button {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid rgba(11, 23, 36, 0.16);
  background: var(--paper-bright);
  border-radius: 8px;
  font-size: var(--fs-13);
  font-weight: 600;
  cursor: pointer;
}
.q-navigator button[data-state="answered"] {
  background: var(--ink);
  color: var(--paper-bright);
  border-color: var(--ink);
}
.q-navigator button[data-state="review"] {
  background: var(--warn-bg);
  border-color: var(--warn);
  color: var(--ink);
}
.q-navigator button[data-state="current"] {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* Footer ---------------------------------------------------------------- */
.site-footer,
#site-footer {
  background: var(--ink);
  color: var(--paper);
  margin-top: var(--space-9);
  padding: var(--space-8) 0 var(--space-5);
}
.footer-inner {
  max-width: var(--frame-wide);
  margin: 0 auto;
  padding: 0 var(--space-5);
}
.footer-cols {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid rgba(251, 252, 247, 0.10);
}
@media (max-width: 720px) { .footer-cols { grid-template-columns: 1fr 1fr; } }
.footer-col h4 {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(251, 252, 247, 0.6);
  margin-bottom: var(--space-4);
}
.footer-col a {
  display: block;
  padding: 6px 0;
  color: rgba(251, 252, 247, 0.85);
  font-size: var(--fs-14);
}
.footer-col a:hover { color: #fff; text-decoration: none; }
.footer-brand-block {
  font-family: var(--font-display);
  font-size: var(--fs-24);
  letter-spacing: -0.02em;
  color: var(--paper);
}
.footer-brand-block .mark { font-weight: 700; }
.footer-tagline {
  color: rgba(251, 252, 247, 0.7);
  font-size: var(--fs-15);
  max-width: 36ch;
  margin-top: var(--space-3);
}
.footer-legal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-5);
  color: rgba(251, 252, 247, 0.55);
  font-size: var(--fs-13);
  flex-wrap: wrap;
  gap: var(--space-4);
}

/* Admin surfaces */
.admin-shell {
  display: grid;
  grid-template-columns: minmax(0, 16rem) minmax(0, 1fr);
  gap: var(--space-7);
  padding: var(--space-6) 0;
}
.admin-shell > #admin-content { min-width: 0; }
.admin-side {
  position: sticky;
  top: calc(var(--header-h) + var(--space-4));
  align-self: start;
}
.admin-side nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.admin-side nav a {
  display: block;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: var(--fs-15);
  font-weight: 500;
}
.admin-side nav a:hover { background: var(--paper-deep); color: var(--ink); text-decoration: none; }
.admin-side nav a[aria-current="page"] {
  background: var(--ink);
  color: var(--paper-bright);
}
@media (max-width: 920px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { position: static; }
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.kpi {
  background: var(--paper-bright);
  border: 1px solid rgba(11, 23, 36, 0.08);
  border-radius: var(--radius);
  padding: var(--space-4);
}
.kpi .l {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--slate);
}
.kpi .v {
  font-family: var(--font-display);
  font-size: var(--fs-32);
  letter-spacing: -0.02em;
  font-weight: 600;
  color: var(--ink);
  margin-top: 6px;
}

/* Sign in (centered form) */
.signin-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-7);
  padding: var(--space-8) 0;
}
@media (max-width: 820px) { .signin-shell { grid-template-columns: 1fr; } }
.signin-side { padding-right: var(--space-5); border-right: var(--rule-hair); }
@media (max-width: 820px) { .signin-side { padding-right: 0; border-right: 0; border-bottom: var(--rule-hair); padding-bottom: var(--space-5); } }
.signin-shell .lede h1 { font-size: clamp(2rem, 3vw + 1rem, 3rem); margin-bottom: var(--space-4); }

/* Profile row */
.profile-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}
@media (max-width: 720px) { .profile-row { grid-template-columns: 1fr; } }

/* History table */
.history-table th { white-space: nowrap; }
.score-pill {
  display: inline-flex;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--paper-deep);
  font-weight: 600;
  font-size: var(--fs-13);
}

/* Legal / help prose */
.prose { max-width: 64ch; }
.prose h2 { font-size: var(--fs-28); margin-top: var(--space-6); margin-bottom: var(--space-3); }
.prose p { font-size: var(--fs-16); color: var(--ink-soft); line-height: 1.65; }

/* Adaptive entry / chapter list */
.chapter-list {
  border-top: var(--rule-hair);
  margin-top: var(--space-4);
}
.chapter-card {
  padding: var(--space-5) 0;
  border-bottom: var(--rule-hair);
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: var(--space-5);
  align-items: center;
}
.chapter-card .num {
  font-family: var(--font-mono);
  font-size: var(--fs-13);
  letter-spacing: 0.1em;
  color: var(--slate);
}
.chapter-card h3 { font-size: var(--fs-20); margin-bottom: 4px; }
.chapter-card .meta { color: var(--ink-soft); font-size: var(--fs-14); }
.chapter-card button {
  padding: 10px 18px;
  border: 1px solid var(--ink);
  background: transparent;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  font-size: var(--fs-14);
}
.chapter-card button:hover { background: var(--ink); color: var(--paper-bright); }

@media (max-width: 560px) {
  .chapter-card {
    grid-template-columns: 56px 1fr;
    gap: var(--space-3);
  }
  .chapter-card button {
    grid-column: 2;
    justify-self: start;
  }
}

/* Test timer warning */
.test-timer[data-warning="true"] { color: var(--warn); }

/* Test layout switch ---------------------------------------------------
   The question/session logic is shared by both presentations. Bluebook is
   the default exam surface; classic keeps the earlier OMF arrangement
   available for learners who prefer it. These rules deliberately use
   minmax(0, ...) and wrapped labels so compact screens never push controls
   past the content margin.
*/
.test-shell,
.test-body,
.test-header,
.test-nav,
.test-question,
.test-nav-controls,
.test-header-actions {
  min-width: 0;
  max-width: 100%;
}

.test-title {
  display: flex;
  align-items: center;
  gap: 9px;
}
.test-title-brand {
  color: var(--sky);
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  white-space: nowrap;
}
.test-title-divider { color: var(--slate); }
.test-title-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.test-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}
.test-style-control { display: inline-flex; align-items: center; min-width: 0; }
.test-style-select {
  min-width: 0;
  max-width: 100%;
  padding: 8px 30px 8px 10px;
  border: 1px solid rgba(251, 252, 247, 0.44);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--paper-bright);
  font: inherit;
  font-size: var(--fs-12);
  font-weight: 600;
  cursor: pointer;
}
.test-style-select option { background: var(--paper-bright); color: var(--ink); }
.test-header-actions > .btn {
  flex: 0 1 auto;
  min-width: 0;
  color: var(--paper-bright);
  border-color: var(--paper-bright);
}
.test-header-actions > .btn:hover { background: var(--paper-bright); color: var(--navy); }
.test-nav-controls {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
}
.test-nav-controls .btn {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.15;
}
.test-nav-action-label { min-width: 0; overflow-wrap: anywhere; }

/* Bluebook-style presentation ----------------------------------------- */
.test-style-bluebook {
  --test-panel: #f3f6f8;
  --test-border: #c9d2dc;
  background: var(--test-panel);
}
.test-style-bluebook .test-header {
  min-height: 68px;
  padding: 12px clamp(16px, 3vw, 36px);
  border-bottom: 0;
  background: var(--ink);
  box-shadow: 0 2px 0 rgba(11, 23, 36, 0.18);
}
.test-style-bluebook .test-title { color: var(--paper-bright); }
.test-style-bluebook .test-title-brand { color: var(--paper-bright); }
.test-style-bluebook .test-title-divider { color: var(--slate); }
.test-style-bluebook .test-title-name { font-size: var(--fs-15); }
.test-style-bluebook .test-timer {
  border: 1px solid rgba(11, 23, 36, 0.16);
  background: var(--paper-bright);
  padding: 8px 14px;
  font-size: var(--fs-16);
}
.test-style-bluebook .test-body {
  grid-template-columns: minmax(0, 1fr) 19rem;
  gap: 0;
  width: 100%;
  padding: 0;
  align-items: stretch;
}
.test-style-bluebook .test-question {
  order: 1;
  min-height: calc(100vh - var(--header-h) - 68px);
  max-height: none;
  overflow-y: auto;
  border: 0;
  border-right: 1px solid var(--test-border);
  border-radius: 0;
  background: var(--paper-bright);
  box-shadow: none;
  padding: clamp(28px, 5vw, 72px) clamp(20px, 6vw, 96px) 64px;
}
.test-style-bluebook .test-nav {
  order: 2;
  min-height: calc(100vh - var(--header-h) - 68px);
  max-height: none;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  background: var(--test-panel);
  box-shadow: none;
  padding: clamp(18px, 3vw, 32px);
}
.test-style-bluebook .test-nav-header {
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--test-border);
}
.test-style-bluebook .test-nav-header h2 { font-size: var(--fs-20); }
.test-style-bluebook .test-nav-filter { background: var(--paper-bright); }
.test-style-bluebook .test-nav-filter[aria-pressed="true"] { background: var(--ink); }
.test-style-bluebook .nav-cell {
  min-height: 42px;
  border-color: var(--test-border);
  background: var(--paper-bright);
}
.test-style-bluebook .nav-cell.current {
  outline: 3px solid var(--sky);
  outline-offset: 1px;
}
.test-style-bluebook .nav-cell.answered { background: #dce9f0; }
.test-style-bluebook .test-question .question-text-region { max-width: 76ch; }
.test-style-bluebook .question-stem { font-size: clamp(1rem, 0.45vw + 0.9rem, 1.18rem); line-height: 1.7; }
.test-style-bluebook .annotation-toolbar {
  max-width: 76ch;
  margin-bottom: var(--space-6);
  border-color: var(--test-border);
  background: var(--test-panel);
}
.test-style-bluebook .choices { max-width: 76ch; gap: 12px; margin-top: 32px; }
.test-style-bluebook .choice {
  min-height: 62px;
  border-color: var(--test-border);
  border-radius: 8px;
  background: var(--paper-bright);
}
.test-style-bluebook .choice:hover,
.test-style-bluebook .choice[data-selected="true"] {
  border-color: var(--navy);
  background: #e7f0f5;
}
.test-style-bluebook .test-bookmark-button { margin-top: 28px; }
.test-style-bluebook .test-question-meta { max-width: 76ch; }

@media (max-width: 920px) {
  .test-style-bluebook .test-body {
    display: flex;
    flex-direction: column;
  }
  .test-style-bluebook .test-question {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--test-border);
  }
  .test-style-bluebook .test-nav {
    min-height: auto;
    order: 2;
  }
}

@media (max-width: 600px) {
  .test-header-actions {
    grid-column: 1 / -1;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }
  .test-header-actions .test-style-control,
  .test-header-actions .test-style-select { width: 100%; }
  .test-header-actions > .btn { width: auto; }
  .test-title-brand { display: none; }
  .test-title-divider { display: none; }
  .test-title-name { font-size: var(--fs-14); }
  .test-nav-controls { gap: 8px; }
  .test-nav-controls .btn { padding: 10px 6px; font-size: var(--fs-12); }
  .test-nav-controls .test-icon { width: 14px; height: 14px; }
  .test-style-bluebook .test-question { padding: 24px 16px 40px; }
  .test-style-bluebook .test-nav { padding: 16px; }
}

@media (max-width: 380px) {
  .test-header { padding-inline: 10px; }
  .test-header-actions { grid-template-columns: minmax(0, 1fr) minmax(0, auto); }
  .test-header-actions > .btn { padding-inline: 10px; }
  .test-nav-controls .btn { gap: 4px; padding-inline: 4px; font-size: var(--fs-11); }
}

/* Bluebook interaction frame ------------------------------------------
   The public Bluebook documentation describes a dark control header, a
   dedicated timer, a question-menu drawer, test tools, a content region,
   answer options, and persistent bottom navigation. This is the OMF-owned
   implementation of that structure; it uses no College Board marks/assets.
*/
.test-title-mark {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: inline-flex;
  color: var(--gold);
}
.test-title-mark svg { display: block; width: 100%; height: 100%; }
.test-header-actions { flex-wrap: wrap; }
.test-menu-toggle { display: inline-flex; align-items: center; gap: 7px; }
.test-menu-toggle .test-icon { width: 16px; height: 16px; }
.test-menu-backdrop { display: none; }
.test-action-bar { display: none; }

.test-style-bluebook .test-header {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  min-height: 68px;
  padding: 12px clamp(16px, 3vw, 36px);
  background: var(--ink);
}
.test-style-bluebook .test-title-mark { color: var(--gold); }
.test-style-bluebook .test-menu-toggle { color: var(--paper-bright); border-color: rgba(255, 254, 250, 0.5); }
.test-style-bluebook .test-menu-toggle:hover { color: var(--ink); border-color: var(--paper-bright); background: var(--paper-bright); }
.test-style-bluebook .test-body {
  display: block;
  position: relative;
  width: 100%;
  padding: 0;
  margin: 0;
}
.test-style-bluebook .test-question {
  width: 100%;
  min-height: calc(100vh - 144px);
  max-height: none;
  padding: clamp(28px, 5vw, 72px) clamp(20px, 8vw, 144px) 88px;
  border: 0;
  border-radius: 0;
  background: var(--paper-bright);
  box-shadow: none;
  overflow-y: auto;
}
.test-style-bluebook .test-question > * { width: min(100%, 76ch); margin-left: auto; margin-right: auto; }
.test-style-bluebook .test-question .annotation-toolbar { width: min(100%, 76ch); }
.test-style-bluebook .test-nav {
  position: fixed;
  top: 68px;
  right: 0;
  bottom: 78px;
  z-index: 45;
  width: min(360px, calc(100vw - 20px));
  min-height: 0;
  max-height: none;
  padding: 24px;
  overflow-y: auto;
  border: 0;
  border-left: 1px solid var(--test-border);
  border-radius: 0;
  background: var(--test-panel);
  box-shadow: -18px 0 48px rgba(35, 53, 77, 0.18);
  transform: translateX(105%);
  transition: transform var(--motion);
}
.test-style-bluebook.test-menu-open .test-nav { transform: translateX(0); }
.test-style-bluebook .test-nav-controls,
.test-style-bluebook .test-submit { display: none; }
.test-style-bluebook .test-menu-backdrop:not([hidden]) {
  display: block;
  position: fixed;
  inset: 68px 0 78px;
  z-index: 40;
  width: 100%;
  border: 0;
  border-radius: 0;
  background: rgba(35, 53, 77, 0.38);
  cursor: default;
}
.test-style-bluebook .test-action-bar {
  position: sticky;
  bottom: 0;
  z-index: 35;
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(300px, 1.8fr) auto;
  align-items: center;
  gap: var(--space-4);
  min-height: 78px;
  padding: 12px clamp(16px, 3vw, 36px);
  border-top: 1px solid var(--test-border);
  background: rgba(255, 254, 250, 0.98);
  box-shadow: 0 -8px 24px rgba(35, 53, 77, 0.08);
}
.test-action-position {
  color: var(--slate);
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.test-action-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  max-width: 640px;
  width: 100%;
  justify-self: center;
}
.test-action-controls .btn {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  white-space: nowrap;
}
.test-action-submit {
  width: auto;
  min-width: 112px;
  margin: 0;
}
.test-style-classic .test-menu-toggle,
.test-style-classic .test-menu-backdrop,
.test-style-classic .test-action-bar { display: none; }

@media (max-width: 760px) {
  .test-style-bluebook .test-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 126px;
  }
  .test-style-bluebook .test-title { grid-column: 1; grid-row: 1; }
  .test-style-bluebook .test-timer { grid-column: 2; grid-row: 1; justify-self: end; margin: 0; padding: 7px 10px; font-size: var(--fs-16); }
  .test-style-bluebook .test-header-actions {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: stretch;
    justify-content: stretch;
    width: 100%;
    gap: 8px;
  }
  .test-style-bluebook .test-header-actions > * { flex: initial; min-width: 0; }
  .test-style-bluebook .test-menu-toggle { width: 44px; min-width: 44px; padding: 0; justify-content: center; }
  .test-style-bluebook .test-menu-toggle > span:last-child { display: none; }
  .test-style-bluebook .test-style-control { display: block; min-width: 0; }
  .test-style-bluebook .test-style-select { width: 100%; min-height: 38px; font-size: var(--fs-12); }
  .test-style-bluebook .test-header-actions > .btn { width: auto; padding-inline: 12px; font-size: var(--fs-12); white-space: nowrap; }
  .test-style-bluebook .test-action-bar {
    grid-template-columns: 1fr;
    gap: 8px;
    min-height: 0;
    padding: 10px 16px 12px;
  }
  .test-style-bluebook .test-action-position { text-align: center; }
  .test-action-controls { max-width: none; }
  .test-action-submit { width: 100%; }
  .test-style-bluebook .test-nav { bottom: 158px; }
  .test-style-bluebook .test-nav { top: 126px; }
  .test-style-bluebook .test-menu-backdrop:not([hidden]) { top: 126px; bottom: 158px; }
  .test-style-bluebook .test-question { min-height: calc(100vh - 204px); padding: 24px 16px 48px; }
}

@media (max-width: 430px) {
  .test-style-bluebook .test-header { padding-inline: 12px; }
  .test-style-bluebook .test-title-brand { display: none; }
  .test-style-bluebook .test-title-divider { display: none; }
  .test-style-bluebook .test-title-name { font-size: var(--fs-13); }
  .test-style-bluebook .test-header-actions { gap: 6px; }
  .test-style-bluebook .test-menu-toggle,
  .test-style-bluebook .test-header-actions > .btn { padding-inline: 9px; font-size: var(--fs-12); }
  .test-style-bluebook .test-action-controls .btn { padding-inline: 6px; font-size: var(--fs-12); }
  .test-style-bluebook .test-action-controls .test-nav-action-label { overflow-wrap: anywhere; white-space: normal; }
}

/* The exam session is a full-viewport app surface, like Bluebook. */
body.test-route-active #site-header,
body.test-route-active #site-footer { display: none; }
body.test-route-active #main { min-height: 100vh; }
body.test-route-active .test-shell { min-height: 100vh; }
