/* ============================================
   Adry × Fio — Cosas que merecen quedarse
   Design System & Styles
   ============================================ */

/* --- Google Fonts Import --- */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Caveat:wght@400;500;600;700&display=swap');

/* --- Custom Properties --- */
:root {
  /* Cream palette */
  --cream-50: #FFFDF7;
  --cream-100: #FFF8EC;
  --cream-200: #FFEFD6;
  --cream-300: #FFE4BB;

  /* Yellow (Flores Amarillas) */
  --yellow-200: #FFF3BF;
  --yellow-300: #FFE066;
  --yellow-400: #FFD43B;
  --yellow-500: #FCC419;
  --yellow-600: #F59F00;

  /* Lavender / Purple (Flores Moradas) */
  --purple-100: #F3EDFF;
  --purple-200: #D0BFFF;
  --purple-300: #B197FC;
  --purple-400: #9775FA;
  --purple-500: #845EF7;
  --purple-600: #7048E8;
  --purple-700: #5F3DC4;
  --purple-800: #4A2D99;

  /* Neutrals */
  --white: #FFFFFF;
  --gray-50: #F8F9FA;
  --gray-100: #F1F3F5;
  --gray-200: #E9ECEF;
  --gray-400: #CED4DA;
  --gray-500: #ADB5BD;
  --gray-600: #868E96;
  --gray-700: #495057;
  --gray-800: #343A40;
  --gray-900: #212529;

  /* Lock screen */
  --lock-bg: #0F0A1A;
  --lock-surface: #1A1428;
  --lock-accent: #B197FC;

  /* Typography */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-handwritten: 'Caveat', cursive;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* Borders */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 50%;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
  --shadow-glow-yellow: 0 0 30px rgba(252,196,25,0.25);
  --shadow-glow-purple: 0 0 30px rgba(132,94,247,0.25);

  /* Transitions */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 200ms;
  --duration-normal: 400ms;
  --duration-slow: 800ms;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--gray-800);
  line-height: 1.6;
  overflow-x: hidden;
  background-color: var(--cream-50);
  transition: background-color 1.5s var(--ease-out);
}

body.locked {
  overflow: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

/* --- Utility Classes --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   LOCK SCREEN
   ============================================ */
#lock-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--lock-bg);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

#lock-screen.unlocked {
  opacity: 0;
  transform: scale(1.05);
  pointer-events: none;
}

/* Particle background */
.lock-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.lock-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--purple-400);
  opacity: 0;
  animation: lockParticleFloat 8s infinite ease-in-out;
}

@keyframes lockParticleFloat {
  0% { opacity: 0; transform: translateY(100vh) scale(0); }
  10% { opacity: 0.6; }
  90% { opacity: 0.6; }
  100% { opacity: 0; transform: translateY(-20vh) scale(1); }
}

.lock-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: var(--space-xl);
  max-width: 440px;
  width: 100%;
}

/* Envelope */
.envelope-container {
  margin: 0 auto var(--space-2xl);
  width: 120px;
  height: 100px;
  position: relative;
  cursor: default;
}

.envelope-body {
  width: 120px;
  height: 80px;
  background: linear-gradient(135deg, var(--cream-200), var(--cream-100));
  border-radius: 4px 4px 12px 12px;
  position: absolute;
  bottom: 0;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  overflow: hidden;
}

.envelope-body::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 30px;
  background: linear-gradient(to top, rgba(0,0,0,0.04), transparent);
}

.envelope-flap {
  width: 0;
  height: 0;
  border-left: 60px solid transparent;
  border-right: 60px solid transparent;
  border-top: 50px solid var(--cream-300);
  position: absolute;
  top: 0;
  transform-origin: top center;
  transition: transform 0.6s var(--ease-out);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.envelope-container:hover .envelope-flap,
.envelope-container.open .envelope-flap {
  transform: rotateX(180deg);
}

.envelope-heart {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  z-index: 1;
  animation: heartPulse 2s infinite ease-in-out;
}

@keyframes heartPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.15); }
}

/* Lock text */
.lock-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--cream-200);
  margin-bottom: var(--space-sm);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 500;
}

