/* ==========================================================================
   GWMS eLearning Engine — engine.css
   Palette contrast is checked against WCAG 2.1 AA (4.5:1 body, 3:1 UI).
   Measured ratios are noted beside each pairing.
   ========================================================================== */

/* ---------- Tokens ---------- */
/* GWMS brand: olive #6B8E23, black, white, red and gold reserved for
   feedback. Every pairing below is measured against WCAG 2.1 AA (4.5:1 body
   text, 3:1 UI/large text) with the same relative-luminance formula the
   engine runs at load time in validate.js — not eyeballed. Ratios noted
   beside each token. Re-verify with tools/palette-check.js before changing
   any of these; a hand-tweaked hex here is exactly the kind of thing that
   passes a glance and fails the live contrast audit. */
:root {
  color-scheme: light dark;

  /* Light surface set */
  --bg:          #FAFAF6;
  --surface:     #FFFFFF;
  --surface-2:   #EFF1E8;
  --ink:         #15170F;   /* on --bg  : 17.3:1 */
  --ink-muted:   #565A4C;   /* on --bg  :  6.8:1 */
  --line:        #E1E4D8;
  --line-strong: #8C9280;   /* on --bg  :  3.1:1  (UI boundary) */
  --accent:      #4E6B1B;   /* on --bg  :  5.8:1 */
  --accent-ink:  #FFFFFF;   /* on accent:  6.1:1 */
  --accent-soft: #E9EFDD;
  --ok:          #1D7A3D;   /* on --bg  :  5.1:1 */
  --ok-soft:     #E3F3E7;
  --no:          #A32E24;   /* on --bg  :  6.8:1 */
  --no-soft:     #FBE7E4;
  --highlight:   #7A5E00;   /* on --bg  :  5.9:1 — reserved: spaced-retrieval screens only */
  --highlight-soft: #F5EBC8;
  --focus:       #15170F;

  --shadow: 0 1px 2px rgba(21,23,15,.05), 0 8px 24px -12px rgba(21,23,15,.22);

  --font-body: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, "Segoe UI", Roboto, sans-serif;
  --font-head: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, "Segoe UI", Roboto, sans-serif;

  --measure: 34rem;          /* ~66 characters */
  --pad: clamp(1rem, 4vw, 2.25rem);
  --radius: 10px;
  --tap: 44px;               /* minimum touch target */

  --leading: 1.62;
  --step: 1rem;
  --dur: 180ms;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
}

/* Dark surface set — applied by media query or by explicit [data-theme] */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #121412;
    --surface:     #1B1D18;
    --surface-2:   #242822;
    --ink:         #F1F2ED;   /* on --bg : 16.5:1 */
    --ink-muted:   #A7AC9E;   /* on --bg :  8.0:1 */
    --line:        #2C2F27;
    --line-strong: #666C58;   /* on --bg :  3.4:1 */
    --accent:      #8CB93A;   /* on --bg :  8.0:1 */
    --accent-ink:  #12140D;   /* on accent: 8.1:1 */
    --accent-soft: #202512;
    --ok:          #5FD37A;   /* on --bg :  9.8:1 */
    --ok-soft:     #132A18;
    --no:          #F0645A;   /* on --bg :  5.9:1 */
    --no-soft:     #2C1613;
    --highlight:   #E8B93A;   /* on --bg : 10.1:1 — reserved: spaced-retrieval screens only */
    --highlight-soft: #2E2610;
    --focus:       #F1F2ED;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 28px -14px rgba(0,0,0,.8);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:#121412; --surface:#1B1D18; --surface-2:#242822;
  --ink:#F1F2ED; --ink-muted:#A7AC9E; --line:#2C2F27; --line-strong:#666C58;
  --accent:#8CB93A; --accent-ink:#12140D; --accent-soft:#202512;
  --ok:#5FD37A; --ok-soft:#132A18; --no:#F0645A; --no-soft:#2C1613;
  --highlight:#E8B93A; --highlight-soft:#2E2610;
  --focus:#F1F2ED;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 28px -14px rgba(0,0,0,.8);
}

