/* Estilos comunes. Cada plantilla define sus colores con estas variables. */
:root {
  --rg-fondo: #1a1026;
  --rg-texto: #fff7ea;
  --rg-acento: #ffc93c;
  --rg-intro-fondo: radial-gradient(circle at 50% 40%, #3a2350, #120a1c);
  --rg-fuente-titulo: 'Dancing Script', cursive;
  --rg-fuente: 'Quicksand', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--rg-fondo);
  color: var(--rg-texto);
  font-family: var(--rg-fuente);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }

/* ---------- Intro "toca para abrir" ---------- */
.rg-intro {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: var(--rg-intro-fondo);
  cursor: pointer;
  transition: opacity .7s ease, transform .7s ease;
}
.rg-intro.rg-saliendo { opacity: 0; transform: scale(1.08); pointer-events: none; }
.rg-intro-caja { text-align: center; padding: 24px; }
.rg-intro-icono { font-size: 88px; animation: rg-latido 1.6s ease-in-out infinite; }
.rg-intro-texto { font-family: var(--rg-fuente-titulo); font-size: 2rem; margin: 18px 0 26px; }
.rg-intro-boton {
  font: 600 1rem var(--rg-fuente);
  color: var(--rg-fondo); background: var(--rg-acento);
  border: 0; border-radius: 999px; padding: 14px 30px;
  box-shadow: 0 0 0 0 var(--rg-acento);
  animation: rg-pulso 2s infinite;
}
.rg-expirado, .rg-espera { cursor: default; }

/* ---------- VIP: cuenta regresiva ---------- */
.rg-reloj { display: grid; grid-template-columns: repeat(4, 64px); justify-content: center; gap: 0 10px; }
.rg-reloj b { font-size: 2.2rem; font-weight: 600; color: var(--rg-acento); grid-row: 1; }
.rg-reloj small { grid-row: 2; opacity: .7; font-size: .8rem; }

/* ---------- VIP: pregunta secreta ---------- */
.rg-pregunta { display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 320px; margin: 0 auto; }
.rg-pregunta label { font-size: 1.1rem; }
.rg-pregunta input {
  width: 100%; font: 1rem var(--rg-fuente); text-align: center; color: var(--rg-texto);
  background: color-mix(in srgb, var(--rg-texto) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--rg-acento) 60%, transparent); border-radius: 12px; padding: 12px 14px; outline: none;
}
.rg-pregunta input:focus { border-color: var(--rg-acento); }
.rg-pregunta .rg-intro-boton { animation: none; }
.rg-pista { margin: 0; min-height: 1.4em; opacity: .85; font-size: .95rem; }
.rg-mal { animation: rg-temblor .4s; }
@keyframes rg-temblor { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes rg-latido { 0%,100% { transform: scale(1); } 15% { transform: scale(1.12); } 30% { transform: scale(1); } 45% { transform: scale(1.08); } }
@keyframes rg-pulso { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--rg-acento) 70%, transparent); } 70% { box-shadow: 0 0 0 18px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---------- Botón de música ---------- */
.rg-musica {
  position: fixed; right: 16px; bottom: 16px; z-index: 90;
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: color-mix(in srgb, var(--rg-texto) 18%, transparent);
  color: var(--rg-texto); font-size: 20px;
  backdrop-filter: blur(6px);
  animation: rg-girar 4s linear infinite;
}
.rg-musica.rg-off { animation: none; opacity: .5; text-decoration: line-through; }
@keyframes rg-girar { to { transform: rotate(360deg); } }

/* ---------- Canción: tarjeta de Spotify (barra inferior) o YouTube (miniatura) ---------- */
.rg-cancion, .rg-yt {
  position: fixed; z-index: 90; bottom: 12px;
  opacity: 0; pointer-events: none; transform: translateY(24px); transition: opacity .6s, transform .6s;
}
.rg-cancion { left: 12px; right: 12px; max-width: 480px; margin: 0 auto; height: 80px; border-radius: 12px; }
.rg-yt { left: 12px; width: 200px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #000; box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.rg-cancion.rg-visible, .rg-yt.rg-visible { opacity: 1; pointer-events: auto; transform: none; }
.rg-cancion iframe, .rg-yt iframe { width: 100%; height: 100%; border: 0; display: block; border-radius: 12px; }
.rg-cerrar {
  position: absolute; top: -10px; right: -6px; width: 26px; height: 26px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.75); color: #fff; font-size: 16px; line-height: 1; cursor: pointer;
}
.rg-yt .rg-cerrar { top: 4px; right: 4px; }
/* Deja espacio para que la barra no tape el final de la página */
body:has(.rg-cancion.rg-visible) { padding-bottom: 100px; }

/* ---------- Máquina de escribir ---------- */
.rg-cursor::after { content: '|'; margin-left: 2px; animation: rg-parpadeo .8s steps(1) infinite; }
@keyframes rg-parpadeo { 50% { opacity: 0; } }

/* ---------- Galería deslizable ---------- */
.rg-galeria {
  display: flex; gap: 16px; overflow-x: auto;
  scroll-snap-type: x mandatory; padding: 12px 16px 24px;
  scrollbar-width: none;
}
.rg-galeria::-webkit-scrollbar { display: none; }
.rg-galeria:has(figure:only-child) { justify-content: center; }
.rg-galeria figure {
  flex: 0 0 78%; max-width: 420px; margin: 0; scroll-snap-align: center;
  background: #fff; color: #333; padding: 10px 10px 14px; border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  transform: rotate(calc((var(--i) % 3 - 1) * 2deg));
}
.rg-galeria img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 2px; }
.rg-galeria figcaption { font-family: var(--rg-fuente-titulo); font-size: 1.3rem; text-align: center; margin-top: 8px; }

/* ---------- Capas de efectos ---------- */
.rg-canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 80; }
.rg-flotantes { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
.rg-flotantes span {
  position: absolute; bottom: -40px; opacity: .85;
  animation: rg-subir linear forwards;
  color: var(--rg-acento);
}
@keyframes rg-subir { to { transform: translate(30px, -115vh) rotate(25deg); opacity: 0; } }

/* ---------- Revelado progresivo ---------- */
.rg-oculto { opacity: 0; transform: translateY(20px); transition: opacity 1s ease, transform 1s ease; }
.rg-visible { opacity: 1; transform: none; }

.rg-firma { font-family: var(--rg-fuente-titulo); font-size: 1.6rem; text-align: right; margin-top: 18px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
