:root {
  color-scheme: light;
  --ink: #20352e;
  --muted: #546960;
  --line: #d2dcd6;
  --paper: #fafbf8;
  --accent: #245746;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  font: 16px/1.5 Inter, system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.mast, main { margin: auto; width: min(1264px, 92%); }
.mast { padding: 19px 0; border-bottom: 1px solid var(--line); }
.brand { color: var(--ink); font-size: 23px; font-weight: 700; letter-spacing: -.075em; text-decoration: none; }
.title-row { margin: clamp(24px, 4vw, 54px) 0 27px; }
.title-row, #experiment-options { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.title-row { justify-content: space-between; }
#experiment-options a { color: var(--accent); }
h1 { margin: 0; font: 400 clamp(36px, 4.2vw, 60px)/1.08 Baskervville, Georgia, serif; letter-spacing: -.045em; }
h2 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -.025em; }
h3 { font-size: 16px; margin: 24px 0 8px; }
button, select { font-weight: 500; line-height: 1.25; font-family: inherit; font-size: 14px; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 5px; padding: 8px 12px; min-height: 38px; }
button, select, input[type=range] { cursor: pointer; }
button:hover:enabled, select:hover:enabled { border-color: var(--muted); }
button:disabled, select:disabled { opacity: .52; cursor: default; }
:focus-visible { outline: 2px solid #227359; outline-offset: 2px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); background: white; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 32px; }
.pane { min-width: 0; display: flex; flex-direction: column; }
.result { border-left: 1px solid var(--line); }
.pane-head, .toolbar { padding: 14px 20px; display: flex; align-items: center; gap: 9px; }
.pane-head { padding-block: 10px; justify-content: space-between; min-height: 60px; border-bottom: 1px solid var(--line); }
.text-button { border: 0; background: transparent; padding: 5px 0 5px 8px; color: var(--accent); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: #aec5b8; }
.editor, #frames { height: clamp(255px, 39vh, 420px); }
.editor { display: flex; background: #fcfdfb; --leading: 24px; }
#gutter, textarea { font: 14px/var(--leading) var(--mono); padding-block: 16px; }
#gutter { color: #74837b; text-align: right; overflow: hidden; min-width: 3.1em; user-select: none; }
#gutter span { display: block; padding-inline: 5px 9px; }
#gutter .active { color: #174332; background: #d7ebdd; box-shadow: inset 3px 0 var(--accent); font-weight: bold; }
textarea { flex: 1; min-width: 0; resize: none; border: 0; padding-inline: 10px; background: transparent; color: var(--ink); tab-size: 4; }
textarea:focus-visible { outline-offset: -2px; }
.toolbar { border-top: 1px solid var(--line); flex-wrap: wrap; min-height: 63px; }
.primary { background: var(--accent); color: white; border-color: var(--accent); padding-inline: 19px; }
#origin { margin-left: auto; }
#status, #position, .frame-heading, summary { font-size: 14px; color: var(--muted); }
#status, #position { font-variant-numeric: tabular-nums; }
#frames { container-type: size; padding: 16px 20px; overflow: auto; }
#frames:has(.empty) { display: grid; align-content: center; justify-items: center; }
.empty { color: var(--muted); text-align: center; margin: 0; max-width: 31ch; }
.frame-heading { margin: 0 0 8px; }
figure { margin: 0 0 16px; }
figure:last-child { margin-bottom: 0; }
.single-grid { min-width: 100%; width: max-content; min-height: 100%; display: grid; place-items: center; }
.grid {
  --side: clamp(13px, min(calc(94cqw / var(--cols) - 2px), calc(92cqh / var(--rows) - 2px)), 64px);
  border-spacing: 1px;
  font: clamp(10px, calc(var(--side) * .45), 16px)/1.2 var(--mono);
}
.grid td { min-width: var(--side); height: var(--side); text-align: center; padding: 1px 2px; border-radius: 2px; }
.relations { border-collapse: collapse; font: 13px/1.5 var(--mono); }
.relations th, .relations td { padding: 4px 14px 4px 0; text-align: left; border-bottom: 1px solid var(--line); }
details { margin: 8px 0; } summary { cursor: pointer; }
#timeline { flex-wrap: nowrap; }
#play { min-width: 66px; }
#scrub { min-width: 45px; flex: 1; accent-color: var(--accent); }
#position { white-space: nowrap; }
#error { color: #943422; margin: 0 20px 16px; font-size: 14px; }
#error:empty { display: none; }
dialog { width: min(560px, calc(100% - 24px)); max-height: 84dvh; padding: 0; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); box-shadow: 0 16px 60px #142d2529; }
dialog::backdrop { background: #182b2347; }
dialog .pane-head { position: sticky; top: 0; background: white; z-index: 1; }
.guide-body { padding: 0 20px 22px; overflow-wrap: anywhere; }
.guide-body p { margin: 8px 0; }
.guide-body code, pre { font: 14px/1.55 var(--mono); }
.guide-body pre { background: #f2f5f0; overflow: auto; padding: 12px; }
.guide-body label { display: block; font-size: 14px; margin: 14px 0 5px; }
.op { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 9px; margin-top: 6px; }
.op button { font: 13px var(--mono); }
.op span { font-size: 14px; color: var(--muted); }
@media (max-width: 740px) {
  .mast, main { width: calc(100% - 28px); }
  .mast { padding: 12px 0; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .result { border-left: 0; border-top: 1px solid var(--line); }
  .pane-head, .toolbar { padding: 10px 14px; min-height: 52px; }
  .editor { height: 185px; }
  #frames { height: 220px; padding: 12px 14px; }
}
