/* Terminal stack of Scott Pierce's identity: square edges, Signal Orange,
   JetBrains Mono for anything that is code or data. */
:root {
  color-scheme: dark;
  --bg: #1a1a1a;
  --surface: #242424;
  --line: #3a3a3a;
  --text: #e0e0e0;
  --muted: #9a9a9a;
  --orange: #e85d00;
  --orange-2: #d4722a;
  --green: #4ade80;
  --stop: #cc3333;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 17px/1.6 var(--sans); }
a { color: var(--text); text-decoration-color: var(--orange); text-underline-offset: 3px; }
a:hover { color: var(--orange-2); }
code, pre, .mono { font-family: var(--mono); }
code { font-size: 0.9em; color: var(--green); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.prompt { color: var(--orange); font-family: var(--mono); font-weight: 600; }

.bar { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 2; }
.bar-row { display: flex; align-items: center; justify-content: space-between; height: 52px; }
.mark { font-family: var(--mono); font-weight: 600; text-decoration: none; font-size: 18px; }
.bar nav { display: flex; gap: 18px; font-family: var(--mono); font-size: 14px; }
.bar nav a { text-decoration: none; color: var(--muted); }
.bar nav a:hover { color: var(--text); }

.hero { padding: 48px 0 8px; }
h1 { font-size: clamp(32px, 6vw, 48px); line-height: 1.1; margin: 0 0 16px; font-weight: 700; }
.lede { max-width: 760px; color: var(--text); margin: 0 0 24px; }
h2 { font: 600 20px/1.3 var(--mono); letter-spacing: 0.02em; margin: 56px 0 16px; }
.slashes { color: var(--orange); }

.status { font: 14px/1.5 var(--mono); border: 2px solid var(--orange); padding: 12px 14px; max-width: 760px; }
.cursor { display: inline-block; width: 9px; height: 1.1em; background: var(--orange); margin-left: 4px; vertical-align: text-bottom; animation: blink 1s steps(1) infinite; }
.status.ready .cursor { display: none; }
@keyframes blink { 50% { opacity: 0; } }
.meter { height: 6px; background: var(--surface); margin-top: 10px; }
.meter > div { height: 100%; width: 0; background: var(--orange); transition: width 0.1s linear; }

.tabs { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line); border-bottom: none; }
.tabs button {
  font: 600 13px var(--mono); letter-spacing: 0.04em; color: var(--muted); background: var(--bg);
  border: none; border-right: 1px solid var(--line); padding: 10px 14px; cursor: pointer; border-radius: 0;
}
.tabs button[aria-selected="true"] { color: var(--text); background: var(--surface); box-shadow: inset 0 -2px 0 var(--orange); }
.tabs button:hover { color: var(--text); }

.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border: 1px solid var(--line); }
.panel { padding: 18px; min-width: 0; }
#left { border-right: 1px solid var(--line); background: var(--surface); }
.blurb { margin: 0 0 14px; color: var(--text); }
.label { font: 600 11px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 16px 0 6px; }
.tools { margin: 0; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.tools .fn { color: var(--orange); }
.tools .ty { color: var(--muted); }
textarea {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 0;
  font: 12.5px/1.5 var(--mono); padding: 10px; resize: vertical;
}
textarea:focus, input:focus { outline: 1px solid var(--orange); outline-offset: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button {
  font: 13px var(--mono); color: var(--text); background: var(--bg); border: 1px solid var(--line);
  padding: 6px 9px; cursor: pointer; border-radius: 0; text-align: left;
}
.chips button:hover { border-color: var(--orange); }

.ask { display: flex; align-items: center; gap: 8px; margin-top: 16px; border: 2px solid var(--line); padding: 4px 4px 4px 10px; background: var(--bg); }
.ask:focus-within { border-color: var(--orange); }
.ask input { flex: 1; min-width: 0; background: none; border: none; color: var(--text); font: 15px var(--mono); padding: 8px 0; }
.ask input:focus { outline: none; }
.ask button, .opts input[type="number"] { border-radius: 0; }
.ask button {
  font: 600 13px var(--mono); background: var(--orange); color: #111; border: none; padding: 9px 16px; cursor: pointer;
}
.ask button:disabled { background: var(--line); color: var(--muted); cursor: default; }
.opts { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 12px; font: 13px var(--mono); color: var(--muted); }
.opts input[type="checkbox"] { accent-color: var(--orange); }
.opts input[type="number"] { width: 64px; background: var(--bg); color: var(--text); border: 1px solid var(--line); font: 13px var(--mono); padding: 2px 6px; }

.empty { color: var(--muted); font: 14px var(--mono); padding: 8px 0; }
.verdict { font: 600 13px var(--mono); letter-spacing: 0.06em; display: inline-block; padding: 4px 10px; border: 2px solid; }
.verdict.act { color: var(--green); border-color: var(--green); }
.verdict.escalate { color: var(--orange); border-color: var(--orange); }
.verdict.none { color: var(--muted); border-color: var(--line); }
.json { margin: 0; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.json .k { color: var(--muted); }
.json .s { color: var(--green); }
.json .n { color: var(--orange-2); }

.decision { margin-top: 4px; }
.opt { display: grid; grid-template-columns: minmax(70px, 30%) 1fr 54px; align-items: center; gap: 8px; font: 12.5px var(--mono); color: var(--muted); padding: 1px 0; }
.opt .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt.chosen { color: var(--text); }
.opt .track { height: 10px; background: var(--surface); }
.opt .fill { height: 100%; background: var(--line); }
.opt.chosen .fill { background: var(--orange); }
.opt .pct { text-align: right; }

.conf { display: flex; align-items: center; gap: 10px; font: 13px var(--mono); }
.conf-bar { position: relative; flex: 1; height: 12px; background: var(--surface); }
#conf-fill { height: 100%; background: var(--green); width: 0; }
.conf-bar.low #conf-fill { background: var(--orange); }
#conf-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); }
.reasoning { margin: 0; font: 13px/1.55 var(--mono); color: var(--muted); }
.timing { margin-top: 14px; font: 12px var(--mono); color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }

.history { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); font: 12.5px/1.5 var(--mono); max-height: 260px; overflow: auto; }
.history:empty::before { content: "no runs yet"; display: block; padding: 10px 12px; color: var(--muted); }
.history li { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 7px 12px; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: none; }
.history .q { color: var(--text); }
.history .c { color: var(--muted); overflow-wrap: anywhere; }
.history .t { color: var(--muted); white-space: nowrap; }
.history .esc { color: var(--orange); }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border: 1px solid var(--line); }
thead th { font: 600 13px var(--mono); color: var(--muted); background: var(--surface); }
tbody th { font: 600 13px var(--mono); color: var(--orange); white-space: nowrap; width: 1%; }
.code { background: var(--surface); border: 1px solid var(--line); padding: 14px 16px; font-size: 13.5px; overflow-x: auto; }
.code .c { color: var(--muted); }
.note { color: var(--muted); font-size: 15px; }
.facts { padding-left: 18px; }
.facts li { margin-bottom: 8px; }
.facts b { color: var(--text); }
.foot { border-top: 1px solid var(--line); margin-top: 56px; padding: 20px 16px 40px; font: 13px var(--mono); color: var(--muted); }

@media (max-width: 820px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  #left { border-right: none; border-bottom: 1px solid var(--line); }
  .bar nav { gap: 12px; }
  body { font-size: 16px; }
}

/* // SCENES */
.scene-head { display: flex; justify-content: space-between; align-items: baseline; }
.scene-head .label { margin-top: 0; }
.link-btn { background: none; border: none; color: var(--muted); font: 12px var(--mono); cursor: pointer; padding: 0; text-decoration: underline; text-decoration-color: var(--line); }
.link-btn:hover { color: var(--text); }
.scene { border: 1px solid var(--line); background: var(--bg); padding: 12px; margin-bottom: 14px; }
.stage { font-family: var(--mono); font-size: 13px; }
.scene-log { list-style: none; margin: 10px 0 0; padding: 8px 0 0; border-top: 1px dashed var(--line); font: 12px/1.6 var(--mono); color: var(--muted); min-height: 1.6em; }
.scene-log li:first-child { color: var(--text); }
.scene-log li.held { color: var(--orange); }
.scene-log li.held::before { content: "⏸ "; }
.scene-log li:first-child:not(.held)::before { content: "$ "; color: var(--orange); }

.grid-map { display: grid; grid-template-columns: repeat(9, 30px); grid-auto-rows: 30px; gap: 2px; }
.cell { display: flex; align-items: center; justify-content: center; background: var(--surface); color: #555; font-size: 16px; transition: background 0.4s, color 0.4s; }
@media (max-width: 420px) { .grid-map { grid-template-columns: repeat(9, 26px); grid-auto-rows: 26px; } }
.grid-map.lit .cell { background: #2e2a24; }
.cell.dark { background: #111; color: #222; }
.cell.you { color: var(--orange); font-weight: 600; }
.cell.foe { color: var(--stop); font-weight: 600; }
.cell.dead { color: #555; }
.hud { margin-top: 8px; color: var(--muted); }
.hearts { color: var(--stop); letter-spacing: 2px; }
.bubble { margin-top: 8px; color: var(--green); }

.arm-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.gripper { display: flex; gap: 8px; align-items: center; border: 2px solid var(--line); padding: 6px 10px; }
.gripper.holding { border-color: var(--orange); }
.label { font: 600 11px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.stage .label { margin-right: 4px; }
.empty-slot { color: #555; }
.speed.fast { color: var(--orange); }
.speed.slow { color: var(--green); }
.estop { background: var(--stop); color: #fff; font-weight: 600; padding: 3px 8px; }
.belt, .bin { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.belt { border-bottom: 3px double var(--line); padding-bottom: 10px; margin-bottom: 10px; }
.bins { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bin { border: 1px solid var(--line); border-top: none; min-height: 58px; padding: 6px; align-content: flex-start; }
.part { font-size: 12px; padding: 2px 6px; border: 1px solid; }
.part.red { color: #ff6b6b; border-color: #ff6b6b; }
.part.blue { color: #6bb8ff; border-color: #6bb8ff; }
.part.yellow { color: #ffd166; border-color: #ffd166; }
.part.green { color: var(--green); border-color: var(--green); }

.dash { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { border: 1px solid var(--line); padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile.wide { grid-column: span 2; }
.tile .big { font-size: 20px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .big.live { color: var(--green); }

.ledger { width: 100%; border-collapse: collapse; font: 12.5px var(--mono); }
.ledger th, .ledger td { border: none; border-bottom: 1px solid var(--line); padding: 5px 6px; text-align: left; }
.ledger th { color: var(--muted); font-weight: 600; }
.ledger .num { text-align: right; }
.ledger .empty-row { color: #555; }
.totals { margin-top: 8px; text-align: right; color: var(--orange); }
.plain { color: var(--muted); }

/* // RACE */
.race-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin: 16px 0; }
.go { font: 600 14px var(--mono); background: var(--orange); color: #111; border: none; padding: 11px 18px; cursor: pointer; border-radius: 0; }
.go:disabled { background: var(--line); color: var(--muted); cursor: default; }
.race-note { font: 12.5px var(--mono); color: var(--muted); }
.race { border: 1px solid var(--line); padding: 16px; display: grid; gap: 16px; }
.lane-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font: 13px var(--mono); margin-bottom: 6px; }
.who { font-weight: 600; }
#lane-ours .who { color: var(--orange); }
.stat { color: var(--muted); }
.lane-bar { height: 14px; background: var(--surface); }
.lane-fill { height: 100%; width: 0; transition: width 0.2s linear; }
#fill-ours { background: var(--orange); }
#fill-cactus { background: #777; }
.chips-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; font: 11.5px var(--mono); color: var(--muted); }
.chips-row span { border: 1px solid var(--line); padding: 1px 6px; }
.chips-row span.diff { border-color: var(--orange); color: var(--orange); }
.race-verdict { font: 600 15px var(--mono); }
.race-verdict .win { color: var(--orange); }
