/* ------------------------------------------------------------------
   Absurd Dice — stylesheet
   One accent. Hairlines. Tabular figures. Nothing glows.
   ------------------------------------------------------------------ */

:root {
  --bg: #0f0e0c;
  --bg-2: #15130f;
  --bg-3: #1c1915;
  --ink: #ebe3d1;
  --ink-2: #c9c0ad;
  --muted: #8d8578;
  --faint: #5a544a;
  --hair: rgba(235, 227, 209, 0.16);
  --hair-2: rgba(235, 227, 209, 0.08);
  --accent: #e4532b;
  --accent-ink: #0f0e0c;
  --accent-soft: rgba(228, 83, 43, 0.18);
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, "Noto Serif JP", "Noto Sans Runic", serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Noto Serif JP", "Noto Sans Runic", monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --grain-opacity: 0.07;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f3eee4;
  --bg-2: #ece6d9;
  --bg-3: #e3dccd;
  --ink: #17140f;
  --ink-2: #332e26;
  --muted: #6f685c;
  --faint: #aaa295;
  --hair: rgba(23, 20, 15, 0.18);
  --hair-2: rgba(23, 20, 15, 0.08);
  --accent: #c9401a;
  --accent-ink: #f3eee4;
  --accent-soft: rgba(201, 64, 26, 0.14);
  --grain-opacity: 0.05;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { height: 100%; -webkit-text-size-adjust: 100%; overflow-x: hidden; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-variation-settings: "opsz" 12, "SOFT" 20, "WONK" 0;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga";
  transition: background-color 0.4s var(--ease-in-out), color 0.4s var(--ease-in-out);
}

::selection { background: var(--accent); color: var(--accent-ink); }

.grain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: var(--grain-opacity);
  mix-blend-mode: overlay;
  z-index: 50;
}

a { color: inherit; text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
kbd {
  font-family: var(--mono);
  font-size: 0.68em;
  letter-spacing: 0.04em;
  border: 1px solid var(--hair);
  border-radius: 3px;
  padding: 0.05em 0.4em 0.1em;
  color: var(--muted);
  vertical-align: 0.1em;
}

/* ---------- Masthead ---------- */

.masthead {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
  gap: 1.5rem;
  padding: 1.1rem 1.75rem 1rem;
  border-bottom: 1px solid var(--hair);
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
  font-style: italic;
  font-size: 1.45rem;
  font-weight: 400;
  letter-spacing: -0.015em;
  font-variation-settings: "opsz" 48, "SOFT" 60, "WONK" 1;
  white-space: nowrap;
}

.wordmark-glyph {
  width: 0.78em;
  height: 0.78em;
  border: 1.5px solid var(--ink);
  border-radius: 20%;
  position: relative;
  transform: translateY(0.06em) rotate(-8deg);
  transition: transform 0.6s var(--ease-out);
}
.wordmark-glyph::before,
.wordmark-glyph::after {
  content: "";
  position: absolute;
  width: 0.2em;
  height: 0.2em;
  border-radius: 50%;
  background: var(--ink);
}
.wordmark-glyph::before { left: 0.12em; top: 0.12em; }
.wordmark-glyph::after { right: 0.12em; bottom: 0.12em; background: var(--accent); }
.wordmark:hover .wordmark-glyph { transform: translateY(0.06em) rotate(352deg); }

.tagline {
  margin: 0;
  text-align: center;
  font-style: italic;
  color: var(--muted);
  font-size: 0.98rem;
  letter-spacing: 0.005em;
}

.masthead-tools {
  display: flex;
  justify-content: flex-end;
  gap: 1.25rem;
}

.tool {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  display: inline-flex;
  gap: 0.5em;
  padding: 0.25em 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.tool:hover { color: var(--ink); border-bottom-color: var(--hair); }
.tool-val { color: var(--ink-2); }
.tool[aria-pressed="true"] .tool-val { color: var(--accent); }

/* ---------- Board ---------- */

.board {
  display: grid;
  grid-template-columns: 15.5rem minmax(0, 1fr) 23rem;
  min-height: 60vh;
  border-bottom: 1px solid var(--hair);
}

.board > * { min-width: 0; }
.board > * + * { border-left: 1px solid var(--hair); }

/* ---------- Index ---------- */

.index {
  padding: 1.5rem 0 1.5rem;
  display: flex;
  flex-direction: column;
}

.index-title,
.spec-label,
.ledger-title {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.index-title { padding: 0 1.5rem 0.9rem; }

.index-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}

.index-item {
  display: grid;
  grid-template-columns: 2.4rem 1fr;
  gap: 0 0.5rem;
  align-items: baseline;
  width: 100%;
  text-align: left;
  padding: 0.5rem 1.5rem 0.5rem 1.25rem;
  border-left: 2px solid transparent;
  color: var(--ink-2);
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
  position: relative;
}
.index-item:hover { color: var(--ink); background: var(--bg-2); }
.index-item[aria-current="true"] { color: var(--ink); border-left-color: var(--accent); }
.index-item[aria-current="true"] .index-name { font-style: italic; }

.index-num {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  padding-top: 0.1em;
}
.index-name {
  font-size: 1.02rem;
  line-height: 1.25;
  letter-spacing: -0.005em;
}
.index-reg {
  grid-column: 2;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 0.1rem;
}

.index-foot {
  margin: 1.5rem 1.5rem 0;
  font-style: italic;
  color: var(--faint);
  font-size: 0.85rem;
  line-height: 1.45;
}

/* ---------- Stage ---------- */

.stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background:
    radial-gradient(120% 90% at 50% 40%, var(--bg-2) 0%, var(--bg) 70%);
}

.scene {
  position: relative;
  flex: 1;
  min-height: 24rem;
  aspect-ratio: 4 / 3;
  max-height: calc(100vh - 16rem);
  overflow: hidden;
}

.scene canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  cursor: crosshair;
}
.scene canvas:focus-visible { box-shadow: inset 0 0 0 1px var(--accent); }
/* A scene that takes touch keeps sideways drags (the Trolley's lever) and still lets a vertical swipe scroll the page;
   on a phone the scene is half the screen, and a scene that swallowed every touch left nowhere to scroll from. */
