/*
 * blocking-io :: shared/arcade.css
 *
 * The cabinet. Every game in this collection sits inside the same chrome:
 * a HUD strip, a CRT screen with scanlines, an overlay for attract/pause/over
 * states, and a control legend. Game-specific styling stays in the game's own
 * <style> block; anything that makes the collection feel like one machine
 * belongs here.
 *
 * This commits to a single dark visual world on purpose, so there is no
 * light-theme token set. Every colour is painted explicitly rather than
 * inherited, so a page holds up on any host background.
 */

:root {
  --void:         #080a12;
  --cabinet:      #0f1522;
  --phosphor:     #5ff2e0;
  --phosphor-dim: #2a7d76;
  --hazard:       #ffb238;
  --alert:        #ff4d7d;
  --slate:        #5a6b85;
  --slate-hi:     #8fa3bf;
  --edge:         #1e2b40;

  --arcade: "Press Start 2P", "Courier New", monospace;
  --mono:   "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  background: var(--void);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, #12304a55, transparent 70%),
    radial-gradient(ellipse 60% 40% at 50% 110%, #1a2c4433, transparent 70%);
  color: var(--slate-hi);
  font-family: var(--mono);
  min-height: 100vh;
  margin: 0;
  padding: 24px 16px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

/* ---- masthead ------------------------------------------------------ */

.masthead {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.masthead h1 {
  font-family: var(--arcade);
  font-size: clamp(15px, 4.2vw, 22px);
  line-height: 1.5;
  color: var(--phosphor);
  margin: 0;
  letter-spacing: 0.02em;
  text-wrap: balance;
  text-shadow: 0 0 12px #5ff2e066, 0 0 34px #5ff2e022;
}

.tagline {
  font-size: 12px;
  color: var(--slate);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0;
}

/* ---- cabinet ------------------------------------------------------- */

.cabinet {
  width: min(480px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--cabinet);
  border: 1px solid var(--edge);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 0 0 1px #060910, 0 24px 60px -20px #000c, inset 0 1px 0 #ffffff0a;
}

.cabinet.wide { width: min(560px, 100%); }

.hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--edge);
  background: linear-gradient(#131b2b, #0e1421);
}

.hud-block { display: flex; flex-direction: column; gap: 5px; }
.hud-block.right { align-items: flex-end; }
.hud-block.mid   { align-items: center; }

.hud-label {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--slate);
}

.hud-value {
  font-family: var(--arcade);
  font-size: 13px;
  color: var(--phosphor);
  font-variant-numeric: tabular-nums;
}

.hud-value.warm { color: var(--hazard); }

.lives { display: flex; gap: 5px; height: 13px; align-items: center; }
.life  { width: 12px; height: 9px; background: var(--phosphor); }
.life.spent { background: #24354d; }

/* ---- screen -------------------------------------------------------- */

.screen { position: relative; background: #05070d; line-height: 0; }

.screen canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
}

.screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, #00000000 0px, #00000000 2px, #0000001f 2px, #0000001f 3px),
    radial-gradient(ellipse 78% 68% at 50% 50%, transparent 55%, #000000b0 100%);
}

/* ---- overlay ------------------------------------------------------- */

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: #05070de6;
  z-index: 2;
  line-height: 1.6;
}

.overlay[hidden] { display: none; }

.overlay-title {
  font-family: var(--arcade);
  font-size: 17px;
  color: var(--phosphor);
  text-shadow: 0 0 14px #5ff2e055;
  margin: 0;
  text-wrap: balance;
}
.overlay-title.over  { color: var(--alert);  text-shadow: 0 0 14px #ff4d7d55; }
.overlay-title.clear { color: var(--hazard); text-shadow: 0 0 14px #ffb23855; }

.overlay-sub {
  font-size: 12.5px;
  color: var(--slate-hi);
  max-width: 34ch;
  margin: 0;
}

.overlay-stat {
  font-family: var(--arcade);
  font-size: 12px;
  color: var(--hazard);
  font-variant-numeric: tabular-nums;
}

.prompt {
  font-family: var(--arcade);
  font-size: 10px;
  color: var(--phosphor-dim);
  letter-spacing: 0.04em;
  animation: blink 1.25s steps(2, start) infinite;
}

@keyframes blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0.15; } }

/* ---- legend + status ----------------------------------------------- */

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  padding: 11px 14px;
  border-top: 1px solid var(--edge);
  background: #0b111c;
}

.key { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--slate); }

.cap {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 10px;
  color: var(--slate-hi);
  background: #16203a;
  border: 1px solid #24344f;
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 2px 6px;
  letter-spacing: 0.03em;
}

.pad-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--slate);
  width: min(480px, 100%);
  justify-content: center;
  letter-spacing: 0.02em;
}

.dot { width: 7px; height: 7px; border-radius: 50%; background: #2c3d57; flex: none; }
.pad-status.live .dot { background: var(--phosphor); box-shadow: 0 0 8px var(--phosphor); }
.pad-status.live { color: var(--phosphor); }

.colophon {
  width: min(560px, 100%);
  font-size: 11.5px;
  line-height: 1.7;
  color: #46566e;
  text-align: center;
  max-width: 62ch;
}

.backlink {
  font-size: 11px;
  color: var(--phosphor-dim);
  text-decoration: none;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid transparent;
}
.backlink:hover { color: var(--phosphor); border-bottom-color: var(--phosphor-dim); }
.backlink:focus-visible { outline: 2px solid var(--hazard); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  .prompt { animation: none; opacity: 1; }
}