/* Learner display preferences */
:root[data-text-size="large"]  { --step: 1.125rem; --measure: 32rem; }
:root[data-text-size="xlarge"] { --step: 1.28rem;  --measure: 30rem; }
:root[data-line-spacing="loose"] { --leading: 1.9; }
:root[data-typeface="legible"] {
  --font-body: "Atkinson Hyperlegible", Verdana, Tahoma, sans-serif;
  --font-head: "Atkinson Hyperlegible", Verdana, Tahoma, sans-serif;
}

@media (prefers-reduced-motion: reduce) { :root { --dur: 0ms; } }
:root[data-motion="reduced"] { --dur: 0ms; }

/* ---------- Reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
/* The UA rule for [hidden] is element-level, so any class that sets display
   (.btn, .reveal, …) would silently defeat it. Keep hidden meaning hidden. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: var(--step)/var(--leading) var(--font-body);
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow-wrap: break-word;
}
h1, h2, h3 { font-family: var(--font-head); font-weight: 800; line-height: 1.16; letter-spacing: -0.015em; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
img, video, svg { max-width: 100%; height: auto; }
button, input, textarea, select { font: inherit; color: inherit; }

:where(a) { color: var(--accent); text-underline-offset: 3px; }

/* Focus: always visible, never removed */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}
#main:focus { outline: none; }
#main:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: .5rem; top: -100vh; z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  padding: .7rem 1rem; border-radius: var(--radius); font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: .5rem; }

/* ---------- App bar ---------- */
.appbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.appbar__inner {
  max-width: 62rem; margin: 0 auto;
  padding: .4rem max(.5rem, env(safe-area-inset-left)) .4rem max(.5rem, env(safe-area-inset-right));
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .5rem;
}
.appbar__title {
  display: flex; align-items: center; justify-content: center; gap: .55rem;
  min-width: 0; text-align: left;
}
.appbar__mark { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; }
.appbar__title-text { min-width: 0; }
.appbar__eyebrow {
  display: block; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-muted);
}
.appbar__name {
  display: block; font-family: var(--font-head); font-size: .98rem; font-weight: 800;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.iconbtn {
  display: inline-flex; flex-direction: column; align-items: center; gap: .1rem;
  min-width: var(--tap); min-height: var(--tap);
  padding: .35rem .5rem; border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; cursor: pointer;
}
.iconbtn:hover { background: var(--surface-2); }
.iconbtn__glyph { display: flex; }
.iconbtn__label { font-size: .68rem; letter-spacing: .02em; color: var(--ink-muted); }

/* ---------- Progress ---------- */
.progress { height: 4px; background: var(--line); position: relative; }
.progress__fill {
  height: 100%; width: 0%; background: var(--accent);
  transition: width var(--dur) ease-out;
}

/* ---------- Stage ---------- */
.stage {
  flex: 1 0 auto; width: 100%;
  padding: var(--pad) max(var(--pad), env(safe-area-inset-left)) 2rem max(var(--pad), env(safe-area-inset-right));
}
.slide { max-width: var(--measure); margin: 0 auto; }
body.is-booting .slide { opacity: .6; }
.slide[data-enter] { animation: fade var(--dur) ease-out both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.loading { color: var(--ink-muted); }

/* Slide header */
.slide__eyebrow {
  font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 .5rem; font-weight: 600;
}
.slide__title { font-size: clamp(1.5rem, 1.15rem + 1.6vw, 2.1rem); margin-bottom: .7em; }
.slide__title:focus { outline: none; }
.slide__title:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }

/* ---------- Body blocks ---------- */
.block-lead { font-size: 1.12em; color: var(--ink); }
.block-list { padding-left: 1.15em; margin: 0 0 1em; }
.block-list li { margin-bottom: .4em; }
/* The only place this renders today is the spaced-retrieval "Look back"
   screen quoting an earlier session's own question, which is exactly the
   one context reserved for the gold accent — see the token comment above. */
.block-quote {
  margin: 0 0 1.25em; padding: .1em 0 .1em 1rem;
  border-left: 3px solid var(--highlight);
  font-family: var(--font-head); font-size: 1.1em; color: var(--ink);
}
.block-quote cite { display: block; font: 700 .8rem/1.4 var(--font-body); color: var(--highlight); font-style: normal; margin-top: .5em; }
.callout {
  margin: 0 0 1.25em; padding: .9rem 1rem;
  background: var(--surface-2); border-radius: var(--radius);
  border-left: 3px solid var(--line-strong);
}
.callout > :last-child { margin-bottom: 0; }
.callout__label {
  display: block; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-muted); font-weight: 700; margin-bottom: .35rem;
}

