/* =========================================================
   Paleta única: rosas + blanco + brillo plateado
   (los nombres antiguos se mantienen porque los usa el panel)
   ========================================================= */
:root {
  --rojo: #d81b72;          /* fucsia principal (títulos, puntos) */
  --rojo-oscuro: #8e0f4c;   /* frambuesa oscuro (sombras, texto fuerte) */
  --verde: #d81b72;         /* botones y etiquetas = fucsia */
  --verde-claro: #f48fb8;   /* rosa medio */
  --oro: #ffffff;           /* bordes claros */
  --rosa: #f7b6cf;
  --rosa-claro: #fde3ee;
  --crema: #fff7fb;
  --texto: #4a1631;
  --sombra: 0 10px 30px rgba(142, 15, 76, .25);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--texto);
  background: var(--rosa) url("img/glitter-rosa.webp") repeat;
  background-size: 446px auto;
  line-height: 1.5;
  overflow-x: hidden;
}

#nieve {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

header, main, footer { position: relative; z-index: 1; }

h1, h2 {
  font-family: "Mountains of Christmas", cursive;
  margin: 0;
  line-height: 1.05;
}

/* ---------- BRILLOS ---------- */

/* Texto con purpurina que se mueve */
@keyframes brillo-texto {
  from { background-position: 200% 50%; }
  to   { background-position: -100% 50%; }
}

/* Destello que cruza botones y etiquetas */
.destello { position: relative; overflow: hidden; isolation: isolate; }
.destello::after {
  content: "";
  position: absolute;
  inset: -50% auto -50% -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .85), transparent);
  transform: skewX(-20deg);
  animation: barrido 3.6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes barrido {
  0%, 55% { left: -60%; }
  100% { left: 130%; }
}

/* Estrellitas que parpadean junto a los títulos */
@keyframes parpadeo {
  0%, 100% { opacity: .25; transform: scale(.7) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.15) rotate(20deg); }
}

/* Los títulos con brillo solo pintan dentro de su caja: les damos aire
   para que no se corten los rabitos de las letras (g, j, p, ¿…) */
