@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@300;400;500&family=Inter:wght@400;500;600;700&display=swap");

:root {
  color-scheme: dark;
  --bg: #090b10;
  --bg-raised: #0e1118;
  --panel: #121620;
  --panel-soft: #171c27;
  --line: #282f3c;
  --line-soft: #1c222d;
  --text: #f5f7fb;
  --muted: #9099aa;
  --faint: #626b7b;
  --red: #ff365d;
  --red-soft: rgba(255, 54, 93, 0.12);
  --cyan: #38dac7;
  --amber: #f8b84e;
  --green: #48d597;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef0f4;
  --bg-raised: #f8f9fb;
  --panel: #ffffff;
  --panel-soft: #f0f2f6;
  --line: #d4d9e2;
  --line-soft: #e4e7ed;
  --text: #12151c;
  --muted: #616a78;
  --faint: #9299a4;
  --red-soft: rgba(230, 33, 72, 0.08);
  --shadow: 0 30px 80px rgba(32, 40, 58, 0.11);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

button,
input,
select {
  color: inherit;
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  left: 16px;
  top: -80px;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
}

.skip-link:focus {
  top: 16px;
}

.site-header {
  position: sticky;
  z-index: 100;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 clamp(20px, 4vw, 68px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(18px);
}

.brand,
.brand > span:last-child,
.site-header nav,
.site-header nav a,
.sim-header > div,
.runtime-status,
.panel-label,
.timeline-meta,
.chart-heading,
footer,
footer > div {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
}

.brand-mark {
  color: var(--red);
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
}

.brand > span:last-child {
  align-items: flex-start;
  flex-direction: column;
  line-height: 1.05;
}

.brand strong {
  font-size: 12px;
  letter-spacing: 0.13em;
}

.brand small {
  margin-top: 5px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
}

.site-header nav {
  gap: 8px;
}

.site-header nav a {
  min-height: 38px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  transition: color 160ms ease;
}

.site-header nav a:hover {
  color: var(--text);
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  margin-left: 4px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  cursor: pointer;
}

.hero {
  position: relative;
  display: grid;
  min-height: 690px;
  padding: clamp(80px, 12vw, 160px) clamp(24px, 8vw, 140px) 90px;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  align-items: center;
  gap: 7vw;
  overflow: hidden;
  border-bottom: 1px solid var(--line-soft);
}

.hero-grid {
  position: absolute;
  inset: 0;
  opacity: 0.55;
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--line) 54%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--line) 54%, transparent) 1px, transparent 1px);
  background-position: center;
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 74% 48%, black 0, transparent 65%);
}

.hero::before {
  position: absolute;
  width: 560px;
  height: 560px;
  right: 5vw;
  top: 70px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 54, 93, 0.16), transparent 68%);
  content: "";
  filter: blur(30px);
}