/* Figures */
.figure { margin: 0 0 1.5rem; }
.figure__frame {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.figure img { display: block; width: 100%; }
.figure figcaption { font-size: .82rem; color: var(--ink-muted); margin-top: .55rem; }
.credit { font-size: .74rem; color: var(--ink-muted); margin-top: .35rem; }
.credit b { font-weight: 600; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: var(--tap); padding: .6rem 1.15rem;
  border-radius: var(--radius); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink);
  font-weight: 600; cursor: pointer;
  transition: background var(--dur), border-color var(--dur), transform var(--dur);
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.btn--ghost { border-color: transparent; background: transparent; color: var(--ink-muted); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.btn--wide { width: 100%; }

.linkbtn {
  background: none; border: 0; padding: .5rem .25rem; min-height: var(--tap);
  color: var(--accent); font-weight: 600; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}

/* ---------- Slide nav bar ---------- */
.slidebar {
  position: sticky; bottom: 0; z-index: 15;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.slidebar__inner {
  max-width: 62rem; margin: 0 auto;
  padding: .55rem max(.75rem, env(safe-area-inset-left)) .55rem max(.75rem, env(safe-area-inset-right));
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .5rem;
}
.slidebar__inner > :first-child { justify-self: start; }
.slidebar__inner > :last-child { justify-self: end; }
.slidebar__status {
  margin: 0; font-size: .78rem; color: var(--ink-muted); text-align: center;
}
.slidebar__gate {
  margin: 0; padding: 0 1rem .6rem; text-align: center;
  font-size: .82rem; color: var(--accent);
}

/* ---------- Alternate representations (differentiation) ---------- */
.altbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem;
  margin: 0 0 1.5rem; padding: .45rem; border: 1px solid var(--line);
  background: var(--surface); border-radius: var(--radius);
}
.altbar__label {
  font-size: .72rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-muted); font-weight: 700; padding: 0 .5rem; margin: 0;
}
.altbar__opts { display: flex; flex-wrap: wrap; gap: .25rem; }
.altbar__opts label { position: relative; }
.altbar__opts input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.altbar__opts span {
  display: inline-flex; align-items: center; min-height: 36px; padding: .3rem .8rem;
  border-radius: 999px; border: 1px solid var(--line-strong); font-size: .85rem; font-weight: 600;
  color: var(--ink-muted); cursor: pointer;
}
.altbar__opts input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.altbar__opts input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

.media-note { font-size: .82rem; color: var(--ink-muted); }
.media-error {
  padding: .8rem 1rem; border-radius: var(--radius);
  background: var(--no-soft); color: var(--no); font-size: .88rem;
}

/* ---------- Video ---------- */
.videowrap {
  position: relative; background: #000; border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--line); margin-bottom: .75rem;
}
.videowrap--embed { aspect-ratio: 16 / 9; }
.videowrap--embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.videowrap video { display: block; width: 100%; }

/* ---------- Disclosure / reveal ---------- */
.reveal { border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 .85rem; background: var(--surface); }
.reveal__btn {
  display: flex; align-items: center; gap: .65rem; width: 100%;
  min-height: var(--tap); padding: .8rem 1rem;
  background: none; border: 0; border-radius: var(--radius);
  text-align: left; font-weight: 600; cursor: pointer;
}
.reveal__btn:hover { background: var(--surface-2); }
.reveal__marker {
  flex: 0 0 auto; width: 1.5rem; height: 1.5rem; border-radius: 50%;
  border: 1.5px solid var(--accent); color: var(--accent);
  display: grid; place-items: center; font-size: .9rem; line-height: 1;
  transition: transform var(--dur) ease-out, background var(--dur), color var(--dur);
}
.reveal__btn[aria-expanded="true"] .reveal__marker {
  transform: rotate(45deg); background: var(--accent); color: var(--accent-ink);
}
.reveal__panel { padding: 0 1rem 1rem; border-top: 1px solid var(--line); }
.reveal__panel > :first-child { margin-top: 1rem; }
.reveal__panel > :last-child { margin-bottom: 0; }
.reveal__panel[hidden] { display: none; }
.reveal__done { margin-left: auto; font-size: .72rem; color: var(--ok); font-weight: 700; }

/* ---------- Assessment shared ---------- */
.assess {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 1rem 1.1rem 1.1rem; margin: 0 0 1.25rem;
  box-shadow: var(--shadow);
}
.assess__kind {
  font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-muted); font-weight: 700; margin: 0 0 .5rem;
}
.assess__q { font-family: var(--font-head); font-size: 1.15em; margin: 0 0 1rem; padding: 0; border: 0; }
fieldset.assess__set { border: 0; padding: 0; margin: 0; min-width: 0; }