.hero h1, .tarjeta h2, .premio-titulo {
  line-height: 1.25;
  padding: .1em .35em .32em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.tarjeta h2 { margin-bottom: .6rem; }

/* ---------- HERO ---------- */
.hero {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1rem;
  padding: 2rem 1rem 0;
  max-width: 900px;
  margin: 0 auto;
}

.hero-texto {
  text-align: center;
  color: #fff;
  padding-bottom: 2.5rem;
  flex: 0 1 420px;
}

.hero h1 {
  font-size: clamp(3.4rem, 12vw, 6.4rem);
  background: linear-gradient(110deg, #e6338a 0%, #e6338a 36%, #ff8cc0 46%, #fff0f7 50%, #ff8cc0 54%, #e6338a 64%, #e6338a 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: brillo-texto 5s linear infinite;
  /* contorno blanco + sombra para que destaque sobre la purpurina */
  filter:
    drop-shadow(0 0 1.5px #fff) drop-shadow(0 0 1.5px #fff) drop-shadow(0 0 1px #fff)
    drop-shadow(0 3px 0 var(--rojo-oscuro)) drop-shadow(0 0 12px rgba(255, 255, 255, .8));
}

/* Cuenta atrás */
.cuenta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  margin: .5rem 0 1.1rem;
  color: var(--rojo-oscuro);
}
.cuenta-titulo {
  font-weight: 900;
  font-size: .95rem;
  background: rgba(255, 255, 255, .75);
  padding: .1rem .8rem;
  border-radius: 999px;
}
.cuenta-bloques { display: flex; gap: .45rem; }
.cuenta-bloque {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 3.6rem;
  padding: .35rem .3rem .3rem;
  border-radius: 14px;
  background: #fff;
  border: 2px solid var(--verde-claro);
  box-shadow: 0 0 14px rgba(255, 255, 255, .8), 0 4px 10px rgba(142, 15, 76, .15);
}
.cuenta-bloque b {
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;   /* que los números no bailen al cambiar */
  color: #e6338a;
}
.cuenta-bloque small {
  font-size: .65rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.cuenta-final {
  background: rgba(255, 255, 255, .85);
  padding: .4rem .9rem;
  border-radius: 14px;
  font-weight: 700;
}

.hero-elfo {
  width: clamp(170px, 34vw, 320px);
  height: auto;
  filter: drop-shadow(0 0 18px rgba(255, 255, 255, .9)) drop-shadow(0 10px 18px rgba(142, 15, 76, .3));
  animation: saltito 3.2s ease-in-out infinite;
  /* la foto está cortada por abajo: la difuminamos */
  -webkit-mask-image: linear-gradient(to bottom, #000 82%, transparent);
  mask-image: linear-gradient(to bottom, #000 82%, transparent);
}

@keyframes saltito {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-10px) rotate(1deg); }
}

.boton {
  display: inline-block;
  padding: .8rem 1.6rem;
  border-radius: 999px;
  background: #fff;
  color: var(--rojo);
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 4px 0 var(--rojo-oscuro), 0 0 18px rgba(255, 255, 255, .8);
  transition: transform .15s;
}
.boton:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--rojo-oscuro); }

/* En móvil: texto arriba, elfo debajo */
/* En móvil: título a la izquierda y elfo a la derecha, todo en la primera pantalla */
@media (max-width: 640px) {
  .hero {
    display: grid;
    grid-template-columns: 1fr 40%;
    grid-template-areas:
      "titulo elfo"
      "estado estado"
      "boton  boton";
    align-items: center;
    column-gap: .25rem;
    padding: 1.25rem 1rem 1.5rem;
    text-align: center;
  }
  .hero-texto { display: contents; }   /* sus partes se colocan en la rejilla */
  .hero h1 { grid-area: titulo; align-self: center; font-size: clamp(2.9rem, 15vw, 4rem); margin-top: .3rem; }
  .hero-elfo {
    grid-area: elfo;
    width: 100%;
    max-width: 190px;
    justify-self: center;
    -webkit-mask-image: linear-gradient(to bottom, #000 75%, transparent);
    mask-image: linear-gradient(to bottom, #000 75%, transparent);
  }
  .cuenta { grid-area: estado; justify-self: center; margin: .25rem 0 1rem; position: relative; z-index: 1; }
  .boton { grid-area: boton; justify-self: center; }
}

/* ---------- TARJETAS ---------- */
main {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
  display: grid;
  gap: 1.5rem;
}

/* Marco de purpurina: el borde transparente deja ver la purpurina de debajo */
.tarjeta {
  border-radius: 26px;
  padding: 1.75rem 1.5rem;
  border: 7px solid transparent;
  background:
    linear-gradient(var(--crema), var(--crema)) padding-box,
    linear-gradient(rgba(216, 27, 114, .45), rgba(216, 27, 114, .45)) border-box,
    url("img/glitter-rosa.webp") border-box;
  background-size: auto, auto, 300px auto;
  box-shadow: var(--sombra), 0 0 0 2px #fff, 0 0 22px rgba(255, 255, 255, .7);
}

.tarjeta h2 {
  position: relative;
  width: fit-content;
  margin: 0 auto 1rem;
  font-size: clamp(2.1rem, 7vw, 2.8rem);
  text-align: center;
  background: linear-gradient(110deg, var(--rojo) 0%, var(--rojo) 38%, #ff9cc8 47%, #fff0f6 50%, #ff9cc8 53%, var(--rojo) 62%, var(--rojo) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: brillo-texto 4.5s linear infinite;
  padding: 0 .15em;
}
.tarjeta h2::before, .tarjeta h2::after {
  content: "✦";
  position: absolute;
  top: .1em;
  font-size: .55em;
  color: var(--verde-claro);
  -webkit-text-fill-color: var(--verde-claro);
  animation: parpadeo 2.2s ease-in-out infinite;
}
.tarjeta h2::before { left: -1em; }
.tarjeta h2::after { right: -1em; animation-delay: 1.1s; }

.intro, .nota { text-align: center; }
.nota {
  background: var(--rosa-claro);
  border-radius: 12px;
  padding: .75rem 1rem;
  font-size: .95rem;
  margin-bottom: 0;
}

/* ---------- PASOS ---------- */
.pasos { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.pasos li { display: flex; gap: 1rem; align-items: flex-start; }
.pasos p { margin: .2rem 0 0; }
.paso-num {
  flex: none;
  width: 2.4rem; height: 2.4rem;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--rojo);
  color: #fff;
  font-weight: 900;
  font-size: 1.2rem;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--verde-claro);
}
.whatsapp {
  display: inline-block;
  background: var(--rojo);
  color: #fff;
  font-weight: 900;
  padding: .05rem .6rem;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
}

/* ---------- TIPOS DE ELFO ---------- */
.elfos { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .75rem; }
.elfo {
  display: grid;
  grid-template-columns: 3.4rem 1fr;
  gap: .9rem;
  align-items: center;
  background: #fff;
  border-radius: 16px;
  padding: .8rem 1rem;
  border-left: 6px solid var(--c);
}
.elfo-puntos {
  width: 3.4rem; height: 3.4rem;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--c);
  color: #fff;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  font-size: 1.35rem;
}
.elfo-puntos small { display: block; font-size: .5rem; text-transform: uppercase; }
.elfo h3 { margin: 0; font-size: 1.1rem; color: var(--rojo-oscuro); }
.elfo p { margin: .15rem 0 0; font-size: .95rem; }

/* ---------- CLASIFICACIÓN ---------- */
.podio {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: .5rem;
  margin-bottom: 1.25rem;
}
.podio-puesto { text-align: center; }
.podio-nombre {
  font-weight: 900;
  background: #fff;
  border: 2px solid var(--rosa-claro);
  border-radius: 10px;
  padding: .25rem .3rem;
  margin-bottom: .35rem;
  word-break: break-word;
  font-size: .95rem;
}
.podio-bloque {
  border-radius: 14px 14px 4px 4px;
  color: #fff;
  font-weight: 900;
  padding: .5rem .2rem;
  box-shadow: inset 0 -6px 0 rgba(142, 15, 76, .25);
}
.podio-bloque .medalla {
  display: block;
  font-family: "Mountains of Christmas", cursive;
  font-size: 2.4rem;
  line-height: 1;
  text-shadow: 0 0 10px rgba(255, 255, 255, .9);
}
.p1 { order: 2; } .p1 .podio-bloque { background: var(--rojo); height: 9rem; }
.p2 { order: 1; } .p2 .podio-bloque { background: #e8579a; height: 7rem; }
.p3 { order: 3; } .p3 .podio-bloque { background: #f48fb8; height: 5.5rem; }

.ranking { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.fila {
  display: grid;
  grid-template-columns: 2.2rem 1fr auto;
  align-items: center;
  gap: .75rem;
  background: #fff;
  border: 2px solid var(--rosa-claro);
  border-radius: 14px;
  padding: .6rem .9rem;
}
.fila-pos { font-weight: 900; color: var(--rojo); font-size: 1.2rem; text-align: center; }
.fila-nombre { font-weight: 700; }
.fila-puntos {
  background: var(--rojo);
  color: #fff;
  border-radius: 999px;
  padding: .2rem .75rem;
  font-weight: 900;
  white-space: nowrap;
}
.vacio {
  text-align: center;
  background: #fff;
  border-radius: 14px;
  padding: 1.25rem;
  font-weight: 700;
}
.actualizado {
  text-align: center;
  font-size: .85rem;
  margin: 1rem 0 0;
  color: var(--rojo-oscuro);
  font-weight: 700;
}

/* ---------- PREMIO ---------- */
.premio {
  text-align: center;
  position: relative;
  padding-inline: 4.5rem;    /* sitio para el elfo a un lado */
  margin-bottom: 3.5rem;     /* las piernas cuelgan por debajo */
}
/* Elfo rosa sentado en el borde de abajo de la tarjeta, en la esquina:
   las rodillas quedan sobre el borde y las piernas cuelgan por fuera */
.premio-elfo {
  position: absolute;
  left: .6rem;
  bottom: -72px;
  height: 230px;
  width: auto;
  filter: drop-shadow(0 0 12px rgba(255, 255, 255, .9)) drop-shadow(0 6px 10px rgba(142, 15, 76, .3));
  pointer-events: none;
  z-index: 1;
}
.premio p { margin: .3rem 0; }
.premio-icono { font-size: 3rem; }
.premio-titulo {
  font-family: "Mountains of Christmas", cursive;
  font-size: clamp(2rem, 7vw, 2.6rem);
  font-weight: 700;
  background: linear-gradient(110deg, var(--rojo) 0%, var(--rojo) 38%, #ff9cc8 47%, #fff0f6 50%, #ff9cc8 53%, var(--rojo) 62%, var(--rojo) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: brillo-texto 4s linear infinite;
}

footer {
  text-align: center;
  color: var(--rojo-oscuro);
  font-weight: 900;
  padding: 0 1rem 2rem;
  text-shadow: 0 0 8px #fff, 0 0 4px #fff;
}

/* ---------- BOTÓN DE MÚSICA ---------- */
.oculto { display: none !important; }
.musica {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: .4rem;
  height: 3.4rem;
  min-width: 3.4rem;
  padding: 0 .9rem;
  border-radius: 999px;
  border: 3px solid #fff;
  background: var(--rojo);
  color: #fff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 0 0 2px var(--verde-claro), 0 0 20px rgba(255, 255, 255, .9), 0 6px 14px rgba(142, 15, 76, .35);
}
.musica-icono { font-size: 1.5rem; line-height: 1; }
.musica-texto { display: none; }
/* Bloqueada por el navegador: invita a tocar */
.musica.pide { animation: latido 1.2s ease-in-out infinite; }
.musica.pide .musica-texto { display: inline; }
/* Sonando: la nota se mueve */
.musica.sonando .musica-icono { animation: baile 1s ease-in-out infinite; }
/* Apagada: más discreta */
.musica.apagada { background: #fff; color: var(--rojo); }

@keyframes latido {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
@keyframes baile {
  0%, 100% { transform: rotate(-12deg) translateY(0); }
  50% { transform: rotate(12deg) translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
}
