:root {
  color-scheme: dark light;
  --bg: #0f1115;
  --panel: #171a21;
  --line: #262a33;
  --text: #d7dae0;
  --muted: #8b919c;
  --accent: #e5484d;
  --op: #f2c572;
  --reg: #7cc4fa;
  --num: #b9e08a;
  --mod: #c9a4f5;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  /* EXEC region colours. */
  --r0: #e5484d; --r1: #46a758; --r2: #f2c572; --r3: #7cc4fa; --r4: #c9a4f5; --r5: #f76b15;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #fafafa; --panel: #fff; --line: #e3e5e8; --text: #1d2026; --muted: #5d636e;
    --accent: #c62a2f; --op: #8a5200; --reg: #0b5c9c; --num: #2f6a0c; --mod: #6d35b0;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0 auto; max-width: 1100px; padding: 2rem 1.25rem 3rem;
  background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
h1 { margin: 0; font: 600 1.6rem var(--mono); }
h1::before { content: "▍"; color: var(--accent); }
header p { color: var(--muted); max-width: 62ch; margin: .4rem 0; }
a { color: var(--reg); }
code { font-family: var(--mono); font-size: .9em; }

.input { margin: 1.75rem 0 1.25rem; }
.input > label { display: block; color: var(--muted); font-size: .85rem; margin-bottom: .4rem; }
textarea {
  width: 100%; resize: vertical; padding: .75rem;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  font: 13px/1.5 var(--mono);
}
textarea:focus-visible, button:focus-visible, .file:focus-within { outline: 2px solid var(--reg); outline-offset: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .6rem; }
button, .file {
  position: relative; padding: .45rem .9rem; border-radius: 6px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; font: inherit; font-size: .9rem; cursor: pointer;
}
.secondary { background: transparent; color: var(--text); border-color: var(--line); }
.secondary:hover { border-color: var(--muted); }
.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
#status { color: var(--muted); font-size: .85rem; }
#status.error { color: var(--accent); }
.hint { color: var(--muted); font-size: .8rem; margin: .4rem 0 0; }
body.dragging { outline: 2px dashed var(--reg); outline-offset: -8px; }

.output { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.output[hidden], [hidden] { display: none !important; }
.scroll { overflow-x: auto; }
.views { display: flex; gap: .25rem; margin: 0; padding: .5rem .6rem; border: 0; border-bottom: 1px solid var(--line); }
.views label { padding: .25rem .7rem; border-radius: 6px; color: var(--muted); font-size: .85rem; cursor: pointer; }
.views label:has(:checked) { background: color-mix(in srgb, var(--reg) 14%, transparent); color: var(--text); }
.views label:has(:focus-visible) { outline: 2px solid var(--reg); }
.views input { position: absolute; opacity: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.check { display: inline-flex; gap: .35rem; align-items: center; color: var(--muted); font-size: .9rem; cursor: pointer; }
.check input { accent-color: var(--accent); }
table { border-collapse: collapse; width: 100%; font: 13px/1.6 var(--mono); }
th {
  text-align: left; padding: .6rem .9rem; border-bottom: 1px solid var(--line);
  font: 600 .72rem system-ui, sans-serif; color: var(--muted); text-transform: uppercase; letter-spacing: .05em;
}
td { padding: .1rem .9rem; white-space: pre; vertical-align: top; }
tbody tr:first-child td { padding-top: .5rem; }
tbody tr:last-child td { padding-bottom: .5rem; }
tbody tr:hover { background: color-mix(in srgb, var(--reg) 8%, transparent); }
td:first-child, td:last-child { color: var(--muted); }
tr.block-start td { border-top: 1px solid var(--line); }
tr.label td { padding-top: .6rem; color: var(--op); font-weight: 600; }

#graph { position: relative; padding: .9rem .9rem .9rem 24px; font: 13px/1.6 var(--mono); width: max-content; min-width: 100%; }
.edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.edge { fill: none; stroke-width: 1.5; }
.edge.cond, marker .cond { stroke: var(--num); fill: var(--num); }
.edge.jump, marker .jump { stroke: var(--reg); fill: var(--reg); }
.edge.back, marker .back { stroke: var(--op); fill: var(--op); }
.edge { fill: none !important; }
.block { position: relative; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 1.1rem; background: var(--bg); white-space: pre; }
.block.falls::after { content: ""; position: absolute; left: 50%; bottom: -1.1rem; height: 1.1rem; border-left: 1px dashed var(--muted); }
.block .head { display: flex; gap: .6rem; align-items: baseline; padding: .25rem .7rem; border-bottom: 1px solid var(--line); font: 600 .75rem system-ui, sans-serif; color: var(--muted); }
.block .head .sym { color: var(--op); font-family: var(--mono); }
.block .head .exits { margin-left: auto; font-weight: 400; }
.block > div:not(.head) { padding: 0 .7rem; }
.block > div:nth-child(2) { padding-top: .3rem; }
.block > div:last-child { padding-bottom: .3rem; }
.off { color: var(--muted); margin-right: 1.2rem; }
.op { color: var(--op); }
.reg { color: var(--reg); }
.num { color: var(--num); }
.mod { color: var(--mod); }
.unknown { color: var(--accent); }

footer { margin-top: 2rem; color: var(--muted); font-size: .8rem; }

/* Liveness and EXEC regions in the listing. */
caption { caption-side: top; text-align: left; padding: .55rem .9rem; color: var(--muted); font: .8rem system-ui, sans-serif; border-bottom: 1px solid var(--line); }
.swatch { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; margin: 0 .3rem 0 .7rem; vertical-align: -1px; background: var(--region); }
td.exec { box-shadow: inset 3px 0 0 var(--region, transparent); }
td.live { color: var(--muted); font-size: 12px; }
.bar { display: inline-block; width: 3.5rem; height: .45rem; margin-right: .5rem; border-radius: 2px; background: var(--line); vertical-align: 1px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--reg); }
.block .head .facts { font-weight: 400; }
