/* =====================================================================
   style.css  —  Arcade-cabinet presentation for the canvas game.
   CRT scanlines, vignette, neon glow, responsive letterboxed scaling,
   and on-screen touch controls.
   ===================================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
  /* radial glow behind the cabinet */
  background:
    radial-gradient(ellipse at 50% 30%, #0c1030 0%, #05060f 55%, #000 100%);
  font-family: "Courier New", monospace;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#cabinet {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2vh;
}

/* The screen keeps the native 448:576 aspect ratio while fitting the
   viewport in either orientation. */
#screen {
  position: relative;
  width: min(96vw, calc(94vh * 448 / 576));
  aspect-ratio: 448 / 576;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  box-shadow:
    0 0 0 3px #11142e,
    0 0 0 10px #05060f,
    0 0 28px 6px rgba(60, 110, 255, 0.25),
    0 0 80px 12px rgba(255, 60, 80, 0.08);
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #04030c;
}

/* CRT scanlines + subtle RGB shimmer */
#crt {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0) 0px,
      rgba(0, 0, 0, 0) 2px,
      rgba(0, 0, 0, 0.22) 3px,
      rgba(0, 0, 0, 0.22) 4px
    );
  mix-blend-mode: multiply;
  opacity: 0.7;
}
#crt::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 0, 0, 0.04),
    rgba(0, 255, 0, 0.02),
    rgba(0, 0, 255, 0.04)
  );
  mix-blend-mode: screen;
}

/* corner darkening for that tube look */
#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 50% 50%,
    rgba(0, 0, 0, 0) 55%,
    rgba(0, 0, 0, 0.55) 100%
  );
}

/* ---------------- touch controls ---------------- */
#touch-controls {
  display: none;
  width: min(96vw, 520px);
  justify-content: space-between;
  align-items: center;
  padding: 0 6px;
}
#touch-controls .pad {
  display: flex;
  gap: 14px;
}
.tbtn {
  font-family: inherit;
  font-weight: bold;
  color: #cfe0ff;
  background: rgba(40, 70, 160, 0.25);
  border: 2px solid rgba(120, 170, 255, 0.5);
  border-radius: 50%;
  width: 72px;
  height: 72px;
  font-size: 26px;
  backdrop-filter: blur(2px);
  transition: transform 0.05s, background 0.1s;
}
.tbtn:active {
  transform: scale(0.92);
  background: rgba(80, 130, 255, 0.45);
}
.tbtn.fire {
  border-radius: 50%;
  width: 92px;
  height: 92px;
  font-size: 18px;
  color: #ffd7d2;
  background: rgba(180, 40, 40, 0.3);
  border-color: rgba(255, 90, 90, 0.6);
}
.tbtn.fire:active {
  background: rgba(255, 70, 70, 0.5);
}

/* show touch controls only on touch / coarse-pointer devices */
@media (pointer: coarse) {
  #touch-controls {
    display: flex;
  }
}