.lock-names {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: var(--space-lg);
  background: linear-gradient(135deg, var(--yellow-400), var(--purple-300));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.lock-message {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--gray-500);
  line-height: 1.7;
  margin-bottom: var(--space-2xl);
  font-style: italic;
}

/* Riddle Section */
.riddle-section {
  display: none;
  animation: fadeSlideUp 0.6s var(--ease-out);
}

.riddle-section.visible {
  display: block;
}

.riddle-box {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
  backdrop-filter: blur(10px);
}

.riddle-label {
  font-family: var(--font-body);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--purple-400);
  margin-bottom: var(--space-md);
  font-weight: 600;
}

.riddle-text {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--cream-200);
  line-height: 1.8;
  margin-bottom: var(--space-lg);
}

.riddle-hint {
  font-family: var(--font-handwritten);
  font-size: 1.2rem;
  color: var(--yellow-400);
}

/* Password Input */
.password-group {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  margin-bottom: var(--space-lg);
}

.password-digit {
  width: 40px;
  height: 52px;
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: var(--font-display);
  font-size: 1.4rem;
  text-align: center;
  outline: none;
  transition: all var(--duration-fast) var(--ease-out);
  -moz-appearance: textfield;
}

.password-digit::-webkit-outer-spin-button,
.password-digit::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.password-digit:focus {
  border-color: var(--purple-400);
  background: rgba(132,94,247,0.1);
  box-shadow: 0 0 20px rgba(132,94,247,0.15);
}

.password-digit.error {
  border-color: #FF6B6B;
  animation: shake 0.5s var(--ease-out);
}

.password-digit.success {
  border-color: var(--yellow-400);
  background: rgba(252,196,25,0.1);
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--purple-500), var(--purple-700));
  color: var(--white);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-xl);
  letter-spacing: 0.02em;
  transition: all var(--duration-normal) var(--ease-out);
  box-shadow: 0 4px 20px rgba(95,61,196,0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(95,61,196,0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-discover {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 14px 32px;
  background: transparent;
  color: var(--cream-200);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255,255,255,0.15);
  letter-spacing: 0.02em;
  transition: all var(--duration-normal) var(--ease-out);
}

.btn-discover:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.3);
  transform: translateY(-2px);
}

.lock-error {
  color: #FF6B6B;
  font-size: 0.85rem;
  margin-top: var(--space-md);
  opacity: 0;
  transition: opacity var(--duration-fast);
}

.lock-error.visible {
  opacity: 1;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
#timeline {
  display: none;
  opacity: 0;
  transition: opacity 1s var(--ease-out);
}

#timeline.visible {
  display: block;
  opacity: 1;
}

/* --- Petals Overlay --- */
.petals-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  overflow: hidden;
}

.petal {
  position: absolute;
  top: -30px;
  width: 14px;
  height: 18px;
  border-radius: 50% 0 50% 50%;
  opacity: 0.5;
  animation: petalFall linear infinite;
  will-change: transform;
}

.petal.yellow {
  background: linear-gradient(135deg, var(--yellow-400), var(--yellow-300));
}

.petal.purple {
  background: linear-gradient(135deg, var(--purple-400), var(--purple-300));
}

@keyframes petalFall {
  0% {
    transform: translateY(-10%) translateX(0) rotate(0deg) scale(0.8);
    opacity: 0;
  }
  10% {
    opacity: 0.5;
  }
  85% {
    opacity: 0.4;
  }
  100% {
    transform: translateY(110vh) translateX(100px) rotate(720deg) scale(0.3);
    opacity: 0;
  }
}

/* --- Progress Dots --- */
.progress-nav {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  transition: opacity 0.5s var(--ease-out);
}

.progress-nav.visible {
  opacity: 1;
}

.progress-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gray-400);
  transition: all var(--duration-normal) var(--ease-out);
  cursor: pointer;
  border: 2px solid transparent;
}

.progress-dot.active {
  background: var(--purple-500);
  transform: scale(1.3);
  border-color: var(--purple-200);
}

.progress-dot:hover {
  transform: scale(1.2);
}

/* --- Chapter Base --- */
.chapter {
  min-height: 100vh;
  padding: var(--space-3xl) var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.chapter-inner {
  max-width: 600px;
  width: 100%;
  position: relative;
  z-index: 2;
}

/* Chapter header */
.chapter-number {
  font-family: var(--font-body);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gray-500);
  margin-bottom: var(--space-sm);
  font-weight: 600;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.8s var(--ease-out);
}

