/* Skyzai web brand typography, self-hosted for offline/public-gate safety. */
@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 100 900;
  font-display: optional;
  src: url("../assets/fonts/Roboto-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 100 900;
  font-display: optional;
  src: url("../assets/fonts/Roboto-greek.woff2") format("woff2");
  unicode-range: U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF;
}

@font-face {
  font-family: "Roboto Mono";
  font-style: normal;
  font-weight: 100 700;
  font-display: optional;
  src: url("../assets/fonts/RobotoMono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
  font-family: "Roboto Mono";
  font-style: normal;
  font-weight: 100 700;
  font-display: optional;
  src: url("../assets/fonts/RobotoMono-greek.woff2") format("woff2");
  unicode-range: U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF;
}

:root {
  --bg: #000;
  --canvas: #0a0a0a;
  --ink: #fff;
  --muted: #a0a0a0;
  --dim: #6a6a6a;
  --panel: #191919;
  --panel-raised: #191919;
  --visual-panel: #0a0a0a;
  --visual-label: #191919;
  --visual-grid-line: rgba(255, 255, 255, 0.05);
  --line: #212327;
  --line-strong: rgba(255, 255, 255, 0.18);
  --gold: #fff;
  --gold-soft: #a0a0a0;
  --teal: #2196f3;
  --crimson: #ff7a17;
  --accent-blue: #2196f3;
  --accent-sunset: #ff7a17;
  --violet: #8b5cf6;
  --paper: #fff;
  --code-bg: #0a0a0a;
  --nav-bg: rgba(0, 0, 0, 0.9);
  --hover-bg: #191919;
  --control-bg: transparent;
  --control-hover-bg: #fff;
  --control-hover-ink: #000;
  --grid-line: rgba(255, 255, 255, 0.05);
  --instrument-bg: rgba(5, 5, 5, 0.96);
  --instrument-bg-soft: rgba(5, 5, 5, 0.82);
  --instrument-line: rgba(243, 244, 246, 0.15);
  --instrument-line-soft: rgba(243, 244, 246, 0.075);
  --instrument-amber: #FFEB3B;
  --instrument-blue: #2196F3;
  --instrument-green: #4CAF50;
  --instrument-warn: #FF7A17;
  --nav-h: 64px;
  --font-body: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #fff;
  --ink: #050505;
  --muted: #666;
  --dim: #9a9a9a;
  --canvas: #fff;
  --panel: #f6f6f6;
  --panel-raised: #fff;
  --visual-panel: #0a0a0a;
  --visual-label: #191919;
  --visual-grid-line: rgba(255, 255, 255, 0.05);
  --line: #e5e5e5;
  --line-strong: #cfcfcf;
  --gold: #050505;
  --gold-soft: #707070;
  --teal: #2196f3;
  --crimson: #ff7a17;
  --accent-blue: #2196f3;
  --accent-sunset: #ff7a17;
  --violet: #8b5cf6;
  --paper: #050505;
  --code-bg: #f6f6f6;
  --nav-bg: rgba(255, 255, 255, 0.9);
  --hover-bg: #f6f6f6;
  --control-bg: transparent;
  --control-hover-bg: #050505;
  --control-hover-ink: #fff;
  --grid-line: rgba(0, 0, 0, 0.055);
  --instrument-bg: rgba(5, 5, 5, 0.96);
  --instrument-bg-soft: rgba(5, 5, 5, 0.82);
  --instrument-line: rgba(243, 244, 246, 0.15);
  --instrument-line-soft: rgba(243, 244, 246, 0.075);
  --instrument-amber: #FFEB3B;
  --instrument-blue: #2196F3;
  --instrument-green: #4CAF50;
  --instrument-warn: #FF7A17;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--ink);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.42;
  text-rendering: geometricPrecision;
}

a {
  color: inherit;
}

code,
table,
.number-nav,
.equation-strip,
.label,
.chapter-number,
.fallback-equation {
  font-family: var(--font-mono);
}

code {
  color: var(--paper);
  font-size: 0.94em;
}

strong {
  color: var(--ink);
}

table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line) !important;
  background: var(--code-bg);
}

td {
  vertical-align: top;
}

.site-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: var(--nav-h);
  padding: 0 clamp(1rem, 3vw, 2.5rem);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0;
  text-decoration: none;
}

