/* =====================================================
   FUENTES (RUTAS RELATIVAS CORREGIDAS)
   ===================================================== */
@font-face {
  font-family: "futura-medium";
  src: url("../fonts/Futura Medium.otf") format("opentype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "futura-light";
  src: url("../fonts/futuralight.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* =====================================================
   CONTENEDOR PRINCIPAL DEL JUEGO
   ===================================================== */
.game-wrapper {
  max-width: 100%;
  margin: 0 auto;
  font-family: Arial, sans-serif;
  padding: 20px 10px;
}

#gameContainer {
  position: relative;
  width: 100%;
  height: 75vh;
  min-height: 400px;
  max-height: 600px;
  background: #1a1a2e;
  border: 3px solid #3fc89a;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  margin: 20px auto;
}

#gameCanvas {
  display: block;
  background: transparent;
  width: 100%;
  height: 100%;
  cursor: default;
}

/* =====================================================
   UI DEL JUEGO (Puntuación, Vidas, etc.)
   ===================================================== */
#ui {
  position: absolute;
  top: 10px;
  right: 10px;
  color: white;
  font-family: "futura-medium", Arial, sans-serif;
  font-size: 16px;
  z-index: 10;
  background: rgba(0, 0, 0, 0.7);
  padding: 10px 15px;
  border-radius: 8px;
  line-height: 1.8;
}

#ui div {
  margin: 3px 0;
}

/* =====================================================
   PANTALLAS DE ESTADO (Inicio, Instrucciones, Game Over)
   ===================================================== */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  color: white;
  text-align: center;
  z-index: 20;
  padding: 20px;
  box-sizing: border-box;
  overflow-y: auto;
}

.screen.hidden {
  display: none;
}

.screen h1 {
  font-family: "futura-medium", Arial, sans-serif;
  font-size: 2.5em;
  margin-top: 20px;
  margin-bottom: 15px;
  color: #3fc89a;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  text-align: center;
  padding: 0 10px;
}

.screen h2 {
  font-family: "futura-medium", Arial, sans-serif;
  font-size: 1.8em;
  margin-bottom: 15px;
  color: #ff6b6b;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
  text-align: center;
  padding: 0 10px;
}

/* =====================================================
   INSTRUCCIONES
   ===================================================== */
.instructions {
  max-width: 600px;
  width: 90%;
  margin: 20px auto;
  line-height: 1.8;
  padding: 0 10px;
  box-sizing: border-box;
}

.instructions div {
  font-family: "futura-light", Arial, sans-serif;
  font-size: 1.1em;
  margin: 10px 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  border-left: 3px solid #3fc89a;
  word-wrap: break-word;
  overflow-wrap: break-word;
  color: #f0f0f0;
  text-align: left;
}

/* =====================================================
   BOTONES DEL JUEGO
   ===================================================== */
.game-btn {
  background: linear-gradient(45deg, #4caf50, #45a049);
  color: white;
  border: none;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  margin: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
  min-width: 140px;
  font-family: "futura-medium", Arial, sans-serif;
}

.game-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.5);
}

.game-btn:active {
  transform: translateY(0);
}

.game-btn.secondary {
  background: linear-gradient(45deg, #607d8b, #546e7a);
  box-shadow: 0 4px 15px rgba(96, 125, 139, 0.3);
}

.game-btn.secondary:hover {
  box-shadow: 0 6px 20px rgba(96, 125, 139, 0.5);
}

/* =====================================================
   PANTALLA DE PUNTUACIÓN FINAL
   ===================================================== */
.score-display {
  font-family: "futura-medium", Arial, sans-serif;
  font-size: 1.3em;
  margin: 20px 0;
  line-height: 2;
}

.score-display div {
  margin: 8px 0;
  padding: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

/* =====================================================
   CONTROLES MÓVILES
   ===================================================== */
#mobileControls {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 15;
  display: none;
}

.control-pad {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 70px;
}

.control-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 12px;
  color: white;
  font-size: 28px;
  font-weight: bold;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: manipulation;
  transition: all 0.15s ease;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.control-btn:active {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(0.95);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* =====================================================
   RESPONSIVE - TABLETS
   ===================================================== */
@media (max-width: 768px) {
  .game-wrapper {
    padding: 10px 5px;
  }

  #gameContainer {
    height: 60vh;
    min-height: 350px;
    border-radius: 10px;
    border-width: 2px;
    margin: 15px auto;
  }

  #ui {
    font-size: 14px;
    padding: 8px 12px;
    top: 8px;
    right: 8px;
  }

  .screen {
    padding: 15px;
    justify-content: flex-start;
    padding-top: 40px;
  }

  .screen h1 {
    font-size: 2em;
    margin-top: 15px;
    margin-bottom: 12px;
  }

  .screen h2 {
    font-size: 1.5em;
    margin-bottom: 12px;
  }

  .instructions {
    max-width: 95%;
    padding: 0 5px;
    font-size: 0.95em;
  }

  .instructions div {
    font-size: 1em;
    padding: 10px;
    margin: 8px 0;
  }

  .game-btn {
    padding: 10px 20px;
    font-size: 15px;
    margin: 6px;
    min-width: 110px;
  }

  .score-display {
    font-size: 1.15em;
  }

  #mobileControls {
    display: block;
    bottom: 15px;
    right: 15px;
  }

  .control-pad {
    width: 65px;
    gap: 12px;
  }

  .control-btn {
    height: 55px;
    font-size: 24px;
  }
}