/* Choice list — native radios/checkboxes for full keyboard support */
.choices { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .5rem; }
.choice { position: relative; }
.choice > input { position: absolute; left: .95rem; top: 50%; transform: translateY(-50%); margin: 0; }
.choice > label {
  display: block; min-height: var(--tap); padding: .8rem 1rem .8rem 2.65rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--bg); cursor: pointer;
}
.choice > label:hover { background: var(--surface-2); }
.choice > input:checked + label { border-color: var(--accent); background: var(--accent-soft); }
.choice > input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice > input:disabled + label { cursor: default; }
.choice[data-state="correct"] > label { border-color: var(--ok); background: var(--ok-soft); }
.choice[data-state="incorrect"] > label { border-color: var(--no); background: var(--no-soft); }
.choice__mark { font-weight: 700; }
.choice[data-state="correct"] .choice__mark { color: var(--ok); }
.choice[data-state="incorrect"] .choice__mark { color: var(--no); }
.choice__why { display: block; margin-top: .4rem; font-size: .86rem; color: var(--ink-muted); }

.feedback { padding: .85rem 1rem; border-radius: var(--radius); margin: 0 0 1rem; }
.feedback--ok { background: var(--ok-soft); border: 1px solid var(--ok); }
.feedback--no { background: var(--no-soft); border: 1px solid var(--no); }
.feedback__head { font-weight: 700; margin: 0 0 .3rem; }
.feedback--ok .feedback__head { color: var(--ok); }
.feedback--no .feedback__head { color: var(--no); }
.feedback > :last-child { margin-bottom: 0; }
.assess__actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Reflection */
.reflect__field { display: block; }
.reflect__hint { display: block; font-size: .86rem; color: var(--ink-muted); margin: 0 0 .6rem; }
.reflect textarea {
  width: 100%; min-height: 8.5rem; padding: .8rem .9rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--bg); resize: vertical;
}
.reflect textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.reflect__group { margin-bottom: 1.15rem; }
.reflect__group:last-of-type { margin-bottom: 0; }
.reflect__group .assess__q { font-size: 1em; margin-bottom: .4rem; }
.reflect__foot { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: .75rem; }
.reflect__saved { font-size: .82rem; color: var(--ok); font-weight: 600; }
.sendstatus { margin: .75rem 0 0; font-size: .9rem; font-weight: 600; }
.sendstatus--sending { color: var(--ink-muted); }
.sendstatus--sent, .sendstatus--handed { color: var(--ok); }
.sendstatus--queued, .sendstatus--local { color: var(--ink-muted); font-weight: 400; }