.brand::before {
  content: "/";
  color: var(--dim);
  margin-right: 0.22rem;
}

.number-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1;
}

.number-nav a,
.number-nav span {
  display: inline-grid;
  place-items: center;
  min-width: 2rem;
  height: 2rem;
  border: 1px solid transparent;
  color: var(--muted);
  text-decoration: none;
}

.number-nav a:hover {
  border-color: var(--line-strong);
  color: var(--ink);
  background: var(--hover-bg);
}

.number-nav .active {
  border-color: var(--ink);
  color: var(--bg);
  background: var(--ink);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.3rem;
  height: 2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--control-bg);
  color: var(--muted);
  font: 600 0.72rem/1 var(--font-body);
  letter-spacing: 0;
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.command-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.2rem;
  height: 2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 600 0.72rem/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.command-open:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.command-palette {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: max(5rem, 10vh) 1rem 1rem;
  background: rgba(0, 0, 0, 0.68);
}

.command-palette.is-open {
  display: flex;
}

.command-panel {
  width: min(620px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.command-panel form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 0.75rem;
}

.command-prefix,
.command-empty,
.command-result small {
  color: var(--muted);
  font: 700 0.66rem/1 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.command-input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: 0.95rem/1.2 var(--font-mono);
}

.command-input::placeholder {
  color: var(--dim);
}

.command-results {
  display: grid;
  max-height: min(420px, 60vh);
  overflow: auto;
}

.command-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  padding: 0.7rem 0.8rem;
  text-decoration: none;
}

.command-result:last-child {
  border-bottom: 0;
}

.command-result:hover,
.command-result.is-active {
  background: var(--hover-bg);
}

.command-result strong {
  display: block;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
}

.command-result span {
  color: var(--accent-blue);
  font: 700 0.72rem/1 var(--font-mono);
}

.command-empty {
  padding: 1rem;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(340px, 1.08fr);
  gap: clamp(1.25rem, 3.5vw, 4rem);
  align-items: center;
  min-height: calc(100svh - var(--nav-h));
  padding: clamp(2.75rem, 5vw, 5.25rem) clamp(1rem, 4vw, 4rem);
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.hero-copy {
  max-width: 720px;
}

body.dimension-page .hero-copy {
  max-width: min(38vw, 460px);
}

body.dimension-page .subtitle {
  max-width: 34ch;
}

@media (min-width: 901px) {
  body.dimension-page .hero {
    align-items: start;
  }
}

.kicker,
.evidence,
.chapter-kicker {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.evidence {
  max-width: 42rem;
  margin-top: 1.3rem;
  color: var(--muted);
}

h1,
h2,
h3 {
  margin-top: 0;
  font-weight: 400;
  line-height: 0.94;
  letter-spacing: 0;
}

h1 {
  margin: 1rem 0 1.15rem;
  font-size: clamp(3.25rem, 9vw, 8rem);
}

h2 {
  margin: 0.55rem 0 1rem;
  font-size: clamp(1.9rem, 4.3vw, 3.8rem);
}

h3 {
  margin: 0;
  font-size: clamp(1.25rem, 2.4vw, 1.7rem);
}

.subtitle {
  max-width: 48rem;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.7vw, 1.28rem);
  line-height: 1.42;
}

.equation-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1.8rem;
}

.equation-strip span {
  border: 1px solid var(--line);
  background: var(--control-bg);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.45rem 0.72rem;
  font-size: clamp(0.78rem, 1.1vw, 0.92rem);
  line-height: 1;
}

.visual-panel {
  position: relative;
  min-height: min(70vh, 720px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(0deg, rgba(255,255,255,0.018) 1px, transparent 1px) 0 0 / 32px 32px,
    #050505;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.028);
}

.visual-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(transparent 0, rgba(255, 255, 255, 0.018) 1px, transparent 1px) 0 0 / 100% 64px,
    linear-gradient(90deg, transparent 0, rgba(255, 255, 255, 0.018) 1px, transparent 1px) 0 0 / 64px 100%;
  opacity: 0.38;
}

.instrument-visual {
  border-color: rgba(243, 244, 246, 0.18);
  background: #050505;
}

.instrument-visual::after {
  opacity: 0.09;
}

.dimension-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
}