.scene[data-interactive="true"] canvas { cursor: pointer; touch-action: pan-y; }
.scene[data-dragging="true"] canvas { cursor: grabbing; }

.scene-caption {
  position: absolute;
  left: 1.25rem;
  bottom: 1rem;
  right: 1.25rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  text-transform: uppercase;
}
.scene-caption:empty { display: none; }
.scene-progress { position: absolute; left: 0; bottom: 0; height: 1px; width: 100%; background: var(--accent); transform-origin: left center; transform: scaleX(0); opacity: 0; transition: opacity 0.3s; }
.scene-progress.is-live { opacity: 0.9; }
.scene-caption .accent { color: var(--accent); }
.scene-caption .k { text-transform: none; }

.readout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1.5rem;
  padding: 1rem 1.75rem 1.5rem;
  border-top: 1px solid var(--hair);
  min-height: 9.5rem;
}

.result { min-width: 0; }

.result-value {
  font-size: clamp(4rem, 9vw, 7.5rem);
  line-height: 0.95;
  font-weight: 300;
  letter-spacing: -0.035em;
  font-variation-settings: "opsz" 144, "SOFT" 40, "WONK" 1;
  font-variant-numeric: lining-nums proportional-nums;
  transition: color 0.3s;
  overflow-wrap: anywhere;
  min-height: 1em;
}
.result-value.is-text {
  font-size: clamp(2rem, 4.2vw, 3.4rem);
  line-height: 1.05;
  font-style: italic;
  font-weight: 350;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 72, "SOFT" 60, "WONK" 1;
}
.result-value.is-tumbling { color: var(--muted); }
.result-value.is-settled { animation: settle 0.5s var(--ease-out) both; }
@keyframes settle { from { transform: translateY(0.06em) scale(0.985); filter: blur(3px); opacity: 0.3; } to { transform: none; filter: blur(0); opacity: 1; } }
.result-value.is-null { color: var(--faint); }
.result-value .dim { color: var(--muted); font-weight: 300; }
.result-value .thin { font-weight: 200; }
.result-value .small { font-size: 0.42em; font-style: italic; letter-spacing: 0; vertical-align: 0.35em; margin-left: 0.15em; color: var(--muted); }

