/* =========================================================
   VARIANTE 3: RAMO MÁGICO & LLUVIA DE PÉTALOS (ULTRA-RESPONSIVE)
   Adaptación total para móviles, tablets, desktop y landscape
   ========================================================= */

/* Ocultar y cancelar animaciones del escenario antiguo cuando la variante bouquet está activa */
body.variant-bouquet .flowers,
body.variant-bouquet .flowers * {
  display: none !important;
  animation: none !important;
  transition: none !important;
}

body.variant-bouquet .night {
  background-image:
    radial-gradient(ellipse at 50% 30%, rgba(255, 195, 0, 0.15) 0%, transparent 65%),
    radial-gradient(ellipse at bottom, #180f02 0%, #060401 100%),
    linear-gradient(180deg, #0a0600 0%, #140c02 50%, #1f1203 100%) !important;
  filter: none !important;
}

/* Contenedor principal de la escena Bouquet con centrado armónico */
.bouquet-scene {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: max(10px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom)) 16px;
  box-sizing: border-box;
  z-index: 20;
  pointer-events: none;
}

body.variant-bouquet .bouquet-scene {
  display: flex !important;
}

/* Canvas para la lluvia de pétalos y destellos mágicos */
#bouquet-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 21;
  pointer-events: auto;
}

/* =========================================================
   TARJETA DEDICATORIA SUPERIOR (EQUILIBRADA Y CENTRADA)
   ========================================================= */
.bouquet-card {
  position: relative;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: clamp(8px, 1.5vh, 14px) clamp(16px, 3.5vw, 28px);
  background: rgba(22, 14, 3, 0.84);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 214, 10, 0.38);
  border-radius: 18px;
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.7),
    0 0 24px rgba(255, 195, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  pointer-events: auto;
  animation:
    cardEntrance 1.1s cubic-bezier(0.22, 1, 0.36, 1) both,
    cardFloat 4s 1.2s ease-in-out infinite alternate;
  width: auto;
  max-width: min(90vw, 440px);
  margin: clamp(28px, 5vh, 44px) 0 0 0;
  flex-shrink: 0;
}

@keyframes cardEntrance {
  0% {
    opacity: 0;
    transform: translateY(-25px);
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0px);
  }
}

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

.bouquet-card-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: clamp(8.5px, 2vw, 10.5px);
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: #ffc300;
  text-shadow: 0 0 10px rgba(255, 195, 0, 0.7);
  margin-bottom: 2px;
}

.bouquet-card-name {
  font-family: 'Dancing Script', cursive, 'Brush Script MT', sans-serif;
  font-size: clamp(1.65rem, 4.5vh, 2.4rem);
  font-weight: 700;
  color: #fffbeb;
  text-shadow:
    0 0 10px #ffd60a,
    0 0 25px #ffb703,
    0 0 45px #fb8500;
  line-height: 1.15;
  margin-bottom: 3px;
}

.bouquet-card-sub {
  font-family: 'Outfit', -apple-system, sans-serif;
  font-size: clamp(11px, 2.2vh, 13px);
  color: rgba(255, 243, 196, 0.92);
  letter-spacing: 0.6px;
  line-height: 1.35;
  font-weight: 300;
  max-width: 390px;
}

/* =========================================================
   RAMO DE FLORES TRIDIMENSIONAL (BOUQUET CENTERPIECE)
   ========================================================= */
.bouquet-display {
  position: relative;
  width: min(300px, 86vw);
  height: clamp(230px, 35vh, 290px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 25;
  pointer-events: auto;
  cursor: pointer;
  margin: auto 0;
  flex-shrink: 0;
  transform: scale(clamp(0.85, min(38vh, 42vw) / 260, 1.1));
  transform-origin: center center;
  transition: transform 0.3s ease;
}

/* Resplandor áureo envolvente detrás del ramo */
.bouquet-back-glow {
  position: absolute;
  bottom: 40px;
  width: min(260px, 75vw);
  height: min(260px, 75vw);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 214, 10, 0.32) 0%, rgba(251, 133, 0, 0.12) 50%, transparent 75%);
  filter: blur(24px);
  z-index: 1;
  animation: auraPulse 3.5s ease-in-out infinite alternate;
}

