/* Giga Viz — The Liquid Engine · engine-room stylesheet */

/* ---------- fonts (self-hosted) ---------- */
@font-face {
  font-family: 'Big Shoulders';
  src: url('./assets/fonts/big-shoulders-800-latin.woff2') format('woff2');
  font-weight: 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Big Shoulders';
  src: url('./assets/fonts/big-shoulders-600-latin.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'DM Mono';
  src: url('./assets/fonts/dm-mono-400-latin.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'DM Mono';
  src: url('./assets/fonts/dm-mono-500-latin.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}

/* ---------- theme tokens ---------- */
:root, html[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0f1114;
  --bg-deep: #0a0c0e;
  --panel: #15181d;
  --panel-2: #191d23;
  --plate: #1a1e24;
  --line: #2c3038;
  --line-soft: #22262d;
  --ink: #e9e2cf;
  --muted: #948d7b;
  --faint: #6b665a;
  --brass: #c9a227;
  --brass-bright: #e6c14a;
  --copper: #c96f33;
  --patina: #4aa896;
  --steam: #8b93a3;
  --danger: #c65441;
  --stage: #0b0d0a;
  --stage-line: #1d2118;
  --glow: rgba(201, 162, 39, 0.35);
  --grain-opacity: 0.05;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
}
html[data-theme='light'] {
  color-scheme: light;
  --bg: #ebe7dc;
  --bg-deep: #e2ddcf;
  --panel: #f4f1e7;
  --panel-2: #efebdf;
  --plate: #f7f4ea;
  --line: #b9b2a0;
  --line-soft: #cdc6b4;
  --ink: #20242a;
  --muted: #6a6455;
  --faint: #8d8672;
  --brass: #7d6008;
  --brass-bright: #93720c;
  --copper: #94481a;
  --patina: #1f6e5f;
  --steam: #5a6270;
  --danger: #a03826;
  --stage: #f0ecdf;
  --stage-line: #d8d2bf;
  --glow: rgba(125, 96, 8, 0.3);
  --grain-opacity: 0.035;
  --shadow: 0 14px 34px rgba(60, 52, 30, 0.18);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 70% -10%, rgba(201, 162, 39, 0.05), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 31px, color-mix(in srgb, var(--line-soft) 34%, transparent) 31px 32px),
    repeating-linear-gradient(90deg, transparent 0 31px, color-mix(in srgb, var(--line-soft) 34%, transparent) 31px 32px),
    var(--bg);
  color: var(--ink);
  font-family: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
}
body::after { /* film grain */
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 60;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}
main { max-width: 1360px; margin: 0 auto; padding: 0 28px 40px; }
a { color: var(--brass-bright); }
::selection { background: var(--brass); color: var(--bg-deep); }

h1, h2, .deck-no, .eyebrow, .plate-title, .rail-title, .notes-heading {
  font-family: 'Big Shoulders', 'Arial Narrow', sans-serif;
  letter-spacing: 0.04em;
}
dl, dt, dd, code, .mono, .ctl, .ledger, .rail, .deck-disclosure, .mast-rules, .board-table,
.stage-hints, .scrub-label, .plate-foot, .colophon-list, .shift-bar-scale {
  font-family: 'DM Mono', ui-monospace, 'Cascadia Mono', monospace;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
.skip {
  position: fixed; left: 12px; top: -60px; z-index: 100;
  background: var(--brass); color: #14120a; padding: 10px 16px;
  font-family: 'DM Mono', monospace; font-size: 13px; text-decoration: none;
  transition: top 0.15s ease;
}
.skip:focus { top: 52px; }

:is(button, a, input, canvas, summary):focus-visible {
  outline: 2px solid var(--brass-bright);
  outline-offset: 3px;
}

/* ---------- operator rail ---------- */
.rail {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 18px;
  height: 40px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg-deep) 88%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  font-size: 11.5px; letter-spacing: 0.14em;
}
.rail-brand { color: var(--faint); }
.rail-link { color: var(--muted); text-decoration: none; }
.rail-link:hover { color: var(--brass-bright); }
.rail-title { color: var(--ink); font-weight: 600; font-size: 15px; letter-spacing: 0.12em; }
.rail-status { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); }
.lamp {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brass); box-shadow: 0 0 8px var(--glow);
}
body[data-ready='true'] .lamp { background: var(--patina); box-shadow: 0 0 8px color-mix(in srgb, var(--patina) 50%, transparent); }
.lamp.is-live { background: var(--patina); box-shadow: 0 0 12px color-mix(in srgb, var(--patina) 70%, transparent); }
.lamp.is-retrying { background: var(--copper); box-shadow: 0 0 10px color-mix(in srgb, var(--copper) 65%, transparent); }
.lamp.is-degraded { background: var(--danger); box-shadow: 0 0 10px color-mix(in srgb, var(--danger) 65%, transparent); }
.rail-toggle {
  display: flex; align-items: center; gap: 8px;
  background: none; border: 1px solid var(--line); color: var(--muted);
  padding: 5px 10px; cursor: pointer; font: inherit; letter-spacing: 0.14em;
}
.rail-toggle:hover { color: var(--ink); border-color: var(--brass); }
.toggle-track {
  display: inline-block; width: 26px; height: 12px; border: 1px solid var(--line);
  border-radius: 8px; position: relative;
}
.toggle-thumb {
  position: absolute; top: 1px; left: 1px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--brass); transition: transform 0.2s ease;
}
html[data-theme='light'] .toggle-thumb { transform: translateX(14px); }