.chapter-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--space-sm);
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s var(--ease-out) 0.1s;
}

.chapter-subtitle {
  font-family: var(--font-handwritten);
  font-size: 1.3rem;
  margin-bottom: var(--space-2xl);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.8s var(--ease-out) 0.2s;
}

.chapter-text {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--gray-700);
  margin-bottom: var(--space-xl);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.8s var(--ease-out) 0.3s;
}

/* Reveal animation */
.chapter.in-view .chapter-number,
.chapter.in-view .chapter-title,
.chapter.in-view .chapter-subtitle,
.chapter.in-view .chapter-text,
.chapter.in-view .reveal-item {
  opacity: 1;
  transform: translateY(0);
}

.reveal-item {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s var(--ease-out);
}

/* ============================================
   CHAPTER 01 — LOS COMIENZOS
   ============================================ */
#chapter-01 {
  background: linear-gradient(180deg, var(--cream-50), var(--cream-100));
}

#chapter-01 .chapter-title {
  color: var(--gray-900);
}

#chapter-01 .chapter-subtitle {
  color: var(--gray-600);
}

/* Timeline connector */
.timeline-line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, transparent, var(--purple-200), var(--yellow-300), var(--purple-200), transparent);
  transform: translateX(-50%);
  opacity: 0.3;
}

/* Chat bubble */
.chat-bubble-container {
  margin: var(--space-xl) 0;
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s var(--ease-out) 0.4s;
}

.chat-bubble {
  background: var(--white);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: 4px;
  padding: var(--space-lg) var(--space-xl);
  box-shadow: var(--shadow-md);
  position: relative;
  max-width: 320px;
}

.chat-bubble-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--purple-500);
  margin-bottom: var(--space-xs);
}

.chat-bubble-text {
  font-size: 0.95rem;
  color: var(--gray-800);
  line-height: 1.6;
}

.chat-bubble-time {
  font-size: 0.72rem;
  color: var(--gray-500);
  text-align: right;
  margin-top: var(--space-xs);
}

.chat-bubble::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: -8px;
  width: 16px;
  height: 16px;
  background: var(--white);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

#chapter-01.in-view .chat-bubble-container {
  opacity: 1;
  transform: translateY(0);
}

/* Date badge */
.date-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px 18px;
  background: linear-gradient(135deg, rgba(252,196,25,0.12), rgba(132,94,247,0.12));
  border: 1px solid rgba(132,94,247,0.15);
  border-radius: var(--radius-xl);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: var(--space-lg);
}

.date-badge-icon {
  font-size: 1rem;
}

/* Photo placeholder */
.photo-frame {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 10px;
  box-shadow: var(--shadow-md);
  transform: rotate(-2deg);
  transition: transform var(--duration-normal) var(--ease-out);
  margin: var(--space-xl) auto;
  max-width: 300px;
}

.photo-frame:hover {
  transform: rotate(0deg) scale(1.02);
}

.photo-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, var(--cream-200), var(--purple-100));
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--space-sm);
  color: var(--gray-500);
  font-size: 0.85rem;
}

.photo-placeholder-icon {
  font-size: 2rem;
  opacity: 0.5;
}

.photo-frame-caption {
  font-family: var(--font-handwritten);
  font-size: 1rem;
  color: var(--gray-600);
  text-align: center;
  padding: 8px 0 4px;
}

/* ============================================
   CHAPTER 02 — FLORES AMARILLAS
   ============================================ */
#chapter-02 {
  background: linear-gradient(180deg, var(--cream-100), #FFF9E6, var(--yellow-200));
  min-height: 120vh;
  flex-direction: column;
  gap: var(--space-3xl);
}

#chapter-02 .chapter-title {
  color: var(--yellow-600);
}

#chapter-02 .chapter-subtitle {
  color: var(--gray-600);
}

/* Flower field */
.flower-field {
  position: relative;
  width: 100%;
  height: 200px;
  margin: var(--space-xl) 0;
}

.svg-flower {
  position: absolute;
  bottom: 0;
  opacity: 0;
  transform: scale(0) translateY(20px);
  transition: all 1.2s var(--ease-spring);
}