.privacy-note { font-size: .78rem; color: var(--ink-muted); margin: .75rem 0 0; }

/* Branch */
.branch__opts { display: grid; gap: .6rem; margin: 0; padding: 0; list-style: none; }
.branch__btn {
  width: 100%; text-align: left; min-height: var(--tap);
  padding: .9rem 1rem; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--bg); cursor: pointer; font-weight: 600;
  display: flex; align-items: center; gap: .75rem;
}
.branch__btn:hover { background: var(--surface-2); border-color: var(--accent); }
.branch__btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.branch__idx {
  flex: 0 0 auto; width: 1.75rem; height: 1.75rem; border-radius: 50%;
  display: grid; place-items: center; font-size: .8rem;
  background: var(--surface-2); color: var(--ink-muted);
}
.branch__btn:hover .branch__idx, .branch__btn[aria-pressed="true"] .branch__idx { background: var(--accent); color: var(--accent-ink); }
.branch__sub { display: block; font-weight: 400; font-size: .86rem; color: var(--ink-muted); margin-top: .2rem; }

/* ---------- Dialogs ---------- */
.sheet {
  width: min(34rem, 100vw); max-width: 100vw;
  max-height: 88svh; padding: 0; border: 1px solid var(--line);
  border-radius: 14px; background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow);
}
.sheet::backdrop { background: rgba(10,10,10,.45); }
.sheet__head {
  position: sticky; top: 0; z-index: 2; background: var(--surface);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.15rem .75rem; border-bottom: 1px solid var(--line);
}
.sheet__head h2 { margin: 0; font-size: 1.15rem; }
.closebtn {
  min-height: var(--tap); padding: .5rem .9rem; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--bg); cursor: pointer; font-weight: 600;
}
.closebtn:hover { background: var(--surface-2); }
.sheet__body { padding: 1rem 1.15rem 1.5rem; overflow-y: auto; }
.sheet__intro { color: var(--ink-muted); font-size: .9rem; }
.sheet__foot {
  display: flex; flex-wrap: wrap; gap: .25rem 1.25rem;
  margin-top: 1.25rem; padding-top: .75rem; border-top: 1px solid var(--line);
}

@media (max-width: 480px) {
  .sheet {
    width: 100vw; max-height: 92svh; margin: auto 0 0; border-radius: 14px 14px 0 0;
    border-bottom: 0;
  }
}