/* ---------- masthead ---------- */
.masthead {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr);
  gap: 48px; padding: 72px 0 40px; align-items: start;
}
.eyebrow {
  margin: 0 0 14px; font-size: 13px; font-weight: 600;
  color: var(--brass); letter-spacing: 0.22em;
}
h1 {
  margin: 0 0 22px; font-size: clamp(64px, 9vw, 132px); font-weight: 800;
  line-height: 0.86; text-transform: uppercase;
}
h1 .ink-brass { color: var(--brass); }
.dek { max-width: 62ch; font-size: 17.5px; color: color-mix(in srgb, var(--ink) 86%, var(--muted)); margin: 0 0 24px; }
.dek strong { color: var(--brass-bright); font-weight: 600; }
.mast-rules {
  list-style: none; display: flex; flex-wrap: wrap; gap: 10px 22px;
  margin: 0; padding: 14px 0 0; border-top: 1px solid var(--line-soft);
  font-size: 12px; color: var(--muted);
}
.rule-key { color: var(--copper); margin-right: 7px; letter-spacing: 0.1em; }

/* riveted plates */
.manifest-plate, .plate {
  position: relative;
  background: linear-gradient(160deg, var(--plate), var(--panel));
  border: 1px solid var(--line);
  box-shadow: var(--shadow), inset 0 0 0 1px color-mix(in srgb, var(--bg-deep) 40%, transparent);
  padding: 22px 24px 18px;
}
.manifest-plate::before, .plate::before {
  content: ''; position: absolute; inset: 7px; pointer-events: none;
  border: 1px dashed color-mix(in srgb, var(--line) 70%, transparent);
}
.manifest-plate::after, .plate::after {
  content: ''; position: absolute; width: 100%; height: 100%; inset: 0; pointer-events: none;
  background:
    radial-gradient(3px 3px at 13px 13px, var(--faint) 45%, transparent 55%),
    radial-gradient(3px 3px at calc(100% - 13px) 13px, var(--faint) 45%, transparent 55%),
    radial-gradient(3px 3px at 13px calc(100% - 13px), var(--faint) 45%, transparent 55%),
    radial-gradient(3px 3px at calc(100% - 13px) calc(100% - 13px), var(--faint) 45%, transparent 55%);
}
.plate-title {
  margin: 0 0 14px; font-size: 15px; font-weight: 600; color: var(--brass);
  letter-spacing: 0.18em;
}
.plate-grid { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; font-size: 12.5px; }
.plate-grid dt { color: var(--muted); letter-spacing: 0.06em; }
.plate-grid dd { margin: 0; text-align: right; color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.plate-grid dd.unavail { color: var(--faint); font-style: italic; }
.plate-grid dd a { color: var(--brass-bright); text-decoration: none; border-bottom: 1px dotted var(--brass); }
.plate-foot { margin: 14px 0 0; font-size: 10.5px; color: var(--faint); line-height: 1.6; }

/* ---------- direct WSS ignition bus ---------- */
.live-bus {
  position: relative;
  margin: 6px 0 26px;
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--brass) 6%, transparent), transparent 36%),
    repeating-linear-gradient(90deg, transparent 0 63px, color-mix(in srgb, var(--line-soft) 44%, transparent) 63px 64px),
    var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.live-bus::before {
  content: ''; position: absolute; inset: 7px; pointer-events: none;
  border: 1px dashed color-mix(in srgb, var(--line) 62%, transparent);
}
.live-bus-head {
  position: relative; display: flex; align-items: end; justify-content: space-between; gap: 24px;
  padding: 22px 24px 15px; border-bottom: 1px solid var(--line);
}
.live-bus-head h2 {
  margin: 2px 0 0; font-family: 'Big Shoulders', sans-serif; font-weight: 800;
  font-size: clamp(31px, 4vw, 50px); line-height: 0.95; letter-spacing: 0.06em;
}
.live-link-state {
  margin: 0; display: flex; align-items: center; gap: 10px;
  font-family: 'DM Mono', monospace; font-size: 11px; letter-spacing: 0.14em;
  color: var(--brass-bright); text-align: right;
}
.live-beacon {
  width: 11px; height: 11px; border-radius: 50%; flex: none;
  border: 1px solid var(--brass); background: color-mix(in srgb, var(--brass) 28%, transparent);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--brass) 8%, transparent), 0 0 16px var(--glow);
}
.live-bus[data-state='live'] .live-beacon {
  border-color: var(--patina); background: var(--patina);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--patina) 10%, transparent), 0 0 18px color-mix(in srgb, var(--patina) 58%, transparent);
}
.live-bus[data-state='retrying'] .live-beacon,
.live-bus[data-state='validating'] .live-beacon { border-color: var(--copper); background: var(--copper); }
.live-bus[data-state='degraded'] .live-beacon {
  border-color: var(--danger); background: var(--danger);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--danger) 10%, transparent), 0 0 18px color-mix(in srgb, var(--danger) 55%, transparent);
}
.live-bus-grid {
  position: relative; display: grid; grid-template-columns: minmax(270px, 0.72fr) minmax(0, 1.5fr);
  min-height: 210px;
}
.live-gauges {
  margin: 0; padding: 18px 24px; display: grid; align-content: center; gap: 0;
  border-right: 1px solid var(--line);
  font-family: 'DM Mono', monospace;
}
.live-gauges div {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px;
  padding: 6px 0; border-bottom: 1px dotted var(--line-soft);
}
.live-gauges dt { color: var(--muted); font-size: 10px; letter-spacing: 0.12em; }
.live-gauges dd {
  margin: 0; color: var(--brass-bright); font-size: 12px; font-weight: 500;
  text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.live-tape-wrap { min-width: 0; padding: 17px 24px 19px; }
.live-tape-head { display: flex; justify-content: space-between; gap: 18px; align-items: baseline; margin-bottom: 10px; }
.live-tape-head h3 {
  margin: 0; font-family: 'Big Shoulders', sans-serif; font-size: 17px; letter-spacing: 0.15em; color: var(--copper);
}
.live-tape-head span { font-family: 'DM Mono', monospace; font-size: 9px; letter-spacing: 0.1em; color: var(--faint); }
.live-tape { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.live-tape li { min-width: 0; }
.live-empty {
  padding: 18px 12px; border: 1px dashed var(--faint); color: var(--faint);
  font-family: 'DM Mono', monospace; font-size: 10.5px; letter-spacing: 0.1em; text-align: center;
}
.live-strike {
  display: grid; grid-template-columns: minmax(112px, 0.55fr) minmax(165px, 1fr) auto auto;
  gap: 12px; align-items: baseline; padding: 7px 9px;
  border: 1px solid var(--line-soft); background: color-mix(in srgb, var(--bg-deep) 58%, transparent);
  font-family: 'DM Mono', monospace; font-size: 10.5px;
}
.live-strike:hover { border-color: var(--brass); }
.live-pair { color: var(--ink); font-weight: 500; }
.live-flow { color: var(--brass-bright); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-mode { color: var(--patina); letter-spacing: 0.08em; }
.live-strike a { color: var(--muted); text-decoration: none; white-space: nowrap; }
.live-strike a:hover { color: var(--brass-bright); }
.live-boundary {
  position: relative; margin: 0; padding: 11px 24px 13px; border-top: 1px solid var(--line);
  font-family: 'DM Mono', monospace; font-size: 9.5px; line-height: 1.65; letter-spacing: 0.04em; color: var(--faint);
}
.live-boundary code { color: var(--copper); }

/* ---------- deck index ---------- */
.deck-index {
  display: flex; flex-wrap: wrap; gap: 1px; margin: 8px 0 26px;
  border: 1px solid var(--line); background: var(--line);
}
.deck-index a {
  flex: 1 1 160px; padding: 12px 16px; text-decoration: none;
  background: var(--panel); color: var(--muted);
  font-family: 'Big Shoulders', sans-serif; font-weight: 600; font-size: 17px; letter-spacing: 0.1em;
}
.deck-index a b { color: var(--copper); margin-right: 8px; font-weight: 800; }
.deck-index a:hover { background: var(--panel-2); color: var(--brass-bright); }

/* ---------- decks ---------- */
.deck { margin: 44px 0 70px; }
.deck-head { max-width: 900px; }
.deck-no { margin: 0; color: var(--copper); font-weight: 600; font-size: 14px; letter-spacing: 0.3em; }
.deck h2 {
  margin: 4px 0 14px; font-size: clamp(38px, 5vw, 64px); font-weight: 800;
  text-transform: uppercase; line-height: 0.95;
}
.deck-dek { margin: 0 0 10px; color: color-mix(in srgb, var(--ink) 82%, var(--muted)); font-size: 15.5px; }
.deck-dek b { color: var(--brass-bright); font-weight: 600; }
.deck-disclosure { margin: 10px 0 0; font-size: 11.5px; color: var(--faint); letter-spacing: 0.04em; }

.studio {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px; margin-top: 26px; align-items: start;
}
.studio-stack { grid-template-columns: minmax(0, 1fr) 340px; }

.stage {
  margin: 0; position: relative; overflow: hidden;
  border: 1px solid var(--line); background:
    radial-gradient(900px 480px at 50% 18%, color-mix(in srgb, var(--brass) 4%, transparent), transparent 70%),
    var(--stage);
  box-shadow: var(--shadow);
}
.stage canvas {
  display: block; width: 100%; height: 560px; touch-action: none; cursor: grab;
}
#manifold-canvas { height: 470px; cursor: crosshair; }
.stage-hints {
  position: absolute; top: 10px; left: 12px; right: 12px; margin: 0;
  max-width: calc(100% - 24px); white-space: normal; line-height: 1.5;
  font-size: 10px; letter-spacing: 0.12em; color: var(--faint);
}
.stage-controls {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px; border-top: 1px solid var(--line-soft);
}
.ctl {
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--line);
  font-size: 11.5px; letter-spacing: 0.12em; padding: 9px 14px; cursor: pointer;
}
.ctl:hover { border-color: var(--brass); color: var(--brass-bright); }
.ctl[aria-pressed='true'] { border-color: var(--brass); box-shadow: inset 0 0 0 1px var(--brass); }
.scrub-label { font-size: 10.5px; color: var(--muted); letter-spacing: 0.16em; margin-left: 8px; }
input[type='range'] {
  flex: 1 1 160px; accent-color: var(--brass); height: 26px; min-width: 120px;
  background: transparent;
}

.readout { min-height: 280px; }
.howto { margin: 16px 0 4px; font-size: 12px; color: var(--muted); }
.howto summary { cursor: pointer; color: var(--copper); letter-spacing: 0.08em; font-family: 'DM Mono', monospace; }
.howto ul { margin: 10px 0 0; padding-left: 18px; display: grid; gap: 6px; }
.ledger-title { margin-top: 20px; }
.ledger { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; counter-reset: ledger; }
.ledger button {
  width: 100%; display: flex; justify-content: space-between; gap: 10px; align-items: baseline;
  background: none; border: 1px solid var(--line-soft); color: var(--ink);
  font: inherit; font-size: 12px; padding: 8px 10px; cursor: pointer; text-align: left;
}
.ledger button:hover { border-color: var(--brass); }
.ledger button[aria-pressed='true'] { border-color: var(--brass); background: color-mix(in srgb, var(--brass) 9%, transparent); }
.ledger .lv { color: var(--brass-bright); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- shift log ---------- */
.shift-rows { list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 8px; }
.shift-rows li { display: block; }
.shift-row {
  width: 100%; display: grid; grid-template-columns: 74px minmax(0, 1fr) 96px;
  align-items: center; gap: 14px;
  background: var(--panel); border: 1px solid var(--line-soft);
  padding: 10px 14px; cursor: pointer; font: inherit; color: var(--ink); text-align: left;
}
.shift-row:hover { border-color: var(--brass); }
.shift-row[aria-pressed='true'] { border-color: var(--brass); background: color-mix(in srgb, var(--brass) 8%, var(--panel)); }
.shift-day { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--muted); }
.shift-bar { position: relative; height: 22px; background: var(--bg-deep); border: 1px solid var(--line-soft); }
.shift-seg { position: absolute; top: 0; bottom: 0; }
.seg-new { background: linear-gradient(180deg, color-mix(in srgb, var(--copper) 92%, white), var(--copper)); }
.seg-ret { background: linear-gradient(180deg, color-mix(in srgb, var(--patina) 92%, white), var(--patina)); }
.shift-notch {
  position: absolute; top: -4px; bottom: -4px; width: 2px;
  background: var(--ink); opacity: 0.55;
}
.shift-count { font-family: 'DM Mono', monospace; font-size: 12px; text-align: right; color: var(--brass-bright); font-variant-numeric: tabular-nums; }
.shift-legend {
  display: flex; gap: 20px; margin: 14px 0 0; font-family: 'DM Mono', monospace;
  font-size: 11px; color: var(--muted); flex-wrap: wrap;
}
.shift-legend i, .board-legend i { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; }
.shift-legend .k-new { background: var(--copper); }
.shift-legend .k-ret { background: var(--patina); }
.shift-legend .k-notch { background: var(--ink); width: 2px; height: 14px; }

/* ---------- maintenance board ---------- */
.board-wrap { margin-top: 26px; overflow-x: auto; contain: inline-size; }
.board-legend { display: flex; gap: 22px; font-size: 11px; color: var(--muted); margin: 0 0 12px; font-family: 'DM Mono', monospace; }
.chip-dial { background: conic-gradient(var(--brass) 0 60%, var(--bg-deep) 60% 100%); border-radius: 50%; border: 1px solid var(--line); }
.chip-due { border: 1px dashed var(--faint); background: transparent; }
.board-table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 640px; }
.board-table th {
  text-align: left; color: var(--copper); font-weight: 500; letter-spacing: 0.14em;
  border-bottom: 1px solid var(--line); padding: 8px 10px; font-size: 11px;
}
.board-table td { border-bottom: 1px solid var(--line-soft); padding: 7px 10px; vertical-align: middle; }
.board-table tr:hover td { background: color-mix(in srgb, var(--brass) 5%, transparent); }
.cohort-day { color: var(--ink); font-weight: 500; white-space: nowrap; }
.cohort-size { color: var(--muted); font-variant-numeric: tabular-nums; }
.dial-cell { display: flex; align-items: center; gap: 9px; }
.dial {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  border: 1px solid var(--line);
  background: conic-gradient(var(--brass) calc(var(--rate) * 1turn), var(--bg-deep) 0);
  box-shadow: inset 0 0 0 6px var(--panel);
}
.dial-rate { color: var(--ink); font-variant-numeric: tabular-nums; }
.not-due {
  display: inline-block; padding: 4px 8px; border: 1px dashed var(--faint);
  color: var(--faint); font-size: 10px; letter-spacing: 0.12em;
}

/* ---------- deck 05-07 stages ---------- */
#furnace-canvas { height: 400px; cursor: pointer; }
#caliper-canvas { height: 420px; cursor: crosshair; }
#dynamo-canvas { height: 440px; cursor: crosshair; }
.stage-alt { border-color: color-mix(in srgb, var(--steam) 55%, var(--line)); }
.stage-alt::after {
  content: 'SEPARATE SOURCE'; position: absolute; top: 8px; right: 10px;
  font-family: 'DM Mono', monospace; font-size: 9px; letter-spacing: 0.18em;
  color: var(--steam); border: 1px solid color-mix(in srgb, var(--steam) 60%, transparent);
  padding: 2px 7px;
}

/* ---------- deck 08 counterweights ---------- */
.weights-wrap { margin-top: 26px; display: grid; gap: 26px; }
.weights-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.weight-dial {
  position: relative; background: linear-gradient(160deg, var(--plate), var(--panel));
  border: 1px solid var(--line); padding: 18px 18px 16px;
  display: grid; grid-template-columns: 74px 1fr; gap: 4px 16px; align-items: center;
}
.weight-face {
  grid-row: 1 / 3; width: 74px; height: 74px; border-radius: 50%;
  border: 1px solid var(--line);
  background: conic-gradient(from 180deg, var(--copper) calc(var(--share) * 1turn), var(--bg-deep) 0);
  box-shadow: inset 0 0 0 13px var(--panel);
}
.weight-dial.heavy .weight-face { background: conic-gradient(from 180deg, var(--danger) calc(var(--share) * 1turn), var(--bg-deep) 0); }
.weight-value { font-family: 'DM Mono', monospace; font-size: 24px; font-weight: 500; color: var(--brass-bright); font-variant-numeric: tabular-nums; align-self: end; }
.weight-label { font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: 0.1em; color: var(--muted); align-self: start; line-height: 1.55; }
.weights-track-fig { margin: 0; border: 1px solid var(--line-soft); background: var(--panel); padding: 16px 18px; }
.weights-track-cap { font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: 0.14em; color: var(--muted); margin-bottom: 12px; }
#weights-track svg { display: block; width: 100%; height: 120px; }

/* ---------- deck 09 blueprint wall ---------- */
.bp-wall { margin-top: 26px; display: grid; gap: 26px; }
.bp-cat { font-family: 'Big Shoulders', sans-serif; font-weight: 600; font-size: 20px; letter-spacing: 0.16em; color: var(--copper); margin: 0 0 12px; text-transform: uppercase; }
.bp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.bp-plate {
  display: block; text-decoration: none; position: relative;
  background: linear-gradient(165deg, var(--plate), var(--panel));
  border: 1px solid var(--line); padding: 14px 16px 12px; color: var(--ink);
}
.bp-plate:hover { border-color: var(--brass); }
.bp-plate::before { content: ''; position: absolute; inset: 5px; border: 1px dashed color-mix(in srgb, var(--line) 60%, transparent); pointer-events: none; }
.bp-name { font-family: 'DM Mono', monospace; font-size: 12px; font-weight: 500; color: var(--ink); margin: 0 0 6px; line-height: 1.4; }
.bp-addr { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--faint); margin: 0 0 10px; word-break: break-all; }
.bp-stamps { display: flex; gap: 6px; flex-wrap: wrap; }
.bp-stamp {
  font-family: 'DM Mono', monospace; font-size: 8.5px; letter-spacing: 0.12em;
  padding: 2px 6px; border: 1px solid var(--patina); color: var(--patina);
}
.bp-stamp.proxy { border-color: var(--copper); color: var(--copper); }

