:root {
  --bg: var(--demo-bg);
  --bg-2: var(--demo-surface);
  --panel: color-mix(in srgb, var(--demo-surface) 94%, transparent);
  --panel-solid: var(--demo-surface-2);
  --line: var(--demo-border);
  --line-strong: color-mix(in srgb, var(--demo-border) 65%, var(--demo-muted));
  --text: var(--demo-text-strong);
  --muted: var(--demo-muted);
  --blue: var(--demo-accent);
  --cyan: var(--demo-accent);
  --orange: var(--demo-accent);
  --green: #28754a;
  --radius: var(--demo-radius);
  --mono: var(--demo-mono);
  --sans: var(--demo-font);
  --scene-text: #e7ecff;
  --scene-muted: #95a0c4;
  --scene-green: #4fd889;
  --policy-rl: #176b3a;
  --policy-heuristic: #2456a6;
  --policy-random: #8a5200;
}
:root[data-theme="dark"] {
  --green: #78d69b;
  --policy-rl: #78d69b;
  --policy-heuristic: #91b5ff;
  --policy-random: #ffd166;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --green: #78d69b;
    --policy-rl: #78d69b;
    --policy-heuristic: #91b5ff;
    --policy-random: #ffd166;
  }
}
@font-face {
  font-family: "Inter Site";
  src: url("./demo-kit/fonts/Inter4.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, output { font-family: var(--mono); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.accent { color: var(--orange); }

.backdrop {
  position: fixed;
  inset: -20vmax;
  z-index: -1;
  background:
    radial-gradient(40vmax 30vmax at 15% 10%, color-mix(in srgb, var(--demo-accent) 16%, transparent), transparent 60%),
    radial-gradient(35vmax 28vmax at 85% 30%, color-mix(in srgb, var(--demo-accent) 10%, transparent), transparent 60%),
    var(--bg);
  animation: drift 40s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translate3d(0, 0, 0) rotate(0deg); }
  to { transform: translate3d(2vmax, -2vmax, 0) rotate(4deg); }
}
@media (prefers-reduced-motion: reduce) { .backdrop { animation: none; } }

/* ------------------------------------------------------------ nav */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 48px);
  background: linear-gradient(to bottom, color-mix(in srgb, var(--demo-bg) 94%, transparent), transparent);
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font: 600 18px var(--mono); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: conic-gradient(from 200deg, var(--blue), var(--cyan), var(--orange), var(--blue));
  box-shadow: 0 0 18px rgba(91, 140, 255, 0.6);
}
.nav nav { display: flex; gap: clamp(10px, 2vw, 26px); align-items: center; }
.nav nav a { color: var(--muted); font-size: 14px; }
.nav nav a:hover { color: var(--text); text-decoration: none; }
.nav .nav-cta { color: var(--text); border: 1px solid var(--line-strong); padding: 6px 14px; border-radius: 999px; }
/* The demo kit's scheme toggle keeps the header at its height. */
.nav .demo-theme-toggle { margin-block: -4px; }
@media (max-width: 720px) { .nav nav a:not(.nav-cta) { display: none; } }