@keyframes auraPulse {
  0% { transform: scale(0.9); opacity: 0.65; }
  100% { transform: scale(1.1); opacity: 0.95; }
}

/* Hojas botánicas ornamentales en verde esmeralda y oliva */
.b-leaf {
  position: absolute;
  background: linear-gradient(135deg, #40916c 0%, #2d6a4f 60%, #1b4332 100%);
  border-radius: 80% 0 80% 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 2;
}

.b-leaf--1 {
  width: 36px;
  height: 60px;
  bottom: 96px;
  left: 10px;
  transform: rotate(-45deg);
}

.b-leaf--2 {
  width: 36px;
  height: 60px;
  bottom: 96px;
  right: 10px;
  transform: rotate(45deg) scaleX(-1);
}

.b-leaf--3 {
  width: 28px;
  height: 48px;
  bottom: 145px;
  left: 36px;
  transform: rotate(-18deg);
}

.b-leaf--4 {
  width: 28px;
  height: 48px;
  bottom: 145px;
  right: 36px;
  transform: rotate(18deg) scaleX(-1);
}

/* =========================================================
   FLORES INDIVIDUALES DEL RAMO (EN PRIMER PLANO DELANTE DEL FLORERO)
   ========================================================= */
.b-flower {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.55));
}

/* Flor principal central (Girasol grande superior en primer plano con floración de entrada) */
.b-flower--main {
  bottom: 96px;
  width: 140px;
  height: 140px;
  z-index: 13;
  animation:
    flowerEntranceMain 1.4s 0.75s cubic-bezier(0.34, 1.25, 0.64, 1) both,
    flowerSwayMain 5s 2.2s ease-in-out infinite alternate;
}

/* Flor izquierda (delante del florero con floración de entrada) */
.b-flower--left {
  bottom: 66px;
  left: 10px;
  width: 110px;
  height: 110px;
  transform: rotate(-18deg) scale(0.92);
  z-index: 12;
  animation:
    flowerEntranceLeft 1.3s 0.45s cubic-bezier(0.34, 1.25, 0.64, 1) both,
    flowerSwayLeft 4.5s 1.8s ease-in-out infinite alternate;
}

/* Flor derecha (delante del florero con floración de entrada) */
.b-flower--right {
  bottom: 66px;
  right: 10px;
  width: 110px;
  height: 110px;
  transform: rotate(18deg) scale(0.92);
  z-index: 12;
  animation:
    flowerEntranceRight 1.3s 0.6s cubic-bezier(0.34, 1.25, 0.64, 1) both,
    flowerSwayRight 4.8s 2.0s ease-in-out infinite alternate;
}

/* Flor fondo arriba con floración inicial */
.b-flower--top {
  bottom: 126px;
  width: 98px;
  height: 98px;
  transform: scale(0.85);
  z-index: 9;
  animation:
    flowerEntranceTop 1.2s 0.25s cubic-bezier(0.34, 1.25, 0.64, 1) both,
    flowerSwayTop 5.2s 1.5s ease-in-out infinite alternate;
}

