:root {
  --bg: #0f1216;
  --panel: #161a20;
  --panel-2: #1d222a;
  --line: #2a303a;
  --text: #e9ecf1;
  --muted: #98a2b3;
  --accent: #f2b544;
  --accent-2: #7cc4ff;
  --live: #4ade80;
  --warn: #fbbf24;
  --off: #f87171;
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.5; }
a { color: var(--accent-2); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 12px; letter-spacing: 0.1px; }
h2 { font-size: 22px; margin-top: 0; }
main { max-width: 1120px; margin: 0 auto; padding: 24px 16px 48px; display: grid; gap: 40px; }
section > p, .explain > p { color: var(--muted); max-width: 72ch; }

.topbar { display: flex; align-items: center; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 2; }
.site-mark { font-family: Georgia, "Times New Roman", serif; font-size: 22px; font-weight: 700; color: var(--accent); text-decoration: none; }
.topbar h1 { font-size: 18px; margin: 0; }
.topbar h1 span { display: block; font-size: 13px; font-weight: 400; color: var(--muted); }
.status { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; color: var(--muted); white-space: nowrap; }
.status i { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.status.is-live i { background: var(--live); box-shadow: 0 0 0 0 rgba(74,222,128,.6); animation: pulse 1.6s infinite; }
.status.is-wait i { background: var(--warn); }
.status.is-off i { background: var(--off); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(74,222,128,.55); } 70% { box-shadow: 0 0 0 8px rgba(74,222,128,0); } 100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); } }

.stage { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.screen-wrap { display: grid; gap: 12px; }
.screen { position: relative; background: #000; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; outline: none; }
.screen:focus-visible { box-shadow: 0 0 0 3px rgba(242,181,68,.45); }
.screen canvas { display: block; width: 100%; aspect-ratio: 1 / 1; height: auto; image-rendering: auto; }
.screen.pixelated canvas { image-rendering: pixelated; }
.screen-badges { position: absolute; left: 12px; right: 12px; top: 12px; display: flex; justify-content: space-between; gap: 8px; pointer-events: none; }
.screen-badges span { font-family: var(--mono); font-size: 12px; padding: 4px 8px; border-radius: 6px; background: rgba(0,0,0,.55); color: #fff; }
.screen-message { position: absolute; inset: auto 12px 12px; margin: 0; padding: 10px 12px; border-radius: 8px; background: rgba(15,18,22,.92); color: var(--text); font-size: 14px; }
.touchpad { display: grid; grid-template-columns: repeat(4, 56px); gap: 8px; justify-content: center; }
.touchpad button { height: 48px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: 18px; touch-action: none; user-select: none; }
.touchpad button.is-down { background: var(--accent); color: #111; }

.controls { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: grid; gap: 14px; }
.controls .lede { margin: 0; color: var(--muted); font-size: 14px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; }
.segmented span { display: block; text-align: center; padding: 8px 6px; font-size: 14px; color: var(--muted); cursor: pointer; }
.segmented input:checked + span { background: var(--panel-2); color: var(--text); font-weight: 600; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.slider { display: grid; gap: 6px; font-size: 14px; }
.slider output { float: right; font-family: var(--mono); color: var(--accent); }
.slider input { width: 100%; accent-color: var(--accent); }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
button { font: inherit; }
.button-row button, .latent .button-row button { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; font-size: 14px; }
.button-row button:hover { border-color: var(--accent); }
.button-row button[aria-pressed="true"] { background: var(--accent); color: #111; border-color: var(--accent); }
.check { font-size: 14px; display: flex; gap: 8px; align-items: center; color: var(--muted); }
.check input { accent-color: var(--accent); }
.readout { display: grid; gap: 6px; font-family: var(--mono); font-size: 12px; }
.bar { display: grid; grid-template-columns: 48px 1fr; align-items: center; gap: 10px; color: var(--muted); }
.bar .track { position: relative; height: 10px; border-radius: 5px; background: var(--panel-2); overflow: hidden; }
.bar .track i { position: absolute; top: 0; bottom: 0; left: 0; width: 0; background: var(--accent-2); border-radius: 5px; }
.bar.steer .track::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--line); }
.bar.steer .track i { left: 50%; background: var(--accent); }
.memory { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.memory canvas { width: 128px; height: 128px; image-rendering: pixelated; border-radius: 6px; border: 1px solid var(--line); }
.hint { margin: 0; font-size: 12px; color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.cards article { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.cards h3 { font-size: 16px; display: flex; gap: 10px; align-items: baseline; }
.cards h3 b { font-family: Georgia, serif; font-size: 26px; color: var(--accent); }
.cards p { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.cards .stat { font-family: var(--mono); font-size: 12px; }
.cards .stat strong { color: var(--text); }

.results figure { margin: 0 0 16px; }
.results video { width: 100%; max-width: 820px; display: block; border-radius: 10px; border: 1px solid var(--line); background: #000; }
.results figcaption { color: var(--muted); font-size: 14px; margin-top: 8px; max-width: 72ch; }
.facts { border-collapse: collapse; width: 100%; max-width: 820px; font-size: 14px; }
.facts td { padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; }
.facts td:first-child { color: var(--muted); width: 38%; }
.facts td:last-child { font-family: var(--mono); font-size: 13px; }

.latent-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.samples { display: flex; flex-wrap: wrap; gap: 6px; }
.samples button { width: 64px; height: 64px; padding: 0; border-radius: 6px; border: 2px solid transparent; background-image: url("model/samples.png"); background-size: auto 64px; cursor: pointer; }
.samples button[aria-pressed="true"] { border-color: var(--accent); }
.pair { display: flex; gap: 16px; }
.pair figure { margin: 0; text-align: center; font-size: 12px; color: var(--muted); }
.pair canvas { width: 192px; height: 192px; border-radius: 8px; border: 1px solid var(--line); background: #000; image-rendering: auto; display: block; margin-bottom: 4px; }
.sliders { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 4px 12px; }
.sliders label { display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.sliders input { width: 100%; accent-color: var(--accent-2); margin: 0; }

footer { border-top: 1px solid var(--line); padding-top: 16px; color: var(--muted); font-size: 13px; }
footer p { margin: 0 0 6px; }

@media (max-width: 900px) {
  .stage { grid-template-columns: minmax(0, 1fr); }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .topbar h1 span { display: none; }
}
@media (max-width: 480px) {
  .pair canvas { width: 140px; height: 140px; }
  .topbar { padding: 10px 12px; gap: 10px; }
  .status { font-size: 12px; }
}