.result-sub {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-top: 0.5rem;
  min-height: 1.2em;
}
.result-sub .accent { color: var(--accent); }

.verb {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border: 1px solid var(--ink);
  padding: 1.05rem 1.6rem 1rem;
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  white-space: nowrap;
  transition: background-color 0.18s, color 0.18s, transform 0.1s, border-color 0.18s;
}
.verb kbd { border-color: currentColor; opacity: 0.55; }
.verb:hover { background: var(--ink); color: var(--bg); }
.verb:active { transform: translateY(1px); }
.verb:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.verb[disabled] { border-color: var(--hair); color: var(--faint); cursor: default; }
.verb[disabled]:hover { background: none; color: var(--faint); }
.verb.is-busy { border-color: var(--muted); color: var(--muted); }
.verb.is-busy:hover { background: none; color: var(--muted); }
.verb.is-accent { border-color: var(--accent); color: var(--accent); }
.verb.is-accent:hover { background: var(--accent); color: var(--accent-ink); }

/* ---------- Spec ---------- */

.spec {
  padding: 1.5rem 1.75rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  min-width: 0;
}

.spec-head { display: grid; grid-template-columns: auto 1fr; gap: 0 0.75rem; align-items: baseline; }
.spec-numeral {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  grid-row: 1;
}
.spec-name {
  margin: 0;
  font-size: 2.1rem;
  line-height: 1;
  font-weight: 400;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 72, "SOFT" 30, "WONK" 1;
  grid-row: 1;
}
.spec-register {
  grid-column: 2;
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.55rem;
}
.spec-epigraph {
  grid-column: 1 / -1;
  margin: 0.9rem 0 0;
  font-style: italic;
  color: var(--ink-2);
  font-size: 1.02rem;
  line-height: 1.45;
  border-left: 1px solid var(--hair);
  padding-left: 0.9rem;
}

.spec-section { display: flex; flex-direction: column; gap: 0.6rem; }
.spec.is-switching > * { animation: spec-in 0.45s var(--ease-out) both; }
.spec.is-switching > *:nth-child(2) { animation-delay: 0.04s; }
.spec.is-switching > *:nth-child(3) { animation-delay: 0.08s; }
.spec.is-switching > *:nth-child(4) { animation-delay: 0.12s; }
.spec.is-switching > *:nth-child(5) { animation-delay: 0.16s; }
@keyframes spec-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.spec-rule { font-size: 0.95rem; line-height: 1.55; color: var(--ink-2); }
.spec-rule p { margin: 0 0 0.6em; }
.spec-rule p:last-child { margin-bottom: 0; }
.spec-rule em { color: var(--ink); }
.spec-rule code, .spec-rule var {
  font-family: var(--mono);
  font-style: normal;
  font-size: 0.86em;
  color: var(--ink);
  background: var(--bg-3);
  padding: 0.05em 0.35em;
  border-radius: 3px;
}

.spec-confession p {
  margin: 0;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--muted);
  line-height: 1.5;
}

/* ---------- Controls ---------- */

.controls { display: flex; flex-direction: column; gap: 0.9rem; }
.controls:empty::after { content: "None. The die admits no adjustment."; font-style: italic; color: var(--faint); font-size: 0.9rem; }

.control { display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 1rem; align-items: center; }
.control-label { font-size: 0.92rem; color: var(--ink-2); }
.control-readout {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  text-align: right;
  white-space: nowrap;
}
.control-readout .u { color: var(--muted); }
.control-hint { grid-column: 1 / -1; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.04em; color: var(--faint); margin-top: -0.1rem; }

input[type="range"] {
  grid-column: 1 / -1;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 20px;
  background: transparent;
  margin: 0;
  cursor: pointer;
}
input[type="range"]:focus { outline: none; }
input[type="range"]::-webkit-slider-runnable-track { height: 1px; background: var(--hair); }
input[type="range"]::-moz-range-track { height: 1px; background: var(--hair); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--ink);
  border: 0;
  margin-top: -5.5px;
  transition: background-color 0.15s, transform 0.15s;
}
input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--ink);
  border: 0;
  transition: background-color 0.15s, transform 0.15s;
}
input[type="range"]:hover::-webkit-slider-thumb, input[type="range"]:focus-visible::-webkit-slider-thumb { background: var(--accent); transform: scale(1.2); }
input[type="range"]:hover::-moz-range-thumb, input[type="range"]:focus-visible::-moz-range-thumb { background: var(--accent); transform: scale(1.2); }
input[type="range"].is-marked { background-image: linear-gradient(var(--faint), var(--faint)); background-size: 1px 7px; background-repeat: no-repeat; background-position: var(--mark, 50%) 6.5px; }