.chapter.in-view .svg-flower {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.svg-flower:nth-child(1) { left: 5%; transition-delay: 0.2s; }
.svg-flower:nth-child(2) { left: 20%; transition-delay: 0.4s; }
.svg-flower:nth-child(3) { left: 35%; transition-delay: 0.1s; }
.svg-flower:nth-child(4) { left: 50%; transition-delay: 0.6s; }
.svg-flower:nth-child(5) { left: 65%; transition-delay: 0.3s; }
.svg-flower:nth-child(6) { left: 80%; transition-delay: 0.5s; }
.svg-flower:nth-child(7) { left: 92%; transition-delay: 0.7s; }

/* Flower sway animation */
@keyframes sway {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

.svg-flower svg {
  animation: sway 4s ease-in-out infinite;
}

.svg-flower:nth-child(even) svg {
  animation-delay: -2s;
  animation-duration: 3.5s;
}

/* Memory gallery */
.memory-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  margin: var(--space-xl) 0;
}

.memory-card {
  background: var(--white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-normal) var(--ease-out);
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s var(--ease-out), box-shadow 0.3s, transform 0.3s;
}

.chapter.in-view .memory-card {
  opacity: 1;
  transform: translateY(0);
}

.chapter.in-view .memory-card:nth-child(1) { transition-delay: 0.2s; }
.chapter.in-view .memory-card:nth-child(2) { transition-delay: 0.35s; }
.chapter.in-view .memory-card:nth-child(3) { transition-delay: 0.5s; }
.chapter.in-view .memory-card:nth-child(4) { transition-delay: 0.65s; }
.chapter.in-view .memory-card:nth-child(5) { transition-delay: 0.8s; }
.chapter.in-view .memory-card:nth-child(6) { transition-delay: 0.95s; }

.memory-card:hover {
  transform: translateY(-4px) !important;
  box-shadow: var(--shadow-lg);
}

.memory-card-image {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(135deg, var(--cream-200), var(--yellow-200));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  position: relative;
  overflow: hidden;
}

.memory-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.memory-card-body {
  padding: var(--space-md);
}

.memory-card-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 4px;
}

.memory-card-desc {
  font-size: 0.78rem;
  color: var(--gray-600);
  line-height: 1.5;
}

/* Fullscreen gallery */
.gallery-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-out);
  backdrop-filter: blur(10px);
}

.gallery-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.gallery-overlay-content {
  max-width: 90vw;
  max-height: 85vh;
  text-align: center;
}

.gallery-overlay-content img {
  max-width: 100%;
  max-height: 75vh;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.gallery-overlay-caption {
  color: var(--cream-200);
  font-family: var(--font-handwritten);
  font-size: 1.3rem;
  margin-top: var(--space-lg);
}

.gallery-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  color: var(--white);
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration-fast);
}

.gallery-close:hover {
  background: rgba(255,255,255,0.2);
}

/* ============================================
   CHAPTER 03 — 100 DÍAS DE RACHA
   ============================================ */
#chapter-03 {
  background: linear-gradient(180deg, var(--yellow-200), #FFF3E0, var(--cream-100));
}

#chapter-03 .chapter-title {
  color: var(--gray-900);
}

/* Streak badge */
.streak-badge {
  background: linear-gradient(135deg, #FF6B35, #FF3D00);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-xl);
  text-align: center;
  color: var(--white);
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(255,61,0,0.25);
  margin: var(--space-xl) 0;
}

.streak-badge::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(135deg, #FFD43B, #FF6B35, #FF3D00, #FF6B35);
  z-index: -1;
  animation: streakGlow 3s ease-in-out infinite;
}

@keyframes streakGlow {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.streak-badge-label {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: var(--space-md);
  font-weight: 600;
}

.streak-number {
  font-family: var(--font-display);
  font-size: clamp(4rem, 15vw, 7rem);
  font-weight: 700;
  line-height: 1;
  margin-bottom: var(--space-sm);
  text-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.streak-badge-text {
  font-size: 1rem;
  opacity: 0.9;
  font-weight: 500;
}

.streak-date {
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid rgba(255,255,255,0.2);
  font-size: 0.85rem;
  opacity: 0.8;
}

/* Fire particles */
.fire-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.fire-particle {
  position: absolute;
  bottom: -10px;
  font-size: 1.2rem;
  animation: fireRise 2s ease-out infinite;
  opacity: 0;
}

@keyframes fireRise {
  0% { opacity: 0; transform: translateY(0) scale(1); }
  20% { opacity: 0.8; }
  100% { opacity: 0; transform: translateY(-120px) scale(0.3); }
}

/* ============================================
   CHAPTER 04 — JARDÍN MORADO
   ============================================ */
#chapter-04 {
  background: linear-gradient(180deg, var(--cream-100), var(--purple-100), #E8DCFF);
  min-height: 120vh;
}

#chapter-04 .chapter-title {
  color: var(--purple-700);
}

#chapter-04 .chapter-subtitle {
  color: var(--purple-500);
}

/* Interactive cards */
.interactive-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  margin: var(--space-xl) 0;
}