/* ------------------------------------------------------------ hero */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 110px clamp(16px, 5vw, 64px) 60px;
  overflow: hidden;
}
.hero-wall { position: absolute; inset: 0; }
.hero-wall canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.wall-glow, .lab-glow { filter: blur(10px) saturate(1.6); opacity: 0.75; }
.hero-shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 55% at 50% 50%, color-mix(in srgb, var(--demo-bg) 96%, transparent) 0%, color-mix(in srgb, var(--demo-bg) 88%, transparent) 45%, color-mix(in srgb, var(--demo-bg) 32%, transparent) 100%),
    linear-gradient(to bottom, color-mix(in srgb, var(--demo-bg) 30%, transparent), transparent 30%, transparent 70%, var(--bg));
}
/* Pointer spotlight: the shade thins around a mouse pointer so the wall shows through. */
.hero.lit .hero-shade {
  -webkit-mask-image: radial-gradient(circle 230px at var(--mx) var(--my), rgba(0, 0, 0, 0.3), #000 100%);
  mask-image: radial-gradient(circle 230px at var(--mx) var(--my), rgba(0, 0, 0, 0.3), #000 100%);
}
.wall-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; mix-blend-mode: screen; }
.hero-copy { position: relative; max-width: 1080px; text-align: center; }
/* Two lines reserved, so a longer readout never re-centres the hero. */
.hero-hint { margin: 26px 0 0; min-height: 3.2em; color: var(--muted); font: 13px/1.6 var(--mono); opacity: 0.85; }
.hero-hint::before { content: "\2726  "; color: var(--cyan); }
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: color-mix(in srgb, var(--demo-surface) 82%, transparent);
  color: var(--muted);
  font: 13px var(--mono);
}
.kicker .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
/* Headings stay on one line: short copy fits the available width at 320 px and up. */
h1 {
  margin: 0;
  font-size: clamp(20px, calc((100vw - 40px) / 17), 64px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 750;
}
.grad {
  background: linear-gradient(92deg, var(--cyan) 0%, var(--blue) 40%, #b38cff 65%, var(--orange) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lede { max-width: 680px; margin: 22px auto 0; color: var(--muted); font-size: clamp(16px, 1.7vw, 19px); }
.cta-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 32px; }
.stats {
  display: flex;
  justify-content: center;
  gap: clamp(16px, 5vw, 56px);
  margin: 44px 0 0;
  flex-wrap: wrap;
}
.stats div { min-width: 150px; }
.stats dt { color: var(--muted); font: 12px var(--mono); text-transform: uppercase; letter-spacing: 0.08em; }
.stats dd { margin: 4px 0 0; font: 600 clamp(24px, 3vw, 34px) var(--mono); font-variant-numeric: tabular-nums; }
.boot { position: absolute; bottom: 24px; left: 0; right: 0; text-align: center; color: var(--muted); font: 13px var(--mono); }

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--panel-solid);
  color: var(--text);
  font: 600 15px var(--sans);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.btn:hover:not(:disabled) { text-decoration: none; transform: translateY(-1px); border-color: var(--blue); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.primary {
  border-color: transparent;
  background: var(--demo-accent);
  color: var(--demo-on-accent);
  box-shadow: 0 8px 30px color-mix(in srgb, var(--demo-accent) 35%, transparent);
}
.btn.primary:hover:not(:disabled) { box-shadow: 0 10px 40px color-mix(in srgb, var(--demo-accent) 55%, transparent); }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 13px; font-size: 13px; border-radius: 10px; }
.btn-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ------------------------------------------------------------ sections */
.section { max-width: 1240px; margin: 0 auto; padding: 110px clamp(16px, 4vw, 40px) 30px; }
.section-head { max-width: 760px; margin-bottom: 36px; }
.eyebrow { margin: 0 0 8px; color: var(--orange); font: 13px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }
h2 { margin: 0 0 12px; font-size: clamp(18px, calc((100vw - 32px) / 19), 40px); line-height: 1.1; letter-spacing: -0.02em; }
.section-head p { margin: 0; color: var(--muted); }
.section-head p + p { margin-top: 12px; }
.section-head .try { color: var(--text); }
.section-head .try b:first-child { margin-right: 6px; color: var(--cyan); font: 600 12px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.section-head .try i { font-style: normal; color: var(--text); }
h3 { margin: 0; font-size: 18px; }

/* ------------------------------------------------------------ cards */
.cards { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 720px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(8px);
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: 0 16px 50px rgba(0, 0, 0, 0.4); }
.card-stage {
  position: relative;
  height: 200px;
  background: radial-gradient(ellipse at 50% 40%, rgba(91, 140, 255, 0.10), transparent 70%), #080b16;
  border-bottom: 1px solid var(--line);
}
.card-stage canvas { width: 100%; height: 100%; display: block; }
.card-return {
  position: absolute;
  top: 10px;
  right: 12px;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(7, 9, 15, 0.7);
  font: 12px var(--mono);
  color: var(--scene-green);
  font-variant-numeric: tabular-nums;
}
.card-body { padding: 16px 18px 18px; }
.card-body p { margin: 8px 0 12px; color: var(--muted); font-size: 14px; }
.card .id { display: block; margin-top: 4px; color: var(--cyan); font-size: 12px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tags span { padding: 2px 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font: 12px var(--mono); }
.toggle {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--green);
  font: 12px var(--mono);
  padding: 3px 10px;
  cursor: pointer;
}
.toggle[data-policy="rl"], :is(#lab-policy, #map-policy) button[data-value="rl"] { --policy-color: var(--policy-rl); }
.toggle[data-policy="heuristic"], :is(#lab-policy, #map-policy) button[data-value="heuristic"] { --policy-color: var(--policy-heuristic); }
.toggle[data-policy="random"], :is(#lab-policy, #map-policy) button[data-value="random"] { --policy-color: var(--policy-random); }
.toggle[data-policy] {
  border-color: var(--policy-color);
  background: color-mix(in srgb, var(--policy-color) 1%, var(--panel));
  color: var(--policy-color);
}
.toggle[data-policy]:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* ------------------------------------------------------------ lab */
.lab { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; }
@media (max-width: 960px) {
  .lab { grid-template-columns: 1fr; }
}
.lab-stage {
  position: sticky;
  top: 76px;
  align-self: start;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(200px, 1fr) auto;
  gap: 8px;
  padding: 12px;
  height: min(calc(100vh - 100px), 820px);
  min-height: 460px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: radial-gradient(ellipse at 50% 30%, rgba(91, 140, 255, 0.10), transparent 70%), #070a14;
  overflow: hidden;
}
@media (max-width: 960px) {
  .lab-stage {
    position: relative;
    top: 0;
    height: auto;
    min-height: 320px;
    grid-template-rows: auto clamp(200px, 76vw, 480px) auto;
  }
}
.lab-stage canvas {
  grid-area: 2 / 1;
  position: relative;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.lab-stage canvas:focus { outline: none; }
.lab-stage canvas:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.lab-stage:focus-within { border-color: var(--line-strong); }
.lab-hud {
  grid-area: 1 / 1;
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
  pointer-events: none;
  font: 12px var(--mono);
  color: var(--scene-muted);
}
.lab-hud span {
  min-width: 0;
  padding: 3px 9px;
  border-radius: 8px;
  background: rgba(7, 9, 15, 0.7);
  overflow-wrap: anywhere;
}
.lab-keys {
  grid-area: 3 / 1;
  justify-self: center;
  max-width: 100%;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(7, 9, 15, 0.8);
  font: 12px var(--mono);
  color: var(--scene-muted);
}
.lab-keys button {
  width: 44px;
  height: 40px;
  border: 1px solid #4a4a4a;
  border-radius: 10px;
  background: #2f2f2f;
  color: var(--scene-text);
  font-size: 16px;
  cursor: pointer;
  touch-action: none;
  user-select: none;
}
.lab-keys button:active { background: var(--demo-accent); color: var(--demo-on-accent); }
.lab-keys[data-step-mode="true"] { display: grid; grid-template-columns: repeat(4, max-content); }
.lab-keys[data-step-mode="true"] span { grid-column: 1 / -1; text-align: center; }
.lab-keys[data-step-mode="true"] button { width: auto; min-width: 44px; padding: 0 9px; font-size: 12px; }
@media (max-width: 600px) {
  #lab-keys[data-step-mode="true"] {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    grid-template-columns: repeat(4, minmax(44px, 1fr));
  }
  #lab-keys[data-step-mode="true"] > button {
    height: auto;
    min-width: 44px;
    min-height: 44px;
    padding: 4px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  #lab-keys[data-step-mode="true"] > button[data-key="KeyP"],
  #lab-keys[data-step-mode="true"] > button[data-key="KeyD"],
  #lab-keys[data-step-mode="true"] > button[data-key="Enter"],
  #lab-keys[data-step-mode="true"] > button[data-key="Space"] { grid-column: span 2; }
  #lab-keys[data-step-mode="true"] > span {
    grid-column: 1 / -1;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}
.lab-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(8px);
}
.lab-panel .share, .map-panel .share { align-self: flex-start; }
.section > details.policy-editor,
.section > .policy-notice {
  min-width: 0;
}
.section > details.policy-editor {
  box-sizing: border-box;
  width: 100%;
  margin-top: 18px;
}
.section > .policy-notice { margin: 18px 0 0; }

/* ---- robustness map */
.map { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; }
@media (max-width: 960px) { .map { grid-template-columns: 1fr; } }
.map-stage {
  position: relative;
  aspect-ratio: 1 / 1;
  max-height: 720px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: radial-gradient(ellipse at 50% 40%, rgba(179, 140, 255, 0.10), transparent 70%), #070a14;
  overflow: hidden;
}
.map-stage canvas { position: absolute; inset: 0 0 34px 0; width: 100%; height: calc(100% - 34px); display: block; cursor: crosshair; }
.map-stage canvas.terrain { cursor: grab; touch-action: pan-y; }
.map-stage canvas.terrain.dragging { cursor: grabbing; }
.map-stage canvas:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.map-legend {
  position: absolute;
  left: 76px;
  right: 16px;
  bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  font: 12px var(--mono);
  color: var(--scene-muted);
}
.map-legend b { color: var(--scene-text); font-weight: 600; }
.map-legend .ramp {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgb(34, 18, 58), rgb(122, 48, 170) 30%, rgb(255, 107, 97) 55%, rgb(255, 196, 87) 80%, rgb(140, 255, 214));
}
.map-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(8px);
}
.map-progress { margin: 0; min-height: 2.6em; font: 12px var(--mono); color: var(--muted); }
.map-span { display: grid; grid-template-columns: 2.6em 1fr; align-items: center; gap: 0 8px; margin-top: 6px; font-size: 12px; }
.map-span .row-between { grid-column: 1 / -1; }
.map-span > span { color: var(--muted); }
.map-span input:disabled { opacity: 0.4; }
.transition { margin: 0; min-height: 2.9em; font: 12px/1.45 var(--mono); color: var(--text); }
.map-inset canvas { width: 100%; height: 170px; display: block; border: 1px solid var(--line); border-radius: 12px; background: #070a14; }
.fault {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 50;
  max-width: min(92vw, 720px);
  margin: 0;
  padding: 10px 14px;
  transform: translateX(-50%);
  border: 1px solid var(--orange);
  border-radius: 10px;
  background: var(--panel-solid);
  color: var(--text);
  font: 13px var(--mono);
}
.map-readout { margin-top: 8px; font: 12px var(--mono); color: var(--muted); line-height: 1.5; }

/* ---- deterministic still capture (?still=N): hero only, no chrome */
body.still .nav, body.still .boot, body.still .cta-row, body.still .stats div:last-child, body.still .hero-hint, body.still .wall-fx { display: none; }
body.still *, body.still *::before, body.still *::after { animation: none !important; transition: none !important; }
.still-url { display: none; }
body.still .still-url { display: block; margin: 26px 0 0; font: 600 20px var(--mono); color: var(--cyan); letter-spacing: 0.02em; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field output { color: var(--text); font-size: 12px; }
.hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; opacity: 0.9; }
.lab-panel > .hint { margin-bottom: -8px; }
select {
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel-solid);
  color: var(--text);
  font: 14px var(--sans);
}
.seg { display: flex; flex-wrap: wrap; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: color-mix(in srgb, var(--demo-surface-2) 62%, transparent); }
.seg button {
  /* Sized by their labels and never broken inside one; a narrow panel wraps whole buttons. */
  flex: 1 1 auto;
  white-space: nowrap;
  padding: 6px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: 13px var(--mono);
  cursor: pointer;
}
.seg button[aria-checked="true"] { background: var(--demo-accent); color: var(--demo-on-accent); }
:is(#lab-policy, #map-policy) button:is([data-value="rl"], [data-value="heuristic"], [data-value="random"]) { color: var(--policy-color); }
:is(#lab-policy, #map-policy) button:is([data-value="rl"], [data-value="heuristic"], [data-value="random"])[aria-checked="true"] {
  background: color-mix(in srgb, var(--policy-color) 1%, var(--demo-surface-2));
  color: var(--policy-color);
  box-shadow: inset 0 0 0 1px var(--policy-color);
}
:is(#lab-policy, #map-policy) button:is([data-value="rl"], [data-value="heuristic"], [data-value="random"]):focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
.seg button:disabled { opacity: 0.45; cursor: not-allowed; }
input[type="range"] { width: 100%; accent-color: var(--blue); }
.params { border-top: 1px solid var(--line); padding-top: 10px; }
.params summary { cursor: pointer; font-size: 13px; margin-bottom: 8px; }
#lab-params { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow: auto; padding-right: 4px; }
.param { font-size: 12px; }
.param .pname { font-family: var(--mono); color: var(--text); }
.param output { color: var(--cyan); }
.param.static { opacity: 0.55; }
details.policy-editor { border-top: 1px solid var(--line); padding-top: 10px; min-width: 0; }
details.policy-editor > summary { cursor: pointer; font-size: 13px; margin-bottom: 8px; }
.policy-editor { min-width: 0; }
.policy-editor__summary { margin: 0 0 10px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.policy-editor__notice { margin: 6px 0 0; color: var(--orange); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.policy-editor__fields { display: grid; gap: 10px; min-width: 0; }
.policy-editor__field, .policy-editor__weight { display: grid; gap: 5px; min-width: 0; color: var(--muted); font-size: 12px; }
.policy-editor__label { color: var(--text); font-family: var(--mono); }
.policy-editor__description { color: var(--muted); line-height: 1.4; }
.policy-editor__number, .policy-editor__selector select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel-solid);
  color: var(--text);
  font: 13px var(--mono);
}
.policy-editor__selectors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.policy-editor__selector { display: grid; gap: 5px; min-width: 0; color: var(--muted); font-size: 12px; }
.policy-editor__pager { display: grid; grid-template-columns: repeat(2, max-content); align-items: center; justify-content: space-between; gap: 6px; min-width: 0; }
.policy-editor__page { grid-column: 1 / -1; color: var(--muted); font: 11px var(--mono); }
.policy-editor__weights { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; min-width: 0; }
.policy-editor__actions { margin-top: 10px; }
#lab-policy-editor[data-policy-editor-disabled="true"],
#map-policy-editor[data-policy-editor-disabled="true"] { opacity: 0.55; }
.policy-notice { overflow-wrap: anywhere; }
.policy-notice:empty { display: none; }
.lab-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lab-stats div { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.lab-stats span { display: block; font-size: 11px; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.06em; }
.lab-stats b { font: 600 20px var(--mono); font-variant-numeric: tabular-nums; }
.spark { width: 100%; height: 64px; border: 1px solid var(--line); border-radius: 12px; background: #070a14; }
.obs { display: flex; flex-direction: column; gap: 4px; }
.obs.frame { display: grid; grid-template-columns: repeat(var(--side), 1fr); gap: 2px; width: min(100%, 208px); aspect-ratio: 1; }
.obs.frame i { border-radius: 2px; background: var(--cyan); }
.bar { display: grid; grid-template-columns: 64px 1fr 64px; gap: 8px; align-items: center; font: 11px var(--mono); color: var(--muted); }
.bar .track { position: relative; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--demo-border) 55%, var(--demo-surface)); }
.bar .track::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--line-strong); }
.bar .fill { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: linear-gradient(90deg, var(--blue), var(--cyan)); }
.bar .val { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ Oniro */
/* Experiment cards: one radio group, each choice an algorithm and task with a short note. */
.picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.picks button {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  font: 600 15px var(--mono);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.picks button small { color: var(--muted); font: 400 13px/1.45 var(--sans); }
.picks button:hover { border-color: var(--line-strong); }
.picks button[aria-checked="true"] {
  border-color: var(--demo-accent);
  background: var(--demo-accent);
  color: var(--demo-on-accent);
  box-shadow: 0 0 0 1px var(--demo-accent), 0 10px 30px color-mix(in srgb, var(--demo-accent) 20%, transparent);
}
.picks button[aria-checked="true"] small { color: var(--demo-on-accent); }
.picks button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.train { display: grid; gap: 22px; }
.train-note { max-width: 860px; margin: 0; color: var(--muted); font-size: 14px; }
.solved { color: var(--green); font-weight: 600; white-space: nowrap; }
.oniro-frame {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--demo-surface);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(91, 140, 255, 0.15);
}
.frame-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); font: 13px var(--mono); color: var(--muted); }
.frame-actions { display: flex; flex: none; gap: 12px; align-items: center; white-space: nowrap; }
@media (max-width: 720px) { .frame-actions .wide { display: none; } }
.frame-body { position: relative; height: min(78vh, 820px); }
.oniro-frame iframe { display: block; width: 100%; height: 100%; border: 0; background: #1b1b1f; }
.oniro-frame iframe[hidden] { display: none; }
.frame-poster {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: radial-gradient(60% 60% at 50% 45%, color-mix(in srgb, var(--demo-accent) 16%, transparent), transparent 70%);
}
.frame-poster[hidden] { display: none; }
.frame-poster p { max-width: 460px; margin: 0; font-size: 14px; }
.btn.play { padding: 14px 26px; font-size: 17px; }
@media (max-width: 720px) {
  .frame-body { height: min(80vh, 640px); }
  /* Before a run starts, a phone needs only the button and its note, not the full stage. */
  .oniro-frame.idle .frame-body { height: 320px; }
}

/* ------------------------------------------------------------ code */
.code { border: 1px solid var(--line); border-radius: var(--radius); background: var(--demo-surface); overflow: hidden; }
.tabs { display: flex; gap: 2px; padding: 8px; border-bottom: 1px solid var(--line); }
.tabs button { padding: 7px 14px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: 13px var(--mono); cursor: pointer; }
.tabs button[aria-selected="true"] { background: color-mix(in srgb, var(--demo-accent) 16%, var(--demo-surface-2)); color: var(--text); }
.code pre { margin: 0; padding: 22px 24px; overflow-x: auto; font-size: 14px; line-height: 1.7; color: var(--demo-text); }
.code .k, .code .n { color: var(--demo-accent); }
.code .t { color: var(--demo-text-strong); }
.code .s, .code .c { color: var(--demo-muted); }

/* ------------------------------------------------------------ footer */
.foot { max-width: 1240px; margin: 60px auto 0; padding: 30px clamp(16px, 4vw, 40px) 60px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.foot p { margin: 4px 0; }

/* ---- reduced motion: no pulsing or lifting (after the rules it overrides) */
@media (prefers-reduced-motion: reduce) {
  .kicker .dot { animation: none; }
  .btn, .card, .picks button { transition: none; }
  .btn:hover, .card:hover { transform: none; }
}

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

/* The portfolio kit hides this link when the demo runs inside its frame. */
.demo-home {
  flex: none;
  color: var(--demo-muted);
  font-size: 13px;
  white-space: nowrap;
}
.demo-home:hover { color: var(--demo-text-strong); }
.btn:focus-visible, .toggle:focus-visible, .lab-keys button:focus-visible,
select:focus-visible, input:focus-visible, summary:focus-visible,
.tabs button:focus-visible, .nav a:focus-visible, .demo-home:focus-visible {
  outline: 2px solid var(--demo-accent);
  outline-offset: 3px;
}
@media (max-width: 720px) {
  .demo-home { font-size: 12px; }
}
