/* ===========================================================================
   The real-time cabinet: the playfield canvas, the in-play HUD, and the
   pause / game-over card. Shared by every action game, so a new cabinet needs
   only its own small file on top of this.
   ======================================================================== */

.stage {
  position: relative;
  /* stage.js rewrites this on every resize; declared here so the default is
     visible in the stylesheet rather than implied by a var() fallback. */
  --stage-scale: 1;
  margin: 0 auto;
  display: block;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow:
    inset 0 0 40px -12px rgba(var(--accent-rgb), .35),
    0 0 50px -18px rgba(var(--accent-rgb), .45),
    0 24px 60px -30px #000;
  outline: none;
}
/* A visible focus ring, because the playfield is keyboard-operable. */
.stage:focus-visible {
  box-shadow:
    0 0 0 2px var(--accent),
    inset 0 0 40px -12px rgba(var(--accent-rgb), .35),
    0 0 50px -18px rgba(var(--accent-rgb), .45);
}
.stage__canvas {
  display: block;
  /* The art is a deliberate pixel grid; never let the browser smooth it. */
  image-rendering: pixelated;
}

/* ------------------------------------------------------------------- the HUD */
.hud {
  position: absolute;
  inset: 0 0 auto 0;
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  /* The HUD is part of the SCREEN, so it follows the stage's scale rather
     than staying a fixed size while the board behind it grows by half again.
     Clamped at both ends: readable on a letterboxed phone, not shouting on a
     1.75x desktop board. */
  --hud-k: clamp(.8, var(--stage-scale, 1), 1.4);
  padding: calc(.3rem * var(--hud-k)) calc(.46rem * var(--hud-k));
  pointer-events: none;
  font-family: var(--mono);
  font-size: calc(.58rem * var(--hud-k));
  letter-spacing: .12em;
  text-transform: uppercase;
}
.hud__field { display: flex; flex-direction: column; gap: .1rem; line-height: 1.1; }
.hud__label { color: var(--ink-faint); font-size: calc(.5rem * var(--hud-k)); }
.hud__value {
  color: var(--accent-soft);
  font-size: calc(.78rem * var(--hud-k));
  font-weight: 700;
  text-shadow: 0 0 8px rgba(var(--accent-rgb), .7);
}
.hud__field--score .hud__value { color: #fff; }

/* The neon world puts the HUD on its 8-bit face. The score is the one place
   in the arcade where a pixel font is not decoration: a row of chunky digits
   over a dark playfield is what a cabinet actually looked like. Sized down to
   match, as everywhere else that face is used. */
[data-world='neon'] .hud { font-family: var(--pixel); font-size: calc(0.5rem * var(--hud-k)); letter-spacing: 0.04em; }
[data-world='neon'] .hud__label { font-size: calc(0.4rem * var(--hud-k)); }
[data-world='neon'] .hud__value { font-size: calc(0.62rem * var(--hud-k)); font-weight: 400; }
[data-world='neon'] .hud__banner-title { font-size: clamp(0.8rem, 3.4vw, 1.2rem); letter-spacing: 0.06em; line-height: 1.5; }
.hud__field.is-bumped .hud__value { animation: hud-bump .35s var(--ease-out); }
@keyframes hud-bump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.22); text-shadow: 0 0 16px rgba(var(--accent-rgb), 1); }
  100% { transform: scale(1); }
}

/* ------------------------------------------------- the pause / game over card */
.hud__banner {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: .55rem;
  text-align: center;
  padding: 1rem;
  background: radial-gradient(ellipse at 50% 50%, rgba(5, 1, 15, .82), rgba(5, 1, 15, .95));
  backdrop-filter: blur(2px);
  animation: banner-in .22s var(--ease-out);
}
@keyframes banner-in { from { opacity: 0; } }
.hud__banner-title {
  margin: 0;
  font-family: var(--display);
  font-weight: var(--display-weight);
  letter-spacing: .16em;
  font-size: clamp(1.1rem, 5vw, 1.7rem);
  color: var(--accent);
  text-shadow: 0 0 24px rgba(var(--accent-rgb), .6);
}
.hud__banner-sub {
  margin: 0;
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .1em;
  color: var(--ink-dim);
}
.hud__banner-actions {
  display: flex;
  gap: .5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: .3rem;
}

/* Screen-reader-only, for the announcements that are worth interrupting for. */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .hud__field.is-bumped .hud__value { animation: none; }
  .hud__banner { animation: none; }
}

/* --------------------------------------------- the polished game-over card */
.hud__banner-badge {
  margin: 0;
  font-family: var(--mono);
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .2em;
  color: #0a0612;
  background: linear-gradient(90deg, var(--accent), var(--o));
  padding: .28rem .7rem;
  border-radius: 999px;
  justify-self: center;
  animation: badge-pop .45s var(--ease-spring);
}
@keyframes badge-pop { from { transform: scale(.7); opacity: 0; } }

.hud__banner-stats {
  display: grid;
  grid-template-columns: auto auto;
  gap: .18rem 1.1rem;
  margin: .2rem auto 0;
  font-family: var(--mono);
  font-size: .64rem;
  letter-spacing: .08em;
}
.hud__banner-stats dt { color: var(--ink-faint); text-align: right; margin: 0; }
.hud__banner-stats dd { color: var(--ink); margin: 0; text-align: left; font-weight: 700; }
.hud__banner-stats dd.is-highlight {
  color: var(--accent);
  text-shadow: 0 0 10px rgba(var(--accent-rgb), .8);
}
.hud__banner--win .hud__banner-title { color: var(--accent-o, #ffe900); }

@media (prefers-reduced-motion: reduce) {
  .hud__banner-badge { animation: none; }
}