.instrument-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
  border: 1px solid rgba(243, 244, 246, 0.075);
  box-shadow:
    inset 0 0 0 1px rgba(5, 5, 5, 0.78),
    inset 0 0 0 12px rgba(243, 244, 246, 0.006);
  contain: paint;
}

.instrument-graticule {
  position: absolute;
  inset: 24px;
  opacity: 0.052;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.07) 0 1px, transparent 1px 32px),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.07) 0 1px, transparent 1px 32px),
    repeating-linear-gradient(90deg, rgba(33,150,243,0.13) 0 1px, transparent 1px 128px),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.1) 0 1px, transparent 1px 128px);
}

.instrument-corners {
  position: absolute;
  inset: 12px;
}

.instrument-corners span {
  position: absolute;
  width: 24px;
  height: 24px;
  border-color: rgba(243, 244, 246, 0.14);
  border-style: solid;
}

.instrument-corners span:nth-child(1) { top: 0; left: 0; border-width: 1px 0 0 1px; }
.instrument-corners span:nth-child(2) { top: 0; right: 0; border-width: 1px 1px 0 0; }
.instrument-corners span:nth-child(3) { right: 0; bottom: 0; border-width: 0 1px 1px 0; }
.instrument-corners span:nth-child(4) { bottom: 0; left: 0; border-width: 0 0 1px 1px; }

.instrument-overlay::before,
.instrument-overlay::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(243, 244, 246, 0.095);
}

.instrument-overlay::after {
  inset: 24px;
  border-color: rgba(243, 244, 246, 0.055);
}

.instrument-reticle {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent calc(50% - 0.5px), rgba(255,255,255,0.16) calc(50% - 0.5px), rgba(255,255,255,0.16) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(0deg, transparent calc(50% - 0.5px), rgba(66,165,245,0.14) calc(50% - 0.5px), rgba(66,165,245,0.14) calc(50% + 0.5px), transparent calc(50% + 0.5px));
  opacity: 0.064;
}

.instrument-id {
  position: absolute;
  left: 13px;
  bottom: 13px;
  display: inline-flex;
  gap: 5px;
  color: rgba(243, 244, 246, 0.5);
  font: 700 9px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-transform: none;
}

.instrument-id span {
  border: 1px solid rgba(243, 244, 246, 0.11);
  border-radius: 2px;
  background: rgba(5, 5, 5, 0.86);
  padding: 3px 5px;
}

.instrument-calibration {
  position: absolute;
  right: 13px;
  bottom: 13px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
  max-width: min(360px, 44%);
  color: rgba(243, 244, 246, 0.5);
  font: 700 9px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-transform: none;
}

.instrument-calibration span {
  border: 1px solid rgba(243, 244, 246, 0.11);
  border-radius: 2px;
  background: rgba(5, 5, 5, 0.84);
  padding: 3px 5px;
}

.instrument-measurements {
  position: absolute;
  top: 112px;
  left: 13px;
  display: grid;
  width: min(218px, calc(100% - 26px));
  gap: 5px;
  color: rgba(243, 244, 246, 0.7);
  font: 700 9px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-transform: none;
}

.instrument-meter {
  display: grid;
  grid-template-columns: minmax(4.5rem, 0.55fr) minmax(0, 1fr) minmax(3.5rem, auto);
  gap: 6px;
  align-items: center;
  min-height: 19px;
  border: 1px solid var(--instrument-line-soft);
  border-radius: 2px;
  background: rgba(5, 5, 5, 0.88);
  padding: 4px 6px 5px;
  backdrop-filter: blur(3px);
}

.instrument-meter span,
.instrument-meter em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.instrument-meter span {
  color: rgba(243, 244, 246, 0.58);
}

.instrument-meter em {
  justify-self: end;
  color: rgba(243, 244, 246, 0.84);
  font-style: normal;
}

.instrument-meter i {
  position: relative;
  display: block;
  height: 6px;
  overflow: hidden;
  border: 1px solid rgba(243, 244, 246, 0.13);
  background:
    repeating-linear-gradient(90deg, rgba(243,244,246,0.14) 0 1px, transparent 1px 12.5%),
    rgba(243, 244, 246, 0.035);
}

.instrument-meter b {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, rgba(66,165,245,0.5), rgba(243,244,246,0.66));
}

.instrument-meter.error b {
  background: linear-gradient(90deg, rgba(76,175,80,0.36), rgba(255,122,23,0.5));
}

