/* ============================================
   WHAC-AN-ALIEN · MISIÓN A MARTE — STYLES
   ============================================ */

/* === CSS Custom Properties === */
:root {
  --bg-space: #05050f;
  --bg-gradient-1: #0a0515;
  --bg-gradient-2: #150a25;
  --bg-gradient-3: #1a0a10;
  --neon-green: #39ff14;
  --neon-pink: #ff6ec7;
  --neon-cyan: #00f0ff;
  --neon-yellow: #ffe600;
  --neon-orange: #ff6a00;
  --mars-red: #c1440e;
  --mars-dark: #7a2e0a;
  --mars-rust: #a0522d;
  --mars-light: #d4724e;
  --mars-sand: #e8a87c;
  --crater-shadow: #3d1a08;
  --crater-rim: #b5651d;
  --hud-bg: rgba(5, 5, 20, 0.9);
  --font-arcade: 'Press Start 2P', monospace;
  --font-body: 'Outfit', sans-serif;
}

/* === Reset & Base === */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-body);
  background: linear-gradient(180deg, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 40%, var(--bg-gradient-3) 100%);
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><text y="24" font-size="24">🔨</text></svg>') 4 4, pointer;
}

/* === Animated Stars === */
.stars {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(1px 1px at 10% 20%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1px 1px at 25% 50%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1.5px 1.5px at 40% 15%, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(1px 1px at 55% 80%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 70% 35%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1.5px 1.5px at 85% 65%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1px 1px at 15% 70%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 95% 10%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1px 1px at 50% 45%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 30% 90%, rgba(255, 200, 100, 0.7), transparent),
    radial-gradient(1px 1px at 60% 5%, rgba(200, 200, 255, 0.6), transparent),
    radial-gradient(1px 1px at 80% 88%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(2px 2px at 5% 45%, rgba(255, 100, 100, 0.4), transparent),
    radial-gradient(1px 1px at 45% 60%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1px 1px at 90% 40%, rgba(255, 255, 255, 0.5), transparent);
  animation: twinkle 4s ease-in-out infinite alternate;
}

.stars-2 {
  animation-delay: -2s;
  animation-duration: 6s;
  opacity: 0.6;
  background-image:
    radial-gradient(1px 1px at 12% 30%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 35% 55%, rgba(200, 200, 255, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 65% 22%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1px 1px at 78% 72%, rgba(255, 200, 150, 0.6), transparent),
    radial-gradient(1px 1px at 48% 88%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 92% 55%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 22% 12%, rgba(150, 200, 255, 0.6), transparent),
    radial-gradient(1px 1px at 58% 38%, rgba(255, 255, 255, 0.5), transparent);
}

@keyframes twinkle {
  0% {
    opacity: 0.7;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0.8;
  }
}

/* === Scanline overlay === */
.scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
  background: repeating-linear-gradient(0deg,
      rgba(0, 0, 0, 0.06) 0px,
      rgba(0, 0, 0, 0.06) 1px,
      transparent 1px,
      transparent 3px);
}

/* === Game Container === */
.game-container {
  width: 100%;
  max-width: 700px;
  height: 100vh;
  max-height: 900px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
  z-index: 1;
}

/* === Screens === */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1;
}

.screen.active {
  display: flex;
}

/* === Title Screen === */
.arcade-cabinet {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.planet-mars {
  font-size: 3rem;
  animation: float 3s ease-in-out infinite;
  filter: hue-rotate(-20deg) saturate(1.5);
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-10px) rotate(5deg);
  }
}

.game-title {
  font-family: var(--font-arcade);
  display: flex;
  flex-direction: column;
  gap: 8px;
  user-select: none;
}

.title-line-1 {
  font-size: clamp(1.8rem, 7vw, 3rem);
  color: var(--neon-cyan);
  text-shadow:
    0 0 10px var(--neon-cyan),
    0 0 30px rgba(0, 200, 255, 0.5),
    0 0 60px rgba(0, 200, 255, 0.3),
    3px 3px 0 #005577;
  animation: titleGlow 2s ease-in-out infinite alternate;
}

