/* FAST Prep — test player, prep home, results. Uses tokens.css variables and
   follows whatever theme (cooper / piper) is on <body>. */

.tp { display: flex; flex-direction: column; gap: var(--s-4); padding: var(--s-4); max-width: 1180px; margin: 0 auto; }
.tp__bar { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.tp__title { font-family: var(--font-display); font-size: var(--t-16); letter-spacing: 0.04em; color: var(--ink-2); flex: 1 1 auto; }
.tp__clock { font-size: var(--t-16); color: var(--ink-2); }
.tp__clock.is-low { color: var(--warn); }
.tp__clock.is-over { color: var(--danger); }
.tp__tools { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.tp__tool { font-size: var(--t-15); }

.tp__body { display: grid; gap: var(--s-4); }
.tp__body--split { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 860px) { .tp__body--split { grid-template-columns: 1fr; } }

.tp__passage {
  background: var(--reading-surface); color: var(--ink-on-reading);
  border-radius: var(--r-md); padding: var(--s-5); max-height: 70vh; overflow-y: auto;
  font-size: var(--t-18); line-height: 1.6;
}
@media (max-width: 860px) { .tp__passage { max-height: 45vh; } }
.tp__tabs { display: flex; gap: var(--s-2); margin-bottom: var(--s-3); }
.tp__tab { border: 1px solid rgba(0,0,0,.2); background: transparent; color: inherit; padding: var(--s-2) var(--s-3); border-radius: var(--r-pill); font: inherit; font-size: var(--t-15); cursor: pointer; }
.tp__tab[aria-selected="true"] { background: var(--ink-on-reading); color: var(--reading-surface); }
.tp__pintro { font-style: italic; font-size: var(--t-16); }
.tp__ptitle { font-size: var(--t-24); margin: 0 0 var(--s-2); }
.tp__pby { font-size: var(--t-15); opacity: .7; margin-top: 0; }
.tp__para { position: relative; padding-left: 2.2em; margin: 0 0 var(--s-3); }
.tp__para--poem { white-space: normal; }
.tp__pnum { position: absolute; left: 0; top: 0.15em; font-family: var(--font-num); font-size: var(--t-12); opacity: .55; }

.tp__q { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-5); }
.tp__qnum { font-family: var(--font-num); font-size: var(--t-14); color: var(--ink-3); margin-bottom: var(--s-3); }

.tp__nav { display: flex; gap: var(--s-3); justify-content: space-between; flex-wrap: wrap; }
.tp__strip { display: flex; flex-wrap: wrap; gap: 6px; }
.tp__dot {
  min-width: 38px; height: 38px; border-radius: var(--r-sm); border: 1px solid var(--border-strong);
  background: transparent; color: var(--ink-2); font-family: var(--font-num); font-size: var(--t-14); cursor: pointer; position: relative;
}
.tp__dot.is-answered { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--ink); }
.tp__dot.is-current { outline: 2px solid var(--accent); outline-offset: 1px; }
.tp__dot.is-flagged::after { content: "⚑"; position: absolute; top: -9px; right: -5px; font-size: 12px; color: var(--warn); }
.tp__strip--big .tp__dot { min-width: 48px; height: 48px; font-size: var(--t-16); }
.tp__h { font-family: var(--font-display); margin: 0; }
.tp__note { color: var(--ink-2); }
/* Adaptive FAST: greyed slots for questions not served yet, the "answer to go
   on" gate, and items locked because they were answered on an earlier day. */
.tp__dot.is-placeholder { opacity: .35; border-style: dashed; cursor: default; display: inline-flex; align-items: center; justify-content: center; }
.tp__gate { margin: 0; min-height: 1.4em; color: var(--warn); font-size: var(--t-15); }
.tp__locked { margin: 0 0 var(--s-3); padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink-2); font-size: var(--t-15); }
.tpi__choice:disabled, .tpi__input:disabled { cursor: not-allowed; opacity: .75; }