.hero-copy,
.hero-orbit {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 24px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow span {
  color: var(--red);
}

.hero h1,
.section-heading h2,
.policy-intro h3 {
  margin: 0;
  letter-spacing: -0.055em;
  line-height: 0.97;
}

.hero h1 {
  max-width: 850px;
  font-size: clamp(54px, 6.4vw, 100px);
}

.hero h1 em {
  color: var(--muted);
  font-style: normal;
  font-weight: 500;
}

.hero-intro {
  max-width: 700px;
  margin: 35px 0 0;
  color: var(--muted);
  font-size: clamp(17px, 1.45vw, 21px);
}

.hero-actions {
  display: flex;
  margin-top: 36px;
  gap: 12px;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  min-height: 46px;
  padding: 0 18px;
  align-items: center;
  justify-content: center;
  gap: 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button.primary {
  background: var(--red);
  color: white;
}

.button.ghost {
  border-color: var(--line);
  background: var(--panel);
}

.button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.hero-orbit {
  min-height: 430px;
}

.orbit-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  border: 1px solid var(--line);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.ring-one {
  width: min(36vw, 470px);
  aspect-ratio: 1;
}

.ring-two {
  width: min(27vw, 350px);
  aspect-ratio: 1;
  border-style: dashed;
  animation: rotate 45s linear infinite;
}

@keyframes rotate {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.hero-token {
  position: absolute;
  display: grid;
  width: 120px;
  height: 120px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  box-shadow: var(--shadow);
  font-family: var(--mono);
  font-size: 92px;
  line-height: 1;
  backdrop-filter: blur(12px);
}

.token-x {
  right: 18%;
  top: 7%;
  color: var(--red);
  transform: rotate(9deg);
}

.token-o {
  left: 8%;
  bottom: 2%;
  color: var(--text);
  transform: rotate(-8deg);
}

.hero-terminal {
  position: absolute;
  right: 0;
  bottom: 14%;
  width: min(92%, 390px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
  font-family: var(--mono);
}

.hero-terminal span,
.hero-terminal small {
  display: block;
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.hero-terminal strong {
  display: block;
  margin: 8px 0 3px;
  color: var(--cyan);
  font-size: 15px;
}

.provenance-strip,
.metric-ribbon {
  display: grid;
  padding: 0 clamp(24px, 5vw, 80px);
}

.provenance-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg-raised);
}

.provenance-strip > div {
  display: grid;
  min-height: 92px;
  padding: 18px 24px;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 15px;
  border-right: 1px solid var(--line-soft);
}

.provenance-strip > div:last-child {
  border-right: 0;
}

.provenance-strip span,
.provenance-strip code,
.metric-ribbon span,
.panel-label,
.camera-card figcaption span,
.camera-card figcaption code,
.speed-control,
.episode-item code,
.filter-grid label,
.control-note,
.policy-controls label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.provenance-strip span,
.provenance-strip code {
  color: var(--faint);
}

.provenance-strip strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-ribbon {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.metric-ribbon article {
  min-height: 145px;
  padding: 32px 26px;
  border-right: 1px solid var(--line-soft);
}

.metric-ribbon article:last-child {
  border: 0;
}

.metric-ribbon strong {
  display: block;
  font-family: var(--mono);
  font-size: clamp(30px, 3vw, 46px);
  font-weight: 400;
  letter-spacing: -0.05em;
}

.metric-ribbon span {
  color: var(--faint);
}

.studio-shell,
.analytics-section,
.method-section {
  padding: 110px clamp(18px, 4vw, 70px);
}

.studio-shell {
  border-top: 1px solid var(--line-soft);
  background: var(--bg-raised);
}

.section-heading {
  display: grid;
  max-width: 1500px;
  margin: 0 auto 48px;
  grid-template-columns: 1fr minmax(320px, 0.65fr);
  align-items: end;
  gap: 60px;
}

.section-heading h2 {
  font-size: clamp(40px, 5vw, 72px);
}

.section-heading p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.mode-switch {
  display: grid;
  max-width: 1500px;
  margin: 0 auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
}

.mode-switch button {
  display: grid;
  min-height: 86px;
  padding: 17px 22px;
  grid-template-columns: 42px 1fr;
  grid-template-rows: 1fr 1fr;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--panel-soft);
  text-align: left;
  cursor: pointer;
}

.mode-switch button:last-child {
  border-right: 0;
}

.mode-switch button[aria-selected="true"] {
  box-shadow: inset 0 -3px var(--red);
  background: var(--panel);
}

.mode-switch button > span {
  grid-row: 1 / 3;
  color: var(--red);
  font-family: var(--mono);
  font-size: 12px;
}

.mode-switch strong {
  font-size: 14px;
}

.mode-switch small {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
}

.studio-grid {
  display: grid;
  max-width: 1500px;
  margin: 0 auto;
  grid-template-columns: 300px minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.episode-browser {
  min-height: 900px;
  padding: 20px;
  border-right: 1px solid var(--line);
  background: var(--panel-soft);
}

.panel-label {
  justify-content: space-between;
  color: var(--faint);
  gap: 16px;
}

.panel-label strong {
  color: var(--muted);
  font-weight: 400;
}

.search-field {
  position: relative;
  display: block;
  margin: 17px 0 12px;
}

.search-field input,
.filter-grid select,
.speed-control select,
.policy-controls input,
.policy-controls select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg-raised);
}

.search-field input {
  height: 42px;
  padding: 0 42px 0 13px;
  font-size: 12px;
}

.search-field kbd {
  position: absolute;
  right: 10px;
  top: 9px;
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--faint);
  background: var(--panel);
  font-family: var(--mono);
  font-size: 10px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.filter-grid label,
.policy-controls label {
  color: var(--faint);
}

.filter-grid select {
  height: 35px;
  margin-top: 5px;
  padding: 0 8px;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}

.episode-list {
  height: 675px;
  margin: 18px -8px 0 0;
  padding-right: 8px;
  overflow: auto;
  scrollbar-color: var(--line) transparent;
  scrollbar-width: thin;
}

.episode-item {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 78px;
  padding: 13px 12px 13px 42px;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.episode-item:hover,
.episode-item[aria-selected="true"] {
  background: var(--red-soft);
}

.episode-item[aria-selected="true"]::before {
  position: absolute;
  left: 10px;
  top: 15px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  content: "";
  box-shadow: 0 0 0 5px var(--red-soft);
}

.episode-item strong {
  font-size: 12px;
  line-height: 1.35;
}

.episode-item code {
  color: var(--faint);
}

.episode-item small {
  color: var(--muted);
  font-size: 10px;
}

.episode-symbol {
  grid-row: 1 / 3;
  grid-column: 2;
  color: var(--red);
  font-family: var(--mono);
  font-size: 26px;
  line-height: 1;
}

.studio-main {
  min-width: 0;
  padding: 26px;
}

.simulation-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}

.sim-header {
  display: flex;
  min-height: 50px;
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.sim-header > div {
  gap: 12px;
}

.sim-header > div:last-child {
  color: var(--faint);
}

.sim-header i,
.runtime-status > i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 5px var(--red-soft);
}

.sim-stage {
  position: relative;
  min-height: clamp(420px, 51vw, 680px);
  overflow: hidden;
  background: var(--bg);
}

.sim-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.sim-loading {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  background: var(--bg);
}

.sim-loading[hidden] {
  display: none;
}

.sim-loading strong {
  margin-top: 8px;
  font-size: 13px;
}

.sim-loading small {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
}

.loader {
  width: 28px;
  height: 28px;
  border: 2px solid var(--line);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: rotate-loader 900ms linear infinite;
}

@keyframes rotate-loader { to { transform: rotate(360deg); } }

.view-controls {
  position: absolute;
  z-index: 4;
  right: 14px;
  bottom: 14px;
  display: flex;
  padding: 4px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  backdrop-filter: blur(12px);
}

.view-controls button {
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-family: var(--mono);
  font-size: 9px;
  cursor: pointer;
}

.view-controls button:hover {
  color: var(--text);
  background: var(--panel-soft);
}

.transport {
  display: flex;
  min-height: 78px;
  padding: 14px;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  background: var(--panel-soft);
}

.transport-button {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
}

.transport-button.subtle {
  background: var(--panel);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.timeline-wrap {
  min-width: 0;
  flex: 1;
  padding: 0 8px;
}

.timeline-wrap input {
  width: 100%;
  accent-color: var(--red);
}

.timeline-meta {
  margin-top: 3px;
  justify-content: space-between;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
}

.timeline-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.speed-control {
  width: 82px;
  color: var(--faint);
}

.speed-control select {
  height: 32px;
  margin-top: 4px;
  padding: 0 7px;
  font-size: 11px;
}

.camera-grid,
.analysis-grid,
.analytics-grid,
.method-grid {
  display: grid;
  gap: 14px;
}

.camera-grid {
  margin-top: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.camera-card,
.analysis-card,
.analytics-card {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  overflow: hidden;
}

.camera-card figcaption {
  display: grid;
  min-height: 52px;
  padding: 0 14px;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.camera-card figcaption span,
.camera-card figcaption code {
  color: var(--faint);
}

.camera-card figcaption strong {
  font-size: 11px;
  font-weight: 550;
}

.video-frame {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #030405;
}

.video-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-frame > span {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.analysis-grid {
  margin-top: 14px;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
}

.analysis-card {
  padding: 18px;
}

.board-layout {
  display: grid;
  margin-top: 18px;
  grid-template-columns: 150px 1fr;
  align-items: center;
  gap: 22px;
}

.board-mini,
.heatmap {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  aspect-ratio: 1;
}

.board-mini > span {
  display: grid;
  place-items: center;
  border-right: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  font-family: var(--mono);
  font-size: 31px;
}

.board-mini > span:nth-child(3n) { border-right: 0; }
.board-mini > span:nth-child(n + 7) { border-bottom: 0; }
.board-mini .x { color: var(--red); }
.board-mini .target { background: var(--red-soft); }

.board-copy strong {
  font-size: 15px;
}

.board-copy p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.metric-table {
  display: grid;
  margin-top: 17px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.metric-table > div {
  min-height: 74px;
  padding: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metric-table > div:nth-child(3n) { border-right: 0; }
.metric-table > div:nth-last-child(-n + 3) { border-bottom: 0; }
.metric-table span { display: block; color: var(--faint); font-family: var(--mono); font-size: 8px; letter-spacing: .06em; text-transform: uppercase; }
.metric-table strong { display: block; margin-top: 8px; font-family: var(--mono); font-size: 18px; font-weight: 400; }

.chart-card {
  margin-top: 14px;
}

.chart-heading {
  justify-content: space-between;
  gap: 18px;
}

.joint-legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.joint-legend button {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  font-family: var(--mono);
  font-size: 8px;
  cursor: pointer;
}

.joint-legend button[aria-pressed="false"] { opacity: .35; }

.chart-card canvas,
.analytics-card canvas {
  display: block;
  width: 100%;
}

.chart-card canvas {
  height: 250px;
  margin-top: 16px;
}

.joint-readout {
  display: grid;
  margin: 12px -18px -18px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.joint-readout > div {
  padding: 10px 12px;
  border-right: 1px solid var(--line);
}

.joint-readout > div:last-child { border-right: 0; }
.joint-readout span { display: block; color: var(--faint); font-family: var(--mono); font-size: 8px; text-transform: uppercase; }
.joint-readout strong { font-family: var(--mono); font-size: 12px; font-weight: 400; }

.policy-panel {
  min-height: 650px;
}

.policy-intro {
  display: grid;
  padding: clamp(26px, 4vw, 54px);
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 60px;
  border: 1px solid var(--line);
  border-radius: 12px 12px 0 0;
  background:
    radial-gradient(circle at 90% 0, rgba(255, 54, 93, 0.14), transparent 40%),
    var(--bg);
}

.policy-intro h3 {
  max-width: 770px;
  font-size: clamp(36px, 4.8vw, 64px);
}

.policy-intro p:last-child {
  max-width: 770px;
  margin: 24px 0 0;
  color: var(--muted);
}

.runtime-status {
  align-self: start;
  padding: 16px;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.runtime-status[data-state="ready"] > i { background: var(--green); box-shadow: 0 0 0 5px rgba(72,213,151,.12); }
.runtime-status[data-state="error"] > i,
.runtime-status[data-state="disabled"] > i { background: var(--amber); box-shadow: 0 0 0 5px rgba(248,184,78,.12); }
.runtime-status span { display: flex; flex-direction: column; }
.runtime-status strong { font-size: 12px; }
.runtime-status small { color: var(--faint); font-family: var(--mono); font-size: 9px; }

.policy-workbench {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 410px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  overflow: hidden;
}

.policy-controls {
  display: flex;
  padding: 22px;
  flex-direction: column;
  gap: 14px;
  border-right: 1px solid var(--line);
  background: var(--panel-soft);
}

.policy-controls input,
.policy-controls select {
  height: 38px;
  margin-top: 5px;
  padding: 0 10px;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
}

.policy-controls .button { width: 100%; }
.control-note { margin: auto 0 0; color: var(--faint); line-height: 1.6; text-transform: none; letter-spacing: 0; }

.policy-sim {
  position: relative;
  display: grid;
  min-height: 410px;
  place-items: center;
  background:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px),
    var(--bg);
  background-size: 48px 48px;
}

.policy-sim canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.policy-placeholder { position: relative; z-index: 1; display: flex; align-items: center; flex-direction: column; text-align: center; }
.policy-placeholder span { color: var(--red); font-family: var(--mono); font-size: 42px; }
.policy-placeholder strong { margin-top: 8px; font-size: 13px; }
.policy-placeholder small { color: var(--faint); font-family: var(--mono); font-size: 9px; }

.policy-results {
  display: grid;
  margin-top: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.policy-results[hidden] { display: none; }
.policy-results article { min-height: 98px; padding: 16px; border-right: 1px solid var(--line); background: var(--panel-soft); }
.policy-results article:last-child { border: 0; }
.policy-results span,.policy-results small { display: block; color: var(--faint); font-family: var(--mono); font-size: 9px; text-transform: uppercase; }
.policy-results strong { display: block; margin: 8px 0 2px; font-family: var(--mono); font-size: 20px; font-weight: 400; }

.analytics-section {
  border-top: 1px solid var(--line-soft);
}

.analytics-grid {
  max-width: 1500px;
  margin: 0 auto;
  grid-template-columns: 1.35fr .75fr .9fr;
}

.analytics-card {
  min-height: 360px;
  padding: 20px;
}

.analytics-card canvas { height: 280px; margin-top: 22px; }

.heatmap {
  max-width: 270px;
  margin: 28px auto 0;
  gap: 5px;
}

.heatmap > div {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--red) calc(var(--heat) * 1%), var(--panel));
}

.heatmap strong { font-family: var(--mono); font-size: 20px; font-weight: 400; }
.heatmap span { color: var(--muted); font-family: var(--mono); font-size: 8px; text-transform: uppercase; }

.integrity-list {
  margin: 22px 0 0;
}

.integrity-list > div {
  display: grid;
  min-height: 51px;
  padding: 10px 0;
  grid-template-columns: 1fr auto;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
}

.integrity-list dt { color: var(--muted); font-size: 11px; }
.integrity-list dd { margin: 0; font-family: var(--mono); font-size: 10px; }
.integrity-list .pass { color: var(--green); }

.method-section {
  border-top: 1px solid var(--line-soft);
  background: var(--bg-raised);
}

.method-section > .eyebrow,
.method-grid {
  max-width: 1500px;
  margin-left: auto;
  margin-right: auto;
}

.method-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.method-grid article {
  padding: 38px 28px;
  border-right: 1px solid var(--line);
}

.method-grid article:last-child { border-right: 0; }
.method-grid span { color: var(--red); font-family: var(--mono); font-size: 10px; }
.method-grid h3 { margin: 18px 0 12px; font-size: 20px; }
.method-grid p { margin: 0; color: var(--muted); }

footer {
  min-height: 130px;
  padding: 30px clamp(24px, 5vw, 80px);
  justify-content: space-between;
  gap: 30px;
  border-top: 1px solid var(--line);
}

footer > div { gap: 10px; font-size: 12px; letter-spacing: .12em; }
footer p { color: var(--muted); }
footer a { color: var(--cyan); font-family: var(--mono); font-size: 11px; }

.toast {
  position: fixed;
  z-index: 500;
  right: 22px;
  bottom: 22px;
  max-width: 420px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  box-shadow: var(--shadow);
  font-family: var(--mono);
  font-size: 10px;
}

@media (max-width: 1180px) {
  .hero { grid-template-columns: 1fr .7fr; }
  .provenance-strip > div { grid-template-columns: 1fr auto; }
  .provenance-strip span { grid-column: 1 / 3; }
  .studio-grid { grid-template-columns: 250px minmax(0, 1fr); }
  .episode-browser { padding: 16px; }
  .analysis-grid { grid-template-columns: 1fr; }
  .analytics-grid { grid-template-columns: repeat(2, 1fr); }
  .analytics-card.wide { grid-column: 1 / 3; }
}

@media (max-width: 860px) {
  .site-header { min-height: 62px; }
  .site-header nav a { display: none; }
  .hero { min-height: auto; grid-template-columns: 1fr; padding-top: 100px; }
  .hero-orbit { min-height: 330px; }
  .ring-one { width: 340px; }
  .ring-two { width: 250px; }
  .provenance-strip { grid-template-columns: 1fr; }
  .provenance-strip > div { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .metric-ribbon { grid-template-columns: repeat(2, 1fr); }
  .metric-ribbon article { min-height: 115px; }
  .section-heading { grid-template-columns: 1fr; gap: 20px; }
  .studio-grid { display: block; }
  .episode-browser { min-height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .episode-list { height: 260px; }
  .policy-intro { grid-template-columns: 1fr; gap: 28px; }
  .policy-workbench { grid-template-columns: 1fr; }
  .policy-controls { border-right: 0; border-bottom: 1px solid var(--line); }
  .analytics-grid { grid-template-columns: 1fr; }
  .analytics-card.wide { grid-column: auto; }
  .method-grid { grid-template-columns: 1fr; }
  .method-grid article { border-right: 0; border-bottom: 1px solid var(--line); }
  footer { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 620px) {
  .hero h1 { font-size: 49px; }
  .hero-orbit { min-height: 290px; }
  .hero-token { width: 86px; height: 86px; border-radius: 20px; font-size: 65px; }
  .hero-terminal { bottom: 5%; }
  .metric-ribbon { grid-template-columns: 1fr 1fr; padding: 0 14px; }
  .metric-ribbon article { padding: 24px 16px; }
  .studio-shell,.analytics-section,.method-section { padding: 78px 12px; }
  .mode-switch button { min-height: 76px; padding: 12px; grid-template-columns: 28px 1fr; }
  .studio-main { padding: 10px; }
  .sim-header > div:last-child span:last-child { display: none; }
  .sim-stage { min-height: 370px; }
  .transport { flex-wrap: wrap; }
  .timeline-wrap { order: 5; min-width: 100%; }
  .camera-grid { grid-template-columns: 1fr; }
  .board-layout { grid-template-columns: 110px 1fr; }
  .metric-table { grid-template-columns: repeat(2, 1fr); }
  .metric-table > div:nth-child(3n) { border-right: 1px solid var(--line); }
  .metric-table > div:nth-child(2n) { border-right: 0; }
  .metric-table > div:nth-last-child(-n + 3) { border-bottom: 1px solid var(--line); }
  .metric-table > div:nth-last-child(-n + 2) { border-bottom: 0; }
  .joint-readout { grid-template-columns: repeat(3, 1fr); }
  .joint-readout > div:nth-child(3) { border-right: 0; }
  .joint-readout > div:nth-child(-n + 3) { border-bottom: 1px solid var(--line); }
  .policy-results { grid-template-columns: repeat(2, 1fr); }
  .policy-results article:nth-child(2) { border-right: 0; }
  .policy-results article:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