/* =====================================================
   RESPONSIVE - MÓVILES
   ===================================================== */
@media (max-width: 480px) {
  .game-wrapper {
    padding: 5px;
  }

  #gameContainer {
    height: 50vh;
    min-height: 300px;
    border-radius: 8px;
    margin: 10px auto;
  }

  #ui {
    font-size: 12px;
    padding: 6px 10px;
    top: 5px;
    right: 5px;
    line-height: 1.5;
  }

  .screen {
    padding: 10px;
    padding-top: 30px;
  }

  .screen h1 {
    font-size: 1.6em;
    margin-top: 10px;
    margin-bottom: 10px;
  }

  .screen h2 {
    font-size: 1.3em;
    margin-bottom: 10px;
  }

  .instructions {
    font-size: 0.9em;
    line-height: 1.5;
  }

  .instructions div {
    font-size: 0.9em;
    padding: 8px;
    margin: 6px 0;
  }

  .game-btn {
    padding: 8px 16px;
    font-size: 14px;
    margin: 5px;
    min-width: 100px;
  }

  .score-display {
    font-size: 1em;
    margin: 15px 0;
  }

  .score-display div {
    padding: 8px;
    margin: 6px 0;
  }

  #mobileControls {
    bottom: 10px;
    right: 10px;
  }

  .control-pad {
    width: 55px;
    gap: 10px;
  }

  .control-btn {
    height: 50px;
    font-size: 22px;
    border-radius: 10px;
  }
}

/* =====================================================
   RESPONSIVE - MÓVILES MUY PEQUEÑOS
   ===================================================== */
@media (max-width: 360px) {
  #gameContainer {
    height: 45vh;
    min-height: 280px;
  }

  .screen h1 {
    font-size: 1.4em;
  }

  .screen h2 {
    font-size: 1.2em;
  }

  .instructions div {
    font-size: 0.85em;
    padding: 6px;
  }

  .game-btn {
    padding: 7px 14px;
    font-size: 13px;
    min-width: 90px;
  }

  .control-pad {
    width: 50px;
  }

  .control-btn {
    height: 45px;
    font-size: 20px;
  }
}

/* =====================================================
   ACCESIBILIDAD - REDUCIR MOVIMIENTO
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }

  .game-btn:hover {
    transform: none;
  }

  .control-btn:active {
    transform: none;
  }
}

/* =====================================================
   MEJORAS VISUALES
   ===================================================== */

/* Efecto de foco para accesibilidad */
.game-btn:focus,
.control-btn:focus {
  outline: 3px solid #3fc89a;
  outline-offset: 2px;
}

/* Cursor personalizado en el canvas */
#gameCanvas {
  cursor: crosshair;
}

#gameCanvas:active {
  cursor: grabbing;
}

/* Animación de entrada para pantallas */
.screen:not(.hidden) {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Efecto hover mejorado para controles móviles en desktop */
@media (hover: hover) {
  .control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
  }
}

/* Estado de vida baja (alerta visual) */
.stat {
  display: inline-block;
}

/* Puedes agregar clases dinámicas desde JS */
.low-lives {
  color: #ff6b6b;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}
