:root {
  color-scheme: dark;
  --ink: #f4f1e8;
  --muted: #a9afbd;
  --line: rgba(255,255,255,.12);
  --panel: rgba(17,22,32,.82);
  --lime: #c8ff58;
  --cyan: #58e6ff;
  --violet: #8a72ff;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(circle at 12% 12%, rgba(88,230,255,.12), transparent 28rem),
    radial-gradient(circle at 86% 10%, rgba(138,114,255,.16), transparent 30rem),
    #070a10;
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .16;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 32px 32px;
}
button { font: inherit; }
.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 64px 0 34px; position: relative; }
.hero { max-width: 780px; margin-bottom: 30px; }
.eyebrow { color: var(--lime); letter-spacing: .2em; font: 700 12px/1.3 ui-monospace, SFMono-Regular, monospace; }
h1 { font-size: clamp(44px, 8vw, 92px); line-height: .9; letter-spacing: -.065em; margin: 12px 0 20px; }
.lede { color: var(--muted); font-size: clamp(17px, 2.3vw, 22px); line-height: 1.55; max-width: 690px; }
.lab { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .75fr); border: 1px solid var(--line); border-radius: 24px; overflow: hidden; background: rgba(8,11,17,.75); box-shadow: 0 30px 90px rgba(0,0,0,.4); }
.viewport-wrap { min-height: 570px; position: relative; overflow: hidden; background: radial-gradient(circle at 50% 38%, #222b3a 0, #10151f 58%, #090c12 100%); }
.viewport-wrap::after { content: "ENERGY MINIMIZATION / 30 HZ"; position: absolute; left: 20px; bottom: 18px; color: rgba(255,255,255,.36); font: 10px ui-monospace, monospace; letter-spacing: .14em; pointer-events: none; }
.viewport-wrap canvas { display: block; width: 100% !important; height: 100% !important; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); letter-spacing: .08em; }
.loading[hidden] { display: none; }
.panel { padding: 26px; border-left: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(18px); }
.readout { display: flex; align-items: center; gap: 12px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.readout small, .metric-grid small { display: block; color: #788092; font: 700 10px/1.4 ui-monospace, monospace; letter-spacing: .12em; }
.readout strong { display: block; margin-top: 2px; }
.pulse { width: 12px; height: 12px; border-radius: 50%; background: #717783; box-shadow: 0 0 0 6px rgba(113,119,131,.1); }
.pulse.active { background: var(--lime); box-shadow: 0 0 0 6px rgba(200,255,88,.1), 0 0 20px rgba(200,255,88,.65); }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 20px 0; background: var(--line); border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.metric-grid > div { background: #111620; padding: 13px 14px; }
.metric-grid strong { display: block; margin-top: 4px; font: 700 16px ui-monospace, monospace; }
fieldset { border: 0; padding: 0; margin: 19px 0; }
legend { margin-bottom: 8px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 7px; }
button { color: var(--ink); background: #161c28; border: 1px solid var(--line); border-radius: 10px; min-height: 44px; padding: 9px 12px; cursor: pointer; transition: transform .15s, border-color .15s, background .15s; }
button:hover { transform: translateY(-1px); border-color: rgba(255,255,255,.3); }
button:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
button[aria-pressed="true"] { color: #07100c; background: var(--lime); border-color: var(--lime); font-weight: 800; }
.actions { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 7px; margin-top: 22px; }
.actions .primary { background: linear-gradient(135deg, var(--violet), #6252d9); border-color: #9c8fff; font-weight: 800; }
.actions .primary.awake { background: linear-gradient(135deg, #b9ef4e, #74c934); color: #091007; border-color: var(--lime); }
.hint { margin: 17px 2px 0; color: #858d9e; font-size: 12px; line-height: 1.55; }
.smoke-check { margin-top: 14px; padding: 12px; border: 1px solid rgba(88,230,255,.35); border-radius: 12px; background: rgba(88,230,255,.07); }
.smoke-check[hidden] { display: none; }
.smoke-check button { width: 100%; border-color: var(--cyan); }
.smoke-check p { margin: 8px 2px 0; color: var(--cyan); font: 700 11px/1.5 ui-monospace, monospace; }
.science { display: grid; grid-template-columns: repeat(3,1fr); margin-top: 26px; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.science article { padding: 24px; background: rgba(13,17,25,.72); }
.science article + article { border-left: 1px solid var(--line); }
.science span { color: var(--cyan); font: 700 11px ui-monospace, monospace; }
.science h2 { margin: 10px 0 8px; font-size: 18px; }
.science p, footer p { color: var(--muted); line-height: 1.6; font-size: 14px; margin: 0; }
footer { padding: 24px 2px 0; }

@media (max-width: 780px) {
  .shell { padding-top: 38px; }
  .lab { grid-template-columns: 1fr; }
  .viewport-wrap { min-height: 430px; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
  .science { grid-template-columns: 1fr; }
  .science article + article { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 430px) {
  .shell { width: min(100% - 18px, 1180px); }
  .viewport-wrap { min-height: 350px; }
  .panel { padding: 20px; }
  .actions { grid-template-columns: 1fr 1fr; }
  .actions .primary { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
