/* ============================================================
   EXPERIENCIA VISUAL: SATURNO & FLORES AMARILLAS Y BLANCAS 🪐🌼🌻
   Ultra Optimizado para Teléfonos Gama Baja (Mali-G52 / Adreno / 2GB RAM)
   60 FPS Fluidos • Sin Lag • Cero Sobrecarga de 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;
}

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;
}

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

/* ============================================================
   BOTÓN DE CONTROL DE MÚSICA FLOTANTE
   ============================================================ */
.music-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 60;
  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 12px rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  outline: none;
  transition: transform 0.15s 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 16px rgba(255, 215, 0, 0.5);
  animation: musicPulse 2.5s ease-in-out infinite alternate;
}

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

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

/* ============================================================
   PANTALLA DE INICIO (MINIMALISTA Y ULTRA FLUIDA)
   ============================================================ */
#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: 110px;
  height: 110px;
  margin-bottom: 20px;
  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.75) 0%, rgba(255, 160, 0, 0.25) 50%, transparent 75%);
  animation: pulseAura 2.2s ease-in-out infinite alternate;
  will-change: transform;
}

.intro-seed-glow .flower-icon {
  font-size: 54px;
  filter: drop-shadow(0 0 15px #ffd700);
  animation: floatSeed 3s ease-in-out infinite;
  z-index: 2;
  will-change: transform;
}

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

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

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

@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.4s 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, 3rem);
  font-weight: 700;
  letter-spacing: 3px;
  color: #fff9d6;
  text-shadow: 
    0 0 18px rgba(255, 215, 0, 0.85),
    0 0 35px rgba(255, 160, 0, 0.6);
  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.05); opacity: 1; }
}

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

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

/* ============================================================
   ESCENA SATURNO
   ============================================================ */
#nebula-ui {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 1s ease 0.2s, visibility 1s;
}

#nebula-ui.active {
  opacity: 1;
  visibility: visible;
}

/* ============================================================
   FOTO CENTRAL EN SATURNO
   ============================================================ */
#center-photo-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 25;
  transition: transform 0.15s ease;
}

.photo-hologram-wrapper {
  position: relative;
  width: clamp(100px, 27vw, 125px);
  aspect-ratio: 9 / 16;
  border-radius: 14px;
  padding: 3px;
  background: linear-gradient(135deg, rgba(255, 235, 120, 0.6) 0%, rgba(255, 140, 0, 0.35) 50%, rgba(138, 43, 226, 0.4) 100%);
  box-shadow: 
    0 0 20px rgba(255, 215, 0, 0.35),
    0 10px 25px rgba(0, 0, 0, 0.75);
  animation: photoLevitate 4.5s ease-in-out infinite alternate;
  will-change: transform;
}

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

.photo-inner-border {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1.5px solid rgba(255, 240, 160, 0.8);
  background: #000;
}

.photo-inner-border img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-gleam {
  position: absolute;
  top: 0;
  left: -150%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    115deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  transform: skewX(-20deg);
  animation: gleamSweep 5s infinite ease-in-out 1s;
  pointer-events: none;
}

@keyframes gleamSweep {
  0% { left: -150%; }
  35%, 100% { left: 200%; }
}

/* Indicador de acción para tocar la imagen */
.photo-tap-hint {
  margin-top: 8px;
  white-space: nowrap;
  background: rgba(18, 6, 36, 0.94);
  border: 1px solid rgba(255, 220, 100, 0.75);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
  border-radius: 18px;
  padding: 3px 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  pointer-events: none;
  animation: hintFloat 2s ease-in-out infinite alternate;
  z-index: 28;
  will-change: transform;
}

.hint-arrow {
  font-size: 0.8rem;
  display: inline-block;
  animation: hintArrowTap 1.2s ease-in-out infinite alternate;
}

@keyframes hintArrowTap {
  0% { transform: translateY(1.5px); }
  100% { transform: translateY(-1.5px); }
}

.hint-text {
  font-family: var(--font-body);
  font-size: 0.66rem;
  font-weight: 600;
  color: #fffdf0;
  letter-spacing: 0.3px;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.7);
}

.hint-sparkle {
  font-size: 0.72rem;
}

@keyframes hintFloat {
  0% { transform: translateY(0); }
  100% { transform: translateY(3px); }
}

/* ============================================================
   MENSAJES CORTOS FLOTANTES (ACCELERACIÓN GPU PURA)
   ============================================================ */
#floating-messages-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.floating-message-bubble {
  position: absolute;
  pointer-events: auto;
  cursor: pointer;
  z-index: 22;
  max-width: 105px;
  will-change: transform;
  transform: translate(-50%, -50%);
  animation: floatBubble 4s ease-in-out infinite alternate;
}

.floating-message-bubble:nth-child(even) {
  animation-duration: 4.6s;
  animation-delay: -1.5s;
}

.floating-message-bubble:nth-child(3n) {
  animation-duration: 5s;
  animation-delay: -3s;
}

@keyframes floatBubble {
  0% { transform: translate(-50%, -50%) translateY(-4px); }
  100% { transform: translate(-50%, -50%) translateY(4px); }
}

.message-card-inner {
  background: rgba(18, 7, 36, 0.92);
  border: 1px solid rgba(255, 215, 0, 0.45);
  border-radius: 12px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.65);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.floating-message-bubble:active .message-card-inner {
  transform: scale(1.1);
  background: rgba(36, 14, 66, 0.96);
  border-color: rgba(255, 230, 100, 0.85);
}

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

.message-text {
  font-size: 0.65rem;
  line-height: 1.22;
  color: #fffdf0;
  font-weight: 500;
  white-space: pre-line;
  letter-spacing: 0.1px;
}

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

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

.card-reveal-wrapper {
  position: relative;
  width: clamp(235px, 72vw, 300px);
  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;
}

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

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

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

.card-stage {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 18px;
  overflow: hidden;
  border: 2px solid rgba(255, 235, 140, 0.9);
  box-shadow: 
    0 0 25px rgba(255, 215, 0, 0.45),
    0 15px 40px rgba(0, 0, 0, 0.9);
  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.3) 45%,
    rgba(255, 235, 140, 0.5) 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 GAMA BAJA (360x800 Samsung A03/A12/A22)
   ============================================================ */
@media (max-width: 768px) {
  .photo-hologram-wrapper {
    width: clamp(92px, 26vw, 105px);
    border-radius: 12px;
    padding: 2.5px;
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.35), 0 8px 20px rgba(0, 0, 0, 0.7);
  }

  .photo-inner-border {
    border-radius: 10px;
    border: 1px solid rgba(255, 240, 160, 0.75);
  }

  .card-reveal-wrapper {
    width: clamp(220px, 70vw, 270px);
  }

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

  .floating-message-bubble {
    max-width: 88px;
  }

  .message-card-inner {
    padding: 4px 6px;
    border-radius: 10px;
    gap: 1.5px;
    background: rgba(16, 6, 32, 0.94);
    border: 1px solid rgba(255, 215, 0, 0.4);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.7);
  }

  .message-icon {
    font-size: 0.88rem;
  }

  .message-text {
    font-size: 0.58rem;
    line-height: 1.18;
    letter-spacing: 0;
  }
}