.instrument-mode-burrisphere .instrument-measurements,
.instrument-mode-ccc .instrument-measurements {
  left: auto;
  right: 13px;
  top: 52px;
}

.instrument-scale {
  position: absolute;
  opacity: 0.5;
  color: rgba(243, 244, 246, 0.48);
  font: 700 9px/1 var(--font-mono);
  letter-spacing: 0;
  text-transform: uppercase;
}

.instrument-scale.x {
  left: 12px;
  right: 12px;
  bottom: 12px;
  height: 12px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.28) 0 1px, transparent 1px 32px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.11) 0 1px, transparent 1px 8px);
}

.instrument-scale.x::after {
  content: attr(data-axis-label);
  position: absolute;
  right: 0;
  top: -15px;
}

.instrument-scale.y {
  top: 12px;
  bottom: 12px;
  left: 12px;
  width: 12px;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.28) 0 1px, transparent 1px 32px),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.11) 0 1px, transparent 1px 8px);
}

.instrument-scale.y::after {
  content: attr(data-axis-label);
  position: absolute;
  left: 16px;
  top: 0;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  transform-origin: left top;
}

.instrument-telemetry {
  position: absolute;
  top: 13px;
  left: 13px;
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  align-items: center;
  max-width: calc(100% - 354px);
  min-height: 25px;
  overflow: hidden;
  color: rgba(243, 244, 246, 0.76);
  font: 700 9px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-transform: none;
}

.instrument-telemetry span {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 10.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--instrument-line);
  border-radius: 2px;
  background: rgba(5, 5, 5, 0.88);
  padding: 4px 6px;
  backdrop-filter: blur(4px);
}

.instrument-telemetry span[data-field="metric"],
.instrument-telemetry span[data-field="uncertainty"],
.instrument-telemetry span[data-field="time"],
.instrument-telemetry span[data-field="phase"],
.instrument-telemetry span[data-field="sample"],
.instrument-telemetry span[data-field="state"] {
  display: none;
}

.instrument-telemetry span[data-field="mode"] {
  max-width: 8.75rem;
}

.instrument-telemetry span[data-field="invariant"] {
  max-width: 8.75rem;
}

.instrument-telemetry span[data-field="sample"] {
  max-width: 6.4rem;
}

.instrument-telemetry span[data-field="state"] {
  max-width: 7.25rem;
}

.instrument-telemetry span[data-field="metric"] {
  color: #FFEB3B;
}

.instrument-telemetry span[data-field="invariant"] {
  color: rgba(243, 244, 246, 0.92);
}

.instrument-telemetry span[data-field="phase"] {
  color: #4CAF50;
}

.instrument-telemetry span[data-field="uncertainty"] {
  color: rgba(255, 122, 23, 0.94);
}

.instrument-telemetry span[data-field="state"] {
  color: rgba(66, 165, 245, 0.92);
}

@media (min-width: 1520px) {
  .instrument-telemetry span[data-field="metric"],
  .instrument-telemetry span[data-field="uncertainty"],
  .instrument-telemetry span[data-field="time"],
  .instrument-telemetry span[data-field="phase"],
  .instrument-telemetry span[data-field="sample"],
  .instrument-telemetry span[data-field="state"] {
    display: inline-block;
    max-width: 11.5rem;
  }
}

.instrument-controls {
  position: absolute;
  top: 13px;
  right: 13px;
  z-index: 6;
  display: grid;
  grid-template-columns: auto auto auto minmax(120px, 156px);
  gap: 5px;
  align-items: center;
  color: rgba(243, 244, 246, 0.78);
  font: 700 9px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-transform: uppercase;
}

.instrument-controls button,
.instrument-controls label {
  min-height: 25px;
  border: 1px solid var(--instrument-line);
  border-radius: 2px;
  background: rgba(5, 5, 5, 0.9);
  color: inherit;
  backdrop-filter: blur(4px);
}

.instrument-controls button {
  padding: 0 8px;
  cursor: pointer;
}

.instrument-controls button:hover {
  border-color: rgba(243, 244, 246, 0.42);
  color: rgba(243, 244, 246, 0.94);
}

.instrument-controls button[aria-pressed="true"] {
  border-color: rgba(66, 165, 245, 0.54);
  color: rgba(66, 165, 245, 0.96);
}

