/* ABSOLUTE ARCADE — shared game-page shell (cabinet frame + HUD + overlay) */

body.game-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  --cab: var(--c-cobalt);
}

/* ---------- Top bar ---------- */
.gbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 12px clamp(16px, 4vw, 32px);
  background: var(--ink); color: var(--bg);
  border-bottom: var(--border);
}
.gbar__back {
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.1em;
  text-transform: uppercase; text-decoration: none; color: var(--bg);
  border: 2px solid var(--bg); border-radius: 999px; padding: 6px 14px;
  transition: background 0.12s ease, color 0.12s ease;
  white-space: nowrap;
}
.gbar__back:hover { background: var(--c-sun); color: var(--ink); border-color: var(--c-sun); }
.gbar__title {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3.5vw, 1.7rem);
  text-transform: uppercase; letter-spacing: 0.01em;
  color: var(--cab); text-shadow: 2px 2px 0 rgba(0,0,0,0.45);
}
.gbar__hud { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.stat {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px; padding: 5px 10px; white-space: nowrap;
}
.stat b { color: var(--c-sun); font-weight: 700; }

/* ---------- Stage ---------- */
.stage {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: 20px; padding: clamp(20px, 4vw, 40px) 16px 40px;
}
.cab {
  background: var(--cab);
  border: var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  max-width: 96vw;
}
.cab__screen {
  position: relative;
  background: var(--screen);
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid rgba(0,0,0,0.45);
  display: grid; place-items: center;
}
.cab__screen canvas { display: block; max-width: 100%; height: auto; touch-action: none; }
.scan {
  position: absolute; inset: 0; pointer-events: none; z-index: 4;
  background: repeating-linear-gradient(
    to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,0.14) 2px 4px);
}

/* ---------- Overlay (start / pause / game over) ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 6;
  display: grid; place-content: center; text-align: center; gap: 14px;
  padding: 24px;
  background: rgba(16, 14, 31, 0.86);
  backdrop-filter: blur(2px);
  color: var(--bg);
}
.overlay[hidden] { display: none; }
.overlay__title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 6vw, 3rem);
  text-transform: uppercase; color: var(--cab);
  text-shadow: 3px 3px 0 rgba(0,0,0,0.5);
}
.overlay__msg { font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.08em; color: rgba(255,255,255,0.85); max-width: 34ch; margin-inline: auto; }
.overlay__msg .hi { color: var(--c-sun); }
.overlay .btn { justify-self: center; margin-top: 6px; }
.blink-coin { animation: coinblink 1s steps(2) infinite; }
@keyframes coinblink { 50% { opacity: 0.25; } }

/* ---------- Controls help + touch ---------- */
.controls { width: 100%; max-width: 560px; display: flex; flex-direction: column; gap: 18px; align-items: center; }
.keys {
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.04em;
  color: var(--ink-soft); text-align: center; line-height: 1.9;
}
.keys kbd {
  font-family: var(--font-mono); font-size: 11px;
  background: var(--paper); border: 2px solid var(--ink);
  border-bottom-width: 3px; border-radius: 6px; padding: 1px 7px;
  color: var(--ink); box-shadow: 1px 1px 0 var(--ink);
}

/* On-screen D-pad / action buttons (shown on touch + small screens) */
.touch { display: none; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.dpad { display: grid; grid-template-columns: repeat(3, 56px); grid-template-rows: repeat(3, 56px); gap: 8px; }
.dpad button { all: unset; }
.tbtn {
  display: grid; place-items: center;
  background: var(--paper); border: var(--border); border-radius: 14px;
  box-shadow: var(--shadow-sm); cursor: pointer; font-size: 1.4rem; color: var(--ink);
  -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
.tbtn:active { transform: translate(2px, 2px); box-shadow: none; }
.dpad .up    { grid-area: 1 / 2; }
.dpad .left  { grid-area: 2 / 1; }
.dpad .right { grid-area: 2 / 3; }
.dpad .down  { grid-area: 3 / 2; }
.dpad .mid   { grid-area: 2 / 2; background: var(--cab); }

@media (hover: none), (max-width: 640px) {
  .touch { display: flex; }
}
