:root {
  color-scheme: dark;
  --steel-1: #1d2230;
  --steel-2: #121622;
  --steel-3: #090b12;
  --edge: #2e3650;
  --engrave: #9fb0d6;
  --dim: #56607e;
  --phosphor: #6ff3ff;
  --phosphor-dim: #2f6f80;
  --amber: #b98cff;
  --red: #ff4f8b;
  --ink: #e6ecff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: #0b0b0a; color: var(--ink); }
body {
  min-height: 100dvh;
  font-family: "IBM Plex Mono", monospace;
  padding: clamp(10px, 3vw, 40px) clamp(8px, 2vw, 24px) 40px;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

.facility { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.wall {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(90deg, transparent 0 239px, rgba(255,255,255,.025) 240px, transparent 242px),
    radial-gradient(ellipse 60% 45% at 50% 18%, rgba(185,140,255,.11), transparent 70%),
    linear-gradient(#141412, #0b0b0a 70%);
}
.lamp {
  position: absolute; top: 0; left: 50%; width: 120px; height: 14px; margin-left: -60px;
  border-radius: 0 0 60px 60px; background: #2a2620;
  box-shadow: 0 6px 60px 30px rgba(185,140,255,.08);
}
.bench {
  position: absolute; left: 0; right: 0; bottom: 0; height: 28vh;
  background: linear-gradient(#1a1916, #0d0d0c);
  border-top: 1px solid #2a2925;
}

.machine {
  position: relative;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 14px;
  border-radius: 14px;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.012) 0 1px, transparent 1px 3px),
    linear-gradient(170deg, var(--steel-1), var(--steel-2) 45%, var(--steel-3));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.12),
    inset 0 -2px 0 rgba(0,0,0,.6),
    0 2px 0 #0a0a09,
    0 40px 60px -20px rgba(0,0,0,.9),
    0 70px 40px -40px rgba(0,0,0,.8);
}
.plate {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 12px;
  border-radius: 4px;
  background: linear-gradient(#2c2d2a, #1e1f1c);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.7), 0 1px 0 rgba(255,255,255,.06);
  color: var(--engrave);
  font: 500 10px/1.3 "IBM Plex Sans Condensed", sans-serif;
  letter-spacing: .18em;
  text-shadow: 0 1px 0 rgba(0,0,0,.8), 0 -1px 0 rgba(255,255,255,.05);
}
.maker { color: var(--ink); }
.model { flex: 1; color: var(--dim); }
.screw {
  width: 10px; height: 10px; flex: none; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #8a8a84, #3a3a36 60%, #1a1a18);
  box-shadow: 0 1px 1px rgba(0,0,0,.8);
  position: relative;
}
.screw::after { content: ""; position: absolute; left: 2px; right: 2px; top: 4px; height: 1.5px; background: #1b1b19; transform: rotate(32deg); }
.foot-plate { justify-content: space-between; margin-top: 12px; font-size: 9px; }

.body { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 14px; margin-top: 12px; }
.display-bay {
  padding: 12px;
  border-radius: 10px;
  background: linear-gradient(#1b1c1a, #121311);
  box-shadow: inset 0 2px 6px rgba(0,0,0,.8), 0 1px 0 rgba(255,255,255,.06);
}
.bezel {
  position: relative;
  padding: 14px;
  border-radius: 22px;
  background: linear-gradient(145deg, #0f0f0e, #1d1e1b);
  box-shadow: inset 0 0 0 1px #2d2e2a, inset 0 6px 18px rgba(0,0,0,.9);
}
.crt {
  position: relative;
  min-height: 430px;
  padding: 16px 18px 18px;
  border-radius: 16px / 22px;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 45%, #0d1a2e, #060b18 70%, #020409);
  box-shadow: inset 0 0 60px rgba(0,0,0,.85), inset 0 0 2px rgba(111,243,255,.3);
  color: var(--phosphor);
  text-shadow: 0 0 6px rgba(111,243,255,.35);
}
.crt::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(transparent 0 2px, rgba(0,0,0,.22) 3px);
}
.glass {
  position: absolute; inset: 14px; border-radius: 16px / 22px; pointer-events: none;
  background: linear-gradient(118deg, rgba(255,255,255,.08), transparent 26%, transparent 78%, rgba(255,255,255,.03));
}
.crt-head { display: flex; justify-content: space-between; font-size: 10px; letter-spacing: .14em; color: var(--phosphor-dim); }
.rec i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--phosphor); margin-right: 4px; animation: pulse 1.6s ease-in-out infinite; }
.rec b { font-weight: 400; color: var(--phosphor); }
.headline {
  margin: 14px 0 10px;
  font: 400 clamp(28px, 4.4vw, 48px)/1 "Space Grotesk", sans-serif;
  letter-spacing: -.03em;
  color: #e6f9ff;
}
.headline em { font-style: normal; color: var(--phosphor); }
.mission { margin: 0 0 10px; font-size: 12px; line-height: 1.55; color: #86b9d4; }
.mission b { color: var(--phosphor); font-weight: 500; }
.big { margin: 12px 0 8px; font: 500 22px "Space Grotesk", sans-serif; color: #e6f9ff; letter-spacing: .02em; }
.field {
  position: relative;
  height: clamp(180px, 30vh, 250px);
  border: 1px solid rgba(111,243,255,.22);
  touch-action: manipulation;
}
.grat {
  position: absolute; inset: 0;
  background:
    linear-gradient(rgba(111,243,255,.08) 1px, transparent 1px) 0 0 / 10% 20%,
    linear-gradient(90deg, rgba(111,243,255,.08) 1px, transparent 1px) 0 0 / 10% 20%;
}
.trace-line { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.trace-line path { fill: none; stroke: var(--phosphor); stroke-width: 1.4; vector-effect: non-scaling-stroke; opacity: .55; filter: drop-shadow(0 0 3px rgba(111,243,255,.7)); }
.target, .knack { position: absolute; padding: 0; background: none; transition: left .7s ease, top .7s ease; }
.target { width: 40px; height: 40px; border: 1px solid var(--phosphor); border-radius: 50%; box-shadow: 0 0 14px rgba(111,243,255,.5); }
.target::before { content: ""; position: absolute; inset: 14px; border-radius: 50%; background: var(--phosphor); }
.knack { width: 46px; height: 30px; border: 1px dashed rgba(185,140,255,.7); transform: rotate(-12deg); color: var(--amber); }
.knack::before { content: "?"; font: 15px Georgia, serif; }
.status { min-height: 1.4em; margin: 8px 0 0; font-size: 11px; color: #86b9d4; }
.crt-row { display: flex; flex-wrap: wrap; gap: 8px; }
.crt-btn {
  display: inline-grid; place-items: center; min-height: 40px; padding: 0 14px;
  border: 1px solid rgba(111,243,255,.5); background: rgba(111,243,255,.06);
  color: var(--phosphor); text-decoration: none; font-size: 11px; letter-spacing: .12em;
}
.bay-label { display: flex; justify-content: space-between; margin-top: 8px; color: var(--dim); font: 500 9px "IBM Plex Sans Condensed", sans-serif; letter-spacing: .2em; }

.side {
  display: grid; align-content: start; gap: 12px;
  padding: 12px; border-radius: 10px;
  background: linear-gradient(#232421, #191a17);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), inset 0 -1px 0 rgba(0,0,0,.6);
}
.meters { display: grid; gap: 6px; }
.meter {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 8px; border-radius: 3px;
  background: #0b0a08; box-shadow: inset 0 1px 3px rgba(0,0,0,.9);
}
.meter span { color: var(--dim); font: 500 9px "IBM Plex Sans Condensed", sans-serif; letter-spacing: .18em; }
.meter output { color: var(--amber); font-size: 15px; letter-spacing: .1em; text-shadow: 0 0 8px rgba(185,140,255,.45); }
.readout { display: grid; gap: 4px; font-size: 10px; }
.readout div { display: flex; justify-content: space-between; gap: 8px; }
.readout span { color: var(--dim); letter-spacing: .14em; }
.readout b { font-weight: 400; color: var(--engrave); }
.lamps { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.lamp-i { display: flex; align-items: center; gap: 6px; color: var(--dim); font: 500 9px "IBM Plex Sans Condensed", sans-serif; letter-spacing: .16em; }
.lamp-i i { width: 10px; height: 10px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #4a2a22, #1d100c); box-shadow: inset 0 0 0 1px #0a0a09; }
.lamp-i.on i { background: radial-gradient(circle at 35% 30%, #ffd796, var(--amber) 55%, #8a5a1c); box-shadow: 0 0 10px rgba(185,140,255,.7); }
.lamp-i.on { color: var(--engrave); }
.lamp-i.live i { background: radial-gradient(circle at 35% 30%, #ffb3a3, var(--red) 55%, #6a1d12); box-shadow: 0 0 10px rgba(228,83,63,.7); animation: pulse 1.2s ease-in-out infinite; }
.dial-wrap { display: grid; justify-items: center; gap: 6px; }
.dial {
  position: relative; width: 92px; height: 92px; border-radius: 50%;
  background:
    repeating-conic-gradient(from 0deg, #2c2d2a 0 4deg, #1d1e1b 4deg 8deg);
  box-shadow: 0 4px 8px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.12), 0 0 0 6px #121311, 0 0 0 7px #34352f;
  transform: rotate(var(--turn, 0deg));
  transition: transform .7s cubic-bezier(.2,.8,.2,1);
}
.dial i { position: absolute; left: 50%; top: 8px; width: 3px; height: 18px; margin-left: -1.5px; background: var(--amber); border-radius: 2px; }
.engr { color: var(--dim); font: 500 9px "IBM Plex Sans Condensed", sans-serif; letter-spacing: .22em; }
.grille { height: 54px; border-radius: 4px; background: repeating-linear-gradient(0deg, #0c0c0b 0 3px, #2a2b27 3px 6px); box-shadow: inset 0 1px 3px rgba(0,0,0,.8); }

.console {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center;
  margin-top: 14px; padding: 14px; border-radius: 10px;
  background: linear-gradient(#20211e, #151614);
  box-shadow: inset 0 2px 4px rgba(0,0,0,.7), 0 1px 0 rgba(255,255,255,.05);
}
.keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.key {
  position: relative; min-height: 72px; padding: 0;
  border: 0; border-radius: 6px;
  background: linear-gradient(#3a3832, #24231f);
  box-shadow: 0 5px 0 #0d0d0c, 0 6px 10px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.14);
  color: #6d6a5c;
  transition: transform .06s, box-shadow .06s;
}
.key span { display: block; font: 24px Georgia, serif; }
.key small { position: absolute; bottom: 6px; left: 0; right: 0; font: 500 9px "IBM Plex Sans Condensed", sans-serif; letter-spacing: .2em; }
.key:active, .key.picked { transform: translateY(4px); box-shadow: 0 1px 0 #0d0d0c, 0 2px 4px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.1); }
.key.lit, .key.picked { color: #fff1d0; background: linear-gradient(#7a5a28, #4a3415); text-shadow: 0 0 10px rgba(185,140,255,.9); box-shadow: 0 5px 0 #0d0d0c, 0 0 22px rgba(185,140,255,.45), inset 0 1px 0 rgba(255,255,255,.3); }
.key:disabled { cursor: default; }
.machine:not([data-state="pulse"]) .key { opacity: .7; }
.switches { display: grid; grid-template-columns: repeat(4, 54px); gap: 8px; }
.toggle { display: grid; justify-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--dim); font: 500 9px "IBM Plex Sans Condensed", sans-serif; letter-spacing: .14em; }
.toggle i {
  position: relative; width: 22px; height: 38px; border-radius: 11px;
  background: #0c0c0b; box-shadow: inset 0 1px 3px rgba(0,0,0,.9), 0 0 0 3px #2c2d2a;
}
.toggle i::after {
  content: ""; position: absolute; left: 4px; top: 4px; width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #d8d6cc, #6f6d64);
  transition: top .12s;
}
.toggle[aria-pressed="true"] i::after, .toggle.flick i::after { top: 20px; }
.toggle[aria-pressed="true"] { color: var(--amber); }
.keyswitch {
  display: grid; justify-items: center; gap: 6px; padding: 0; border: 0; background: none;
  color: var(--engrave); font: 500 9px "IBM Plex Sans Condensed", sans-serif; letter-spacing: .14em; max-width: 92px; text-align: center;
}
.keyswitch i {
  position: relative; width: 52px; height: 52px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #8f8d84, #45443f 60%, #23221f);
  box-shadow: 0 3px 6px rgba(0,0,0,.8), 0 0 0 4px #141412;
}
.keyswitch i::after { content: ""; position: absolute; left: 50%; top: 12px; bottom: 12px; width: 6px; margin-left: -3px; border-radius: 3px; background: #1a1a18; transition: transform .25s; }
.keyswitch:hover i::after, .keyswitch.turned i::after { transform: rotate(90deg); }
.dock-note { min-height: 1.3em; margin: 8px 4px 0; font-size: 11px; color: var(--engrave); }

.hatch {
  position: relative; margin-top: 14px; border-radius: 10px; overflow: hidden;
  background: #0e0e0d; box-shadow: inset 0 3px 10px rgba(0,0,0,.9);
}
.hatch-cover {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.015) 0 1px, transparent 1px 3px), linear-gradient(#2d2e2b, #1c1d1a);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1);
  color: var(--dim); font: 500 11px "IBM Plex Sans Condensed", sans-serif; letter-spacing: .3em;
  transform-origin: top center;
  transition: transform .9s cubic-bezier(.6,0,.2,1), opacity .9s;
}
.hatch-cover .screw { position: absolute; top: 10px; }
.hatch-cover .screw:nth-of-type(1) { left: 10px; }
.hatch-cover .screw:nth-of-type(2) { right: 10px; }
.hatch[data-open="true"] .hatch-cover { transform: perspective(900px) rotateX(-96deg); opacity: 0; pointer-events: none; }
.hatch[data-open="false"] .hatch-inner { visibility: hidden; }
.hatch-inner { padding: 18px; min-height: 120px; }
.panel { max-width: 460px; margin: 0 auto; }
.panel p { margin: 0 0 10px; font-size: 12px; line-height: 1.55; color: var(--engrave); }
.panel b { color: var(--amber); }
.engr-h { color: var(--ink) !important; font: 600 12px "IBM Plex Sans Condensed", sans-serif !important; letter-spacing: .26em; }
.panel label { display: grid; gap: 4px; margin: 0 0 10px; color: var(--dim); font-size: 10px; letter-spacing: .12em; }
.panel input {
  width: 100%; padding: 12px; border: 0; border-radius: 3px;
  background: #050505; color: var(--phosphor); box-shadow: inset 0 1px 3px rgba(0,0,0,.95), 0 0 0 1px #2c2d2a;
  font-size: 14px;
}
.panel input:focus { outline: none; box-shadow: inset 0 1px 3px rgba(0,0,0,.95), 0 0 0 2px var(--amber); }
.pull {
  width: 100%; min-height: 48px; border: 0; border-radius: 4px;
  background: linear-gradient(#b5482f, #7e2c1b);
  box-shadow: 0 4px 0 #3a140c, inset 0 1px 0 rgba(255,255,255,.25);
  color: #fff3e8; font: 600 12px "IBM Plex Sans Condensed", sans-serif; letter-spacing: .18em;
}
.pull:active { transform: translateY(3px); box-shadow: 0 1px 0 #3a140c; }
.text { border: 0; background: none; padding: 10px 0; color: var(--amber); font-size: 11px; }
.message { min-height: 1.3em; font-size: 11px; }

.pop { position: absolute; inset: 0; pointer-events: none; }
.float { position: absolute; color: #eaffea; font-size: 13px; animation: float .8s ease forwards; }
.machine.jolt { animation: jolt .2s linear; }
.machine[data-state="unlocked"] .crt { box-shadow: inset 0 0 60px rgba(0,0,0,.85), 0 0 30px rgba(111,243,255,.2); }

.sheet { width: min(420px, calc(100% - 24px)); border: 0; border-radius: 8px; padding: 18px; background: linear-gradient(#2a2b28, #1a1b18); color: var(--ink); box-shadow: 0 30px 60px rgba(0,0,0,.8); }
.sheet::backdrop { background: rgba(0,0,0,.7); }
.sheet h2 { margin: 0 0 10px; font: 600 14px "IBM Plex Sans Condensed", sans-serif; letter-spacing: .26em; }
.sheet p { font-size: 12px; line-height: 1.55; color: var(--engrave); }
.board-tabs { display: flex; gap: 8px; margin-bottom: 8px; }
.board-tabs button { min-height: 34px; padding: 0 12px; border: 1px solid #44443e; background: #121311; color: var(--engrave); }
.board-row, .empty { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 12px; }
body.streamer #identity, body.streamer #friend-code { filter: blur(6px); }

@keyframes pulse { 50% { opacity: .35; } }
@keyframes float { to { transform: translateY(-26px); opacity: 0; } }
@keyframes jolt { 25% { transform: translate(-3px, 1px); } 50% { transform: translate(3px, -1px); } 75% { transform: translate(-1px, 0); } }

@media (max-width: 860px) {
  .body { grid-template-columns: 1fr; }
  .side { grid-template-columns: 1fr 1fr; align-items: start; }
  .meters, .readout { grid-column: span 1; }
  .dial-wrap, .grille { display: none; }
  .lamps { grid-column: 1 / -1; grid-template-columns: repeat(4, 1fr); }
  .console { grid-template-columns: 1fr; }
  .switches { grid-template-columns: repeat(4, 1fr); }
  .keyswitch { grid-auto-flow: column; max-width: none; align-items: center; justify-content: center; gap: 12px; }
  .keyswitch i { width: 38px; height: 38px; }
  .model, .serial { display: none; }
  .crt { min-height: 360px; padding: 12px; }
}
@media (max-width: 420px) {
  .machine { padding: 8px; }
  .display-bay { padding: 6px; }
  .bezel { padding: 8px; }
  .glass { inset: 8px; }
  .side { grid-template-columns: 1fr; }
  .key { min-height: 62px; }
  .foot-plate span:last-child { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
