:root {
  --paper: #f4f1e8;
  --raised: #fffdf7;
  --indigo: #17324d;
  --deep: #102a3c;
  --teal: #147d79;
  --teal-dark: #106763;
  --teal-bright: #1fa6a2;
  --ink: #16232d;
  --muted: #566671;
  --line: #c9d0cc;
  --success: #237a4b;
  --warning: #9a6518;
  --danger: #a43a36;
  --shadow: 0 18px 50px rgba(16, 42, 60, 0.09);
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "Manrope", Verdana, sans-serif; line-height: 1.55; }
button, input, select, textarea { font: inherit; }
button, select, input { min-height: 48px; }
button, .link-button { border: 1px solid var(--indigo); border-radius: 5px; background: transparent; color: var(--indigo); cursor: pointer; font-weight: 800; padding: 0.7rem 1rem; }
button:hover, button:focus-visible, .link-button:hover, .link-button:focus-visible { outline: 3px solid rgba(31, 166, 162, 0.34); outline-offset: 2px; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
a { color: var(--teal-dark); }
[hidden] { display: none !important; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 10; background: var(--raised); padding: 0.8rem; }
.skip-link:focus { top: 1rem; }
.masthead { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: 1rem clamp(1rem, 4vw, 4rem); background: var(--deep); color: #fffdf7; }
.brand { color: #fffdf7; font-family: "IBM Plex Mono", "Courier New", monospace; font-weight: 600; letter-spacing: 0.08em; text-decoration: none; }
#runtime-status { margin: 0; max-width: 50rem; font-size: 0.9rem; text-align: right; }
#runtime-status[data-tone="success"] { color: #8ce0bd; }
#runtime-status[data-tone="warning"] { color: #f5cf87; }
#runtime-status[data-tone="danger"] { color: #ffaaa4; }
.stage-nav { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--indigo); border-top: 1px solid rgba(255,255,255,0.14); }
.stage-nav button { border: 0; border-right: 1px solid rgba(255,255,255,0.14); border-radius: 0; color: #dce8e8; font-family: "IBM Plex Mono", "Courier New", monospace; font-size: 0.8rem; }
.stage-nav button[aria-current="step"] { background: var(--teal); color: #fff; box-shadow: inset 0 -4px #a2ebe5; }
main { min-height: 75vh; }
.stage { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(2.5rem, 7vw, 6rem) 0; }
.stage-heading { max-width: 760px; margin-bottom: 2rem; }
.stage-heading h1, .stage-heading h2 { margin: 0.15rem 0 0.8rem; color: var(--indigo); font-size: clamp(2rem, 5vw, 4.6rem); letter-spacing: -0.045em; line-height: 1.02; }
.stage-heading h2 { font-size: clamp(2rem, 4vw, 3.6rem); }
.stage-heading > p:last-child { color: var(--muted); font-size: 1.08rem; }
.eyebrow { margin: 0 0 0.5rem; color: var(--teal-dark); font-family: "IBM Plex Mono", "Courier New", monospace; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.instrument { background: var(--raised); border: 1px solid var(--line); border-left: 5px solid var(--indigo); box-shadow: var(--shadow); padding: clamp(1.25rem, 3vw, 2.25rem); }
form.instrument { max-width: 820px; }
label { display: grid; gap: 0.45rem; color: var(--indigo); font-weight: 800; }
input, select, textarea { width: 100%; border: 1px solid #9ba9aa; border-radius: 3px; background: #fff; color: var(--ink); padding: 0.75rem; font-weight: 500; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(31, 166, 162, 0.3); border-color: var(--teal); }
.form-row, .action-row, .count-row { display: flex; gap: 1rem; align-items: end; margin: 1rem 0; }
.form-row > *, .count-row > * { flex: 1; }
.privacy-note { border-left: 3px solid var(--warning); color: var(--muted); padding-left: 0.8rem; font-size: 0.9rem; }
.primary { background: var(--teal); border-color: var(--teal); color: white; }
.link-button { display: inline-flex; min-height: 48px; align-items: center; text-decoration: none; }
.quiet-link { align-self: center; font-weight: 800; }
.data-strip { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 0 1.5rem; border-block: 1px solid var(--line); }
.datum { padding: 1rem; border-right: 1px solid var(--line); }
.datum dt { color: var(--teal-dark); font: 600 0.72rem "IBM Plex Mono", monospace; text-transform: uppercase; }
.datum dd { margin: 0.35rem 0 0; font-size: 0.9rem; }
.run-grid, .evidence-grid, .improve-grid { display: grid; grid-template-columns: 1.35fr 0.85fr; gap: 1.25rem; margin-bottom: 1.25rem; }
.model-graphic { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.5rem; margin: 1.5rem 0; }
.model-cell { aspect-ratio: 1; min-height: 54px; padding: 0; background: #e5eeeb; }
.model-cell[aria-pressed="true"] { background: var(--teal); color: white; transform: translateY(-2px); }
.student-prompt { color: var(--indigo); font-size: 1.25rem; font-weight: 800; }
.sentence-frame { background: #e8f3ef; border-left: 4px solid var(--teal); padding: 0.9rem; }
.timeline { display: grid; gap: 0.8rem; padding-left: 1.5rem; }
.timeline li::marker { color: var(--teal); font-family: "IBM Plex Mono", monospace; font-weight: 800; }
.copilot, .signal { border-left-color: var(--teal); }
.output { min-height: 3.5rem; padding: 1rem; background: #edf3f1; border: 1px solid var(--line); }
.signal h3 { color: var(--teal); font-size: 1.6rem; text-transform: capitalize; }
.signal small, .review-row small { color: var(--muted); font-family: "IBM Plex Mono", monospace; }
.review-list, .cluster-list { list-style: none; margin: 0; padding: 0; }
.review-row { display: grid; grid-template-columns: 5rem 1fr; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.review-row p { margin: 0.2rem 0; }
.review-state { align-self: start; border-radius: 999px; padding: 0.3rem 0.55rem; text-align: center; font: 600 0.7rem "IBM Plex Mono", monospace; }
.review-state.pass { background: #dcefe3; color: var(--success); }
.review-state.warn { background: #f5ead4; color: var(--warning); }
.cluster-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.8rem; margin-top: 1.5rem; }
.cluster-list li { background: #edf3f1; border-top: 3px solid var(--teal); padding: 1rem; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.fork-maker { max-width: 820px; }
.fork-output { margin-top: 2rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.fork-output dl > div { display: grid; grid-template-columns: 8rem 1fr; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.fork-output dt { font-family: "IBM Plex Mono", monospace; color: var(--teal); }
.fork-output dd { margin: 0; }
.empty { min-height: 45vh; display: grid; place-content: center; text-align: center; }
footer { padding: 2rem; background: var(--deep); color: #dce8e8; text-align: center; }
footer a { color: #8ce0d9; }

@media (max-width: 760px) {
  .masthead { align-items: start; flex-direction: column; gap: 0.4rem; }
  #runtime-status { text-align: left; }
  .stage-nav { grid-template-columns: repeat(5, minmax(76px, 1fr)); overflow-x: auto; }
  .stage-nav button { font-size: 0.7rem; padding-inline: 0.4rem; }
  .run-grid, .evidence-grid, .improve-grid, .data-strip { grid-template-columns: 1fr; }
  .datum { border-right: 0; border-bottom: 1px solid var(--line); }
  .form-row, .action-row { align-items: stretch; flex-direction: column; }
}

@media (prefers-reduced-motion: no-preference) {
  .stage:not([hidden]) { animation: stage-in 180ms ease-out; }
  button, .link-button { transition: background-color 160ms ease, color 160ms ease, transform 160ms ease; }
  @keyframes stage-in { from { transform: translateY(5px); } }
}

@media print {
  .masthead, .stage-nav, button, footer { display: none !important; }
  .stage[hidden] { display: none !important; }
  body { background: white; }
  .instrument { box-shadow: none; break-inside: avoid; }
}