.title-line-2 {
  font-size: clamp(2.5rem, 10vw, 4.5rem);
  color: var(--neon-green);
  text-shadow:
    0 0 10px var(--neon-green),
    0 0 30px rgba(57, 255, 20, 0.5),
    0 0 60px rgba(57, 255, 20, 0.3),
    3px 3px 0 #0a6b00;
  animation: titleGlow 2s ease-in-out infinite alternate-reverse;
}

@keyframes titleGlow {
  from {
    filter: brightness(1);
  }

  to {
    filter: brightness(1.3);
  }
}

.subtitle-mission {
  font-family: var(--font-arcade);
  font-size: 0.55rem;
  color: var(--neon-orange);
  text-shadow: 0 0 15px var(--neon-orange);
  letter-spacing: 3px;
  animation: subtitlePulse 3s ease-in-out infinite;
}

@keyframes subtitlePulse {

  0%,
  100% {
    opacity: 0.7;
  }

  50% {
    opacity: 1;
    text-shadow: 0 0 25px var(--neon-orange);
  }
}

.mole-preview {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: alienBounce 1.2s ease-in-out infinite;
}

.preview-mole {
  font-size: 3.5rem;
  filter: drop-shadow(0 0 20px rgba(57, 255, 20, 0.6));
}

@keyframes alienBounce {

  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-15px) scale(1.1);
  }
}

.instructions {
  font-family: var(--font-arcade);
  font-size: 0.5rem;
  line-height: 2.2;
  color: #bbb;
  background: rgba(0, 0, 0, 0.5);
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid rgba(0, 240, 255, 0.15);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.05);
}

.insert-coin {
  font-family: var(--font-arcade);
  font-size: 0.55rem;
  color: var(--neon-cyan);
  margin-top: 5px;
}

.blink {
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* === Arcade Button === */
.arcade-btn {
  font-family: var(--font-arcade);
  font-size: 0.7rem;
  padding: 14px 28px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, #ff5500 0%, #cc3300 100%);
  color: #fff;
  cursor: pointer;
  text-transform: uppercase;
  position: relative;
  box-shadow:
    0 6px 0 #881a00,
    0 8px 20px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 0 30px rgba(255, 85, 0, 0.2);
  transition: all 0.1s ease;
  letter-spacing: 1px;
}

.arcade-btn:hover {
  transform: translateY(2px);
  box-shadow:
    0 4px 0 #881a00,
    0 6px 15px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 0 40px rgba(255, 85, 0, 0.3);
}

.arcade-btn:active {
  transform: translateY(5px);
  box-shadow:
    0 1px 0 #881a00,
    0 2px 5px rgba(0, 0, 0, 0.5);
}

.pulse {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 6px 0 #881a00, 0 8px 20px rgba(0, 0, 0, 0.5), 0 0 0 0 rgba(255, 85, 0, 0.4);
  }

  50% {
    box-shadow: 0 6px 0 #881a00, 0 8px 20px rgba(0, 0, 0, 0.5), 0 0 0 15px rgba(255, 85, 0, 0);
  }
}

/* === Game HUD === */
.game-hud {
  display: flex;
  justify-content: space-around;
  width: 100%;
  max-width: 650px;
  background: var(--hud-bg);
  border: 2px solid rgba(0, 240, 255, 0.15);
  border-radius: 16px;
  padding: 12px 8px;
  margin-bottom: 15px;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.08);
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.hud-label {
  font-family: var(--font-arcade);
  font-size: 0.45rem;
  color: #666;
  letter-spacing: 1px;
}

.hud-value {
  font-family: var(--font-arcade);
  font-size: 1rem;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px var(--neon-cyan);
  min-width: 50px;
  text-align: center;
}

#score {
  color: var(--neon-green);
  text-shadow: 0 0 10px var(--neon-green);
}

