@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

:root {
  --neon-cyan: #00f3ff;
  --neon-pink: #ff007f;
  --neon-yellow: #ffe600;
  --neon-green: #39ff14;
  --bg-dark: #070913;
  --panel-bg: rgba(14, 18, 36, 0.94);
  --border-neon: #00f3ff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  font-family: 'Press Start 2P', monospace, sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

#game-container {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100%;
  max-height: 860px;
  background: #05070e;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(0, 243, 255, 0.25);
  display: flex;
  flex-direction: column;
}

/* Canvas Layer */
#gameCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  z-index: 1;
}

/* Retro CRT Scanline overlay */
.scanlines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.25) 50%
  ), linear-gradient(
    90deg,
    rgba(255, 0, 0, 0.03),
    rgba(0, 255, 0, 0.01),
    rgba(0, 0, 255, 0.03)
  );
  background-size: 100% 4px, 6px 100%;
  opacity: 0.8;
}

/* UI Overlays */
.ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  pointer-events: none;
}

.interactive {
  pointer-events: auto;
}

/* HUD Top Bar */
.hud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(10, 15, 30, 0.7);
  border: 2px solid rgba(0, 243, 255, 0.3);
  border-radius: 4px;
  backdrop-filter: blur(4px);
}

.hud-score {
  font-size: 14px;
  color: var(--neon-yellow);
  text-shadow: 0 0 8px rgba(255, 230, 0, 0.8);
}

.hud-user {
  font-size: 9px;
  color: var(--neon-cyan);
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-shield {
  font-size: 10px;
  color: var(--neon-green);
}

/* Menu Modal Panels */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 7, 16, 0.88);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 20;
  padding: 24px;
  backdrop-filter: blur(6px);
  transition: opacity 0.25s ease;
}

.hidden {
  display: none !important;
}

.game-title {
  font-size: 24px;
  color: var(--neon-cyan);
  text-align: center;
  margin-bottom: 8px;
  text-shadow: 0 0 12px var(--neon-cyan), 0 0 24px rgba(0, 243, 255, 0.6);
  letter-spacing: 2px;
  animation: pulseTitle 2s infinite ease-in-out;
}

.game-subtitle {
  font-size: 9px;
  color: var(--neon-pink);
  margin-bottom: 28px;
  letter-spacing: 1px;
}

@keyframes pulseTitle {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.03); filter: brightness(1.2); }
}

.tap-to-start {
  font-size: 12px;
  color: #ffffff;
  animation: blinkText 1.1s infinite;
  margin: 20px 0;
  cursor: pointer;
  text-shadow: 0 0 10px #fff;
}

@keyframes blinkText {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.15; }
}

.score-badge {
  background: rgba(0, 243, 255, 0.08);
  border: 2px dashed var(--neon-cyan);
  padding: 12px 20px;
  border-radius: 6px;
  text-align: center;
  margin-bottom: 24px;
  width: 85%;
}

.score-badge .label {
  font-size: 9px;
  color: #93a3b8;
  margin-bottom: 6px;
}

.score-badge .val {
  font-size: 18px;
  color: var(--neon-yellow);
}

/* Pixel Buttons */
.btn-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 85%;
}

.btn-pixel {
  background: #111a33;
  border: 2px solid var(--neon-cyan);
  color: #ffffff;
  padding: 12px 14px;
  font-size: 10px;
  text-align: center;
  cursor: pointer;
  position: relative;
  box-shadow: 0 4px 0 #005a61, 0 0 12px rgba(0, 243, 255, 0.3);
  transition: all 0.1s;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-pixel:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 transparent, 0 0 8px rgba(0, 243, 255, 0.4);
}

.btn-pixel.pink {
  border-color: var(--neon-pink);
  box-shadow: 0 4px 0 #7a003c, 0 0 12px rgba(255, 0, 127, 0.3);
}

.btn-pixel.pink:active {
  box-shadow: 0 0 0 transparent;
}

.btn-pixel.yellow {
  border-color: var(--neon-yellow);
  color: #111;
  background: var(--neon-yellow);
  box-shadow: 0 4px 0 #857800;
}

.btn-pixel.yellow:active {
  box-shadow: 0 0 0 transparent;
}

/* Revive Countdown Modal */
.revive-timer-box {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px solid var(--neon-pink);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 32px;
  color: var(--neon-pink);
  margin-bottom: 20px;
  box-shadow: 0 0 20px rgba(255, 0, 127, 0.5);
  animation: pulseTimer 1s infinite;
}

@keyframes pulseTimer {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* Near-Miss Floating Text */
.near-miss-banner {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 16px;
  color: var(--neon-yellow);
  text-shadow: 0 0 10px #ffe600, 0 0 20px #ff007f;
  animation: nearMissPop 0.6s forwards ease-out;
  pointer-events: none;
  white-space: nowrap;
  z-index: 15;
}

@keyframes nearMissPop {
  0% { transform: translate(-50%, -40%) scale(0.6); opacity: 0; }
  50% { transform: translate(-50%, -60%) scale(1.2); opacity: 1; }
  100% { transform: translate(-50%, -80%) scale(1); opacity: 0; }
}

/* Leaderboard Drawer */
.leaderboard-list {
  width: 100%;
  max-height: 220px;
  overflow-y: auto;
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leader-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid var(--neon-cyan);
  font-size: 9px;
}

.leader-item.top1 { border-left-color: var(--neon-yellow); color: var(--neon-yellow); }
.leader-item.top2 { border-left-color: #cbd5e1; }
.leader-item.top3 { border-left-color: #d97706; }

/* Skin Selector */
.skin-grid {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 16px 0;
}

.skin-card {
  width: 54px;
  height: 54px;
  background: #0c1224;
  border: 2px solid #334155;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.skin-card.active {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 12px var(--neon-cyan);
}

