/* ══════════════════════════════════════════════════════════
   PAC-PERSON: CARB OVERLOAD 1980 · Low Effort Digital Arcade
   ══════════════════════════════════════════════════════════ */

:root {
  --bg-color: #050510;
  --primary-purple: #7c3aed;
  --neon-pink: #ec4899;
  --neon-cyan: #06b6d4;
  --pac-yellow: #fbbf24;
}

*, *::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(--pac-yellow);
  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(--pac-yellow);
  color: #fff;
  background: rgba(251, 191, 36, 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: 448 / 576;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 35px rgba(251, 191, 36, 0.15), 0 0 0 2px rgba(59, 130, 246, 0.3);
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}

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

/* ── CRT Scanline 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, 255, 0, 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 Virtual D-Pad ── */
.touch-dpad {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(3, 50px);
  grid-template-rows: repeat(3, 50px);
  gap: 6px;
  z-index: 100;
  pointer-events: auto;
}

.dpad-btn {
  background: rgba(30, 41, 59, 0.75);
  border: 2px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  touch-action: manipulation;
}

.dpad-btn:active {
  background: var(--pac-yellow);
  color: #000;
  border-color: #fff;
  transform: scale(0.95);
}

.dpad-up    { grid-column: 2; grid-row: 1; }
.dpad-left  { grid-column: 1; grid-row: 2; }
.dpad-down  { grid-column: 2; grid-row: 3; }
.dpad-right { grid-column: 3; grid-row: 2; }

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