/* ===== NEON BLASTER — CARTOON THEME ===== */
/* Theme: Cartoon Space Adventure */

/* -- Tokens -- */
:root {
  --bg: #1A237E;
  --surface: #F5E6D0;
  --surface-container: #EFD9BF;
  --surface-high: #E8CCB0;
  --primary: #FF5722;
  --secondary: #FF9800;
  --tertiary: #FFC107;
  --on-surface: #3E2723;
  --on-primary: #FFF;
  --outline: #8D6E63;
  --danger: #E53935;
  --shadow-dark: #5D4037;
  --shadow-medium: #8D6E63;

  --font-display: 'Nunito', sans-serif;
  --font-body: 'Nunito', sans-serif;
}

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

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--on-surface);
  display: flex;
  flex-direction: column;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* -- Space Background -- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(255, 87, 34, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(255, 152, 0, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(255, 193, 7, 0.06) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

/* -- Top Bar -- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border-bottom: 3px solid var(--outline);
  position: relative;
  z-index: 100;
  min-height: 48px;
  box-shadow: 0 4px 0 var(--shadow-dark);
}

.btn-back {
  color: var(--primary);
  text-decoration: none;
  font-weight: 800;
  font-size: 0.9rem;
  padding: 0.3rem 0.6rem;
  border-radius: 12px;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-back:hover {
  background: rgba(255, 87, 34, 0.12);
  color: #E64A19;
}

.game-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 1px;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 var(--shadow-dark);
}

.stats {
  display: flex;
  gap: 0.5rem;
}

.score-box {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--surface-container);
  border: 3px solid var(--outline);
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  box-shadow: 0 3px 0 var(--shadow-dark);
}

.score-box.best {
  background: #FFF8E1;
  border-color: #F9A825;
  box-shadow: 0 3px 0 #F57F17;
}

.score-icon {
  font-size: 1rem;
}

.score-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--on-surface);
}

.neon-text {
  color: var(--primary);
}

/* -- Game Container -- */
.game-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

#pixi-container {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}

#pixi-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* -- Modal Overlay -- */
.modal-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.glass-overlay {
  background: rgba(26, 35, 126, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.glass-modal {
  background: var(--surface);
  border: 3px solid var(--outline);
  border-radius: 20px;
  padding: 2rem 2.5rem;
  text-align: center;
  max-width: 380px;
  width: 90%;
  box-shadow:
    0 6px 0 var(--shadow-dark),
    0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  animation: pulse-icon 2s ease-in-out infinite;
}

@keyframes pulse-icon {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.modal-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  text-shadow: 2px 2px 0 var(--shadow-dark);
  margin-bottom: 0.5rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.modal-subtitle {
  color: #6D4C41;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.4;
}

.overlay-score {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 1rem;
  min-height: 1.5em;
}

.neon-score {
  color: var(--primary);
  text-shadow: 1px 1px 0 var(--shadow-dark);
}

/* -- Buttons -- */
.btn {
  display: inline-block;
  padding: 0.7rem 2rem;
  border: 3px solid transparent;
  border-radius: 16px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  border-color: #BF360C;
  box-shadow: 0 4px 0 #BF360C;
}

.btn-primary:hover {
  background: #F4511E;
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #BF360C;
}

.btn-primary:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #BF360C;
}

.btn-whatsapp {
  background: #25D366;
  color: #fff;
  border-color: #128C7E;
  box-shadow: 0 4px 0 #128C7E;
}

.btn-whatsapp:hover {
  background: #2BE06F;
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #128C7E;
}

/* -- Mobile Joysticks -- */
.joystick {
  position: fixed;
  bottom: 30px;
  z-index: 200;
  touch-action: none;
}

.joystick-left {
  left: 30px;
}

.joystick-right {
  right: 30px;
}

.joystick-base {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(245, 230, 208, 0.25);
  border: 3px solid var(--outline);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 3px 0 var(--shadow-dark);
}

.joystick-knob {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #BF360C;
  box-shadow: 0 3px 0 #BF360C;
  position: absolute;
  transition: none;
}

.joystick-right .joystick-base {
  background: rgba(255, 152, 0, 0.2);
  border-color: var(--secondary);
}

.joystick-right .joystick-knob {
  background: var(--secondary);
  border-color: #E65100;
  box-shadow: 0 3px 0 #E65100;
}

/* -- Bomb Button -- */
.bomb-button {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--tertiary);
  border: 3px solid #F9A825;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 0 #F57F17;
  touch-action: manipulation;
}

.bomb-button:active {
  background: #FFD54F;
  transform: translateX(-50%) translateY(2px);
  box-shadow: 0 1px 0 #F57F17;
}

/* -- Responsive -- */
@media (max-width: 600px) {
  .topbar {
    padding: 0.4rem 0.6rem;
  }

  .game-title {
    font-size: 1rem;
    letter-spacing: 1px;
  }

  .btn-back {
    font-size: 0.8rem;
    padding: 0.2rem 0.4rem;
  }

  .score-box {
    padding: 0.2rem 0.4rem;
    font-size: 0.85rem;
  }

  .score-value {
    font-size: 0.95rem;
  }

  .glass-modal {
    padding: 1.5rem 1.2rem;
  }

  .modal-title {
    font-size: 1.5rem;
  }

  .modal-subtitle {
    font-size: 0.8rem;
  }

  .joystick-base {
    width: 100px;
    height: 100px;
  }

  .joystick-knob {
    width: 42px;
    height: 42px;
  }

  .joystick {
    bottom: 20px;
  }

  .joystick-left {
    left: 15px;
  }

  .joystick-right {
    right: 15px;
  }
}

@media (max-width: 380px) {
  .game-title {
    font-size: 0.85rem;
  }

  .score-icon {
    display: none;
  }
}

@media (min-width: 601px) {
  .joystick, .bomb-button {
    display: none !important;
  }
}
