/* PrepArcade — ACT Math solution engine styling.
   Inherits the host page's CSS variables (--gold, --green, --text, --border,
   --panel-2) so it looks right on both the dark practice page and the light
   report/exam pages. */
.pa-solve { --pa-line: var(--border-strong, rgba(130,130,145,.35)); font-family: 'Nunito', system-ui, sans-serif; margin-top: 4px; }

.pa-step {
  position: relative;
  display: grid; grid-template-columns: 30px 1fr; gap: 14px;
  padding: 0 0 18px 0;
  opacity: 0; transform: translateY(10px) scale(.985);
  transition: opacity .5s cubic-bezier(.23,1,.32,1), transform .5s cubic-bezier(.23,1,.32,1);
}
.pa-step.in { opacity: 1; transform: none; }
/* connector line linking the markers */
.pa-step:not(:last-child)::before {
  content: ''; position: absolute; left: 14px; top: 30px; bottom: 0; width: 2px;
  background: var(--pa-line); border-radius: 2px; opacity: .5;
}
.pa-mk {
  z-index: 1; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: 'Fredoka', 'Nunito', sans-serif; font-weight: 700; font-size: 14px;
  background: var(--panel-2, rgba(130,130,145,.12)); color: var(--text-dim, inherit);
  border: 2px solid var(--pa-line);
}
.pa-goal > .pa-mk { color: var(--gold-dark, #C89808); border-color: var(--gold, #F7C325); }
.pa-answer > .pa-mk { background: var(--green, #3FBF6A); border-color: var(--green, #3FBF6A); color: #fff; }

.pa-body { min-width: 0; padding-top: 3px; }
.pa-label {
  font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-mute, #8A93A8); margin-bottom: 6px;
}
.pa-goal > .pa-body > .pa-label { color: var(--gold-dark, #C89808); }
.pa-answer > .pa-body > .pa-label { color: var(--green, #2E9E57); }
.pa-text { font-size: 14.5px; line-height: 1.6; color: var(--text, inherit); margin: 4px 0; }
.pa-text + .pa-eq, .pa-eq + .pa-text { margin-top: 8px; }

/* a "- " run in the source is a bullet LIST, never a row of minus signs */
.pa-list { margin: 6px 0 6px 2px; padding-left: 20px; list-style: none; }
.pa-list li {
  position: relative; font-size: 14.5px; line-height: 1.6;
  color: var(--text, inherit); margin: 3px 0;
}
.pa-list li::before {
  content: ''; position: absolute; left: -14px; top: .62em;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent, #f7c325);
}

/* equation card */
.pa-eq {
  margin: 8px 0; padding: 12px 16px; border-radius: 12px;
  background: var(--panel-2, rgba(130,130,145,.10));
  border: 1px solid var(--pa-line);
  overflow-x: auto; overflow-y: hidden;
  text-align: left; color: var(--text, inherit);
}
.pa-eq .katex { font-size: 1.16em; }
.pa-text .katex { font-size: 1.05em; }
/* grouped consecutive equations read as one derivation, left-aligned */
.pa-eq-row { }
.pa-eq-row + .pa-eq-row { margin-top: 5px; }
.pa-eq .katex-display { margin: 0; text-align: left; }
.pa-eq .katex-display > .katex { text-align: left; }

/* final answer callout */
.pa-answer > .pa-body {
  background: color-mix(in srgb, var(--green, #3FBF6A) 12%, transparent);
  border: 1.5px solid var(--green, #3FBF6A);
  border-radius: 12px; padding: 12px 16px; margin-top: 2px;
}
.pa-answer .pa-text, .pa-answer .pa-eq { font-weight: 700; }
.pa-answer .pa-eq { background: transparent; border: none; padding: 4px 0; margin: 2px 0; }
/* grid-in: the answer is a VALUE, not a choice letter — set it as one.
   The colour is INHERITED on purpose. --green-dark is defined on Report.html
   and index.html but NOT on practice.html, where the fallback landed a dark
   green on a dark panel and the value was there but unreadable. Inheriting the
   callout's own text colour is right in every theme on all four surfaces; the
   green identity comes from the tint and the border. */
.pa-ansval {
  display: inline-block; margin-left: 5px; padding: 3px 14px 4px;
  border-radius: 10px; font-weight: 800; font-size: 1.18em; letter-spacing: .3px;
  color: inherit; vertical-align: middle;
  background: color-mix(in srgb, var(--green, #3FBF6A) 22%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--green, #3FBF6A) 60%, transparent);
}
/* a fraction key ("31/2") stacks, which shrinks the numerals — hold the size up */
.pa-ansval .katex { font-size: 1.28em; }

/* stem: inline math + (temporary) monospace ASCII figures until SVG replaces them */
.pa-stem-text { white-space: normal; }
.pa-stem-text + .pa-ascii, .pa-ascii + .pa-stem-text { margin-top: 12px; }
.pa-ascii {
  font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.35; margin: 12px 0; padding: 14px 16px;
  border-radius: 12px; background: var(--panel-2, rgba(130,130,145,.10));
  border: 1px solid var(--border-strong, rgba(130,130,145,.3));
  overflow-x: auto; white-space: pre; color: var(--text-dim, inherit);
}
.stem .katex, .choice .katex { font-size: 1.04em; }

/* stem data tables (rendered from the source ASCII) */
.pa-table-wrap { margin: 16px 0; overflow-x: auto; }
.pa-table {
  border-collapse: separate; border-spacing: 0;
  font-family: 'Nunito', system-ui, sans-serif; font-size: 14.5px;
  border: 1.5px solid var(--border-strong, rgba(130,130,145,.4));
  border-radius: 10px; overflow: hidden;
}
.pa-table th, .pa-table td {
  border-right: 1px solid var(--border-strong, rgba(130,130,145,.32));
  border-bottom: 1px solid var(--border-strong, rgba(130,130,145,.32));
  padding: 9px 18px; text-align: center; color: var(--text, inherit); white-space: nowrap;
}
.pa-table th:last-child, .pa-table td:last-child { border-right: none; }
.pa-table tr:last-child td { border-bottom: none; }
.pa-table th { font-weight: 800; background: var(--panel-2, rgba(130,130,145,.16)); letter-spacing: .01em; }
.pa-table td { font-weight: 600; }

/* ---- mathematical display blocks ----
   Piecewise definitions, determinants and stacked fractions are real notation,
   not text: centred in their own card, at a size where the brace / bracket
   height and the column spacing actually read as typeset mathematics. */
.pa-mathblock {
  margin: 18px 0; padding: 18px 22px; border-radius: 14px;
  background: var(--panel-2, rgba(130,130,145,.10));
  border: 1px solid var(--border-strong, rgba(130,130,145,.3));
  overflow-x: auto; overflow-y: visible; text-align: center;
}
.pa-mathblock .katex-display { margin: 0; }
.pa-mathblock .katex { font-size: 1.42em; }
.pa-matrix .katex { font-size: 1.62em; }
.pa-bigfrac .katex { font-size: 1.7em; }

/* ---- synthetic division ----
   The divisor sits outside the bracket; the carried products are ruled off from
   the result row, exactly as the layout is written by hand. */
.pa-synth { margin: 18px 0; display: flex; justify-content: center; overflow-x: auto; }
.pa-synth table {
  border-collapse: collapse; font-family: 'Nunito', system-ui, sans-serif;
  font-size: 17px; font-weight: 700; color: var(--text, inherit);
}
.pa-synth th {
  border-right: 2.5px solid var(--text-dim, currentColor);
  padding: 6px 16px 6px 6px; text-align: right; vertical-align: middle; font-weight: 800;
}
.pa-synth td { padding: 6px 16px; text-align: right; min-width: 40px; }
.pa-synth tr.pa-synth-add td { border-bottom: 2.5px solid var(--text-dim, currentColor); padding-bottom: 8px; }
.pa-synth tr.pa-synth-res td { padding-top: 9px; }

/* ---- composed mathematical figures ----
   The frame is a BLOCK that fills the available width up to the per-figure
   --fig-max, so a diagram is never a postage stamp floating in a big empty box.
   --fig-bg must be a SOLID colour: label halos are painted with it so text
   stays readable where it crosses gridlines and shape edges. */
.pa-fig {
  /* --fig-bg MUST be a SOLID colour: label halos are painted with it, so a
     translucent value (several surfaces define --panel as rgba(...)) would make
     the halo invisible and let labels collide with gridlines. Every surface
     defines a solid page background, so prefer those. */
  --fig-bg: var(--bg-0, var(--bg, #ffffff));
  --fig-accent: var(--gold, var(--yellow, #F7C325));
  /* extra series colours for multi-series graphs (two plotted graphs, two box
     plots); each must stay legible on both the light and dark surfaces */
  --fig-accent-2: #3D86D8;
  --fig-accent-3: #D8467A;
  --fig-accent-4: #2FA36C;
  --fig-fill: rgba(247,195,37,.14);
  display: block; width: 100%; max-width: var(--fig-max, 600px);
  margin: 18px 0; padding: 14px 16px; border-radius: 14px;
  background: var(--fig-bg);
  border: 1px solid var(--border-strong, rgba(130,130,145,.3));
  color: var(--text, inherit);
}
.pa-fig-svg {
  display: block; width: 100%; height: auto;
  font-family: 'Nunito', system-ui, sans-serif;
  overflow: visible;
}

/* stem bar / pictograph graphs rendered from the source ASCII */
.pa-bars { margin: 14px 0; display: flex; flex-direction: column; gap: 9px; }
.pa-bar-row { display: grid; grid-template-columns: minmax(70px,130px) 1fr auto; align-items: center; gap: 12px; }
.pa-bar-lab { font-size: 13.5px; font-weight: 700; color: var(--text, inherit); text-align: right; }
.pa-bar-track { height: 18px; border-radius: 6px; background: var(--panel-2, rgba(130,130,145,.16)); overflow: hidden; }
.pa-bar-fill {
  display: block; height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, var(--gold, #F7C325), var(--gold-dark, #C89808));
  transform-origin: left; animation: pa-grow .6s cubic-bezier(.23,1,.32,1) both;
}
.pa-bar-val { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 700; color: var(--text-dim, inherit); min-width: 22px; }
@keyframes pa-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { .pa-bar-fill { animation: none; } }

@media (max-width: 560px) {
  .pa-step { grid-template-columns: 26px 1fr; gap: 11px; }
  .pa-mk { width: 26px; height: 26px; font-size: 13px; }
  .pa-step:not(:last-child)::before { left: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .pa-step { transition: none; }
}

/* ============================================================
   ACT Science figures — data displays baked into a passage body.

   These are emitted at import time by seed/act-science-figures.js as
   <figure class="sci-fig"> blocks inside `passage.body`. All four surfaces
   already hold <figure>…</figure> out of their passage-marker transforms
   (the @@TBL n@@ hold-and-restore), and all four load THIS stylesheet, so one
   definition renders identically in practice, the simulator and the report.

   The white-space reset is not optional: every .passage-body / .passage-box is
   `white-space: pre-wrap`, which would otherwise stretch table cells and SVG
   text by their source indentation.
   ============================================================ */
.sci-fig {
  display: block; margin: 20px 0; white-space: normal;
  --sci-ink:  var(--text, #1b2340);
  --sci-mute: var(--text-mute, var(--text-dim, #6b7390));
  --sci-rule: var(--border-strong, rgba(130,130,145,.42));
  --sci-soft: var(--panel-2, rgba(130,130,145,.14));
}
.sci-fig figcaption {
  font-family: 'Nunito', system-ui, sans-serif;
  font-weight: 800; font-size: 12.5px; letter-spacing: .03em; text-transform: uppercase;
  color: var(--sci-mute); margin-bottom: 8px; white-space: normal;
}
.sci-fig .pa-table-wrap { margin: 0; }
.sci-fig .pa-table { white-space: normal; }
.sci-fig .pa-table th, .sci-fig .pa-table td { padding: 8px 14px; font-size: 14px; }
/* a colgroup banner ("Trial 1 / Trial 2 / Trial 3") sits above its sub-columns */
.sci-fig .pa-table th[colspan] { border-bottom: 1.5px solid var(--sci-rule); }
.sci-fig .pa-fig { margin: 0; }

/* ---- chart ink ---- */
.sci-svg { font-family: 'Nunito', system-ui, sans-serif; }
.sci-grid   { stroke: var(--sci-rule); stroke-width: 1; opacity: .38; }
.sci-axis   { stroke: var(--sci-ink); stroke-width: 1.6; opacity: .75; }
.sci-tick   { fill: var(--sci-mute); font-size: 12.5px; font-weight: 600; }
.sci-axlabel{ fill: var(--sci-ink); font-size: 13.5px; font-weight: 800; }
.sci-line   { stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; fill: none; }
.sci-mk     { stroke: var(--fig-bg, #fff); stroke-width: 1.4; }
.sci-plabel { fill: var(--sci-ink); font-size: 12.5px; font-weight: 800;
              paint-order: stroke; stroke: var(--fig-bg, #fff); stroke-width: 3.5px; stroke-linejoin: round; }
.sci-legend { fill: var(--sci-ink); font-size: 12.5px; font-weight: 700; }
.sci-legend-bg { fill: var(--fig-bg, #fff); stroke: var(--sci-rule); stroke-width: 1; opacity: .96; }

/* ---- bar charts ---- */
.sci-bartrack { fill: var(--sci-soft); }
.sci-bar      { stroke: none; }
.sci-barlab   { fill: var(--sci-ink); font-size: 13px; font-weight: 700; }
.sci-barval   { fill: var(--sci-ink); font-size: 13px; font-weight: 800; }

/* ---- apparatus schematics ---- */
.sci-box       { fill: var(--sci-soft); stroke: var(--sci-ink); stroke-width: 1.7; }
.sci-boxtext   { fill: var(--sci-ink); font-size: 13px; font-weight: 700; }
.sci-anno      { fill: var(--sci-mute); font-size: 12.5px; font-weight: 700; }
.sci-anno-strong { fill: var(--sci-ink); font-size: 13px; font-weight: 800; }
.sci-arrow     { stroke: var(--sci-ink); stroke-width: 1.8; }
.sci-arrowhead { fill: var(--sci-ink); }
.sci-lead      { stroke: var(--sci-ink); stroke-width: 1.8; fill: none; }
.sci-path      { stroke: var(--sci-mute); stroke-width: 1.6; stroke-dasharray: 6 5; }
.sci-dim       { stroke: var(--fig-accent-3, #D8467A); stroke-width: 1.5; }
.sci-dimtext   { fill: var(--fig-accent-3, #D8467A); font-size: 12.5px; font-weight: 800;
                 paint-order: stroke; stroke: var(--fig-bg, #fff); stroke-width: 3.5px; stroke-linejoin: round; }
.sci-fillmid    { fill: var(--fig-accent-2, #3D86D8); fill-opacity: .30; stroke: var(--sci-ink); stroke-width: 1.6; }
.sci-fillstrong { fill: var(--fig-accent-4, #2FA36C); fill-opacity: .38; stroke: var(--sci-ink); stroke-width: 1.6; }
.sci-fillwet    { fill: var(--fig-accent-2, #3D86D8); fill-opacity: .22; stroke: none; }
.sci-wave    { stroke: var(--fig-accent-2, #3D86D8); stroke-width: 1.8; fill: none; }
.sci-surface { stroke: var(--fig-accent-2, #3D86D8); stroke-width: 2; }
.sci-paddle  { stroke: var(--sci-ink); stroke-width: 2; fill: none; stroke-linejoin: round; }

@media (max-width: 560px) {
  .sci-fig .pa-table th, .sci-fig .pa-table td { padding: 7px 10px; font-size: 13px; }
  .sci-fig figcaption { font-size: 11.5px; }
}

/* ============================================================
   VERBAL EXPLANATIONS — SAT Reading & Writing

   English has no steps, so the stepped maths layout does not transfer. What
   does transfer is giving each idea its own card instead of one wall of text:
   a GOAL panel, a WHY-THE-ANSWER-IS-RIGHT panel, and a box under EVERY choice.

   The per-choice box is deliberately larger and heavier than the ACT
   `.why` treatment — it is the main teaching surface for a verbal question,
   not a footnote.
   ============================================================ */
.pa-vlabel {
  font-weight: 800; font-size: 13px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-mute, var(--text-dim, #6b7390)); margin: 14px 0 4px;
}

.pa-vbox {
  margin: 14px 0; padding: 16px 18px; border-radius: 14px;
  border: 1.5px solid var(--border-strong, rgba(130,130,145,.32));
  background: var(--panel-2, rgba(130,130,145,.10));
  white-space: normal;
}
.pa-vbox h5 {
  margin: 0 0 8px; font-family: 'Nunito', system-ui, sans-serif;
  font-size: 12.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-mute, var(--text-dim, #6b7390));
}
.pa-vbox p { margin: 0 0 7px; font-size: 14.5px; line-height: 1.58; color: var(--text, inherit); }
.pa-vbox p:last-child { margin-bottom: 0; }
.pa-vbox .pa-vans { font-weight: 800; font-size: 15px; }

/* the goal — what the question is actually testing */
.pa-vgoal { border-left: 5px solid var(--fig-accent-2, #3D86D8); }
/* why the correct answer is correct */
.pa-vright {
  border-left: 5px solid var(--green, #2FA36C);
  background: color-mix(in srgb, var(--green, #2FA36C) 9%, transparent);
}
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  .pa-vright { background: rgba(47,163,108,.10); }
}

/* ---- the box under each answer choice ---- */
.pa-vwhy {
  display: block; margin-top: 12px; padding: 12px 14px; border-radius: 11px;
  border: 1.5px solid var(--border-strong, rgba(130,130,145,.32));
  background: var(--bg-0, var(--bg, #fff));
  white-space: normal; text-align: left;
}
.pa-vwhy-tag {
  display: block; font-family: 'Nunito', system-ui, sans-serif;
  font-size: 11.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  margin-bottom: 5px;
}
.pa-vwhy-text {
  display: block; font-size: 14px; line-height: 1.55; font-weight: 600;
  color: var(--text, inherit);
}
.pa-vwhy.is-right { border-color: var(--green, #2FA36C); }
.pa-vwhy.is-right .pa-vwhy-tag { color: var(--green, #2FA36C); }
.pa-vwhy.is-wrong { border-color: var(--red, #D8467A); }
.pa-vwhy.is-wrong .pa-vwhy-tag { color: var(--red, #D8467A); }

@media (max-width: 560px) {
  .pa-vbox p { font-size: 13.5px; }
  .pa-vwhy-text { font-size: 13.5px; }
}

/* ---- collapsed "why this is wrong" ----
   When the student answered CORRECTLY the wrong-answer reasoning is offered,
   not pushed at them. A native <details> keeps it keyboard-accessible and needs
   no JS — but it must never be nested inside a disabled <button>, or it cannot
   be opened at all. */
details.pa-vwhy.is-collapsed { padding: 0; }
details.pa-vwhy.is-collapsed > summary {
  list-style: none; cursor: pointer; user-select: none;
  padding: 10px 14px; border-radius: 10px;
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 11.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  display: flex; align-items: center; gap: 7px;
}
details.pa-vwhy.is-collapsed > summary::-webkit-details-marker { display: none; }
details.pa-vwhy.is-collapsed > summary::before {
  content: '▸'; font-size: 13px; transition: transform .16s ease; display: inline-block;
}
details.pa-vwhy.is-collapsed[open] > summary::before { transform: rotate(90deg); }
details.pa-vwhy.is-collapsed > summary:hover { background: var(--panel-2, rgba(130,130,145,.14)); }
details.pa-vwhy.is-collapsed > .pa-vwhy-text { padding: 0 14px 12px; }
details.pa-vwhy.is-wrong > summary { color: var(--red, #D8467A); }

/* ---- the sentence every wrong choice shared, lifted out and shown once ---- */
.pa-vshared {
  display: block; margin: 12px 0 4px; padding: 12px 14px; border-radius: 11px;
  border: 1.5px dashed var(--border-strong, rgba(130,130,145,.42));
  background: var(--panel-2, rgba(130,130,145,.10));
  white-space: normal;
}
.pa-vshared-tag {
  display: block; font-family: 'Nunito', system-ui, sans-serif;
  font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-mute, var(--text-dim, #6b7390)); margin-bottom: 5px;
}
.pa-vshared-text { display: block; font-size: 14px; line-height: 1.55; font-weight: 600; color: var(--text, inherit); }

/* the per-choice box must sit OUTSIDE the choice button (a disabled button
   swallows the <details> toggle), so it is spaced as a sibling instead */
.pa-choice-wrap { display: block; margin-bottom: 10px; }
.pa-choice-wrap > .pa-vwhy, .pa-choice-wrap > details.pa-vwhy { margin: 8px 0 0 0; }

/* the shared note collapses too when the student answered correctly */
details.pa-vshared.is-collapsed { padding: 0; }
details.pa-vshared.is-collapsed > summary {
  list-style: none; cursor: pointer; user-select: none; padding: 10px 14px; border-radius: 10px;
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-mute, var(--text-dim, #6b7390));
  display: flex; align-items: center; gap: 7px;
}
details.pa-vshared.is-collapsed > summary::-webkit-details-marker { display: none; }
details.pa-vshared.is-collapsed > summary::before { content: '▸'; font-size: 13px; transition: transform .16s ease; display: inline-block; }
details.pa-vshared.is-collapsed[open] > summary::before { transform: rotate(90deg); }
details.pa-vshared.is-collapsed > summary:hover { color: var(--text, inherit); }
details.pa-vshared.is-collapsed > .pa-vshared-text { padding: 0 14px 12px; }

/* ---- "Why the other options are all incorrect" ----
   Whatever applies to EVERY wrong choice is said once, at the end, beside the
   goal and the answer. Always a toggle — available whether the student got the
   question right or wrong, never opened for them. */
details.pa-vothers.is-collapsed { padding: 0; }
details.pa-vothers.is-collapsed > summary {
  list-style: none; cursor: pointer; user-select: none;
  padding: 13px 16px; border-radius: 13px;
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-mute, var(--text-dim, #6b7390));
  display: flex; align-items: center; gap: 8px;
}
details.pa-vothers.is-collapsed > summary::-webkit-details-marker { display: none; }
details.pa-vothers.is-collapsed > summary::before {
  content: '▸'; font-size: 13px; transition: transform .16s ease; display: inline-block;
}
details.pa-vothers.is-collapsed[open] > summary::before { transform: rotate(90deg); }
details.pa-vothers.is-collapsed > summary:hover { color: var(--text, inherit); }
details.pa-vothers.is-collapsed > p { margin: 0; padding: 0 16px 14px; }