/* Menu (scene/slide list) */
.menu-scene { margin-bottom: 1.25rem; }
.menu-scene__title {
  font-size: .72rem; letter-spacing: .11em; text-transform: uppercase;
  color: var(--ink-muted); font-weight: 700; margin: 0 0 .5rem;
}
.menu-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; }
.menu-item {
  display: flex; align-items: center; gap: .7rem; width: 100%;
  min-height: var(--tap); padding: .6rem .7rem;
  border: 1px solid transparent; border-radius: var(--radius);
  background: none; text-align: left; cursor: pointer;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.menu-item__dot {
  flex: 0 0 auto; width: .6rem; height: .6rem; border-radius: 50%;
  border: 1.5px solid var(--line-strong); background: transparent;
}
.menu-item[data-visited="true"] .menu-item__dot { background: var(--accent); border-color: var(--accent); }
.menu-item__text { flex: 1 1 auto; min-width: 0; }
.menu-item__type { font-size: .7rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .07em; }

/* Preferences */
.prefset { border: 0; padding: 0; margin: 0 0 1.35rem; min-width: 0; }
.prefset legend { padding: 0; font-weight: 700; font-size: .82rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: .5rem; }
.segmented { display: flex; flex-wrap: wrap; gap: .4rem; }
.segmented label { position: relative; }
.segmented input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.segmented span {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: .45rem 1rem;
  border: 1px solid var(--line-strong); border-radius: 999px; cursor: pointer; font-weight: 600; font-size: .9rem;
}
.segmented input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.segmented input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Info sheet content */
.info-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .85rem; }
.info-list li { padding-bottom: .85rem; border-bottom: 1px solid var(--line); font-size: .9rem; }
.info-list li:last-child { border-bottom: 0; }
.info-list b { display: block; }
.issue { display: grid; gap: .2rem; padding: .7rem .85rem; border-radius: var(--radius); font-size: .88rem; }
.issue--error { background: var(--no-soft); border-left: 3px solid var(--no); }
.issue--warn { background: var(--surface-2); border-left: 3px solid var(--line-strong); }
.issue__where { font-size: .74rem; color: var(--ink-muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.tally { display: flex; gap: 1.25rem; margin: 0 0 1rem; }
.tally b { display: block; font-family: var(--font-head); font-size: 1.6rem; }
.tally span { font-size: .75rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .08em; }

/* Fatal load error */
.fatal { max-width: var(--measure); margin: 0 auto; }
.fatal pre {
  background: var(--surface-2); padding: .9rem 1rem; border-radius: var(--radius);
  overflow-x: auto; font-size: .85rem; border: 1px solid var(--line);
}

/* Print — text path for the whole course */
@media print {
  .appbar, .slidebar, .sheet, .skip-link, .altbar { display: none !important; }
  body { background: #fff; color: #000; }
  .reveal__panel[hidden] { display: block !important; }
}

/* Order (tap the steps in order) and Match (tap a line, then its match).
   Tap-only, no drag: every control is a real button, so keyboard and
   screen-reader use come for free and cold hands on a phone still work. */
.order, .match__slots, .match__pool { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .5rem; }
.order__btn, .match__slotbtn, .match__chip {
  width: 100%; text-align: left; min-height: var(--tap);
  padding: .8rem 1rem; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--bg); color: inherit; font: inherit; cursor: pointer;
  display: flex; align-items: center; gap: .75rem;
}
.order__btn:hover:not(:disabled), .match__slotbtn:hover:not(:disabled), .match__chip:hover:not(:disabled) { background: var(--surface-2); }
.order__btn:focus-visible, .match__slotbtn:focus-visible, .match__chip:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.order__btn:disabled, .match__slotbtn:disabled, .match__chip:disabled { cursor: default; }
.order__btn[aria-pressed="true"], .match__slotbtn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }

.order__num {
  flex: 0 0 auto; width: 1.9rem; height: 1.9rem; border-radius: 50%;
  display: grid; place-items: center; font-size: .85rem; font-weight: 700;
  background: var(--surface-2); color: var(--ink-muted);
}
.order__btn[aria-pressed="true"] .order__num { background: var(--accent); color: var(--accent-ink); }
.order__text { flex: 1 1 auto; }
.order__fix, .match__fix { display: block; margin-top: .3rem; font-size: .86rem; color: var(--ink-muted); }
.check__mark { font-weight: 700; }

.order__item[data-state="correct"] > .order__btn, .match__slot[data-state="correct"] > .match__slotbtn { border-color: var(--ok); background: var(--ok-soft); }
.order__item[data-state="incorrect"] > .order__btn, .match__slot[data-state="incorrect"] > .match__slotbtn { border-color: var(--no); background: var(--no-soft); }
.order__item[data-state="correct"] .order__num { background: var(--ok); color: var(--accent-ink); }
.order__item[data-state="incorrect"] .order__num { background: var(--no); color: var(--accent-ink); }
.order__item[data-state="correct"] .check__mark, .match__slot[data-state="correct"] .check__mark { color: var(--ok); }
.order__item[data-state="incorrect"] .check__mark, .match__slot[data-state="incorrect"] .check__mark { color: var(--no); }

.match__slotbtn { flex-direction: column; align-items: flex-start; gap: .2rem; }
.match__left { font-weight: 700; }
.match__pick { color: var(--ink-muted); }
.match__slot[data-filled="true"] .match__pick { color: var(--ink); }
.match__poollabel {
  font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-muted); font-weight: 700; margin: .25rem 0 .5rem;
}
.match__chip { background: var(--surface-2); }
