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

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

body {
  background: #0a0a12;
  background-image:
    radial-gradient(ellipse at 50% 30%, rgba(20, 20, 60, 0.4) 0%, transparent 70%),
    linear-gradient(180deg, #0a0a12 0%, #050510 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden;
  font-family: 'Press Start 2P', monospace;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* === ARCADE CABINET === */
.cabinet {
  position: relative;
  padding: 20px;
  background: linear-gradient(165deg, #1c1c30, #0d0d1a, #080816);
  border-radius: 16px;
  box-shadow:
    0 0 40px rgba(33, 33, 222, 0.2),
    0 0 80px rgba(33, 33, 222, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5);
}

/* === CRT SCREEN BEZEL === */
.screen {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 4px solid #222;
  box-shadow:
    inset 0 0 40px rgba(0, 0, 0, 0.9),
    0 0 20px rgba(33, 33, 222, 0.15),
    0 0 60px rgba(33, 33, 222, 0.05);
}

/* Bezel inner rim */
.screen::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 14px;
  background: linear-gradient(135deg, #333 0%, #111 50%, #222 100%);
  z-index: -1;
}

/* === CANVAS === */
#game {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #000;
}

/* === CRT CURVATURE via CSS === */
.screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    /* Subtle curvature shadow */
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.35) 100%),
    /* Glass reflection */
    linear-gradient(165deg, rgba(255, 255, 255, 0.03) 0%, transparent 40%, transparent 60%, rgba(255, 255, 255, 0.01) 100%);
  pointer-events: none;
  border-radius: 6px;
  z-index: 5;
}

/* === SCREEN GLOW === */
.screen-glow {
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  background: radial-gradient(ellipse at center, rgba(33, 33, 180, 0.08) 0%, transparent 65%);
  pointer-events: none;
  z-index: -1;
  border-radius: 16px;
  filter: blur(10px);
}

/* === TITLE === */
.title {
  text-align: center;
  color: #FFFF00;
  font-size: 11px;
  letter-spacing: 6px;
  padding: 10px 0 6px;
  text-shadow:
    0 0 10px rgba(255, 255, 0, 0.5),
    0 0 20px rgba(255, 255, 0, 0.2);
}

/* === CONTROLS HINT === */
.controls {
  text-align: center;
  color: #444;
  font-size: 7px;
  padding: 8px 0 2px;
  letter-spacing: 1px;
}

/* === MOBILE HINT === */
.mobile-hint {
  display: none;
  color: #444;
  font-size: 8px;
  text-align: center;
  padding: 8px;
}

/* === RESPONSIVE === */
@media (max-width: 500px) {
  .cabinet {
    padding: 8px;
    border-radius: 0;
    width: 100vw;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .screen {
    border-radius: 4px;
    border-width: 2px;
  }

  #game {
    width: 100%;
    height: auto;
    max-height: 80vh;
  }

  .mobile-hint {
    display: block;
  }

  .controls {
    display: none;
  }

  .title {
    font-size: 9px;
    letter-spacing: 4px;
  }
}

@media (min-width: 501px) {
  #game {
    width: 448px;
    height: 512px;
  }
}

/* Large screens: scale up */
@media (min-width: 900px) {
  #game {
    width: 560px;
    height: 640px;
  }
}

/* === SOUND BUTTON === */
.sound-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #333;
  color: #666;
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 4px;
  z-index: 10;
  transition: all 0.2s;
}

.sound-btn:hover {
  color: #aaa;
  border-color: #666;
  background: rgba(33, 33, 222, 0.1);
}

/* === START SCREEN === */
.start-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
  z-index: 20;
  cursor: pointer;
}

.start-overlay .logo {
  color: #FFFF00;
  font-size: 28px;
  text-shadow:
    0 0 20px rgba(255, 255, 0, 0.7),
    0 0 40px rgba(255, 255, 0, 0.3),
    0 0 80px rgba(255, 255, 0, 0.1);
  margin-bottom: 8px;
  letter-spacing: 8px;
  animation: glow-pulse 2s ease-in-out infinite;
}

.start-overlay .sub {
  color: #4444FF;
  font-size: 12px;
  margin-bottom: 50px;
  letter-spacing: 8px;
  text-shadow: 0 0 15px rgba(68, 68, 255, 0.5);
}

.start-overlay .ghost-row {
  display: flex;
  gap: 20px;
  margin-bottom: 40px;
}

.start-overlay .ghost-icon {
  font-size: 24px;
  animation: float 2s ease-in-out infinite;
}

.start-overlay .ghost-icon:nth-child(2) { animation-delay: 0.2s; }
.start-overlay .ghost-icon:nth-child(3) { animation-delay: 0.4s; }
.start-overlay .ghost-icon:nth-child(4) { animation-delay: 0.6s; }

.start-overlay .prompt {
  color: #FFB897;
  font-size: 8px;
  animation: blink 1.2s ease-in-out infinite;
  letter-spacing: 2px;
}

.start-overlay .credits {
  position: absolute;
  bottom: 20px;
  color: #333;
  font-size: 6px;
  letter-spacing: 1px;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

@keyframes glow-pulse {
  0%, 100% { text-shadow: 0 0 20px rgba(255,255,0,0.7), 0 0 40px rgba(255,255,0,0.3); }
  50% { text-shadow: 0 0 30px rgba(255,255,0,0.9), 0 0 60px rgba(255,255,0,0.4); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.hidden {
  display: none !important;
}
