/* ==========================================================================
   DÍA DE LAS FLORES AMARILLAS - "JAMÁS SERÁS ESPECTADORA"
   Design System & Styling
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;0,700;1,400;1,600&family=Great+Vibes&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --bg-gradient: linear-gradient(135deg, #0f0c20 0%, #1a102f 40%, #2a1b3d 70%, #160a24 100%);
  --gold-primary: #ffd700;
  --gold-light: #fff3a1;
  --gold-dark: #d4af37;
  --yellow-flower: #ffb703;
  --yellow-glow: rgba(255, 215, 0, 0.4);
  --pink-accent: #ff6b8b;
  --text-primary: #fff8e7;
  --text-secondary: #e2d5c3;
  --glass-bg: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 215, 0, 0.25);
  --glass-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 215, 0, 0.15);
  --font-cursive: 'Great Vibes', cursive;
  --font-serif: 'Cormorant Garamond', serif;
  --font-sans: 'Outfit', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: var(--font-sans);
  background: var(--bg-gradient);
  color: var(--text-primary);
  position: relative;
}

/* Background Canvas */
#canvas-particles, #canvas-flowers {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
}

#canvas-flowers {
  z-index: 2;
  pointer-events: auto;
}

/* Music & Customizer Controls */
.top-controls {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  gap: 12px;
}

.control-btn {
  background: rgba(26, 16, 47, 0.7);
  border: 1px solid var(--glass-border);
  color: var(--gold-light);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 1.2rem;
}

.control-btn:hover {
  transform: scale(1.1) rotate(5deg);
  background: rgba(255, 215, 0, 0.2);
  border-color: var(--gold-primary);
  box-shadow: 0 0 15px var(--yellow-glow);
}

.control-btn.playing {
  animation: pulse-glow 2s infinite alternate;
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 5px var(--yellow-glow); }
  100% { box-shadow: 0 0 20px var(--gold-primary), 0 0 30px var(--gold-primary); }
}