.interactive-card {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(132,94,247,0.1);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.interactive-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(132,94,247,0.05), rgba(252,196,25,0.05));
  opacity: 0;
  transition: opacity var(--duration-normal);
}

.interactive-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow-purple);
  border-color: var(--purple-300);
}

.interactive-card:hover::before {
  opacity: 1;
}

.interactive-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.interactive-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--purple-200), var(--purple-300));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.interactive-card-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--gray-800);
}

.interactive-card-tap {
  font-size: 0.75rem;
  color: var(--purple-400);
  font-weight: 500;
}

.interactive-card-reveal {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s var(--ease-out), padding 0.5s var(--ease-out);
}

.interactive-card.open .interactive-card-reveal {
  max-height: 300px;
  padding-top: var(--space-md);
}

.interactive-card-reveal-text {
  font-family: var(--font-handwritten);
  font-size: 1.15rem;
  color: var(--purple-700);
  line-height: 1.6;
  border-top: 1px solid var(--purple-200);
  padding-top: var(--space-md);
}

/* ============================================
   DATES SECTION
   ============================================ */
.dates-section {
  padding: var(--space-4xl) var(--space-xl);
  background: linear-gradient(180deg, #E8DCFF, var(--purple-100));
}

.dates-section-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  text-align: center;
  color: var(--purple-700);
  margin-bottom: var(--space-2xl);
}

.dates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-lg);
  max-width: 800px;
  margin: 0 auto;
}

.date-card {
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  text-align: center;
  border: 1px solid rgba(132,94,247,0.1);
  transition: all var(--duration-normal) var(--ease-out);
  opacity: 0;
  transform: translateY(20px);
}

.date-card.in-view {
  opacity: 1;
  transform: translateY(0);
}

.date-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow-purple);
}

.date-card-day {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--purple-600);
  line-height: 1;
}

.date-card-year {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-bottom: var(--space-md);
  font-weight: 500;
}

.date-card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: var(--space-xs);
}

.date-card-desc {
  font-size: 0.82rem;
  color: var(--gray-600);
  line-height: 1.5;
}

.date-card-icon {
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
}

/* ============================================
   CHAPTER FINAL — HOY
   ============================================ */
#chapter-final {
  background: linear-gradient(180deg, var(--purple-100), #F0E6FF, var(--cream-100));
  min-height: 100vh;
  text-align: center;
}

#chapter-final .chapter-title {
  background: linear-gradient(135deg, var(--yellow-500), var(--purple-500));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Final garden */
.final-garden {
  position: relative;
  width: 100%;
  height: 250px;
  margin: var(--space-2xl) 0;
}

/* Dedication */
.dedication {
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(132,94,247,0.1);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-xl);
  margin: var(--space-xl) auto;
  max-width: 500px;
  text-align: left;
}

.dedication-name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--purple-700);
  margin-bottom: var(--space-lg);
}

.dedication-text {
  font-family: var(--font-handwritten);
  font-size: 1.2rem;
  line-height: 1.8;
  color: var(--gray-700);
  margin-bottom: var(--space-lg);
}

.dedication-sign {
  font-family: var(--font-handwritten);
  font-size: 1.4rem;
  color: var(--purple-600);
  text-align: right;
  font-weight: 600;
}