/* ---------- deck 10 fuel budget ---------- */
.budget-wrap { margin-top: 26px; }
.budget-banner {
  margin: 0 0 22px; padding: 12px 16px;
  font-family: 'DM Mono', monospace; font-size: 11.5px; letter-spacing: 0.1em;
  color: var(--copper); border: 1px dashed var(--copper);
  background: color-mix(in srgb, var(--copper) 6%, transparent);
}
.budget-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 22px; align-items: start; }
.fuel-tank { display: flex; height: 60px; border: 1px solid var(--line); background: var(--bg-deep); overflow: hidden; }
.fuel-seg { height: 100%; min-width: 2px; }
.fuel-legend { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 7px; font-family: 'DM Mono', monospace; font-size: 11.5px; }
.fuel-legend li { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 10px; align-items: baseline; color: var(--muted); }
.fuel-legend i { width: 12px; height: 12px; align-self: center; }
.fuel-legend .fl-pct { color: var(--brass-bright); font-variant-numeric: tabular-nums; }
.fuel-legend .fl-amt { color: var(--faint); font-variant-numeric: tabular-nums; }

/* ---------- notes & colophon ---------- */
.notes { margin: 90px 0 30px; border-top: 1px solid var(--line); padding-top: 30px; }
.notes-heading { font-size: 30px; font-weight: 800; letter-spacing: 0.08em; margin: 0 0 22px; text-transform: uppercase; }
.notes-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 30px; }
.notes-grid h3 { font-size: 18px; margin: 0 0 10px; color: var(--brass-bright); font-style: italic; }
.notes-grid p { margin: 0; font-size: 14.5px; color: var(--muted); }