/* Main Layout Container */
.main-wrapper {
  position: relative;
  z-index: 10;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

/* Act Containers */
.act-section {
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.hidden-act {
  display: none !important;
  opacity: 0;
  pointer-events: none;
  transform: translateY(30px) scale(0.95);
}

.visible-act {
  display: flex !important;
  opacity: 1;
  animation: fadeInScale 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Act 1: Interactive 3D Envelope */
.envelope-container {
  perspective: 1000px;
  cursor: pointer;
  margin: 30px 0;
  position: relative;
}

.envelope-hint {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  color: var(--gold-light);
  margin-bottom: 20px;
  text-align: center;
  letter-spacing: 1px;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
  animation: float-hint 2.5s ease-in-out infinite;
}

@keyframes float-hint {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.envelope {
  width: 320px;
  height: 220px;
  background: linear-gradient(145deg, #2d1e3e, #1a1028);
  border-radius: 12px;
  position: relative;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 215, 0, 0.15);
  border: 1px solid var(--glass-border);
  transition: transform 0.5s ease;
}

.envelope:hover {
  transform: translateY(-5deg) scale(1.02);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7), 0 0 40px rgba(255, 215, 0, 0.3);
}

.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-left: 160px solid transparent;
  border-right: 160px solid transparent;
  border-top: 130px solid #3b2852;
  transform-origin: top;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 4;
}

.envelope.open .envelope-flap {
  transform: rotateX(180deg);
  z-index: 1;
}

.envelope-pocket {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 0;
  border-left: 160px solid #281938;
  border-right: 160px solid #281938;
  border-bottom: 110px solid #332047;
  border-radius: 0 0 12px 12px;
  z-index: 3;
}

.wax-seal {
  position: absolute;
  top: 105px;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 58px;
  height: 58px;
  background: radial-gradient(circle, #ffd700 0%, #b8860b 70%, #8b6508 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5), inset 0 2px 4px rgba(255,255,255,0.6);
  transition: all 0.4s ease;
  font-size: 1.6rem;
}

.wax-seal::after {
  content: '';
  position: absolute;
  inset: -6px;
  border: 2px dashed var(--gold-light);
  border-radius: 50%;
  opacity: 0.7;
  animation: spin-slow 12s linear infinite;
}

@keyframes spin-slow {
  to { transform: rotate(360deg); }
}

.envelope.open .wax-seal {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.2);
  pointer-events: none;
}

.preview-letter {
  position: absolute;
  bottom: 10px;
  left: 15px;
  right: 15px;
  height: 190px;
  background: #fffdf5;
  border-radius: 8px;
  z-index: 2;
  transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
  padding: 15px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #332200;
  text-align: center;
  cursor: pointer;
}

.envelope.open .preview-letter {
  transform: translateY(-130px);
  z-index: 10;
  box-shadow: 0 10px 30px rgba(255, 215, 0, 0.4), 0 0 15px rgba(255, 183, 3, 0.5);
  animation: pulse-letter-glow 2s infinite alternate;
}

@keyframes pulse-letter-glow {
  0% { box-shadow: 0 8px 25px rgba(255, 215, 0, 0.3); }
  100% { box-shadow: 0 12px 35px rgba(255, 215, 0, 0.6), 0 0 20px rgba(255, 183, 3, 0.7); }
}

.click-unfold-badge {
  font-size: 0.95rem;
  margin-top: 8px;
  color: #8b5a00;
  background: rgba(255, 215, 0, 0.2);
  border: 1px dashed #d4af37;
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 600;
}

/* Act 2: Detailed Romantic Letter Card */
.letter-card {
  background: rgba(255, 253, 245, 0.95);
  color: #2b1e10;
  border-radius: 20px;
  padding: 45px 35px;
  box-shadow: var(--glass-shadow), 0 0 50px rgba(255, 215, 0, 0.3);
  border: 2px solid var(--gold-dark);
  position: relative;
  width: 100%;
  max-width: 680px;
  overflow: hidden;
}

.letter-header {
  text-align: center;
  margin-bottom: 25px;
}

.letter-title {
  font-family: var(--font-cursive);
  font-size: 3.2rem;
  color: #9e7506;
  line-height: 1.2;
  text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.8);
}

.letter-subtitle {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: #665027;
  font-style: italic;
  letter-spacing: 1px;
}

.letter-body {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  line-height: 1.8;
  color: #382914;
  margin-bottom: 30px;
  text-align: justify;
}

.letter-body p {
  margin-bottom: 18px;
  text-indent: 20px;
}

/* Highlight Banner: "JAMÁS SERÁS ESPECTADORA" */
.highlight-banner {
  background: linear-gradient(135deg, #1c132b 0%, #2d1840 100%);
  color: var(--gold-light);
  border-radius: 16px;
  padding: 30px 25px;
  text-align: center;
  margin: 30px 0;
  position: relative;
  border: 1px solid var(--gold-primary);
  box-shadow: 0 10px 25px rgba(0,0,0,0.3), 0 0 25px rgba(255, 215, 0, 0.3);
}

.highlight-banner::before {
  content: '🌻';
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2rem;
  background: #1c132b;
  padding: 0 10px;
  border-radius: 50%;
}

.highlight-text {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--gold-primary);
  letter-spacing: 1px;
  margin-bottom: 10px;
  text-transform: uppercase;
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
}

.highlight-subtext {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  color: #ebdcb9;
  font-weight: 300;
  line-height: 1.5;
}

/* Polaroid Gallery */
.polaroid-gallery {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 35px 0 20px;
  flex-wrap: wrap;
}

.polaroid-frame {
  background: #ffffff;
  padding: 12px 12px 25px;
  border-radius: 4px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.15);
  transform: rotate(-3deg);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  width: 170px;
  cursor: pointer;
}

.polaroid-frame:nth-child(even) {
  transform: rotate(3deg);
}

.polaroid-frame:hover {
  transform: scale(1.08) rotate(0deg) z-index 10;
  box-shadow: 0 15px 30px rgba(0,0,0,0.3), 0 0 15px rgba(255, 215, 0, 0.4);
  z-index: 10;
}

.polaroid-img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 2px;
  background: #f0e6d2;
}

.polaroid-caption {
  font-family: var(--font-cursive);
  font-size: 1.4rem;
  color: #443311;
  text-align: center;
  margin-top: 10px;
}