#timer {
  color: var(--neon-orange);
  text-shadow: 0 0 10px var(--neon-orange);
}

#combo {
  color: var(--neon-pink);
  text-shadow: 0 0 10px var(--neon-pink);
}

.hud-value.warning {
  color: #ff2222 !important;
  text-shadow: 0 0 15px #ff2222 !important;
  animation: timerPulse 0.5s ease-in-out infinite;
}

@keyframes timerPulse {
  50% {
    transform: scale(1.2);
  }
}

/* === Game Board — Mars Surface === */
.game-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  width: 100%;
  max-width: 500px;
  padding: 30px 20px;
  background:
    radial-gradient(ellipse at 30% 40%, rgba(210, 120, 60, 0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 60%, rgba(180, 90, 40, 0.2) 0%, transparent 50%),
    radial-gradient(ellipse at center, var(--mars-red) 0%, var(--mars-dark) 70%, #4a1a05 100%);
  border-radius: 24px;
  border: 4px solid #5a2a10;
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, 0.4),
    0 10px 40px rgba(0, 0, 0, 0.6),
    0 0 80px rgba(193, 68, 14, 0.15);
  position: relative;
}

.game-board::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background:
    radial-gradient(circle at 15% 25%, rgba(255, 200, 150, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 80% 75%, rgba(0, 0, 0, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 50% 10%, rgba(255, 150, 100, 0.05) 0%, transparent 30%);
  pointer-events: none;
}

/* === Craters (Holes) === */
.hole {
  position: relative;
  width: 100%;
  aspect-ratio: 1.3;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  cursor: pointer;
}

.dirt-back {
  position: absolute;
  bottom: 5%;
  left: 5%;
  right: 5%;
  height: 50%;
  background: radial-gradient(ellipse at 50% 100%, #2a0e04 0%, var(--crater-shadow) 100%);
  border-radius: 50%;
  z-index: 1;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
}

.mole-container {
  position: absolute;
  bottom: 15%;
  left: 10%;
  right: 10%;
  height: 70%;
  overflow: hidden;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.mole {
  width: 70%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateY(100%);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2;
}

.mole.up {
  transform: translateY(5%);
}

.mole.bonked {
  animation: bonk 0.3s ease-out;
}

@keyframes bonk {
  0% {
    transform: translateY(5%) scale(1);
  }

  30% {
    transform: translateY(5%) scale(1.3) rotate(-10deg);
  }

  60% {
    transform: translateY(5%) scale(0.9) rotate(5deg);
  }

  100% {
    transform: translateY(100%) scale(0.8);
  }
}

.mole-face {
  font-size: clamp(2rem, 7vw, 3.5rem);
  user-select: none;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.5));
  transition: filter 0.2s;
}

.mole.golden .mole-face {
  filter: drop-shadow(0 0 15px rgba(255, 230, 0, 0.8)) drop-shadow(0 0 30px rgba(255, 200, 0, 0.4));
  animation: goldenGlow 0.5s ease-in-out infinite alternate;
}

@keyframes goldenGlow {
  from {
    filter: drop-shadow(0 0 10px rgba(255, 230, 0, 0.5));
  }

  to {
    filter: drop-shadow(0 0 30px rgba(255, 230, 0, 1));
  }
}

.mole.bomb .mole-face {
  filter: drop-shadow(0 0 12px rgba(255, 80, 0, 0.7));
  animation: meteorGlow 0.3s ease-in-out infinite alternate;
}

@keyframes meteorGlow {
  from {
    filter: drop-shadow(0 0 8px rgba(255, 80, 0, 0.5));
  }

  to {
    filter: drop-shadow(0 0 18px rgba(255, 80, 0, 0.9));
  }
}

.dirt-front {
  position: absolute;
  bottom: 0;
  left: 2%;
  right: 2%;
  height: 35%;
  background: radial-gradient(ellipse at 50% 30%, var(--mars-sand) 0%, var(--mars-rust) 40%, var(--mars-dark) 100%);
  border-radius: 50%;
  z-index: 3;
  box-shadow:
    inset 0 -5px 10px rgba(0, 0, 0, 0.4),
    0 -2px 6px rgba(0, 0, 0, 0.3),
    inset 0 2px 3px rgba(255, 200, 150, 0.1);
}

/* === Float Score === */
#float-scores {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 500;
}