.colophon {
  border-top: 1px solid var(--line); background: var(--bg-deep);
  display: grid; grid-template-columns: 1fr 1fr; gap: 40px;
  padding: 34px clamp(24px, 5vw, 60px) 60px; font-size: 12px;
}
.colophon-title { color: var(--copper); font-family: 'Big Shoulders', sans-serif; font-weight: 600; letter-spacing: 0.2em; font-size: 14px; }
.colophon-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; color: var(--muted); font-size: 11.5px; line-height: 1.6; }
.colophon-list a { color: var(--brass-bright); }

/* ---------- boot & fault ---------- */
.boot {
  position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 22px;
  background: var(--bg); font-family: 'DM Mono', monospace; font-size: 12px;
  letter-spacing: 0.2em; color: var(--muted);
  transition: opacity 0.4s ease;
}
body[data-ready='true'] .boot { opacity: 0; pointer-events: none; }
.boot-gear {
  width: 54px; height: 54px; border-radius: 50%;
  border: 3px dashed var(--brass);
  animation: bootspin 2.4s linear infinite;
}
@keyframes bootspin { to { transform: rotate(1turn); } }
.fault[hidden] { display: none; }
.fault {
  position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; text-align: center;
  background: var(--bg); color: var(--danger); padding: 40px;
}
.fault h2 { font-size: 54px; margin: 0; }
.fault p { color: var(--muted); max-width: 52ch; font-family: 'DM Mono', monospace; font-size: 13px; }

