:root {
  --paper: #f4f6f3;
  --surface: #ffffff;
  --ink: #202620;
  --muted: #657069;
  --line: #d8e0da;
  --accent: #bd5a3d;
  --display: 'Iowan Old Style', 'Charter', Georgia, serif;
  --body: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--body); }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.container { width: min(1180px, 100%); margin-inline: auto; padding-inline: 24px; }
.topnav { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--line); }
.topnav-inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.logo { font: 600 20px var(--display); letter-spacing: -.02em; }
.logo .meta { font-size: 12px; font-family: var(--mono); color: var(--muted); }
nav { display: flex; align-items: center; gap: 8px; }
nav a { padding: 10px; color: var(--muted); text-decoration: none; font-size: 13px; }
.meta, .eyebrow, .tag, .pill, th, .numeric { font-family: var(--mono); }
.meta { color: var(--muted); font-size: 12px; }
.hero { padding: 56px 0 28px; }
.eyebrow { margin: 0 0 9px; color: var(--accent); font-size: 11px; letter-spacing: .1em; }
.hero h1 { max-width: 12ch; margin: 0; font: 600 clamp(40px, 6vw, 70px)/1.04 var(--display); letter-spacing: -.04em; }
.lead { max-width: 62ch; margin: 18px 0 0; color: var(--muted); font-size: 17px; }
.hero-cta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.task-strip { display: grid; grid-template-columns: minmax(180px, .7fr) 1.3fr; gap: 18px; align-items: end; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--surface); }
.task-strip .eyebrow { margin-bottom: 5px; }
.task-strip .note { margin: 0 0 4px; }
.btn { min-height: 44px; border: 1px solid var(--line); border-radius: 9px; padding: 10px 16px; background: var(--surface); color: var(--ink); }
.btn:hover { border-color: var(--accent); }
.btn-primary { border-color: var(--accent); background: var(--accent); color: var(--surface); }
.btn-ghost { border: 0; background: transparent; color: var(--muted); }
.tag, .pill { display: inline-flex; align-items: center; min-height: 28px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 11px; }
.pill { border-color: var(--accent); color: var(--accent); }
.stage { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 18px; }
.stage span { border-top: 2px solid var(--line); padding-top: 7px; color: var(--muted); font-size: 12px; }
.stage span.active { border-color: var(--accent); color: var(--ink); }
.grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(310px, .7fr); gap: 18px; align-items: start; }
.card { min-width: 0; border: 1px solid var(--line); border-radius: 15px; padding: 20px; background: var(--surface); }
.card h2, .card h3 { margin: 0; }
.card h2 { font: 600 27px var(--display); }
.card h3 { margin: 0; font: 600 17px var(--display); }
.task-prompt { margin: 14px 0 8px; font-weight: 600; }
.status { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.status strong { font-size: 17px; }
.note { color: var(--muted); font-size: 12px; }
.board { margin-top: 15px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--paper); }
.board svg { display: block; width: 100%; height: auto; min-height: 270px; }
.svg-grid { fill: var(--paper); stroke: var(--line); }
.member-hit { cursor: pointer; }
.member-hit line { stroke: var(--ink); stroke-width: 6; stroke-linecap: round; }
.member-hit.member-T line { stroke: var(--accent); stroke-dasharray: none; }
.member-hit.member-C line { stroke: var(--muted); stroke-dasharray: 9 7; }
.member-hit.member-Z line { stroke: var(--line); }
.member-hit.selected line, .member-hit:focus line { stroke-width: 10; }
.member-label { fill: var(--muted); font: 600 11px var(--mono); pointer-events: none; }
.node-hit { cursor: pointer; }
.node-hit .node { fill: var(--surface); stroke: var(--ink); stroke-width: 3; }
.node-hit.selected .node, .node-hit:focus .node { fill: var(--accent); stroke: var(--accent); }
.node-hit.selected text, .node-hit:focus text { fill: var(--accent); }
.load { stroke: var(--accent); stroke-width: 3; }
.load-label { fill: var(--accent); }
.support { fill: var(--muted); }
.svg-label { fill: var(--ink); font: 600 12px var(--mono); }
.svg-label.muted { fill: var(--muted); font-weight: 400; }
.controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 15px; }
.prediction-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.selection-row, .button-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.selection-row .note { flex: 1 1 100%; }
.button-row .btn { flex: 1 1 100px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { color: var(--muted); font-size: 12px; }
.input { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 8px; padding: 9px; background: var(--surface); color: var(--ink); }
.checkbox { display: flex; align-items: center; min-height: 44px; gap: 8px; color: var(--muted); font-size: 13px; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); }
.full { grid-column: 1 / -1; }
.hint { margin-top: 14px; border-left: 3px solid var(--accent); padding: 10px 12px; background: var(--paper); font-size: 13px; }
.feedback { margin: 14px 0; border-left: 3px solid var(--accent); padding: 10px 12px; background: var(--paper); }
.result-body { padding-top: 14px; }
.explanation { display: grid; gap: 8px; margin-top: 18px; border-top: 1px solid var(--line); padding-top: 15px; }
.explanation label { font-weight: 600; }
textarea { width: 100%; resize: vertical; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: var(--surface); color: var(--ink); }
.required { box-shadow: 0 0 0 3px var(--paper); }
@keyframes gi-pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--accent); } 50% { box-shadow: 0 0 0 8px transparent; } }
.gi-pulse { animation: gi-pulse 1.8s infinite; }
.tabs { display: flex; gap: 8px; margin: 18px 0 14px; border-bottom: 1px solid var(--line); }
.tab { min-height: 44px; border: 0; border-bottom: 2px solid transparent; padding: 8px 10px; background: transparent; color: var(--muted); }
.tab[aria-selected='true'] { border-color: var(--accent); color: var(--ink); }
.observe { display: grid; min-height: 290px; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.observe svg { width: 90%; max-height: 270px; }
.result-card { margin-top: 18px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border-bottom: 1px solid var(--line); padding: 9px; text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 11px; font-weight: 500; }
.numeric { text-align: right; white-space: nowrap; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 15px; }
.result-grid h3 { margin-bottom: 8px; font: 600 18px var(--display); }
.comparison-log { display: grid; gap: 8px; margin-top: 15px; }
.log-item { border-left: 2px solid var(--line); padding-left: 10px; font-size: 12px; }
.log-item strong { display: block; }
.limit { margin: 15px 0 0; border-top: 1px solid var(--line); padding-top: 12px; }
.footer { margin-top: 36px; border-top: 1px solid var(--line); padding: 26px 0; color: var(--muted); font-size: 12px; }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; }
.modal { display: none; position: fixed; inset: 0; z-index: 8; place-items: center; padding: 20px; background: var(--ink); }
.modal.show { display: grid; }
.modal-card { width: min(430px, 100%); position: relative; }
.close { position: absolute; top: 10px; right: 10px; min-width: 44px; min-height: 44px; border: 0; background: transparent; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; }
  .task-strip, .prediction-grid { grid-template-columns: 1fr; }
  .hero { padding-top: 38px; }
  .controls, .result-grid { grid-template-columns: 1fr; }
  .full { grid-column: auto; }
  .container { padding-inline: 14px; }
  .topnav nav a { display: none; }
  .hero h1 { font-size: 45px; }
  .footer-inner { display: block; }
  .footer-inner span { display: block; margin-top: 5px; }
}
@media (max-width: 340px) {
  body { font-size: 14px; }
  .card { padding: 14px; }
  .hero h1 { font-size: 38px; }
  .stage { gap: 5px; }
  .stage span { font-size: 10px; }
  .btn { padding-inline: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .gi-pulse { animation: none; outline: 3px solid var(--accent); outline-offset: 2px; }
}