.control-select { display: flex; flex-wrap: wrap; gap: 0.35rem; grid-column: 1 / -1; }
.chip {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  padding: 0.35em 0.7em;
  border: 1px solid var(--hair);
  color: var(--muted);
  border-radius: 2px;
  transition: all 0.15s;
}
.chip:hover { color: var(--ink); border-color: var(--ink-2); }
.chip[aria-pressed="true"] { color: var(--ink); border-color: var(--ink); }
.chip.is-accent[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }

.control-number {
  grid-column: 2;
  font-family: var(--mono);
  font-size: 0.8rem;
  width: 8.5rem;
  background: var(--bg-3);
  border: 1px solid var(--hair);
  color: var(--ink);
  padding: 0.3em 0.5em;
  border-radius: 2px;
  text-align: right;
}
.control-number:focus { outline: none; border-color: var(--ink-2); }

.control-list { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 0.3rem; }
.list-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--hair-2);
  font-size: 0.92rem;
}
.list-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item-meta { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.08em; color: var(--muted); white-space: nowrap; }
.list-item-meta b { color: var(--ink-2); font-weight: 400; }
.list-remove { color: var(--faint); font-family: var(--mono); font-size: 0.8rem; padding: 0 0.3rem; line-height: 1; }
.list-remove:hover { color: var(--accent); }
.list-add { display: flex; gap: 0.5rem; margin-top: 0.3rem; }
.list-add input {
  flex: 1;
  font-family: var(--serif);
  font-size: 0.92rem;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--hair);
  color: var(--ink);
  padding: 0.3em 0;
  outline: none;
}
.list-add input:focus { border-bottom-color: var(--ink-2); }
.list-add input::placeholder { color: var(--faint); font-style: italic; }

.control-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.action {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.45em 0.8em;
  border: 1px solid var(--hair);
  color: var(--ink-2);
  transition: all 0.15s;
}
.action:hover { border-color: var(--ink); color: var(--ink); }
.action[disabled] { color: var(--faint); border-color: var(--hair-2); cursor: default; }

.meter { display: inline-block; width: 3.2rem; height: 3px; background: var(--hair-2); vertical-align: middle; position: relative; }
.meter::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--v, 50%); background: var(--ink-2); }

/* ---------- Chart ---------- */

