/* ============================================================
   EXPERIENCIA VISUAL: FLORES AMARILLAS Y BLANCAS 🪐🌼🌻
   ULTRA OPTIMIZADO PARA TELÉFONOS GAMA BAJA
   60 FPS Fluidos • Sin Lag • Cero Sobrecarga GPU
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --gold-glow: #ffd700;
  --gold-soft: #fff3a8;
  --bg-dark: #060212;
  --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: var(--font-body);
  color: #fff;
  touch-action: none;
}

/* Canvas WebGL 3D Principal */
#webgl-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 1;
  display: block;
  touch-action: none;
  transform: translateZ(0);
}

/* Canvas 2D Lluvia de Flores */
#petal-shower-canvas, #flower-shower-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  pointer-events: none;
  z-index: 35;
  transform: translateZ(0);
}

/* ============================================================
   BOTÓN DE CONTROL DE MÚSICA FLOTANTE
   ============================================================ */
.music-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 80;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(18, 7, 35, 0.92);
  border: 1.5px solid rgba(255, 215, 0, 0.65);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  outline: none;
  transition: transform 0.12s ease;
  will-change: transform;
}

.music-toggle:active {
  transform: scale(0.9);
}

.music-toggle.playing {
  border-color: rgba(255, 235, 120, 0.95);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.45);
  animation: musicPulse 2.5s ease-in-out infinite alternate;
}

@keyframes musicPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.05); }
}

.music-icon {
  font-size: 1.2rem;
  line-height: 1;
}

/* ============================================================
   PANTALLA DE INICIO (MINIMALISTA Y CÓSMICA)
   ============================================================ */
#intro-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 50;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, rgba(30, 12, 54, 0.96) 0%, rgba(6, 2, 18, 0.99) 80%);
  transition: opacity 0.35s ease, visibility 0.35s;
  cursor: pointer;
}

#intro-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-seed-glow {
  position: relative;
  width: 100px;
  height: 100px;
  margin-bottom: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.intro-seed-glow .aura {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.65) 0%, rgba(255, 160, 0, 0.2) 50%, transparent 75%);
  animation: pulseAura 2.2s ease-in-out infinite alternate;
  will-change: transform;
}

.intro-seed-glow .flower-icon {
  font-size: 50px;
  animation: floatSeed 3s ease-in-out infinite;
  z-index: 2;
  will-change: transform;
}

@keyframes pulseAura {
  0% { transform: scale(0.9); opacity: 0.6; }
  100% { transform: scale(1.2); opacity: 1; }
}

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

.intro-prompt {
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 1.5px;
  color: #fff2a8;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
  animation: promptGlow 2s ease-in-out infinite alternate;
  will-change: transform, opacity;
}

@keyframes promptGlow {
  0% { opacity: 0.75; transform: scale(0.98); }
  100% { opacity: 1; transform: scale(1.02); }
}

/* ============================================================
   HUD DEL TÚNEL: VIAJANDOOOO...
   ============================================================ */
.traveling-hud {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 25;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease;
  text-align: center;
  width: 90%;
}

.traveling-hud.active {
  opacity: 1;
  visibility: visible;
}

.traveling-text {
  font-family: var(--font-body);
  font-size: clamp(1.8rem, 6.5vw, 2.8rem);
  font-weight: 700;
  letter-spacing: 2.5px;
  color: #fff9d6;
  text-shadow: 
    0 0 14px rgba(255, 215, 0, 0.8),
    0 0 25px rgba(255, 160, 0, 0.5);
  animation: travelingPulse 1.4s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes travelingPulse {
  0% { transform: scale(0.96); opacity: 0.85; }
  100% { transform: scale(1.04); opacity: 1; }
}

/* ============================================================
   FLASH OVERLAY (TRANSICIÓN TÚNEL -> IMAGEN FINAL)
   ============================================================ */
#flash-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 40;
  background: radial-gradient(circle, #fffdf2 0%, #ffd700 45%, #ff8c00 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}

#flash-overlay.active {
  opacity: 1;
}

/* ============================================================
   OVERLAY DE LA IMAGEN FINAL ("TÚ BRILLAS TAN LINDO")
   ============================================================ */
.card-reveal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 30;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, rgba(32, 10, 52, 0.55) 0%, rgba(4, 1, 12, 0.85) 85%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0.4s;
  padding: 14px;
}

.card-reveal-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.card-reveal-wrapper {
  position: relative;
  width: clamp(240px, 76vw, 320px);
  max-height: 80vh;
  aspect-ratio: 9 / 16;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: cardFloat 4.5s ease-in-out infinite alternate;
  will-change: transform;
  cursor: pointer;
  transform: translateZ(0);
}

@keyframes cardFloat {
  0% { transform: translateY(-5px); }
  100% { transform: translateY(5px); }
}

.card-back-aura {
  position: absolute;
  width: 115%;
  height: 115%;
  border-radius: 24px;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.55) 0%, rgba(255, 140, 0, 0.2) 45%, transparent 75%);
  animation: cardAuraPulse 3s ease-in-out infinite alternate;
  pointer-events: none;
  will-change: transform;
}

@keyframes cardAuraPulse {
  0% { transform: scale(0.93); opacity: 0.6; }
  100% { transform: scale(1.12); opacity: 0.9; }
}

.card-stage {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 18px;
  overflow: hidden;
  border: 1.5px solid rgba(255, 235, 140, 0.9);
  box-shadow: 
    0 0 20px rgba(255, 215, 0, 0.4),
    0 10px 30px rgba(0, 0, 0, 0.85);
  background: #000;
  display: flex;
}

.card-reveal-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-shine {
  position: absolute;
  top: 0;
  left: -150%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    115deg,
    transparent 0%,
    rgba(255, 255, 255, 0.25) 45%,
    rgba(255, 235, 140, 0.45) 50%,
    transparent 100%
  );
  transform: skewX(-22deg);
  animation: cardShineSweep 5s infinite ease-in-out 1s;
  pointer-events: none;
}

@keyframes cardShineSweep {
  0% { left: -150%; }
  30%, 100% { left: 200%; }
}

/* ============================================================
   RESPONSIVE OPTIMIZADO PARA MÓVILES DE 360px - 768px
   ============================================================ */
@media (max-width: 768px) {
  .card-reveal-wrapper {
    width: clamp(220px, 74vw, 280px);
    max-height: 76vh;
  }

  .traveling-text {
    font-size: 1.8rem;
    letter-spacing: 2px;
  }
}
