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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Nunito', sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ============================================
   LOADER SECUENCIAL — FONDO NEGRO Y ROSADO ROBLOX
   ============================================ */
#loader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
  z-index: 1000;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

#loader.saliendo {
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
}

.loader-box {
  max-width: 90vw;
  width: 330px;
  text-align: center;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

/* Icono animado con anillo giratorio */
.loader-icon-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-spinner-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(255, 58, 140, 0.15);
  border-top-color: #ff3a8c;
  border-right-color: #ff79bf;
  animation: spinRing 1s cubic-bezier(0.55, 0.15, 0.45, 0.85) infinite;
  box-shadow: 0 0 20px rgba(255, 58, 140, 0.35);
}

@keyframes spinRing {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loader-icon-inner {
  font-size: 2rem;
  animation: pulseIcon 1.5s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 10px rgba(255, 58, 140, 0.8));
}

@keyframes pulseIcon {
  0% { transform: scale(0.85); opacity: 0.8; }
  100% { transform: scale(1.15); opacity: 1; }
}

.loader-title {
  font-family: 'Fredoka One', cursive, sans-serif;
  font-size: 1.15rem;
  letter-spacing: 0.12em;
  color: #ffffff;
  text-shadow: 0 0 12px rgba(255, 58, 140, 0.6);
  margin-top: 0.25rem;
}

/* Pista de la barra de progreso */
.loader-track {
  width: 100%;
  height: 12px;
  background: #141414;
  border: 1.5px solid rgba(255, 58, 140, 0.4);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.8);
  padding: 1px;
}

/* Barra que se llena suavemente */
.loader-bar {
  height: 100%;
  width: 0%;
  border-radius: 20px;
  background: linear-gradient(90deg, #ff3a8c, #ff79bf, #ff3a8c);
  background-size: 200% 100%;
  animation: barShimmer 2s linear infinite;
  box-shadow: 0 0 14px rgba(255, 58, 140, 0.8);
  transition: width 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes barShimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* Textos informativos de descarga */
.loader-details {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  color: #ff9ecd;
}

#loaderStatus {
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 75%;
}

#loaderPercent {
  font-family: 'Fredoka One', sans-serif;
  font-size: 1rem;
  color: #ffffff;
  text-shadow: 0 0 8px rgba(255, 58, 140, 0.8);
}

/* ============================================
   PORTADA — FONDO NEGRO PURO
   ============================================ */
#portada {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
  z-index: 100;
  transition: opacity 0.8s ease, transform 0.8s ease;
}

#portada.oculto-inicial {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

#portada.saliendo {
  opacity: 0;
  transform: scale(1.08);
  pointer-events: none;
}

/* Contenido central */
.portada-contenido {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  padding: 1.5rem;
  animation: fadeInUp 1s ease forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* WEBP transparente con el nombre */
.portada-imagen {
  max-width: 75vw;
  max-height: 50vh;
  width: auto;
  height: auto;
  object-fit: contain;
  animation: floatSuave 3s ease-in-out infinite alternate;
}

@keyframes floatSuave {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-10px);
  }
}

/* ============================================
   BOTÓN — ROSADO MODERNO ROBLOX
   ============================================ */
.btn-abrir {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2.8rem;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #ff3a8c 0%, #ff6fb5 50%, #ff3a8c 100%);
  background-size: 200% 200%;
  color: #ffffff;
  font-family: 'Fredoka One', 'Nunito', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 4px 20px rgba(255, 58, 140, 0.45),
    0 0 0 0 rgba(255, 58, 140, 0);
  transition: all 0.35s ease;
  animation: fadeInUp 1s ease 0.5s backwards, shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Brillo que recorre el botón */
.btn-abrir::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.25),
    transparent
  );
  transition: none;
  animation: brilloRecorre 3.5s ease-in-out infinite 1.5s;
}

@keyframes brilloRecorre {
  0% { left: -100%; }
  30% { left: 120%; }
  100% { left: 120%; }
}

.btn-abrir:hover,
.btn-abrir:focus-visible {
  transform: scale(1.06) translateY(-2px);
  box-shadow:
    0 6px 30px rgba(255, 58, 140, 0.6),
    0 0 50px rgba(255, 58, 140, 0.2);
}

.btn-abrir:active {
  transform: scale(0.97);
  box-shadow: 0 2px 10px rgba(255, 58, 140, 0.4);
}

.btn-texto {
  position: relative;
  z-index: 1;
}

/* ============================================
   INVITACIÓN — VIDEO
   ============================================ */
#invitacion {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  z-index: 50;
  transition: opacity 0.6s ease;
}

#invitacion.oculto {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

#invitacion.visible {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

/* Video wrapper — ratio 9:16 */
.video-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

#videoInvitacion {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

/* ============================================
   RESPONSIVIDAD — VIDEO 9:16
   ============================================ */

/* Pantalla más angosta que 9:16 → video ocupa todo el ancho */
@media (max-aspect-ratio: 9/16) {
  #videoInvitacion {
    width: 100%;
    height: auto;
  }
}

/* Pantallas móviles típicas → priorizar ancho */
@media (min-aspect-ratio: 9/16) and (max-aspect-ratio: 3/4) {
  #videoInvitacion {
    width: 100%;
    height: auto;
  }
}

/* Pantallas anchas (tablets, PC) → priorizar alto */
@media (min-aspect-ratio: 3/4) {
  #videoInvitacion {
    height: 100%;
    width: auto;
  }
}

/* ============================================
   BOTÓN MÚSICA FLOTANTE
   ============================================ */
.btn-musica {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(255, 58, 140, 0.4);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.btn-musica:hover {
  background: rgba(255, 58, 140, 0.2);
  border-color: rgba(255, 58, 140, 0.7);
  transform: scale(1.1);
}

.btn-musica.oculto {
  display: none;
}

/* ============================================
   UTILIDADES
   ============================================ */
.oculto {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}