/* Action Buttons */
.btn-primary {
  background: linear-gradient(135deg, #ffd700 0%, #ffb703 100%);
  color: #1a0f00;
  border: none;
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 700;
  padding: 18px 38px;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(255, 183, 3, 0.5), 0 0 20px rgba(255, 215, 0, 0.6);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 25px;
}

.btn-primary:hover {
  transform: translateY(-4deg) scale(1.04);
  box-shadow: 0 15px 40px rgba(255, 183, 3, 0.7), 0 0 35px var(--gold-primary);
  background: linear-gradient(135deg, #fff07c 0%, #ffd700 100%);
}

.btn-primary:active {
  transform: translateY(-1deg) scale(0.98);
}

/* Act 3: Flower Garden & Grand Finale */
.garden-stage {
  text-align: center;
  position: relative;
  width: 100%;
}

.garden-title {
  font-family: var(--font-cursive);
  font-size: 3.8rem;
  color: var(--gold-primary);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9), 0 0 20px rgba(255, 215, 0, 0.7);
  margin-bottom: 12px;
  position: relative;
  z-index: 15;
  background: rgba(15, 12, 32, 0.7);
  display: inline-block;
  padding: 6px 28px;
  border-radius: 40px;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 215, 0, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.garden-subtitle {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: var(--gold-light);
  margin-bottom: 30px;
  font-style: italic;
  position: relative;
  z-index: 15;
  background: rgba(15, 12, 32, 0.6);
  display: inline-block;
  padding: 6px 22px;
  border-radius: 20px;
  backdrop-filter: blur(6px);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
  border: 1px solid rgba(255, 215, 0, 0.15);
}

/* ================= INTRO MODAL SEQUENCE ================= */
.intro-modal-card {
  background: linear-gradient(145deg, #25173d, #140b26);
  border: 2px solid var(--gold-primary);
  border-radius: 24px;
  padding: 40px 30px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 35px rgba(255, 215, 0, 0.35);
  text-align: center;
  position: relative;
  transform: scale(0.9);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .intro-modal-card {
  transform: scale(1);
}

.intro-decor {
  font-size: 2.8rem;
  margin-bottom: 15px;
  animation: bounce-decor 2s ease-in-out infinite alternate;
}

@keyframes bounce-decor {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-8px) scale(1.08); }
}

.intro-step {
  display: none;
  flex-direction: column;
  align-items: center;
}

.intro-step.active-step {
  display: flex;
  animation: fadeInStep 0.5s ease forwards;
}

@keyframes fadeInStep {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.intro-text {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 25px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.intro-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  width: 100%;
  flex-wrap: wrap;
}

.intro-btn {
  margin-top: 0 !important;
}

.intro-btn-no {
  background: rgba(255, 255, 255, 0.1);
  color: #e2d5c3;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 14px 28px;
  border-radius: 30px;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.3s ease;
}

.intro-btn-no:hover {
  background: rgba(255, 107, 139, 0.2);
  border-color: var(--pink-accent);
  color: #fff;
}

/* Entry Animation for Act 1 Envelope */
.envelope-container.drop-in {
  animation: dropInLetter 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes dropInLetter {
  0% {
    opacity: 0;
    transform: translateY(-90px) scale(0.8);
  }
  60% {
    transform: translateY(15px) scale(1.03);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Interactive SVG Bouquet Container */
.bouquet-container {
  width: 320px;
  height: 420px;
  margin: 0 auto 30px;
  position: relative;
  animation: float-bouquet 4s ease-in-out infinite alternate;
}

@keyframes float-bouquet {
  0% { transform: translateY(0) rotate(-1deg); }
  100% { transform: translateY(-12px) rotate(1deg); }
}

.bouquet-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 15px 25px rgba(0,0,0,0.6));
}

.interactive-prompt {
  background: rgba(255, 215, 0, 0.15);
  border: 1px dashed var(--gold-primary);
  padding: 14px 24px;
  border-radius: 30px;
  font-size: 1.1rem;
  color: var(--gold-light);
  display: inline-block;
  backdrop-filter: blur(8px);
  margin-bottom: 25px;
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0%, 100% { border-color: rgba(255, 215, 0, 0.4); }
  50% { border-color: rgba(255, 215, 0, 1); }
}

/* Customizer Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 5, 20, 0.85);
  backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: linear-gradient(145deg, #1f1433, #120921);
  border: 1px solid var(--gold-dark);
  border-radius: 20px;
  padding: 35px;
  width: 100%;
  max-width: 540px;
  box-shadow: var(--glass-shadow);
  color: var(--text-primary);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  border-bottom: 1px solid rgba(255, 215, 0, 0.2);
  padding-bottom: 15px;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  color: var(--gold-primary);
}

.close-modal {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.8rem;
  cursor: pointer;
  transition: color 0.3s;
}

.close-modal:hover {
  color: var(--gold-primary);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.95rem;
  color: var(--gold-light);
  margin-bottom: 8px;
  font-weight: 500;
}

.form-group input, .form-group textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 10px;
  padding: 12px 16px;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus, .form-group textarea:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.btn-secondary {
  background: rgba(255, 215, 0, 0.15);
  color: var(--gold-light);
  border: 1px solid var(--gold-primary);
  padding: 12px 25px;
  border-radius: 30px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  width: 100%;
  font-size: 1rem;
}

.btn-secondary:hover {
  background: var(--gold-primary);
  color: #1a0f00;
}

/* Safe Area & Mobile Viewport Enhancements */
html, body {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  font-family: var(--font-sans);
  background: var(--bg-gradient);
  color: var(--text-primary);
  position: relative;
  touch-action: manipulation;
}

.top-controls {
  position: fixed;
  top: max(20px, env(safe-area-inset-top, 20px));
  right: max(20px, env(safe-area-inset-right, 20px));
  z-index: 100;
  display: flex;
  gap: 12px;
}

.main-wrapper {
  position: relative;
  z-index: 10;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(70px + env(safe-area-inset-top, 0px)) 16px calc(30px + env(safe-area-inset-bottom, 0px));
}

/* Responsiveness for Mobile Screens (320px - 600px) */
@media (max-width: 600px) {
  .envelope-container {
    width: min(310px, 86vw);
    margin: 15px auto;
  }

  .envelope {
    width: 100%;
    height: 210px;
  }

  .envelope-flap {
    border-left-width: 43vw;
    border-right-width: 43vw;
    border-top-width: 120px;
  }

  @media (min-width: 380px) {
    .envelope-flap {
      border-left-width: 155px;
      border-right-width: 155px;
      border-top-width: 120px;
    }
  }

  .envelope-pocket {
    border-left-width: 43vw;
    border-right-width: 43vw;
    border-bottom-width: 105px;
  }

  @media (min-width: 380px) {
    .envelope-pocket {
      border-left-width: 155px;
      border-right-width: 155px;
      border-bottom-width: 105px;
    }
  }

  .letter-card {
    padding: 28px 18px;
    border-radius: 16px;
  }

  .letter-title {
    font-size: 2.4rem;
  }

  .letter-subtitle {
    font-size: 1.05rem;
  }

  .letter-body {
    font-size: 1.15rem;
    line-height: 1.75;
    margin-bottom: 20px;
  }

  .highlight-banner {
    padding: 22px 16px;
    margin: 22px 0;
  }

  .highlight-text {
    font-size: 1.55rem;
  }

  .highlight-subtext {
    font-size: 0.98rem;
  }

  .polaroid-gallery {
    gap: 14px;
    margin: 25px 0 15px;
  }

  .polaroid-frame {
    width: min(150px, 42vw);
    padding: 8px 8px 16px;
  }

  .polaroid-img {
    height: 115px;
  }

  .polaroid-caption {
    font-size: 1.2rem;
  }

  .btn-primary {
    font-size: 1.05rem;
    padding: 15px 26px;
    width: 100%;
    justify-content: center;
  }

  .garden-title {
    font-size: 2.8rem;
  }

  .garden-subtitle {
    font-size: 1.15rem;
    padding: 0 10px;
  }

  .bouquet-container {
    width: min(280px, 85vw);
    height: 360px;
  }

  .interactive-prompt {
    font-size: 0.95rem;
    padding: 12px 18px;
    margin-bottom: 20px;
  }

  .modal-content {
    padding: 24px 18px;
    border-radius: 16px;
  }
}

