:root {
  --bg: #11151a;
  --panel: #171d24;
  --line: #273039;
  --text: #e6ebf0;
  --muted: #8b99a7;
  --accent: #5ac8a8;
  --warn: #e0a35c;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
header {
  display: flex; align-items: baseline; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
}
header h1 { font-size: 16px; margin: 0; }
header span { color: var(--muted); font-size: 12px; }
header .right { margin-left: auto; font-size: 13px; color: var(--muted); }
header #who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-link { color: var(--text); font-size: 16px; font-weight: 700; }
.brand-link:hover { text-decoration: none; }
.header-link { flex: none; font-size: 12px; }
main { max-width: 820px; margin: 0 auto; padding: 20px 20px 56px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-size: 12px; color: var(--text); }
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 16px; margin-bottom: 12px;
}
.panel h2 { font-size: 14px; margin: 0 0 10px; }
.panel .step { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.stage-panel > .stage-summary {
  cursor: pointer; color: var(--text); font-size: 14px; font-weight: 700;
}
.stage-panel[open] > .stage-summary { margin-bottom: 10px; }
.stage-panel:not([open]) { padding-top: 10px; padding-bottom: 10px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input, textarea, button {
  font: inherit; color: var(--text); background: #0e1216;
  border: 1px solid var(--line); border-radius: 7px; padding: 9px 10px;
}
input, textarea { width: 100%; }
textarea { resize: vertical; min-height: 84px; }
button {
  background: var(--accent); color: #0d1317; border: 0; font-weight: 600;
  padding: 9px 16px; cursor: pointer;
}
button.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 500; }
button:disabled { opacity: .5; cursor: not-allowed; }
/* Wraps, or a row of four buttons scrolls a phone sideways. */
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
pre {
  background: #0e1216; border: 1px solid var(--line); border-radius: 7px;
  padding: 12px; overflow-x: auto; white-space: pre-wrap;
  font: 12px/1.5 ui-monospace, "SF Mono", Menlo, monospace; color: #c7d2dd;
}
.error { color: #e2756b; font-size: 13px; margin-top: 10px; }
.muted { color: var(--muted); font-size: 12px; }
/* Authoritative: any later rule that sets `display` on an element would otherwise beat this on
   source order alone, and the element would stay on screen while the code believes it is hidden. */
.hidden { display: none !important; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.tag.ours { color: var(--accent); border-color: #2d5a4c; }
.hl { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.hl:last-child { border-bottom: 0; }
/* Inputs are full width by default, which for a tick or a radio pushes its label to the far
   side of the row. Both of them size to themselves. */
.hl input[type=checkbox], .hl input[type=radio] { width: auto; margin-top: 3px; flex: none; }
.highlight-body { flex: 1; min-width: 0; }
.claim-line { display: flex; align-items: center; gap: 8px; min-height: 29px; }
.claim-value { flex: 1; font-size: 14px; }
.claim-line .claim-text { flex: 1; min-width: 0; padding: 5px 8px; }
.claim-line .claim-edit {
  flex: none; padding: 2px 7px; border: 0; color: var(--muted); font-size: 11px;
}
.claim-line .claim-edit:hover { color: var(--text); }
.hl .ev { color: var(--muted); font-size: 12px; }
.claim-evidence > summary { cursor: pointer; }
.claim-evidence > div { margin-top: 4px; }
ol.thinking { padding-left: 18px; }
ol.thinking li { margin-bottom: 10px; }
ol.thinking .why { color: var(--muted); font-size: 12px; }

/* Example briefs under the box. Buttons, not links or divs, so the keyboard and screen readers get
   them for free. */
.examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.examples button {
  width: auto; padding: 5px 11px; font-size: 12px; font-weight: 500;
  background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
}
.examples button:hover { color: var(--text); border-color: #3a4a44; }
.examples button.filled { color: var(--accent); border-color: #2d5a4c; }

/* Keep supporting material available without turning every completed stage into a transcript. */
.section-details > summary, .secondary-details > summary {
  cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 600;
}
.section-details > summary { color: var(--text); font-size: 14px; }
.section-details[open] > summary, .secondary-details[open] > summary { margin-bottom: 10px; }
.section-details h3, .secondary-details h3 {
  margin: 14px 0 6px; font-size: 13px;
}
.secondary-details { margin-top: 12px; }
.technical-meta { margin-top: 10px; }

/* The replay banner. Loud on purpose: nobody should mistake a replay for a live run. */
.banner {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; padding: 10px 14px;
  border: 1px solid #2d5a4c; border-radius: 8px;
  background: rgba(45, 90, 76, .18); color: var(--accent); font-size: 13px;
}
.banner button { width: auto; margin-left: auto; padding: 4px 12px; font-size: 12px; }
td .rowbtn { width: auto; padding: 4px 11px; font-size: 12px; margin-right: 6px; }

/* Posts and pictures. */
.post { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-top: 12px; }
.post h4 { margin: 0 0 8px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.post .body { white-space: pre-wrap; font-size: 14px; line-height: 1.55; }
.post .tags { margin-top: 8px; font-size: 12px; color: var(--accent); }
.post .cta { margin-top: 8px; font-size: 13px; }
.post .checks { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.check { font-size: 11px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.check.bad { color: #e2756b; border-color: #5a2d2d; }
.rule-box, .evaluation {
  margin-top: 10px; border: 1px solid var(--line); border-radius: 7px;
  background: rgba(14, 18, 22, .55); font-size: 12px;
}
.rule-box > summary, .evaluation > summary {
  cursor: pointer; padding: 7px 10px; color: var(--muted); font-weight: 600;
}
.rule-box > div, .evaluation > div { border-top: 1px solid var(--line); }
.rule-intro, .eval-summary { padding: 7px 10px; color: var(--muted); }
.rule-row, .eval-row { display: grid; grid-template-columns: minmax(145px, .8fr) minmax(0, 1.6fr); gap: 10px; padding: 6px 10px; }
.rule-row span:last-child, .eval-row { color: var(--muted); }
.evaluation .eval-pass { color: var(--accent); }
.evaluation .eval-review { color: var(--warn); }
.evaluation .eval-unknown { color: var(--muted); }

/* TEMP PRESENTATION HIGHLIGHT: remove this block after the demo. */
#write-panel {
  border-color: rgba(84, 215, 255, .48);
  background: linear-gradient(110deg, rgba(25, 133, 173, .11), transparent 38%), var(--panel);
  box-shadow: inset 3px 0 0 #54d7ff;
}
#images-panel {
  border-color: rgba(193, 140, 255, .48);
  background: linear-gradient(110deg, rgba(119, 70, 177, .12), transparent 38%), var(--panel);
  box-shadow: inset 3px 0 0 #c18cff;
}
#write-panel > .stage-summary, #write-panel .rule-box > summary {
  color: #75deff;
}
#images-panel > .stage-summary, #images-panel .rule-box > summary {
  color: #cda6ff;
}
#write-panel .rule-box, #write-panel .evaluation { border-color: rgba(84, 215, 255, .42); }
#images-panel .rule-box, #images-panel .evaluation { border-color: rgba(193, 140, 255, .42); }
#write-panel .rule-box > div, #write-panel .evaluation > div {
  border-color: rgba(84, 215, 255, .22);
}
#images-panel .rule-box > div, #images-panel .evaluation > div {
  border-color: rgba(193, 140, 255, .22);
}
#write-panel #write { background: #54d7ff; color: #07151b; }
#images-panel #image-actions button:not(.secondary) { background: #c18cff; color: #160c21; }
#images-panel #image-actions button.secondary {
  background: transparent; color: #cda6ff; border: 1px solid rgba(193, 140, 255, .42);
}
.shot { margin-top: 12px; }
.shot .name { font-size: 12px; color: var(--text); margin-top: 6px; }
/* A contact sheet: every picture the same height, so a portrait next to a square still makes a
   tidy row. Width follows the aspect ratio, which is the thing being compared. */
#gallery { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
#gallery .shot { margin-top: 12px; width: auto; max-width: 100%; }
#gallery .shot img { height: 200px; width: auto; max-width: 100%; }
.shot img { max-width: 320px; width: 100%; border-radius: 8px; border: 1px solid var(--line); display: block; }
.shot .cap { font-size: 11px; color: var(--muted); margin-top: 5px; }

/* Public process notes: compact enough for a demo, detailed enough for a teacher to inspect. */
.how-page { max-width: 980px; }
.how-hero { padding: 24px; }
.how-hero h1 { margin: 3px 0 8px; font-size: clamp(24px, 4vw, 38px); line-height: 1.12; }
.how-hero p { max-width: 680px; margin: 0; color: #c7d2dd; font-size: 16px; }
.how-kicker { color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .14em; }
.how-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.how-tags span {
  padding: 3px 9px; border: 1px solid #2d5a4c; border-radius: 999px;
  color: var(--accent); font-size: 11px;
}
.how-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.how-grid .panel { margin-bottom: 0; }
.flow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 17px; margin-top: 14px; }
.flow-step {
  position: relative; min-height: 78px; padding: 10px 9px;
  border: 1px solid var(--line); border-radius: 8px; background: #0e1216;
}
.flow-step b { display: block; color: var(--accent); font-size: 11px; }
.flow-step span { display: block; margin-top: 5px; font-size: 12px; line-height: 1.35; }
.flow-step:not(:last-child)::after {
  content: "→"; position: absolute; right: -14px; top: 28px; color: var(--muted); z-index: 1;
}
.trace-line { margin: 13px 0 0; color: var(--muted); font: 12px/1.5 ui-monospace, "SF Mono", Menlo, monospace; }
.how-list { list-style: none; margin: 0; padding: 0; }
.how-list li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.how-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.how-list b, .how-list span { display: block; }
.how-list b { font-size: 13px; }
.how-list span { margin-top: 2px; color: var(--muted); font-size: 12px; }
.rule-formula { color: var(--accent); font: 12px/1.5 ui-monospace, "SF Mono", Menlo, monospace; }
.eval-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.eval-card { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #0e1216; }
.eval-card h3 { margin: 0 0 6px; font-size: 13px; }
.eval-card p { margin: 0; color: var(--muted); font-size: 12px; }
.eval-gate {
  margin-top: 10px; padding: 8px 10px; border-left: 3px solid var(--warn);
  background: rgba(224, 163, 92, .08); color: #d8c3aa; font-size: 12px;
}
.update-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.update-item { padding: 10px; border: 1px solid var(--line); border-radius: 7px; }
.update-item b, .update-item span { display: block; }
.update-item b { font-size: 12px; }
.update-item span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.stack-table th { width: 190px; }
.button-link {
  display: inline-block; padding: 9px 14px; border-radius: 7px;
  background: var(--accent); color: #0d1317; font-weight: 700;
}
.button-link:hover { text-decoration: none; }

@media (max-width: 620px) {
  .rule-row { grid-template-columns: 1fr; gap: 2px; }
  main { padding: 14px 12px 40px; }
  .panel { padding: 14px; }
  header { align-items: center; gap: 8px; padding-inline: 12px; }
  .how-grid, .eval-grid, .update-grid { grid-template-columns: 1fr; }
  .flow { grid-template-columns: 1fr; gap: 19px; }
  .flow-step { min-height: 0; }
  .flow-step:not(:last-child)::after { content: "↓"; right: auto; left: 16px; top: auto; bottom: -19px; }
  .stack-table th { width: auto; }
}

/* A switched-off stage: still there, visibly not yet yours to press. */
button[data-locked] { opacity: .45; cursor: not-allowed; background: transparent;
  color: var(--muted); border: 1px dashed var(--line); font-weight: 500; }