/* Keyframes de entrada suave para floración orgánica */
@keyframes flowerEntranceMain {
  0% {
    opacity: 0;
    transform: scale(0.12) translateY(55px);
    filter: blur(5px);
  }
  65% {
    opacity: 1;
    transform: scale(1.06) translateY(-6px);
    filter: blur(0px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes flowerEntranceLeft {
  0% {
    opacity: 0;
    transform: rotate(-35deg) scale(0.12) translateY(45px);
    filter: blur(4px);
  }
  65% {
    opacity: 1;
    transform: rotate(-15deg) scale(0.96) translateY(-4px);
    filter: blur(0px);
  }
  100% {
    opacity: 1;
    transform: rotate(-18deg) scale(0.92) translateY(0);
  }
}

@keyframes flowerEntranceRight {
  0% {
    opacity: 0;
    transform: rotate(35deg) scale(0.12) translateY(45px);
    filter: blur(4px);
  }
  65% {
    opacity: 1;
    transform: rotate(15deg) scale(0.96) translateY(-4px);
    filter: blur(0px);
  }
  100% {
    opacity: 1;
    transform: rotate(18deg) scale(0.92) translateY(0);
  }
}

@keyframes flowerEntranceTop {
  0% {
    opacity: 0;
    transform: scale(0.12) translateY(40px);
    filter: blur(4px);
  }
  65% {
    opacity: 1;
    transform: scale(0.89) translateY(-5px);
    filter: blur(0px);
  }
  100% {
    opacity: 1;
    transform: scale(0.85) translateY(0);
  }
}

@keyframes flowerSwayMain {
  0% { transform: rotate(-2deg) translateY(0); }
  100% { transform: rotate(2deg) translateY(-5px); }
}

@keyframes flowerSwayLeft {
  0% { transform: rotate(-20deg) scale(0.92) translateY(0); }
  100% { transform: rotate(-15deg) scale(0.92) translateY(-4px); }
}

@keyframes flowerSwayRight {
  0% { transform: rotate(15deg) scale(0.92) translateY(-4px); }
  100% { transform: rotate(20deg) scale(0.92) translateY(0); }
}

@keyframes flowerSwayTop {
  0% { transform: scale(0.85) translateY(0); }
  100% { transform: scale(0.85) translateY(-6px); }
}

/* Capas concéntricas de pétalos dorados en espiral */
.b-petals-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Pétalos exteriores */
.b-petal {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 52px;
  margin-left: -9px;
  margin-top: -52px;
  border-radius: 50% 50% 30% 30%;
  background: linear-gradient(to top, #d97706 0%, #f59e0b 25%, #fbbf24 65%, #fef08a 100%);
  transform-origin: center bottom;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.7);
  opacity: 0.96;
}

/* Pétalos interiores */
.b-petals-layer--inner .b-petal {
  width: 14px;
  height: 40px;
  margin-left: -7px;
  margin-top: -40px;
  background: linear-gradient(to top, #b45309 0%, #d97706 30%, #f59e0b 70%, #fde047 100%);
}

/* Centro radiante de la flor perfectamente centrado */
.b-flower-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  margin-left: -22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #78350f 0%, #451a03 60%, #1c0a00 100%);
  box-shadow:
    0 0 16px rgba(245, 158, 11, 0.75),
    inset 0 0 8px rgba(0, 0, 0, 0.85);
  z-index: 10;
  border: 2px solid rgba(255, 214, 10, 0.6);
  animation: centerPulse 3s ease-in-out infinite alternate;
}

.b-flower--left .b-flower-center,
.b-flower--right .b-flower-center,
.b-flower--top .b-flower-center {
  width: 36px;
  height: 36px;
  margin-top: -18px;
  margin-left: -18px;
}

@keyframes centerPulse {
  0% { transform: scale(0.96); box-shadow: 0 0 12px rgba(245, 158, 11, 0.5); }
  100% { transform: scale(1.04); box-shadow: 0 0 24px rgba(245, 158, 11, 0.9); }
}

/* =========================================================
   ENVOLTURA DE REGALO DECORATIVA (KRAFT CONO & LAZO DE SEDA)
   ========================================================= */
.bouquet-wrap-container {
  position: absolute;
  bottom: 0;
  width: 135px;
  height: 115px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 4; /* El florero queda detrás de las flores */
  animation: wrapEntrance 1.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes wrapEntrance {
  0% {
    opacity: 0;
    transform: translateY(35px) scale(0.85);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Capa posterior de la envoltura */
.bouquet-wrap-back {
  position: absolute;
  bottom: 0;
  width: 135px;
  height: 115px;
  background: linear-gradient(150deg, #b08953 0%, #8f6937 50%, #63431a 100%);
  clip-path: polygon(10% 0%, 90% 0%, 65% 100%, 35% 100%);
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.65);
  border-radius: 4px;
}

/* Doblez frontal de papel kraft */
.bouquet-wrap-front {
  position: absolute;
  bottom: 0;
  width: 122px;
  height: 92px;
  background: linear-gradient(165deg, rgba(212, 163, 115, 0.95) 0%, rgba(166, 124, 82, 0.95) 60%, rgba(111, 78, 34, 1) 100%);
  clip-path: polygon(15% 0%, 85% 0%, 62% 100%, 38% 100%);
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.3), 0 8px 20px rgba(0, 0, 0, 0.5);
  z-index: 2;
}

/* Lazo decorativo de cinta dorada satinada */
.bouquet-bow {
  position: absolute;
  bottom: 20px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.bow-knot {
  width: 18px;
  height: 18px;
  background: radial-gradient(circle, #fff 15%, #ffd60a 60%, #e68a00 100%);
  border-radius: 50%;
  box-shadow: 0 0 10px #ffd60a;
  z-index: 3;
}

.bow-loop-left {
  width: 24px;
  height: 16px;
  background: linear-gradient(135deg, #ffd60a, #ff9e00);
  border-radius: 50% 20% 20% 50%;
  transform: rotate(-25deg);
  margin-right: -4px;
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.5);
}

.bow-loop-right {
  width: 24px;
  height: 16px;
  background: linear-gradient(225deg, #ffd60a, #ff9e00);
  border-radius: 20% 50% 50% 20%;
  transform: rotate(25deg);
  margin-left: -4px;
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.5);
}

.bow-tail-left {
  position: absolute;
  top: 10px;
  left: 2px;
  width: 10px;
  height: 26px;
  background: linear-gradient(to bottom, #ffd60a, #e68a00);
  clip-path: polygon(0 0, 100% 0, 70% 100%, 0 85%);
  transform: rotate(-15deg);
  z-index: 1;
}

.bow-tail-right {
  position: absolute;
  top: 10px;
  right: 2px;
  width: 10px;
  height: 26px;
  background: linear-gradient(to bottom, #ffd60a, #e68a00);
  clip-path: polygon(0 0, 100% 0, 100% 85%, 30% 100%);
  transform: rotate(15deg);
  z-index: 1;
}

/* Indicador táctil interactivo (posicionado fuera del flujo flex para no empujar la vista) */
.bouquet-interaction-hint {
  position: absolute;
  bottom: clamp(55px, 8vh, 68px);
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 380px;
  font-family: 'Outfit', sans-serif;
  font-size: clamp(9px, 2.2vw, 11px);
  color: rgba(255, 214, 10, 0.75);
  letter-spacing: 0.6px;
  z-index: 22;
  text-align: center;
  pointer-events: none;
  animation: hintBlink 2.5s ease-in-out infinite;
}

@keyframes hintBlink {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.95; }
}

/* =========================================================
   BOTÓN FLOTANTE DE CONTROL DE MÚSICA (COMPACTO Y ELEGANTE)
   ========================================================= */
.music-toggle-btn {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  background: rgba(18, 14, 28, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 214, 10, 0.45);
  border-radius: 9999px;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: all 0.25s ease;
  outline: none;
  box-sizing: border-box;
}

.music-toggle-btn:hover {
  background: rgba(26, 20, 38, 0.95);
  border-color: rgba(255, 214, 10, 0.7);
  transform: scale(1.05);
}

.music-toggle-btn.is-playing .music-icon {
  display: inline-block;
  animation: musicPulse 1.8s ease-in-out infinite;
}

@keyframes musicPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 4px #ffd60a); }
  50% { transform: scale(1.2); filter: drop-shadow(0 0 10px #ffd60a); }
}

/* En móviles: botón circular perfecto que nunca se corta ni empuja el borde */
@media (max-width: 600px) {
  .music-toggle-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50%;
    right: max(12px, env(safe-area-inset-right));
    top: max(10px, env(safe-area-inset-top));
  }
  .music-toggle-btn .music-label {
    display: none !important;
  }
  .music-toggle-btn .music-icon {
    font-size: 15px;
    line-height: 1;
    margin: 0;
  }
}

/* =========================================================
   ADAPTACIÓN PARA PANTALLAS CON ALTURA COMPACTA (< 640px)
   ========================================================= */
@media (max-height: 640px) {
  .bouquet-card {
    padding: 6px 16px;
  }
  .bouquet-card-tag {
    font-size: 8px;
    letter-spacing: 1.2px;
  }
  .bouquet-card-name {
    font-size: 1.6rem;
  }
  .bouquet-card-sub {
    font-size: 10.5px;
    line-height: 1.25;
  }
  .bouquet-display {
    height: 210px;
    transform: scale(0.78);
  }
  .bouquet-interaction-hint {
    display: none;
  }
}

/* =========================================================
   ADAPTACIÓN PARA MÓVILES EN MODO HORIZONTAL (LANDSCAPE)
   Distribución en 2 columnas: Tarjeta a la izquierda, Ramo a la derecha
   ========================================================= */
@media (orientation: landscape) and (max-height: 520px) {
  .bouquet-scene {
    flex-direction: row !important;
    justify-content: center !important;
    align-items: center !important;
    gap: clamp(16px, 4vw, 40px) !important;
    padding: 10px 24px !important;
  }

  .bouquet-card {
    max-width: min(44vw, 360px) !important;
    padding: 10px 18px !important;
  }

  .bouquet-card-name {
    font-size: 1.65rem !important;
  }

  .bouquet-card-sub {
    font-size: 10.5px !important;
  }

  .bouquet-display {
    height: 220px !important;
    transform: scale(0.8) !important;
    transform-origin: center center !important;
  }

  .bouquet-interaction-hint {
    display: none !important;
  }
}

/* =========================================================
   ADAPTACIÓN PARA PANTALLAS GRANDES Y DESKTOP ESPACIOSO
   (Asegura que el ramo y la tarjeta no se vean diminutos en monitores anchos)
   ========================================================= */
@media (min-width: 900px) and (min-height: 600px) {
  .bouquet-scene {
    padding: 24px 40px;
    gap: 32px;
  }

  .bouquet-card {
    max-width: 560px;
    padding: 16px 36px;
  }

  .bouquet-card-tag {
    font-size: 11px;
    letter-spacing: 2px;
  }

  .bouquet-card-name {
    font-size: 3rem;
  }

  .bouquet-card-sub {
    font-size: 14px;
    max-width: 480px;
  }

  .bouquet-display {
    width: 340px;
    height: 320px;
    transform: scale(1.22);
    transform-origin: center center;
  }
}

@media (min-width: 1400px) and (min-height: 750px) {
  .bouquet-card {
    max-width: 620px;
    padding: 20px 44px;
  }

  .bouquet-card-name {
    font-size: 3.6rem;
  }

  .bouquet-card-sub {
    font-size: 15.5px;
    max-width: 520px;
  }

  .bouquet-display {
    width: 380px;
    height: 350px;
    transform: scale(1.35);
  }
}

/* =========================================================
   OPTIMIZACIONES EXCLUSIVAS PARA MÓVIL (60 FPS & SIN LAG)
   - Oculta la 4ta flor duplicada del fondo (.b-flower--top)
   - Quita filtros costosos individuales (drop-shadow) de cada flor
   - Unifica la sombra en el contenedor padre
   ========================================================= */
body.is-mobile-device .b-flower--top {
  display: none !important;
  animation: none !important;
}

body.is-mobile-device .b-flower {
  filter: none !important;
}

body.is-mobile-device .bouquet-display {
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.6));
}

body.is-mobile-device .bouquet-card {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

body.is-mobile-device .bouquet-back-glow {
  filter: none !important;
  animation: none !important;
  opacity: 0.85;
}

@media (max-width: 768px) {
  .b-flower--top {
    display: none !important;
    animation: none !important;
  }

  .b-flower {
    filter: none !important;
  }
  
  .bouquet-display {
    filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.6));
  }

  /* Reducir desenfoque backdrop-filter en la tarjeta para fluidez extrema */
  .bouquet-card {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  /* Desactivar filtro blur 24px continuo en el resplandor de fondo */
  .bouquet-back-glow {
    filter: none !important;
    animation: none !important;
    opacity: 0.85;
  }
}