/* Items */
.tpi__lead { margin-bottom: var(--s-3); font-size: var(--t-18); }
.tpi__part { border-top: 1px solid var(--border); padding-top: var(--s-3); margin-top: var(--s-3); }
.tpi__partlabel { font-family: var(--font-display); font-size: var(--t-14); color: var(--accent); letter-spacing: .06em; }
.tpi__prompt { font-size: var(--t-20); line-height: 1.45; margin: var(--s-2) 0 var(--s-4); font-weight: 600; }
.tpi__prompt svg { max-width: 100%; height: auto; display: block; margin: var(--s-3) auto; color: var(--ink); }
.tpi__prompt table { border-collapse: collapse; margin: var(--s-3) 0; }
.tpi__prompt td, .tpi__prompt th { border: 1px solid var(--border-strong); padding: 6px 12px; text-align: center; }
.tpi__choices { display: grid; gap: var(--s-2); }
.tpi__choice {
  display: flex; align-items: center; gap: var(--s-3); text-align: left; width: 100%;
  padding: var(--s-3) var(--s-4); border-radius: var(--r-md); border: 2px solid var(--border-strong);
  background: var(--surface-2); color: var(--ink); font: inherit; font-size: var(--t-18); cursor: pointer;
}
.tpi__choice[aria-checked="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--surface-2)); }
.tpi__letter {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--border-strong); font-family: var(--font-num); font-size: var(--t-15);
}
.tpi__choice--box .tpi__letter { border-radius: 6px; }
.tpi__choice[aria-checked="true"] .tpi__letter { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.tpi__hint { color: var(--ink-3); font-size: var(--t-15); margin: var(--s-2) 0; }
.tpi__num { display: flex; align-items: center; gap: var(--s-2); }
.tpi__input {
  font-size: var(--t-24); padding: var(--s-3) var(--s-4); border-radius: var(--r-md);
  border: 2px solid var(--border-strong); background: var(--surface-2); color: var(--ink); width: min(260px, 100%);
}
.tpi__input:focus { outline: none; border-color: var(--accent); }
.tpi__affix { font-size: var(--t-24); color: var(--ink-2); }

/* Star mode — bigger, calmer, one thing at a time */
.tp--star { max-width: 760px; }
.tp--star .tpi__prompt { font-size: var(--t-24); }
.tp--star .tpi__choice { font-size: var(--t-20); padding: var(--s-4); }
.tp__timer { height: 10px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.tp__timer-fill { height: 100%; width: 100%; background: var(--accent); transition: width 1s linear; }
.tp__timer-fill.is-low { background: var(--warn); }
.tp__timer-note { min-height: 1.4em; margin: 0; color: var(--warn); font-size: var(--t-15); }
.tp__read { align-self: flex-start; font-size: var(--t-18); }
.tp__next { align-self: flex-end; }
.tp__next:disabled { opacity: .4; cursor: not-allowed; }

/* Calculator + reference sheet */
.tp-calc {
  position: fixed; right: var(--s-4); bottom: var(--s-4); z-index: 50; width: 248px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  box-shadow: var(--shadow-3); padding: var(--s-3);
}
.tp-calc__head { cursor: grab; touch-action: none; user-select: none; display: flex; justify-content: space-between; align-items: center; color: var(--ink-2); font-size: var(--t-14); }
.tp-calc__x { background: none; border: 0; color: var(--ink-2); font-size: var(--t-18); cursor: pointer; }
.tp-calc__display { display: block; text-align: right; font-size: var(--t-24); padding: var(--s-2) var(--s-3); margin: var(--s-2) 0; background: var(--bg); border-radius: var(--r-sm); overflow: hidden; }
.tp-calc__keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tp-calc__key { height: 44px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--ink); font-size: var(--t-18); cursor: pointer; }
.tp-calc__key.is-op { color: var(--accent); }
.tp-calc__key.is-wide { grid-column: span 2; }
.tp-modal { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: var(--s-4); }
.tp-modal__card { background: var(--surface); border-radius: var(--r-lg); padding: var(--s-5); max-width: 560px; width: 100%; max-height: 85vh; overflow-y: auto; }
.tp-ref__note { color: var(--ink-3); font-size: var(--t-14); }
.tp-ref__table { width: 100%; border-collapse: collapse; margin-bottom: var(--s-4); }
.tp-ref__table th { text-align: left; padding-top: var(--s-3); color: var(--accent); }
.tp-ref__table td { padding: 4px 0; border-bottom: 1px solid var(--border); }

/* Prep home / results / study (used by prep.js and parentcard.js) */
.prep { box-sizing: border-box; width: 100%; min-width: 0; padding: var(--s-4); max-width: 880px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--s-4); }
.prep__h { font-family: var(--font-display); font-size: var(--t-32); margin: 0; }
.prep__sub { color: var(--ink-2); margin: 0; }
.prep__cards { display: grid; gap: var(--s-3); }
.prep-card { display: flex; gap: var(--s-4); align-items: center; padding: var(--s-4); border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); }
.prep-card__icon { font-size: 36px; }
.prep-card__body { flex: 1; min-width: 0; }
.prep-card__title { font-weight: 700; font-size: var(--t-20); }
.prep-card__step { color: var(--ink-2); font-size: var(--t-15); }
.prep-card__steps { display: flex; gap: 6px; margin-top: var(--s-2); }
.prep-card__pip { height: 6px; flex: 1; border-radius: var(--r-pill); background: var(--surface-2); }
.prep-card__pip.is-done { background: var(--accent); }
.prep-card__links { display: flex; gap: var(--s-3); margin-top: var(--s-2); }
.prep-link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-size: var(--t-14); cursor: pointer; text-decoration: underline; }
.prep__list { color: var(--ink-2); line-height: 1.6; }
.prep__score { font-family: var(--font-display); font-size: var(--t-64); line-height: 1; }
.prep__band { display: inline-block; padding: 4px 14px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--accent) 20%, transparent); font-weight: 700; }
.prep__band--big { font-family: var(--font-display); font-size: var(--t-32); padding: 6px 22px; margin: var(--s-2) 0; }
.prep-bars { display: grid; gap: var(--s-3); }
.prep-bar__label { display: flex; justify-content: space-between; font-size: var(--t-15); color: var(--ink-2); }
.prep-bar__track { height: 14px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; margin-top: 4px; }
.prep-bar__fill { height: 100%; background: var(--accent); border-radius: var(--r-pill); }
.prep-bar__fill--a { background: var(--ink-3); }
.prep-miss { min-width: 0; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-4); }
.prep-miss__q { font-weight: 600; }
.prep-miss__q svg { display: block; margin-top: var(--s-2); max-width: min(320px, 100%); height: auto; color: var(--ink); }
.prep-miss__row { font-size: var(--t-15); margin-top: var(--s-2); }
.prep-miss__row b { color: var(--ink-3); font-weight: 600; margin-right: 6px; }
.prep-miss__explain { color: var(--ink-2); font-size: var(--t-15); margin-top: var(--s-2); }
.prep-study__cat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-4); }
.prep-study__sets { display: flex; gap: var(--s-3); flex-wrap: wrap; margin-top: var(--s-3); }
.task--prep .task__icon { font-size: 28px; }
.prep-parent table { width: 100%; border-collapse: collapse; font-size: var(--t-14); }
.prep-parent td, .prep-parent th { padding: 4px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.tp-snip { background: var(--reading-surface); color: var(--ink-on-reading); padding: var(--s-4); border-radius: var(--r-md); font-weight: 400; line-height: 1.6; }

/* Reading text uses the body font (display/pixel fonts are for titles and labels only). */
.tp-snip, .tp-snip *,
.tpi__prompt, .tpi__prompt *,
.tpi__lead, .tpi__lead *,
.tpi__text, .tpi__text *,
.tp__passage, .tp__passage *:not(.tp__pnum):not(.tp__ptitle) {
  font-family: var(--font-body);
  text-transform: none;
  letter-spacing: normal;
}

/* Phones: stack the prep card so the title gets room, and lift the calculator
   clear of the Next button. */
@media (max-width: 600px) {
  .tp { padding: var(--s-3); }
  .prep-card { flex-wrap: wrap; }
  .prep-card__body { flex: 1 1 0; min-width: 140px; }
  .prep-card > .btn { flex: 1 0 100%; }
  .tp-calc { right: var(--s-3); bottom: 80px; width: min(220px, calc(100vw - 2 * var(--s-3))); padding: var(--s-2); }
  .tp-calc__key { height: 38px; font-size: var(--t-16); }
}
@media (max-width: 600px) {
  .tp__passage { padding: var(--s-4); font-size: var(--t-16); }
  .tp__para { padding-left: 1.8em; }
}