.instrument-controls label {
  display: grid;
  grid-template-columns: auto minmax(56px, 1fr);
  gap: 6px;
  align-items: center;
  padding: 0 7px;
}

.instrument-controls input[type="range"] {
  width: 100%;
  appearance: none;
  height: 16px;
  border-radius: 0;
  background-color: transparent;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 3px;
  background-image:
    repeating-linear-gradient(90deg, rgba(243,244,246,.2) 0 1px, transparent 1px 8px),
    linear-gradient(90deg, rgba(66,165,245,.2), rgba(243,244,246,.34));
}

.instrument-controls input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 11px;
  height: 11px;
  border: 2px solid #050505;
  border-radius: 2px;
  background: #FFEB3B;
  box-shadow: 0 0 0 1px rgba(243,244,246,.42);
}

.instrument-controls input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: 2px solid #050505;
  border-radius: 2px;
  background: #FFEB3B;
  box-shadow: 0 0 0 1px rgba(243,244,246,.42);
}

.visual-labels {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.label {
  position: absolute;
  max-width: 16rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 2px;
  background: rgba(5, 5, 5, 0.76);
  color: rgba(243, 244, 246, 0.66);
  padding: 0.45rem 0.55rem;
  font-size: clamp(0.68rem, 1vw, 0.84rem);
  line-height: 1.25;
  text-shadow: none;
}

.label strong {
  color: #fff;
}

.label.top { top: 1rem; left: 1rem; }
.label.right { top: 38%; right: 1rem; text-align: right; }
.label.left { left: 1rem; bottom: 32%; }
.label.bottom { left: 1rem; right: 1rem; bottom: 1rem; max-width: none; text-align: center; }
.horn-visual .label.bottom { bottom: 3.6rem; }
.horn-visual .label.left {
  left: 1rem;
  bottom: 36%;
  max-width: 13.5rem;
}
.horn-visual .label.right {
  top: auto;
  right: 1rem;
  bottom: 34%;
  max-width: 12rem;
}
.burrisphere-visual .label.top {
  left: 50%;
  transform: translateX(-50%);
  max-width: min(26rem, calc(100% - 2rem));
  text-align: center;
}
.burrisphere-visual .label.left { display: none; }
.burrisphere-visual .label.bottom { display: none; }
.ccc-visual .label.top {
  left: 50%;
  transform: translateX(-50%);
  max-width: min(22rem, calc(100% - 2rem));
  text-align: center;
}
.ccc-visual .label.left,
.ccc-visual .label.right {
  display: none;
}
.ccc-visual .label.bottom {
  bottom: 1rem;
}
.constitution-visual .label.center {
  display: none;
}
.label.center { left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; }

.model-readout {
  overflow: hidden;
  text-wrap: balance;
  border-radius: 3px !important;
  box-shadow: none !important;
}

.model-readout.instrument-readout {
  text-wrap: auto;
  font-variant-numeric: tabular-nums;
  background: rgba(5, 5, 5, 0.9) !important;
  border-color: var(--instrument-line) !important;
  border-left-color: var(--instrument-amber) !important;
  color: rgba(243, 244, 246, 0.84) !important;
  line-height: 1.38 !important;
  max-height: min(23vh, 142px) !important;
  outline: 1px solid rgba(5, 5, 5, 0.78);
  text-wrap: auto;
}

.model-readout,
.model-slider {
  font-variant-numeric: tabular-nums;
}

.model-slider {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 6;
  display: grid;
  grid-template-columns: minmax(5.2rem, auto) minmax(0, 1fr) minmax(5.2rem, auto) minmax(5.8rem, auto);
  gap: 10px;
  align-items: center;
  color: rgba(243, 244, 246, 0.68);
  font: 700 11px/1 var(--font-mono);
  letter-spacing: 0;
  text-transform: none;
}

.model-slider .slider-end,
.model-slider .slider-output {
  min-height: 24px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(243, 244, 246, 0.14);
  border-radius: 2px;
  background: rgba(5, 5, 5, 0.9);
  padding: 0 7px;
  white-space: nowrap;
}

.model-slider .slider-lo {
  color: rgba(255, 235, 59, 0.88);
}

.model-slider .slider-hi {
  color: rgba(66, 165, 245, 0.88);
}

.model-slider .slider-output {
  min-width: 4.9rem;
  justify-content: end;
  color: rgba(243, 244, 246, 0.86);
}

body.dimension-page .model-slider {
  bottom: 44px !important;
}

.model-slider input[type="range"] {
  appearance: none;
  height: 16px !important;
  border-radius: 0;
  background-color: transparent;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 4px;
  background-image:
    linear-gradient(90deg, transparent calc(50% - 0.5px), rgba(243,244,246,.5) calc(50% - 0.5px), rgba(243,244,246,.5) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.2) 0 1px, transparent 1px 8px),
    linear-gradient(90deg, rgba(255,235,59,0.2), rgba(66,165,245,0.2));
  cursor: pointer;
}

