/* =====================================================================
   style.css
   Estilo "novela visual": fondo a pantalla completa, personajes anclados
   abajo, caja de diálogo tipo videojuego y pantallas de inicio/final.
   ===================================================================== */

:root {
  --azul: #008cff;
  --azul-oscuro: #005bb5;
  --panel: rgba(10, 10, 20, 0.82);
  --texto-claro: #f5f5f5;
  --fuente-titulo: 'Press Start 2P', cursive;
  --fuente-texto: 'VT323', monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow: hidden;
  font-family: var(--fuente-texto);
  color: var(--texto-claro);
  background-color: #000;
}

.oculto {
  display: none !important;
}

button {
  font-family: var(--fuente-texto);
  cursor: pointer;
}

/* ------------------------------------------------------------------ */
/* Botón flotante de silencio                                          */
/* ------------------------------------------------------------------ */
#btn-mute {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 500;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--panel);
  color: var(--texto-claro);
  font-size: 1.2rem;
}

/* ------------------------------------------------------------------ */
/* Pantalla de inicio                                                   */
/* ------------------------------------------------------------------ */
#pantalla-inicio,
#pantalla-final {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  padding: 24px;
  background: radial-gradient(circle at center, #16213e 0%, #0b0e1a 100%);
}

#pantalla-inicio h1,
#titulo-final {
  font-family: var(--fuente-titulo);
  font-size: clamp(1.1rem, 4vw, 2rem);
  line-height: 1.6;
  text-shadow: 3px 3px 0 var(--azul-oscuro);
  max-width: 90%;
}

.subtitulo {
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  color: #b8c1ec;
}

.portada {
  width: clamp(120px, 20vw, 200px);
  image-rendering: pixelated;
  filter: drop-shadow(0 0 18px rgba(0, 140, 255, 0.6));
  animation: flotar 3s ease-in-out infinite;
}

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

#btn-jugar,
#btn-reiniciar {
  padding: 14px 28px;
  font-size: clamp(1rem, 2.2vw, 1.3rem);
  background-color: var(--azul);
  color: white;
  border: none;
  border-radius: 10px;
  transition: transform 0.2s ease, background-color 0.3s;
}

#btn-jugar:hover,
#btn-reiniciar:hover,
.opcion:hover {
  transform: scale(1.06);
  background-color: var(--azul-oscuro);
}

/* ------------------------------------------------------------------ */
/* Pantalla final                                                       */
/* ------------------------------------------------------------------ */
#img-final {
  width: clamp(110px, 18vw, 180px);
  border-radius: 16px;
  box-shadow: 0 0 30px rgba(0, 140, 255, 0.5);
}

#texto-final {
  max-width: 640px;
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
}

#puntaje-final {
  color: #ffd166;
  font-size: 1.2rem;
}

/* ------------------------------------------------------------------ */
/* Escenario del juego                                                  */
/* ------------------------------------------------------------------ */
#juego {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#fondo-escena {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
  transition: background-image 0.3s ease;
}

#fondo-escena::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.05) 45%);
}

#barra-estado {
  position: relative;
  z-index: 5;
  text-align: center;
  padding: 10px;
}

#nombre-escena {
  font-family: var(--fuente-titulo);
  font-size: clamp(0.7rem, 1.8vw, 1rem);
  background: var(--panel);
  padding: 8px 16px;
  border-radius: 20px;
}

#escenario {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  height: 62vh;
  padding: 0 20px;
}

.personaje {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: filter 0.3s ease;
}

.personaje img {
  width: clamp(110px, 22vw, 260px);
  height: auto;
  filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.5));
  transition: transform 0.25s ease, filter 0.25s ease;
}

.etiqueta-nombre {
  background: var(--panel);
  padding: 4px 14px;
  border-radius: 12px;
  font-size: clamp(0.9rem, 2vw, 1.2rem);
  opacity: 0.85;
}

/* Resalta al personaje que está hablando en este momento */
.personaje.hablando img {
  transform: scale(1.08) translateY(-6px);
  filter: drop-shadow(0 0 20px rgba(0, 200, 255, 0.85));
}

.personaje.hablando .etiqueta-nombre {
  opacity: 1;
  background: var(--azul-oscuro);
}

#explosion {
  display: none;
  position: absolute;
  left: 50%;
  bottom: 10%;
  transform: translateX(-50%);
  width: clamp(160px, 30vw, 320px);
  z-index: 3;
  pointer-events: none;
}

/* ------------------------------------------------------------------ */
/* Caja de diálogo                                                      */
/* ------------------------------------------------------------------ */
#caja-dialogo {
  position: relative;
  z-index: 4;
  margin: 0 auto;
  max-width: 900px;
  background: var(--panel);
  border: 2px solid rgba(0, 140, 255, 0.5);
  border-radius: 16px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

#texto-dialogo {
  margin: 0;
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  line-height: 1.4;
}

#btn-continuar {
  flex-shrink: 0;
  border: none;
  background: var(--azul);
  color: white;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 1rem;
  transition: transform 0.2s ease, background-color 0.3s;
}

#btn-continuar:hover {
  background: var(--azul-oscuro);
  transform: scale(1.05);
}

/* ------------------------------------------------------------------ */
/* Opciones (decisiones del jugador)                                    */
/* ------------------------------------------------------------------ */
#opciones {
  position: relative;
  z-index: 4;
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  padding: 0 16px;
}

.opcion {
  padding: 12px 22px;
  font-size: clamp(1rem, 2vw, 1.2rem);
  background-color: var(--azul);
  color: white;
  border: none;
  border-radius: 12px;
  transition: transform 0.2s ease, background-color 0.3s;
}

.opcion:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

/* ------------------------------------------------------------------ */
/* Pantalla negra de transición entre escenas                           */
/* ------------------------------------------------------------------ */
#pantalla-negra {
  position: fixed;
  inset: 0;
  background-color: black;
  opacity: 0;
  z-index: 999;
  pointer-events: none;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                           */
/* ------------------------------------------------------------------ */
@media (max-width: 640px) {
  #escenario {
    height: 50vh;
    padding: 0 8px;
  }

  #caja-dialogo {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .portada {
    width: 110px;
  }
}