.chart { width: 100%; max-width: 26rem; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .bar { fill: var(--ink); opacity: 0.32; transition: opacity 0.3s, y 0.45s var(--ease-out), height 0.45s var(--ease-out), fill 0.3s; }
.chart .bar.is-hit { fill: var(--accent); opacity: 1; }
.chart .bar.is-zero { opacity: 0.12; }
.chart .ghost { fill: none; stroke: var(--muted); stroke-dasharray: 2 3; opacity: 0.7; }
.chart .axis { stroke: var(--hair); }
.chart .tick { font-family: var(--mono); font-size: 9.5px; fill: var(--muted); letter-spacing: 0.02em; }
.chart .tick.is-hit { fill: var(--accent); }
.chart .note { font-family: var(--mono); font-size: 9.5px; fill: var(--faint); font-style: italic; }
.chart .pct { font-family: var(--mono); font-size: 9px; fill: var(--muted); }

.stats {
  margin: 0.2rem 0 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.25rem 1rem;
  font-size: 0.86rem;
}
.stats dt { color: var(--muted); }
.stats dd { margin: 0; font-family: var(--mono); font-size: 0.76rem; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }
.stats dd.accent { color: var(--accent); }
.stats dd.it { font-family: var(--serif); font-style: italic; font-size: 0.86rem; color: var(--ink-2); }

/* ---------- Ledger ---------- */

.ledger { padding: 1.25rem 1.75rem 1.5rem; border-bottom: 1px solid var(--hair); }
.ledger-head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 0.6rem; }
.ledger-count { font-family: var(--mono); font-size: 0.66rem; color: var(--faint); letter-spacing: 0.1em; }
.ledger-clear {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid transparent;
}
.ledger-clear:hover { color: var(--accent); border-bottom-color: var(--accent); }
.ledger-scroll { max-height: 18rem; overflow-y: auto; }
.ledger-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.ledger-table th {
  text-align: left;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 0.3rem 0.75rem 0.4rem 0;
  border-bottom: 1px solid var(--hair);
  position: sticky; top: 0; background: var(--bg);
}
.ledger-table td { padding: 0.42rem 0.75rem 0.42rem 0; border-bottom: 1px solid var(--hair-2); vertical-align: baseline; color: var(--ink-2); }
.ledger-table .num { width: 3rem; font-family: var(--mono); font-size: 0.72rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.ledger-table .cond { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }
.ledger-table .res { text-align: right; padding-right: 0; font-family: var(--serif); color: var(--ink); white-space: nowrap; }
.ledger-table .res .sub { font-family: var(--mono); font-size: 0.66rem; color: var(--muted); margin-left: 0.5rem; }
.ledger-table tr.is-new td { animation: ledger-in 0.6s var(--ease-out); }
@keyframes ledger-in { from { background: var(--accent-soft); } to { background: transparent; } }
.ledger-empty { font-style: italic; color: var(--faint); font-size: 0.9rem; margin: 0.8rem 0 0; }
.ledger-empty[hidden] { display: none; }

/* ---------- Colophon ---------- */

.colophon { padding: 1rem 1.75rem 2.5rem; font-size: 0.84rem; color: var(--faint); font-style: italic; display: flex; justify-content: space-between; gap: 0.6rem 2rem; flex-wrap: wrap; }
.colophon .colophon-legal { display: block; font-style: normal; font-size: 0.78rem; }
.colophon-legal a { border-bottom: 1px solid var(--hair); }
.colophon-legal a:hover { color: var(--ink-2); border-bottom-color: currentColor; }
.colophon p { margin: 0; display: flex; justify-content: space-between; width: 100%; gap: 1rem; flex-wrap: wrap; }
.colophon-keys { font-style: normal; }
.colophon kbd { margin-right: 0.15em; }

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .board { grid-template-columns: 13.5rem minmax(0, 1fr); }
  .spec { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--hair); }
  .spec { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem 2.5rem; }
  .spec-head { grid-column: 1 / -1; }
  .scene { max-height: 60vh; }
}

@media (max-width: 760px) {
  .masthead { grid-template-columns: 1fr; padding: 0.8rem 1rem 0.7rem; gap: 0.45rem; }
  .tagline { display: none; }
  .masthead-tools { justify-content: flex-start; gap: 1rem; }
  .tool { font-size: 0.66rem; }
  .board { grid-template-columns: 1fr; }
  .board > * + * { border-left: 0; border-top: 1px solid var(--hair); }
  .index { padding: 0.9rem 0 0.4rem; }
  .index-title { padding: 0 1rem 0.6rem; }
  .index-list { display: flex; overflow-x: auto; gap: 0; padding: 0 0.5rem 0.6rem; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .index-list::-webkit-scrollbar { display: none; }
  .index-item { grid-template-columns: auto; border-left: 0; border-bottom: 2px solid transparent; padding: 0.4rem 0.75rem; white-space: nowrap; }
  .index-item[aria-current="true"] { border-bottom-color: var(--accent); }
  .index-num { display: none; }
  .index-reg { display: none; }
  .index-foot { display: none; }
  .scene { min-height: 0; aspect-ratio: 1 / 1; max-height: 70vh; }
  .readout { grid-template-columns: 1fr; padding: 0.9rem 1rem 1.1rem; gap: 0.9rem; min-height: 0; }
  .verb { justify-content: center; }
  .verb kbd { display: none; }
  .spec { grid-template-columns: 1fr; padding: 1.25rem 1rem 1.5rem; }
  .ledger, .colophon { padding-left: 1rem; padding-right: 1rem; }
  .colophon-keys { display: none; }
  .ledger-table .cond { display: none; }
  .ledger-table th:nth-child(3) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .result-value.is-settled { animation: none; }
}