/* Continue button */
.btn-continue {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 16px 36px;
  background: linear-gradient(135deg, var(--yellow-500), var(--purple-500));
  color: var(--white);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: var(--radius-xl);
  margin-top: var(--space-2xl);
  transition: all var(--duration-normal) var(--ease-out);
  box-shadow: 0 8px 30px rgba(132,94,247,0.3);
  letter-spacing: 0.02em;
}

.btn-continue:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(132,94,247,0.4);
}

/* Sparkle animation */
@keyframes sparkle {
  0%, 100% { opacity: 0; transform: scale(0); }
  50% { opacity: 1; transform: scale(1); }
}

.sparkle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--yellow-400);
  pointer-events: none;
  animation: sparkle 2s ease-in-out infinite;
}

/* ============================================
   MUSIC TOGGLE
   ============================================ */
.music-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all var(--duration-normal) var(--ease-out);
  border: 1px solid rgba(132,94,247,0.1);
  opacity: 0;
  pointer-events: none;
}

.music-toggle.visible {
  opacity: 1;
  pointer-events: all;
}

.music-toggle:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-glow-purple);
}

.music-toggle .bars {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 18px;
}

.music-toggle .bar {
  width: 3px;
  background: var(--purple-500);
  border-radius: 2px;
  transition: height var(--duration-fast);
}

.music-toggle.playing .bar {
  animation: musicBar 0.8s ease-in-out infinite alternate;
}

.music-toggle .bar:nth-child(1) { height: 6px; animation-delay: 0s; }
.music-toggle .bar:nth-child(2) { height: 12px; animation-delay: 0.15s; }
.music-toggle .bar:nth-child(3) { height: 8px; animation-delay: 0.3s; }
.music-toggle .bar:nth-child(4) { height: 14px; animation-delay: 0.1s; }

@keyframes musicBar {
  0% { height: 4px; }
  100% { height: 18px; }
}

.music-toggle:not(.playing) .bar {
  height: 4px !important;
  animation: none;
}

/* ============================================
   SCROLL-TO-TOP
   ============================================ */
.btn-back-top {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px 24px;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(10px);
  border: 1px solid var(--purple-200);
  border-radius: var(--radius-xl);
  color: var(--purple-600);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  margin-top: var(--space-xl);
  transition: all var(--duration-normal) var(--ease-out);
}

.btn-back-top:hover {
  background: var(--white);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

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

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
  .chapter {
    padding: var(--space-2xl) var(--space-lg);
  }

  .memory-gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }

  .password-digit {
    width: 36px;
    height: 46px;
    font-size: 1.2rem;
  }

  .progress-nav {
    right: 10px;
    gap: 10px;
  }

  .progress-dot {
    width: 8px;
    height: 8px;
  }

  .dates-grid {
    grid-template-columns: 1fr;
  }

  .lock-names {
    font-size: 1.8rem;
  }

  .streak-number {
    font-size: 4rem;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .memory-gallery {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1025px) {
  .chapter {
    padding: var(--space-4xl) var(--space-xl);
  }

  .memory-gallery {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ============================================
   FLOWER TOOLTIP
   ============================================ */
.flower-tooltip {
  position: fixed;
  z-index: 300;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(15px);
  border: 1px solid var(--purple-200);
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-xl);
  max-width: 280px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: scale(0.9) translateY(10px);
  transition: all var(--duration-normal) var(--ease-out);
  pointer-events: none;
}

.flower-tooltip.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: all;
}

.flower-tooltip-text {
  font-family: var(--font-handwritten);
  font-size: 1.1rem;
  color: var(--purple-700);
  line-height: 1.5;
}

.flower-tooltip-close {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 0.9rem;
  color: var(--gray-500);
  cursor: pointer;
}

/* --- Loading State --- */
.page-loader {
  position: fixed;
  inset: 0;
  background: var(--lock-bg);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s var(--ease-out);
}

.page-loader.hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--purple-400);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Garden flower interactive */
.garden-flower-btn {
  position: absolute;
  background: none;
  border: none;
  cursor: pointer;
  transition: transform 0.4s var(--ease-spring);
  padding: 0;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

.garden-flower-btn:hover {
  transform: scale(1.15);
}

.garden-flower-btn:active {
  transform: scale(0.95);
}
