:root{
  --spectrum-red:#d70000;
  --spectrum-cyan:#00d7d7;
  --spectrum-yellow:#d7d700;
  --key-face:#2b2b2f;
  --key-edge:#0c0c0e;
  --rubber:#1a1a1e;
}
*{box-sizing:border-box;margin:0;padding:0;}
html,body{height:100%;}
body{
  background:
    radial-gradient(circle at 50% 0%, #24242c 0%, #0a0a0c 70%),
    #050506;
  color:#c8c8d0;
  font-family:'VT323', monospace;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding:18px;
  min-height:100%;
  -webkit-font-smoothing:none;
}

#bezel{
  width:100%;
  max-width:720px;
  background:linear-gradient(180deg,#141416,#0d0d0f);
  border:2px solid #000;
  border-radius:14px;
  box-shadow:0 0 0 1px #333 inset, 0 22px 60px rgba(0,0,0,.7);
  padding:16px 16px 12px;
}

#topbar{ text-align:center; margin-bottom:10px; }
#topbar h1{
  font-family:'Press Start 2P', monospace;
  font-size:clamp(13px,3.2vw,20px);
  letter-spacing:1px;
  color:#fff;
  text-shadow:2px 2px 0 var(--spectrum-red), 4px 4px 0 var(--spectrum-cyan);
}
#topbar .sub{
  font-size:19px;
  color:#8a8a95;
  margin-top:8px;
}
.spark{ color:var(--spectrum-yellow); }

#stage{ display:flex; justify-content:center; }
#screen-wrap{
  padding:6px;
  background:#000;
  border-radius:6px;
  box-shadow:0 0 0 3px #222, 0 6px 20px rgba(0,0,0,.6);
}
#canvas{
  display:block;
  width:100%;
  max-width:640px;
  aspect-ratio:352/288;
  image-rendering:pixelated;
  image-rendering:crisp-edges;
  border-radius:3px;
  background:#000;
}

#controls{ margin-top:14px; display:grid; gap:12px; }
.ctl label{
  display:block;
  font-size:18px;
  color:var(--spectrum-cyan);
  letter-spacing:1px;
  margin-bottom:4px;
  text-transform:uppercase;
}
.ctl output{ color:var(--spectrum-yellow); float:right; }

input[type=range]{
  -webkit-appearance:none; appearance:none;
  width:100%; height:8px; border-radius:4px;
  background:linear-gradient(90deg,#00d7d7,#d7d700,#d70000);
  outline:none;
}
input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none; appearance:none;
  width:22px; height:22px; border-radius:3px;
  background:#eee; border:2px solid #000;
  box-shadow:0 2px 0 #000; cursor:pointer;
}
input[type=range]::-moz-range-thumb{
  width:22px; height:22px; border-radius:3px;
  background:#eee; border:2px solid #000; cursor:pointer;
}

#borders{ display:flex; gap:6px; flex-wrap:wrap; }
.swatch{
  width:34px; height:26px; border:2px solid #000; border-radius:3px;
  cursor:pointer; box-shadow:0 2px 0 #000;
}
.swatch.sel{ outline:3px solid var(--spectrum-yellow); outline-offset:1px; }

select{
  font-family:'VT323',monospace; font-size:19px;
  background:#111; color:#eee; border:2px solid #000;
  border-radius:4px; padding:6px 8px; width:100%;
}

.key{
  font-family:'Press Start 2P',monospace;
  font-size:10px; letter-spacing:.5px;
  color:#eee;
  background:linear-gradient(180deg,var(--key-face),var(--rubber));
  border:2px solid var(--key-edge);
  border-radius:6px;
  padding:12px 10px;
  cursor:pointer;
  box-shadow:0 4px 0 var(--key-edge);
  transition:transform .05s, box-shadow .05s;
}
.key:active{ transform:translateY(3px); box-shadow:0 1px 0 var(--key-edge); }

.toggles,.buttons{ display:flex; gap:8px; flex-wrap:wrap; }
.toggles .key,.buttons .key{ flex:1; min-width:82px; }

.toggle.on{ color:#000; background:linear-gradient(180deg,#00e0e0,#00a0a0); }
.run{ color:#fff; background:linear-gradient(180deg,#00b040,#007028); }
.run.paused{ background:linear-gradient(180deg,#e01030,#901020); }
.panic{ color:#fff; background:linear-gradient(180deg,#e01030,#901020); }
.shot{ color:#000; background:linear-gradient(180deg,#e0d000,#a09000); }

.meter{
  font-size:19px; display:flex; gap:8px; align-items:baseline;
  padding:8px 10px; background:#0b0b0d; border:1px solid #222; border-radius:5px;
}
.meter b{ color:var(--spectrum-red); font-size:22px; }

#what{
  background:#0b0b0d; border:1px solid #222; border-radius:5px; padding:6px 10px;
}
#what summary{
  cursor:pointer; color:var(--spectrum-yellow); font-size:18px; letter-spacing:1px;
}
#what p{ margin-top:8px; font-size:18px; line-height:1.35; color:#a8a8b2; }
#what em{ color:var(--spectrum-cyan); font-style:normal; }

#foot{
  margin-top:14px; padding-top:10px; border-top:1px solid #222;
  display:flex; justify-content:space-between; align-items:center;
  font-size:16px; color:#666; flex-wrap:wrap; gap:6px;
}
#foot a{ color:var(--spectrum-cyan); text-decoration:none; }
#foot a:hover{ color:var(--spectrum-yellow); }

#toast{
  position:fixed; left:50%; bottom:24px; transform:translateX(-50%) translateY(140%);
  background:#000; color:#fff; border:2px solid var(--spectrum-yellow);
  padding:12px 18px; border-radius:6px; max-width:90vw; text-align:center;
  font-size:19px; z-index:50; transition:transform .35s ease;
  box-shadow:0 8px 30px rgba(0,0,0,.6);
}
#toast.show{ transform:translateX(-50%) translateY(0); }

@media (max-width:480px){
  #topbar .sub, .meter, #what p, #foot{ font-size:16px; }
  .key{ font-size:9px; }
}