.rapidity-slider .slider-hi {
  min-width: 10.5rem;
}

.theta-slider .slider-end {
  min-width: 5.2rem;
}

.model-slider input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border: 2px solid #050505;
  border-radius: 2px;
  background: #FFEB3B;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.46);
}

.model-slider input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid #050505;
  border-radius: 2px;
  background: #FFEB3B;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.46);
}

.instrument-visual {
  --instrument-phase: 0;
  --instrument-primary: 0;
  --instrument-secondary: 0;
  --instrument-error: 0;
}

.instrument-visual::after {
  opacity: 0.055;
}

.instrument-overlay {
  box-shadow:
    inset 0 0 0 1px rgba(5, 5, 5, 0.86),
    inset 0 0 0 12px rgba(243, 244, 246, 0.006);
}

.instrument-graticule {
  opacity: 0.048;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.06) 0 1px, transparent 1px 40px),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.06) 0 1px, transparent 1px 40px),
    repeating-linear-gradient(90deg, rgba(33,150,243,0.075) 0 1px, transparent 1px 160px),
    repeating-linear-gradient(0deg, rgba(255,235,59,0.055) 0 1px, transparent 1px 160px);
}

.instrument-reticle {
  opacity: 0.052;
}

.instrument-aperture {
  position: absolute;
  inset: 54px 64px 84px;
  border: 1px solid rgba(243, 244, 246, 0.09);
  background:
    linear-gradient(90deg, transparent calc(50% - 0.5px), rgba(255,235,59,0.13) calc(50% - 0.5px), rgba(255,235,59,0.13) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(0deg, transparent calc(50% - 0.5px), rgba(66,165,245,0.12) calc(50% - 0.5px), rgba(66,165,245,0.12) calc(50% + 0.5px), transparent calc(50% + 0.5px));
  opacity: 0.16;
}

.instrument-aperture::before,
.instrument-aperture::after {
  content: "";
  position: absolute;
  pointer-events: none;
  background: rgba(243, 244, 246, 0.54);
}

.instrument-aperture::before {
  left: 0;
  right: 0;
  top: calc((1 - var(--instrument-primary)) * 100%);
  height: 1px;
  box-shadow: 0 0 0 1px rgba(5, 5, 5, 0.42);
}

.instrument-aperture::after {
  top: 0;
  bottom: 0;
  left: calc(var(--instrument-secondary) * 100%);
  width: 1px;
  background: rgba(66, 165, 245, 0.58);
}

.instrument-aperture span {
  position: absolute;
  inset: 8px;
  border: 1px dashed rgba(243, 244, 246, 0.08);
}

.instrument-signal-ruler {
  position: absolute;
  top: 54px;
  right: 14px;
  bottom: 84px;
  width: 42px;
  border-left: 1px solid rgba(243, 244, 246, 0.16);
  color: rgba(243, 244, 246, 0.48);
  font: 700 8px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.instrument-signal-ruler span {
  position: absolute;
  left: 7px;
  right: 0;
  height: 1px;
  border-top: 1px solid rgba(243, 244, 246, 0.16);
}

.instrument-signal-ruler span::after {
  content: attr(data-tick);
  position: absolute;
  right: 0;
  top: -4px;
}

.instrument-signal-ruler span:nth-child(1) { top: 0; }
.instrument-signal-ruler span:nth-child(2) { top: 25%; }
.instrument-signal-ruler span:nth-child(3) { top: 50%; }
.instrument-signal-ruler span:nth-child(4) { top: 75%; }
.instrument-signal-ruler span:nth-child(5) { bottom: 0; }

.instrument-signal-ruler b {
  position: absolute;
  left: -5px;
  width: 10px;
  height: 2px;
  background: rgba(243, 244, 246, 0.82);
  transform: translateY(1px);
}

.instrument-signal-ruler b::after {
  content: attr(data-label);
  position: absolute;
  left: -96px;
  top: -4px;
  width: 88px;
  overflow: hidden;
  color: rgba(243, 244, 246, 0.48);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.instrument-signal-ruler .primary {
  top: calc((1 - var(--instrument-primary)) * 100%);
  background: rgba(255, 235, 59, 0.78);
}

.instrument-signal-ruler .secondary {
  top: calc((1 - var(--instrument-secondary)) * 100%);
  background: rgba(66, 165, 245, 0.78);
}

.instrument-signal-ruler .error {
  top: calc((1 - var(--instrument-error)) * 100%);
  background: rgba(255, 122, 23, 0.78);
}

.instrument-sample-ledger {
  position: absolute;
  left: 64px;
  right: 64px;
  bottom: 64px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  color: transparent;
  font: 700 8px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.instrument-sample-ledger span {
  position: relative;
  text-align: center;
}

.instrument-sample-ledger span::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -8px;
  width: 1px;
  height: 6px;
  background: rgba(243, 244, 246, 0.16);
}

.instrument-acquisition {
  position: absolute;
  left: 13px;
  right: 13px;
  top: 45px;
  height: 5px;
  border: 1px solid rgba(243, 244, 246, 0.1);
  background:
    repeating-linear-gradient(90deg, rgba(243,244,246,0.13) 0 1px, transparent 1px 24px),
    rgba(5, 5, 5, 0.76);
}

.instrument-acquisition span {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(var(--instrument-phase));
  transform-origin: left center;
  background: linear-gradient(90deg, rgba(255,235,59,0.34), rgba(66,165,245,0.3));
}

.instrument-acquisition b {
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: calc(var(--instrument-phase) * 100%);
  width: 1px;
  background: rgba(243, 244, 246, 0.64);
  transform: translateX(-0.5px);
}

.instrument-meter b,
.instrument-acquisition span,
.instrument-acquisition b {
  transition: transform 90ms linear, left 90ms linear;
}

.instrument-controls label {
  grid-template-columns: auto minmax(56px, 1fr) auto;
}

.instrument-controls output {
  min-width: 3.4rem;
  color: rgba(243, 244, 246, 0.86);
  text-align: right;
}

@media (prefers-reduced-transparency: reduce) {
  .instrument-meter,
  .instrument-telemetry span,
  .instrument-controls button,
  .instrument-controls label,
  .model-readout.instrument-readout,
  .model-slider .slider-end,
  .model-slider .slider-output {
    backdrop-filter: none !important;
    background: #050505 !important;
  }
}

@media (prefers-contrast: more) {
  .instrument-overlay,
  .instrument-meter,
  .instrument-telemetry span,
  .instrument-controls button,
  .instrument-controls label,
  .model-readout.instrument-readout {
    border-color: rgba(243, 244, 246, 0.34) !important;
  }
}

.fallback {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--bg);
  text-align: center;
}

.webgl-failed .fallback {
  display: flex;
}

.fallback-inner {
  max-width: 34rem;
}

.fallback-equation {
  color: var(--ink);
  font-size: clamp(1.6rem, 4vw, 3rem);
  line-height: 1.1;
}

.fallback p {
  color: var(--muted);
}

.chapters {
  border-top: 1px solid var(--line);
}

.chapter {
  display: grid;
  grid-template-columns: minmax(5.5rem, 0.2fr) minmax(0, 0.8fr);
  gap: clamp(1.25rem, 4vw, 4rem);
  padding: clamp(2.4rem, 5vw, 5rem) clamp(1rem, 4vw, 4rem);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.chapter-number {
  position: sticky;
  top: calc(var(--nav-h) + 1.25rem);
  align-self: start;
  color: var(--dim);
  font-size: clamp(1.4rem, 3.5vw, 3rem);
  line-height: 1;
}

.chapter p,
.mu-limit p {
  color: var(--muted);
  font-size: clamp(1rem, 1.18vw, 1.09rem);
  line-height: 1.45;
}

.chapter-body {
  max-width: 840px;
}

.chapter-body > div[style],
.chapter-body > p[style] {
  border-color: var(--line) !important;
  background: var(--code-bg) !important;
  color: var(--ink) !important;
  max-width: 100%;
  overflow-x: auto;
}

.mu-limit {
  padding: clamp(3.5rem, 7vw, 6rem) clamp(1rem, 4vw, 4rem);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.mu-inner {
  max-width: 880px;
  margin: 0 auto;
  text-align: left;
}

.mu-mark {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: clamp(2.4rem, 6vw, 5.4rem);
  line-height: 1;
}

.mu-limit a,
.route-footer a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink);
  background: transparent;
  padding: 0.75rem 1rem;
  text-decoration: none;
}

.mu-limit a:hover,
.route-footer a:hover {
  border-color: var(--ink);
  background: var(--control-hover-bg);
  color: var(--control-hover-ink);
}

.route-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 4rem) 3rem;
  background: var(--bg);
}

