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

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

body {
  background: #0a0014;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: 'Press Start 2P', monospace;
  overflow: hidden;
}

/* Scanline overlay for retro CRT feel */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(0deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.08) 2px,
      rgba(0, 0, 0, 0.08) 4px);
  pointer-events: none;
  z-index: 1000;
}

#game-wrapper {
  position: relative;
  border: 4px solid #ff69b4;
  border-radius: 12px;
  box-shadow:
    0 0 20px rgba(255, 105, 180, 0.5),
    0 0 60px rgba(255, 105, 180, 0.2),
    inset 0 0 20px rgba(255, 105, 180, 0.1);
  background: #1a0028;
  max-width: calc(100vw - 16px);
  overflow: hidden;
}

canvas {
  display: block;
  border-radius: 8px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Start Screen */
#start-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: radial-gradient(ellipse at center, #2a0040 0%, #0a0014 100%);
  border-radius: 8px;
  z-index: 10;
  gap: 20px;
  padding: 16px;
  overflow-y: auto;
}

#start-screen h1 {
  font-size: 28px;
  color: #ff69b4;
  text-shadow:
    0 0 10px #ff69b4,
    0 0 30px #ff1493,
    0 0 50px #ff1493;
  text-align: center;
  line-height: 1.6;
  word-break: break-word;
  max-width: 100%;
  animation: glow 2s ease-in-out infinite alternate;
}

#start-screen h2 {
  color: #ff69b4;
  text-shadow:
    0 0 10px #ff69b4,
    0 0 30px #ff1493,
    0 0 50px #ff1493;
  text-align: center;
  line-height: 1.6;
  word-break: break-word;
  max-width: 100%;
  animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
  from {
    text-shadow: 0 0 10px #ff69b4, 0 0 30px #ff1493;
  }

  to {
    text-shadow: 0 0 20px #ff69b4, 0 0 50px #ff1493, 0 0 80px #ff69b4;
  }
}

#start-screen .subtitle {
  font-size: 10px;
  color: #ff9ed2;
  text-align: center;
  line-height: 2;
}

#start-screen .controls-info {
  font-size: 8px;
  color: #cc6699;
  text-align: center;
  line-height: 2.5;
  margin-top: 10px;
}

.btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  padding: 15px 40px;
  border: 3px solid #ff69b4;
  background: transparent;
  color: #ff69b4;
  cursor: pointer;
  margin-top: 20px;
  transition: all 0.2s;
  text-transform: uppercase;
}

.btn:hover {
  background: #ff69b4;
  color: #1a0028;
  box-shadow: 0 0 20px rgba(255, 105, 180, 0.6);
  transform: scale(1.05);
}

/* Win Screen */
#win-screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: radial-gradient(ellipse at center, rgba(42, 0, 64, 0.95) 0%, rgba(10, 0, 20, 0.98) 100%);
  border-radius: 8px;
  z-index: 20;
  gap: 12px;
}

#win-screen.show {
  display: flex;
}

#win-screen h1 {
  font-size: 32px;
  color: #ff1493;
  text-shadow: 0 0 20px #ff1493, 0 0 60px #ff69b4;
  animation: winPulse 0.5s ease-in-out infinite alternate;
}

@keyframes winPulse {
  from {
    transform: scale(1);
  }

  to {
    transform: scale(1.1);
  }
}

#win-screen .kiss-emoji {
  font-size: 48px;
  color: #ff1493;
  text-shadow: 0 0 20px #ff1493, 0 0 50px #ff69b4;
  animation: spinKiss 1s ease-in-out infinite;
}

.win-subtitle {
  font-size: 10px;
  color: #ff9ed2;
  line-height: 2;
  text-align: center;
}

.win-score {
  font-size: 9px;
  color: #ffb6d9;
  margin-top: 4px;
}

.gameover-icon {
  font-size: 60px;
  color: #ff4466;
  text-shadow: 0 0 20px #ff4466;
}

@keyframes spinKiss {
  0% {
    transform: scale(1) rotate(0deg);
  }

  25% {
    transform: scale(1.2) rotate(-10deg);
  }

  50% {
    transform: scale(1) rotate(0deg);
  }

  75% {
    transform: scale(1.2) rotate(10deg);
  }

  100% {
    transform: scale(1) rotate(0deg);
  }
}

.win-hearts {
  position: absolute;
  font-size: 24px;
  animation: floatUp 3s ease-out infinite;
  pointer-events: none;
}

@keyframes floatUp {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(-300px) scale(0.3);
  }
}

/* Game Over Screen */
#gameover-screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: radial-gradient(ellipse at center, rgba(40, 0, 0, 0.95) 0%, rgba(10, 0, 5, 0.98) 100%);
  border-radius: 8px;
  z-index: 20;
  gap: 16px;
}

#gameover-screen.show {
  display: flex;
}

#gameover-screen h1 {
  font-size: 22px;
  color: #ff4466;
  text-shadow: 0 0 15px #ff4466;
}

#gameover-screen .score-text {
  font-size: 11px;
  color: #ff9eb0;
  line-height: 2;
}

/* Mobile Controls */
#mobile-controls {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
}

.dpad {
  display: grid;
  grid-template-columns: 60px 60px 60px;
  grid-template-rows: 60px 60px 60px;
  gap: 4px;
}

.dpad-btn {
  width: 60px;
  height: 60px;
  border: 2px solid #ff69b4;
  background: rgba(255, 105, 180, 0.15);
  color: #ff69b4;
  font-size: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.dpad-btn:active {
  background: rgba(255, 105, 180, 0.4);
}

.dpad-up {
  grid-column: 2;
  grid-row: 1;
}

.dpad-left {
  grid-column: 1;
  grid-row: 2;
}

.dpad-right {
  grid-column: 3;
  grid-row: 2;
}

.dpad-down {
  grid-column: 2;
  grid-row: 3;
}

@media (max-width: 600px) {
  #game-wrapper {
    border-width: 2px;
  }

  #start-screen {
    gap: 10px;
    padding: 12px;
  }

  #start-screen h1 {
    font-size: 18px;
  }

  #start-screen h2 {
    font-size: 14px;
  }

  #start-screen .subtitle {
    font-size: 8px;
  }

  #start-screen .controls-info {
    font-size: 7px;
    margin-top: 4px;
  }

  .btn {
    font-size: 10px;
    padding: 10px 24px;
    margin-top: 10px;
  }

  #mobile-controls {
    display: block;
  }
}