/* ══════════════════════════════════════════════════════════
   SPACE INTRUDERS 1984 · Low Effort Digital Arcade
   ══════════════════════════════════════════════════════════ */

:root {
  --bg-color: #050510;
  --primary-purple: #7c3aed;
  --neon-pink: #ec4899;
  --neon-cyan: #06b6d4;
  --arcade-green: #10b981;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-color);
  color: #ffffff;
  font-family: 'Space Mono', monospace, -apple-system, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ── Top Bar Return Link ── */
.top-nav {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 9999;
  pointer-events: none;
}

.top-nav > * {
  pointer-events: auto;
}

.loweffort-back-btn {
  background: rgba(8, 8, 14, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(124, 58, 237, 0.5);
  color: #e2e8f0;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: all 0.2s;
}

.loweffort-back-btn:hover {
  border-color: var(--neon-pink);
  color: #fff;
  transform: translateY(-1px);
}

.top-actions {
  display: flex;
  gap: 8px;
}

.btn-arcade {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-arcade:hover, .btn-arcade.active {
  border-color: var(--neon-cyan);
  color: #fff;
  background: rgba(6, 182, 212, 0.2);
}

/* ── Game Arcade Cabinet Stage ── */
.arcade-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 10px 80px;
}

.canvas-wrapper {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 480 / 640;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 35px rgba(124, 58, 237, 0.2), 0 0 0 2px rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}

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

/* ── CRT Scanline & Curved Glass Filter ── */
body.crt-effect .canvas-wrapper::before {
  content: " ";
  display: block;
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.04), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.04));
  z-index: 20;
  background-size: 100% 3px, 4px 100%;
  pointer-events: none;
}

body.crt-effect .canvas-wrapper::after {
  content: " ";
  display: block;
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 65%, rgba(0, 0, 0, 0.6) 100%);
  pointer-events: none;
  z-index: 21;
}

/* ── Mobile Touch Controls ── */
.touch-controls {
  position: fixed;
  bottom: 12px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  pointer-events: none;
}

.touch-cluster {
  display: flex;
  gap: 12px;
  pointer-events: auto;
}

.touch-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(30, 41, 59, 0.75);
  border: 2px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  touch-action: manipulation;
  pointer-events: auto;
}

.touch-btn:active {
  background: var(--primary-purple);
  border-color: #fff;
  transform: scale(0.95);
}

.touch-fire-btn {
  width: 68px;
  height: 68px;
  background: rgba(236, 72, 153, 0.75);
  border-color: #f472b6;
  font-size: 13px;
  font-weight: bold;
}

.touch-fire-btn:active {
  background: #db2777;
}

@media (min-width: 800px) {
  .touch-controls {
    display: none;
  }
  .arcade-container {
    padding-bottom: 20px;
  }
}