noscript {
  display: block;
  padding: 1rem;
  color: var(--ink);
  text-align: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

@media (max-width: 980px) {
  .hero,
  .chapter {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .visual-panel {
    min-height: 58vh;
  }

  .chapter-number {
    position: static;
  }
}

@media (max-width: 680px) {
  :root {
    --nav-h: 92px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }

  .number-nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0.2rem;
  }

  .theme-toggle,
  .command-open {
    position: absolute;
    top: 0.75rem;
  }

  .theme-toggle {
    right: 1rem;
  }

  .command-open {
    right: 5.7rem;
  }

  .number-nav a,
  .number-nav span {
    flex: 0 0 2rem;
  }

  h1 {
    max-width: 100%;
    font-size: clamp(2rem, 9.5vw, 3rem);
    overflow-wrap: anywhere;
  }

  .visual-panel {
    min-height: 58vh;
  }

  body.dimension-page .hero-copy,
  body.dimension-page .subtitle {
    max-width: 100%;
  }

  .route-footer {
    flex-direction: column;
  }

  .label {
    max-width: min(13rem, calc(100vw - 2rem));
  }

  .label.top,
  .burrisphere-visual .label.top {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    max-width: calc(100% - 2rem);
  }

  .label.right {
    top: auto;
    right: 1rem;
    bottom: 21%;
  }

  .horn-visual .label.bottom {
    right: 7.25rem;
    text-align: center;
  }

  .horn-visual .label.left,
  .horn-visual .label.right {
    display: none;
  }

  .burrisphere-visual .label.left,
  .burrisphere-visual .label.right,
  .burrisphere-visual .label.bottom {
    display: none;
  }

  .ccc-visual .label.bottom {
    display: none;
  }

  .model-slider {
    left: 0.75rem !important;
    right: 0.75rem !important;
    bottom: 0.75rem !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.45rem !important;
    font-size: 9px !important;
  }

  .model-slider input[type="range"] {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .model-slider .slider-end {
    grid-row: 2;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .model-slider .slider-hi {
    justify-content: end;
  }

  .model-slider .slider-output {
    grid-column: 1 / -1;
    grid-row: 3;
    justify-content: center;
    min-height: 20px;
  }

  .instrument-controls {
    top: auto;
    right: 0.75rem;
    left: 0.75rem;
    bottom: 0.75rem;
    grid-template-columns: auto auto auto minmax(0, 1fr);
    font-size: 8px;
  }

  .instrument-controls button,
  .instrument-controls label {
    min-height: 24px;
  }

  .instrument-telemetry {
    max-width: calc(100% - 1.5rem);
  }

  .instrument-calibration,
  .instrument-id,
  .instrument-measurements,
  .instrument-signal-ruler,
  .instrument-sample-ledger {
    display: none;
  }

  .instrument-aperture {
    inset: 54px 18px 118px;
  }

  .instrument-scale.x::after,
  .instrument-scale.y::after {
    content: none;
  }

  body.dimension-page .model-slider {
    bottom: 3.15rem !important;
  }

  body.dimension-page .model-readout {
    bottom: 8.55rem !important;
  }

  .model-readout {
    left: 0.75rem !important;
    right: 0.75rem !important;
    top: auto !important;
    bottom: 3.8rem !important;
    max-width: none !important;
    max-height: 26vh;
    overflow: hidden;
    font-size: 9.5px !important;
    line-height: 1.45 !important;
  }

  .instrument-telemetry span[data-field="time"],
  .instrument-telemetry span[data-field="sample"],
  .instrument-telemetry span[data-field="state"] {
    display: none;
  }
}