.float-score {
  position: absolute;
  font-family: var(--font-arcade);
  font-size: 0.8rem;
  font-weight: bold;
  color: var(--neon-green);
  text-shadow: 0 0 10px currentColor, 0 2px 4px rgba(0, 0, 0, 0.5);
  animation: floatUp 1s ease-out forwards;
  pointer-events: none;
  white-space: nowrap;
}

.float-score.bonus {
  color: var(--neon-yellow);
  font-size: 1rem;
}

.float-score.penalty {
  color: #ff4444;
}

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

  20% {
    transform: translateY(-10px) scale(1.2);
  }

  100% {
    opacity: 0;
    transform: translateY(-80px) scale(0.8);
  }
}

/* === Screen shake === */
.shake {
  animation: shake 0.3s ease-out;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-8px);
  }

  40% {
    transform: translateX(8px);
  }

  60% {
    transform: translateX(-4px);
  }

  80% {
    transform: translateX(4px);
  }
}

/* === Game Over Screen === */
.gameover-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  background: rgba(5, 5, 20, 0.92);
  padding: 35px 30px;
  border-radius: 24px;
  border: 2px solid rgba(0, 240, 255, 0.2);
  box-shadow:
    0 0 60px rgba(0, 240, 255, 0.08),
    0 0 120px rgba(57, 255, 20, 0.05);
  backdrop-filter: blur(15px);
}

.gameover-title {
  font-family: var(--font-arcade);
  font-size: clamp(1.2rem, 5vw, 2rem);
  color: var(--neon-cyan);
  text-shadow:
    0 0 20px var(--neon-cyan),
    0 0 40px rgba(0, 200, 255, 0.5);
  animation: gameoverPulse 1.5s ease-in-out infinite alternate;
}

.gameover-subtitle {
  font-family: var(--font-arcade);
  font-size: 0.5rem;
  color: var(--neon-orange);
  letter-spacing: 2px;
}

@keyframes gameoverPulse {
  from {
    filter: brightness(0.8);
    transform: scale(1);
  }

  to {
    filter: brightness(1.2);
    transform: scale(1.03);
  }
}

.final-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 320px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  font-size: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-row span:first-child {
  color: #999;
}

.stat-value {
  font-family: var(--font-arcade);
  font-size: 0.65rem;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--neon-cyan);
}

.high-score-msg {
  font-family: var(--font-arcade);
  font-size: 0.7rem;
  color: var(--neon-yellow);
  text-shadow: 0 0 15px var(--neon-yellow);
  animation: blink 0.7s step-end infinite;
}

.hidden {
  display: none !important;
}

/* === Responsive === */
@media (max-width: 500px) {
  .game-board {
    gap: 10px;
    padding: 20px 15px;
  }

  .game-hud {
    padding: 8px 4px;
  }

  .hud-label {
    font-size: 0.35rem;
  }

  .hud-value {
    font-size: 0.75rem;
  }

  .instructions {
    font-size: 0.4rem;
    padding: 10px 15px;
  }

  .gameover-content {
    padding: 25px 20px;
  }
}

@media (max-height: 700px) {
  .game-container {
    padding: 5px;
  }

  .game-board {
    gap: 8px;
    padding: 15px 10px;
  }

  .game-hud {
    margin-bottom: 8px;
    padding: 8px;
  }

  .mole-face {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
  }

  .planet-mars {
    font-size: 2rem;
  }

  .arcade-cabinet {
    gap: 8px;
  }
}