/* ---------- motion & responsiveness ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .boot-gear { animation: none; }
  .toggle-thumb { transition: none; }
  .live-beacon { box-shadow: none; }
}

@media (max-width: 1060px) {
  .studio, .studio-stack { grid-template-columns: 1fr; }
  .masthead { grid-template-columns: 1fr; gap: 30px; padding-top: 48px; }
  .notes-grid { grid-template-columns: 1fr; }
  .colophon { grid-template-columns: 1fr; }
  .live-bus-grid { grid-template-columns: 1fr; }
  .live-gauges { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 620px) {
  main { padding: 0 14px 30px; }
  .rail { gap: 10px; padding: 0 12px; }
  .rail-brand, .rail-link { display: none; }
  .rail-title { font-size: 13px; }
  .live-bus-head { align-items: start; padding: 18px 16px 13px; }
  .live-link-state { font-size: 9px; max-width: 145px; }
  .live-gauges, .live-tape-wrap { padding: 14px 16px; }
  .live-tape-head span { display: none; }
  .live-strike { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; }
  .live-flow { grid-column: 1 / -1; grid-row: 2; }
  .live-strike a { grid-column: 2; grid-row: 1; }
  .live-boundary { padding: 10px 16px 12px; }
  .stage canvas { height: 420px; }
  #manifold-canvas { height: 380px; }
  .shift-row { grid-template-columns: 60px minmax(0, 1fr); }
  .shift-count { grid-column: 1 / -1; text-align: left; }
  .deck-index a { font-size: 14px; padding: 10px 12px; }
  .plate-grid { font-size: 11.5px; }
  .board-table { min-width: 0; width: 100%; font-size: 10.5px; }
  .board-table td, .board-table th { padding: 5px 4px; }
  .cohort-day { white-space: normal; }
  .dial { width: 18px; height: 18px; box-shadow: inset 0 0 0 4px var(--panel); }
  .dial-cell { gap: 5px; }
  .not-due { padding: 2px 4px; font-size: 8.5px; letter-spacing: 0.06em; }
  #furnace-canvas { height: 330px; }
  #caliper-canvas { height: 340px; }
  #dynamo-canvas { height: 360px; }
  .budget-grid { grid-template-columns: 1fr; }
  .fuel-legend li { grid-template-columns: 12px 1fr auto; }
  .fuel-legend .fl-amt { display: none; }
  .weight-value { font-size: 20px; }
}
