/* ==========================================================================
   4TO ANIVERSARIO - NUESTRA HISTORIA EN VILLA HAYES (BODAS DE LINO)
   Estética Rústica Viva, Romántica & Colores de la Noche Estrellada
   Glassmorphism Madera & Musgo, Cera 3D, Radar Astrolabio & Tendedero
   ========================================================================== */

:root {
  /* --- Paleta Rústica Viva Nocturna (Night & Emerald Velvet) --- */
  --night-deep: #0B150D;
  --night-card: #121F15;
  --night-surface: #18281B;
  --night-overlay: rgba(11, 21, 13, 0.85);

  /* --- Verdes Musgo & Esmeralda Vivos --- */
  --moss-primary: #3B6B34;
  --moss-vivid: #4D8B43;
  --moss-emerald: #2E5828;
  --moss-dark: #1E381A;
  --moss-deepest: #11220F;
  --moss-light: #7EAF72;
  --moss-glow: rgba(77, 139, 67, 0.45);
  --moss-soft: #D4E8CE;
  --moss-glass: rgba(59, 107, 52, 0.14);
  --moss-glass-border: rgba(94, 158, 85, 0.35);

  /* --- Tonos Cálidos de Lino, Yute & Madera Noble --- */
  --linen-pure: #FAF7F0;
  --linen-parchment: #F3EBDD;
  --linen-cream: #FFFDF9;
  --thread-brown: #7D4C25;
  --thread-caramel: #A06432;
  --thread-yarn: #D9AC7C;
  --wood-deep: #3A1F0C;
  --wood-mahogany: #4E280E;
  --wood-border: #875429;

  /* --- Acentos Cálidos Vivos, Velas & Dorado Radiante --- */
  --gold-antique: #D9A02A;
  --gold-champagne: #F5CE68;
  --gold-radiant: #FFB82E;
  --gold-shimmer: #FFEAA5;
  --gold-glow: rgba(255, 184, 46, 0.55);
  --candle-flame: #FF9E2C;
  --terracotta-wax: #C84628;
  --terracotta-wax-glow: rgba(200, 70, 40, 0.5);

  /* --- Fondos & Glassmorphism --- */
  --bg-cream: #FAF6EE;
  --bg-mesh-1: rgba(59, 107, 52, 0.16);
  --bg-mesh-2: rgba(217, 160, 42, 0.15);
  --bg-mesh-night-1: rgba(46, 88, 40, 0.32);
  --bg-mesh-night-2: rgba(255, 184, 46, 0.22);
  --bg-mesh-night-3: rgba(20, 40, 60, 0.3);

  --glass-bg: rgba(255, 255, 255, 0.88);
  --glass-bg-card: rgba(255, 254, 249, 0.94);
  --glass-border: rgba(217, 172, 124, 0.45);
  --glass-shadow: 0 16px 40px rgba(30, 56, 26, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
  --glass-shadow-hover: 0 24px 50px rgba(30, 56, 26, 0.22), 0 0 20px rgba(255, 184, 46, 0.2);

  --text-main: #272118;
  --text-muted-custom: #6E6354;
  --text-bright: #1E381A;

  /* --- Tipografías --- */
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-handwriting: 'Caveat', cursive;
  --font-sans: 'Plus Jakarta Sans', -apple-system, system-ui, sans-serif;
}

/* ==========================================================================
   MODO NOCTURNO VIVO / NOCHE ROMÁNTICA & VELAS (CANDLELIGHT MODE)
   ========================================================================== */
body.candlelight-mode {
  --bg-cream: #0B140D;
  --glass-bg: rgba(20, 34, 22, 0.9);
  --glass-bg-card: rgba(16, 28, 18, 0.95);
  --glass-border: rgba(245, 206, 104, 0.3);
  --glass-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 25px rgba(255, 184, 46, 0.12);
  --glass-shadow-hover: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(255, 184, 46, 0.3);
  --text-main: #F4EFE6;
  --text-muted-custom: #C7BFA8;
  --text-bright: #F5CE68;
  --moss-dark: #D4E8CE;
  --wood-deep: #F7DCA8;
  --thread-brown: #E6C59E;
  --moss-soft: rgba(94, 158, 85, 0.25);
}

body.candlelight-mode .hero-card,
body.candlelight-mode .letters-section,
body.candlelight-mode .map-card,
body.candlelight-mode .radar-card,
body.candlelight-mode .counter-box,
body.candlelight-mode .milestone-chip,
body.candlelight-mode .letter-modal-paper,
body.candlelight-mode .modal-content {
  background: var(--glass-bg-card);
  color: var(--text-main);
  border-color: var(--glass-border);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), inset 0 1px 1px rgba(255, 255, 255, 0.08);
}

body.candlelight-mode .hero-card::before,
body.candlelight-mode .letters-section::before,
body.candlelight-mode .map-card::before,
body.candlelight-mode .radar-card::before {
  border-color: rgba(245, 206, 104, 0.25);
}

body.candlelight-mode .counter-box {
  background: rgba(24, 42, 26, 0.95);
  border-color: rgba(245, 206, 104, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(255, 184, 46, 0.08);
}

body.candlelight-mode .counter-box .num {
  color: #FFCF66 !important;
  text-shadow: 0 0 14px rgba(255, 207, 102, 0.6);
}

body.candlelight-mode .counter-box .label {
  color: #C7BFA8 !important;
}

body.candlelight-mode .text-wood {
  color: var(--gold-champagne) !important;
  text-shadow: 0 0 10px rgba(245, 206, 104, 0.3);
}

body.candlelight-mode .text-muted {
  color: var(--text-muted-custom) !important;
}

body.candlelight-mode .milestone-chip {
  background: rgba(24, 40, 26, 0.9);
  border-color: rgba(245, 206, 104, 0.25);
  color: #F4EFE6;
}

body.candlelight-mode .milestone-chip.active {
  background: linear-gradient(135deg, #3B6B34 0%, #1E381A 100%);
  border-color: #FFB82E;
  box-shadow: 0 0 18px rgba(255, 184, 46, 0.4);
}

body.candlelight-mode .polaroid-card {
  background: #18281B;
  border: 1.5px solid rgba(245, 206, 104, 0.4);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.7), 0 0 20px rgba(255, 184, 46, 0.2);
}

body.candlelight-mode .polaroid-card .polaroid-title {
  color: #FFCF66;
}

body.candlelight-mode .polaroid-card .polaroid-date {
  color: #A3D498;
}

body.candlelight-mode .polaroid-card .polaroid-note {
  color: #F3EBDD;
}

body.candlelight-mode #tendedero-locked-notice {
  background: rgba(24, 40, 26, 0.95);
  border-color: rgba(245, 206, 104, 0.4);
}

body.candlelight-mode .floating-audio-bar {
  background: rgba(18, 30, 20, 0.95);
  border-color: #FFB82E;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), 0 0 25px rgba(255, 184, 46, 0.3);
}

body.candlelight-mode .floating-audio-bar .audio-track-title {
  color: #FFCF66;
}

body.candlelight-mode .floating-audio-bar .audio-track-subtitle {
  color: #C7BFA8;
}

/* ==========================================================================
   ESTILOS GENERALES & FONDO ORGÁNICO
   ========================================================================== */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-cream);
  color: var(--text-main);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  padding-bottom: 95px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.6s cubic-bezier(0.4, 0, 0.2, 1), color 0.6s ease;
  position: relative;
}

/* Aurora Mesh Dinámica con Colores de la Noche y Luces Vivas */
.ambient-mesh-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  background: 
    radial-gradient(ellipse at 12% 18%, var(--bg-mesh-1) 0%, transparent 50%),
    radial-gradient(ellipse at 88% 78%, var(--bg-mesh-2) 0%, transparent 55%),
    radial-gradient(circle at 50% 45%, rgba(59, 107, 52, 0.08) 0%, transparent 65%);
  animation: auroraBreath 20s ease-in-out infinite alternate;
  will-change: transform, opacity;
}

body.candlelight-mode .ambient-mesh-bg {
  background: 
    radial-gradient(ellipse at 15% 20%, var(--bg-mesh-night-1) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 80%, var(--bg-mesh-night-2) 0%, transparent 60%),
    radial-gradient(circle at 50% 50%, var(--bg-mesh-night-3) 0%, transparent 70%);
}

@keyframes auroraBreath {
  0% { transform: scale(1) translate(0, 0) rotate(0deg); opacity: 0.85; }
  50% { transform: scale(1.12) translate(-2%, 2%) rotate(2deg); opacity: 1; }
  100% { transform: scale(1.05) translate(2%, -1%) rotate(-1.5deg); opacity: 0.9; }
}

/* Canvas de Partículas Interactivas (Hojas, Luciérnagas, Estrellas & Estelas) */
#particle-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
}

/* Tipografías y Encabezados */
h1, h2, h3, h4, h5, h6, .font-serif {
  font-family: var(--font-serif);
  color: var(--text-bright);
}

.font-handwriting {
  font-family: var(--font-handwriting);
}

.text-moss {
  color: var(--moss-primary) !important;
}

.text-moss-dark {
  color: var(--moss-dark) !important;
}

.text-wood {
  color: var(--wood-deep) !important;
}

.text-thread {
  color: var(--thread-brown) !important;
}

.text-gold {
  color: var(--gold-antique) !important;
}

.text-green-sage {
  color: var(--moss-vivid) !important;
}

/* ==========================================================================
   GUIRNALDA DE LUCES DE HADAS VIVAS (FAIRY LIGHTS)
   ========================================================================== */
.fairy-lights-container {
  position: relative;
  width: 100%;
  height: 62px;
  overflow: hidden;
  pointer-events: none;
  z-index: 25;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.15));
}

.wire-svg {
  width: 100%;
  height: 100%;
}

.fairy-bulb {
  width: 16px;
  height: 22px;
  border-radius: 50% 50% 45% 45%;
  position: absolute;
  top: 18px;
  background: radial-gradient(circle at 35% 28%, #FFFFFF 0%, #FFF3BA 30%, #FFBE2E 70%, #E07D08 100%);
  box-shadow: 0 0 20px 6px rgba(255, 190, 46, 0.95), 0 0 35px 12px rgba(240, 140, 15, 0.45);
  animation: bulbGlowSway 3.6s infinite alternate ease-in-out;
  transform-origin: top center;
}

.fairy-bulb::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 3px;
  width: 10px;
  height: 6px;
  background: #243820;
  border-radius: 2px;
  border: 1px solid #3F5E36;
}

.fairy-bulb:nth-child(2) { left: 6%; animation-delay: 0.1s; }
.fairy-bulb:nth-child(3) { left: 19%; animation-delay: 1.3s; animation-duration: 3.1s; }
.fairy-bulb:nth-child(4) { left: 33%; animation-delay: 0.6s; animation-duration: 4.2s; }
.fairy-bulb:nth-child(5) { left: 48%; animation-delay: 1.9s; animation-duration: 3.4s; }
.fairy-bulb:nth-child(6) { left: 62%; animation-delay: 0.4s; animation-duration: 3.2s; }
.fairy-bulb:nth-child(7) { left: 76%; animation-delay: 1.6s; animation-duration: 3.8s; }
.fairy-bulb:nth-child(8) { left: 91%; animation-delay: 0.8s; animation-duration: 2.9s; }

@keyframes bulbGlowSway {
  0% {
    opacity: 0.75;
    transform: scale(0.92) rotate(-3deg);
    box-shadow: 0 0 14px 4px rgba(255, 190, 46, 0.7);
  }
  50% {
    opacity: 1;
    transform: scale(1.14) rotate(3deg);
    box-shadow: 0 0 26px 9px rgba(255, 190, 46, 1), 0 0 45px 16px rgba(240, 140, 15, 0.6);
  }
  100% {
    opacity: 0.88;
    transform: scale(0.98) rotate(-1.5deg);
    box-shadow: 0 0 18px 5px rgba(255, 190, 46, 0.85);
  }
}

/* ==========================================================================
   BOTONES FLOTANTES SUPERIORES (VELAS & MELODÍA)
   ========================================================================== */
.floating-top-controls {
  position: fixed;
  top: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1000;
}

.modern-action-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid var(--glass-border);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
  color: var(--moss-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-size: 1.25rem;
}

.modern-action-btn:hover {
  transform: translateY(-4px) scale(1.1);
  box-shadow: 0 12px 28px rgba(59, 107, 52, 0.3), 0 0 18px rgba(255, 184, 46, 0.4);
  background: #ffffff;
  color: var(--moss-dark);
  border-color: #FFB82E;
}

.modern-action-btn.active {
  background: linear-gradient(135deg, #3B6B34 0%, #1E381A 100%);
  color: #FFCF66;
  border-color: #FFB82E;
  box-shadow: 0 0 24px rgba(255, 184, 46, 0.7);
  animation: pulseGlowNight 2.6s infinite;
}

@keyframes pulseGlowNight {
  0% { box-shadow: 0 0 12px rgba(59, 107, 52, 0.4); }
  50% { box-shadow: 0 0 28px rgba(255, 184, 46, 0.8), 0 0 10px #FFCF66; }
  100% { box-shadow: 0 0 12px rgba(59, 107, 52, 0.4); }
}

/* ==========================================================================
   HERO CARD - CRESTA DEL 4TO ANIVERSARIO & CONTADOR
   ========================================================================== */
.hero-card {
  background: var(--glass-bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 32px;
  padding: 2.6rem 2rem 2.2rem;
  margin-bottom: 2.4rem;
  border: 2px solid var(--moss-glass-border);
  box-shadow: var(--glass-shadow);
  position: relative;
  z-index: 2;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
  overflow: hidden;
}

.hero-card::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border: 1.5px dashed var(--thread-yarn);
  border-radius: 24px;
  pointer-events: none;
  opacity: 0.6;
}

/* Sello Cresta de Aniversario Esculpido */
.anniversary-crest {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFFDF5 0%, #E8F2E4 50%, #C4DDC0 85%, #9EBF99 100%);
  border: 4px solid var(--moss-primary);
  box-shadow: 0 10px 30px rgba(30, 56, 26, 0.35), 0 0 25px rgba(255, 184, 46, 0.5), inset 0 2px 8px rgba(255, 255, 255, 0.8);
  margin-bottom: 1.3rem;
  position: relative;
  cursor: pointer;
  transition: all 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.anniversary-crest::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1.5px dashed var(--gold-antique);
  animation: rotateDashed 25s linear infinite;
}

@keyframes rotateDashed {
  100% { transform: rotate(360deg); }
}

.anniversary-crest:hover {
  transform: scale(1.12) rotate(6deg);
  box-shadow: 0 16px 40px rgba(30, 56, 26, 0.45), 0 0 35px rgba(255, 184, 46, 0.8);
}

.anniversary-crest span.number {
  font-family: var(--font-serif);
  font-size: 4.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #1E381A 0%, #3B6B34 50%, #875429 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

body.candlelight-mode .anniversary-crest {
  background: radial-gradient(circle at 35% 30%, #2A4426 0%, #182C16 65%, #0F1E0E 100%);
  border-color: #FFB82E;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 184, 46, 0.5);
}

body.candlelight-mode .anniversary-crest span.number {
  background: linear-gradient(135deg, #FFF5D0 0%, #FFB82E 50%, #E07D08 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.anniversary-badge {
  display: inline-block;
  background: linear-gradient(135deg, #E6F2E2 0%, #CDE3C6 100%);
  color: var(--moss-dark);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 7px 24px;
  border-radius: 30px;
  border: 1.5px solid var(--moss-primary);
  box-shadow: 0 4px 14px rgba(59, 107, 52, 0.2), 0 0 10px rgba(255, 184, 46, 0.25);
  transition: all 0.3s ease;
}

body.candlelight-mode .anniversary-badge {
  background: linear-gradient(135deg, #2A4426 0%, #1A2E17 100%);
  color: #FFCF66;
  border-color: #FFB82E;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), 0 0 15px rgba(255, 184, 46, 0.35);
}

/* Cuadrícula del Contador de Tiempo Juntos */
.time-counter-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 1.8rem;
}

.counter-box {
  background: rgba(255, 255, 255, 0.94);
  border: 1.5px solid var(--moss-soft);
  border-radius: 22px;
  padding: 16px 8px;
  text-align: center;
  box-shadow: 0 6px 18px rgba(30, 56, 26, 0.08);
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.counter-box::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  transform: skewX(-20deg);
  transition: 0.65s;
}

.counter-box:hover {
  transform: translateY(-6px) scale(1.04);
  border-color: #FFB82E;
  box-shadow: 0 12px 30px rgba(59, 107, 52, 0.22), 0 0 15px rgba(255, 184, 46, 0.25);
}

.counter-box:hover::after {
  left: 150%;
}

.counter-box .num {
  font-family: var(--font-serif);
  font-size: 1.95rem;
  font-weight: 700;
  color: var(--moss-primary);
  line-height: 1.1;
}

.counter-box .label {
  font-size: 0.74rem;
  text-transform: uppercase;
  color: var(--text-muted-custom);
  letter-spacing: 1.4px;
  font-weight: 700;
  margin-top: 2px;
}

/* ==========================================================================
   SECCIÓN 1: LAS 3 CARTAS DE AMOR RÚSTICAS & VIVAS
   ========================================================================== */
.letters-section {
  background: var(--glass-bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 32px;
  padding: 2.4rem 1.8rem;
  margin-bottom: 2.4rem;
  border: 2px solid var(--moss-glass-border);
  box-shadow: var(--glass-shadow);
  position: relative;
  z-index: 2;
}

.letters-section::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border: 1.5px dashed var(--thread-yarn);
  border-radius: 24px;
  pointer-events: none;
  opacity: 0.5;
}

/* Year Selector Tabs (Año 1, 2, 3, 4 y Todos) */
.year-tabs-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 4px 12px;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  scrollbar-width: thin;
  justify-content: center;
}

@media (max-width: 768px) {
  .year-tabs-nav {
    justify-content: flex-start;
  }
}

.year-tab-btn {
  flex: 0 0 auto;
  padding: 7px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  border: 1.5px solid var(--moss-soft);
  color: var(--moss-dark);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.year-tab-btn:hover {
  border-color: #FFB82E;
  transform: translateY(-2px);
  background: #FFFDF8;
}

.year-tab-btn.active {
  background: linear-gradient(135deg, var(--moss-vivid) 0%, var(--moss-primary) 100%);
  color: #FFFFFF;
  border-color: #FFB82E;
  box-shadow: 0 4px 14px rgba(59, 107, 52, 0.35), 0 0 14px rgba(255, 184, 46, 0.4);
}

body.candlelight-mode .year-tab-btn {
  background: rgba(24, 42, 26, 0.9);
  border-color: rgba(245, 206, 104, 0.3);
  color: #F4EFE6;
}

body.candlelight-mode .year-tab-btn.active {
  background: linear-gradient(135deg, #3B6B34 0%, #1E381A 100%);
  border-color: #FFB82E;
  color: #FFCF66;
}

.letters-progress-tracker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(59, 107, 52, 0.08);
  border-radius: 18px;
  padding: 12px 18px;
  margin-top: 0.6rem;
  border: 1px dashed var(--moss-vivid);
}

body.candlelight-mode .letters-progress-tracker {
  background: rgba(24, 42, 26, 0.8);
  border-color: rgba(245, 206, 104, 0.35);
}

.letters-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-top: 1.6rem;
}

/* ==========================================================================
   SOBRE 3D REALISTA CON HOJA DE PERGAMINO DESLIZANTE
   ========================================================================== */
.envelope-item {
  perspective: 1200px;
  position: relative;
  min-height: 260px;
}

.envelope-container {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 250px;
  border-radius: 26px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.45s ease;
  transform-style: preserve-3d;
}

.envelope-container:hover {
  transform: translateY(-9px) scale(1.02);
}

/* 1. Pared trasera interior del sobre */
.envelope-back-wall {
  position: absolute;
  inset: 0;
  border-radius: 26px;
  background: #EBE1D2;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(138, 86, 44, 0.16) 0%, rgba(68, 36, 14, 0.28) 100%),
    repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(125, 76, 37, 0.03) 11px);
  border: 2px solid var(--thread-yarn);
  box-shadow: inset 0 16px 35px rgba(0, 0, 0, 0.28), 0 14px 35px rgba(30, 56, 26, 0.16);
  z-index: 1;
}

.envelope-container.read .envelope-back-wall {
  background: #142811;
  background-image: radial-gradient(circle at 50% 50%, rgba(59, 107, 52, 0.25) 0%, rgba(10, 20, 9, 0.5) 100%);
  border-color: #FFB82E;
  box-shadow: inset 0 16px 35px rgba(0, 0, 0, 0.6), 0 14px 35px rgba(20, 36, 18, 0.4);
}

/* 2. Hoja de Pergamino Realista que sale del sobre */
.envelope-letter-sheet {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  height: 215px;
  background: #FAF5E8;
  background-image: 
    radial-gradient(ellipse at 50% 30%, #FFFDF7 0%, #F5EDDC 60%, #E7D1B1 100%),
    repeating-linear-gradient(0deg, transparent, transparent 18px, rgba(138, 86, 44, 0.08) 19px);
  border-radius: 18px;
  border: 1.5px solid #D9AC7C;
  box-shadow: inset 0 0 28px rgba(125, 76, 37, 0.22), 0 8px 20px rgba(0, 0, 0, 0.18);
  padding: 14px 16px;
  z-index: 2;
  transform: translateY(0);
  transition: transform 0.55s cubic-bezier(0.34, 1.3, 0.64, 1), box-shadow 0.45s ease, z-index 0.1s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

/* Cabecera del Pergamino con Borde Enrollado y Sello */
.sheet-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.sheet-year-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--thread-brown);
  background: rgba(217, 172, 124, 0.38);
  padding: 3px 9px;
  border-radius: 12px;
  border: 1px solid rgba(125, 76, 37, 0.3);
}

.sheet-lines {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.sheet-seal-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #F05530 0%, #C83516 65%, #8A1E06 100%);
  color: #FFF3DB;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 0.82rem;
  box-shadow: 0 3px 8px rgba(0,0,0,0.3);
  border: 1.5px solid #FFC978;
}

.envelope-container.read .sheet-seal-mini {
  background: radial-gradient(circle at 35% 35%, #FFE28A 0%, #FFB82E 60%, #B8760B 100%);
  color: #1E381A;
  border-color: #FFFDF0;
}

.sheet-line {
  height: 4.5px;
  background: rgba(125, 76, 37, 0.22);
  border-radius: 2px;
}

.sheet-line.line-title {
  height: auto;
  background: transparent;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--moss-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.sheet-line.line-1 { width: 88%; }
.sheet-line.line-2 { width: 96%; }
.sheet-line.line-3 { width: 72%; }

.sheet-read-prompt {
  font-family: var(--font-handwriting);
  font-size: 1.25rem;
  color: var(--thread-brown);
  text-align: right;
  font-weight: 700;
  opacity: 0.95;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
}

/* Efecto hover: el pergamino asoma suavemente */
.envelope-container:hover .envelope-letter-sheet {
  transform: translateY(-34px);
  box-shadow: inset 0 0 28px rgba(125, 76, 37, 0.28), 0 14px 32px rgba(0, 0, 0, 0.28);
}

/* 3. El bolsillo frontal del sobre (cubre el papel por delante) */
.envelope-pocket {
  position: absolute;
  inset: 0;
  border-radius: 26px;
  z-index: 4;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 18px 16px 20px;
  overflow: hidden;
}

.envelope-pocket-bg {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 74%;
  background: linear-gradient(145deg, #FFFDF8 0%, #F5ECE0 100%);
  border-radius: 0 0 26px 26px;
  border: 2px solid var(--thread-yarn);
  border-top: none;
  clip-path: polygon(0% 24%, 50% 0%, 100% 24%, 100% 100%, 0% 100%);
  box-shadow: 0 -6px 22px rgba(0, 0, 0, 0.1);
}

.envelope-container.read .envelope-pocket-bg {
  background: linear-gradient(145deg, #2E5227 0%, #152A12 100%);
  border-color: #FFB82E;
}

.envelope-pocket-content {
  position: relative;
  z-index: 5;
  text-align: center;
  pointer-events: auto;
}

/* 4. Solapa Triangular Superior con Sello de Cera */
.envelope-top-flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 52%;
  background: linear-gradient(180deg, #F8EFE0 0%, #EBDDC8 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-radius: 26px 26px 0 0;
  z-index: 6;
  transform-origin: top center;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), filter 0.3s ease;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 2px;
}

.envelope-container.read .envelope-top-flap {
  background: linear-gradient(180deg, #3A6332 0%, #1E381A 100%);
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.35);
}

.envelope-container:hover .envelope-top-flap {
  transform: rotateX(32deg);
}

/* Sello de Cera en la punta de la solapa */
.envelope-wax-seal {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin-bottom: -23px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.45rem;
  position: relative;
  z-index: 7;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
  background: radial-gradient(circle at 35% 35%, #F05530 0%, #C83516 65%, #8A1E06 100%);
  color: #FFF3DB;
  border: 2.5px solid #FFC978;
  box-shadow: 0 8px 22px rgba(200, 53, 22, 0.55), 0 0 16px rgba(255, 184, 46, 0.65);
  animation: sealBeat 2.6s infinite ease-in-out;
}

.envelope-container.read .envelope-wax-seal {
  background: radial-gradient(circle at 35% 35%, #FFE28A 0%, #FFB82E 60%, #B8760B 100%);
  color: #1E381A;
  border: 2.5px solid #FFFDF0;
  box-shadow: 0 8px 22px rgba(255, 184, 46, 0.65);
  animation: none;
}

.envelope-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
  transition: color 0.3s ease;
  color: var(--moss-dark);
}

.envelope-container.read .envelope-title {
  color: #FFFFFF;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.envelope-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted-custom);
  margin-bottom: 12px;
  line-height: 1.35;
}

.envelope-container.read .envelope-subtitle {
  color: #D6E8D0;
}

.envelope-status-badge {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
  background: #F8EFE0;
  color: var(--thread-brown);
  border: 1px solid var(--thread-yarn);
}

.envelope-container.read .envelope-status-badge {
  background: rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
  border: 1px solid #FFCF66;
}

/* ==========================================================================
   ANIMACIÓN: PAPEL SALIENDO DEL SOBRE AL ABRIRLO
   ========================================================================== */
.envelope-item.is-opening .envelope-container {
  transform: scale(1.05);
}

/* 1. La solapa se abre hacia arriba en 3D */
.envelope-item.is-opening .envelope-top-flap {
  transform: rotateX(180deg) !important;
  z-index: 1 !important;
  transition: transform 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 2. El papel sube y sale deslizándose con elegancia */
.envelope-item.is-opening .envelope-letter-sheet {
  transform: translateY(-145px) scale(1.08) !important;
  z-index: 20 !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45), 0 0 35px rgba(255, 184, 46, 0.55) !important;
  transition: transform 0.65s cubic-bezier(0.2, 1, 0.3, 1), box-shadow 0.65s ease;
}

.envelope-item.is-opening .sheet-read-prompt {
  color: #DE633D;
  transform: scale(1.1);
  transition: transform 0.3s ease;
}

/* Despliegue elegante del modal como papel que se expande */
@keyframes paperUnfoldModal {
  0% {
    opacity: 0;
    transform: scale(0.85) translateY(40px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ==========================================================================
   SECCIÓN FINAL: CARTA DE ESTE AÑO (4TO ANIVERSARIO - BODAS DE LINO)
   ========================================================================== */
.current-year-section {
  background: linear-gradient(145deg, rgba(255, 253, 245, 0.95) 0%, rgba(245, 236, 224, 0.92) 100%);
  border: 2.5px solid #FFCF66 !important;
  box-shadow: 0 16px 45px rgba(59, 107, 52, 0.2), 0 0 35px rgba(255, 184, 46, 0.3) !important;
  position: relative;
}

body.candlelight-mode .current-year-section {
  background: linear-gradient(145deg, rgba(24, 42, 26, 0.96) 0%, rgba(14, 26, 16, 0.94) 100%);
  border-color: #FFB82E !important;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6), 0 0 40px rgba(255, 184, 46, 0.4) !important;
}

.current-year-section::before {
  border-color: #DE633D !important;
}

.current-year-envelope-wrapper {
  max-width: 440px;
  margin: 1.4rem auto 0;
  perspective: 1200px;
}

.current-year-envelope-card {
  min-height: 275px;
}

.envelope-special-gold {
  border-color: #FFB82E;
  box-shadow: 0 14px 35px rgba(59, 107, 52, 0.25), 0 0 25px rgba(255, 184, 46, 0.35);
}

.envelope-special-gold .envelope-pocket-bg {
  border: 2px solid #FFCF66;
}

.seal-special-gold {
  background: radial-gradient(circle at 35% 35%, #FFE072 0%, #FFB82E 60%, #C87A08 100%) !important;
  color: #1E381A !important;
  border: 3px solid #FFF8E7 !important;
  box-shadow: 0 8px 24px rgba(255, 184, 46, 0.7), 0 0 20px rgba(255, 184, 46, 0.8) !important;
  animation: sealBeat 2.2s infinite ease-in-out !important;
}

.sheet-special-gold {
  border: 2px solid #FFB82E !important;
  box-shadow: inset 0 0 30px rgba(255, 184, 46, 0.25), 0 8px 25px rgba(0, 0, 0, 0.22) !important;
}

.sheet-special-gold .sheet-year-badge {
  background: rgba(255, 184, 46, 0.35) !important;
  color: #5A2E0E !important;
  border-color: #FFB82E !important;
  font-weight: 800 !important;
}

/* ==========================================================================
   PERGAMINO MODAL READER (Realistic Antique Scroll Parchment & Smooth Scroll)
   ========================================================================== */
#letterDetailModal .modal-dialog {
  max-width: 760px;
  margin: 1.5rem auto;
}

#letterDetailModal .modal-content {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.letter-modal-paper {
  background: #FDF8ED;
  background-image: 
    radial-gradient(ellipse at 50% 25%, #FFFDF8 0%, #F8EFE0 52%, #EEDBBF 82%, #DFC39E 100%),
    repeating-linear-gradient(0deg, transparent, transparent 27px, rgba(125, 76, 37, 0.05) 28px);
  border-radius: 28px;
  padding: 2.2rem 2.2rem 1.6rem;
  position: relative;
  border: 2.5px solid #C89D66;
  box-shadow: 
    inset 0 0 65px rgba(125, 76, 37, 0.32), 
    inset 0 0 110px rgba(88, 48, 18, 0.18),
    0 25px 80px rgba(0, 0, 0, 0.65), 
    0 0 50px rgba(255, 184, 46, 0.4);
  max-height: calc(100vh - 3.5rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1;
}

.letter-modal-paper::before {
  content: '';
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  bottom: 12px;
  border: 1.5px dashed rgba(160, 102, 54, 0.45);
  border-radius: 20px;
  pointer-events: none;
}

.modal.show .letter-modal-paper {
  animation: paperUnfoldModal 0.48s cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
}

/* Botón de Cierre Elegante del Pergamino */
.letter-modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: 1.5px solid #C89D66;
  color: #7D4C25;
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.letter-modal-close-btn:hover {
  background: #C83516;
  color: #FFF;
  border-color: #FFCF66;
  transform: rotate(90deg) scale(1.15);
  box-shadow: 0 0 14px rgba(200, 53, 22, 0.6);
}

/* Header Fijo del Pergamino */
.letter-modal-header {
  flex: 0 0 auto;
  padding-bottom: 12px;
  margin-bottom: 8px;
  border-bottom: 1.5px solid rgba(160, 102, 54, 0.28);
  position: relative;
  z-index: 2;
}

/* Sello Real en el Pergamino Abierto */
.letter-modal-seal {
  width: 62px;
  height: 62px;
  margin: 0 auto 10px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  background: radial-gradient(circle at 35% 35%, #F05530 0%, #C83516 65%, #8A1E06 100%);
  color: #FFF3DB;
  border: 3px solid #FFCF66;
  box-shadow: 0 10px 25px rgba(200, 53, 22, 0.55), 0 0 20px rgba(255, 184, 46, 0.6);
}

.letter-modal-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: #3E2410;
  margin-bottom: 4px;
  letter-spacing: 0.3px;
}

.letter-modal-date {
  font-size: 0.85rem;
  color: #3B6B34;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.letter-scroll-ornament {
  font-size: 0.95rem;
  color: #B8760B;
  letter-spacing: 4px;
  opacity: 0.8;
}

/* Cuerpo Desplazable del Pergamino con Scrollbar Artesanal y Lectura Completa */
.letter-modal-body-scroll {
  flex: 1 1 auto;
  min-height: 0 !important;
  max-height: 52vh !important;
  overflow-y: scroll !important;
  overflow-x: hidden !important;
  padding: 0.8rem 1.4rem 1.8rem 0.6rem;
  margin-right: -4px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
}

.letter-modal-body-scroll::-webkit-scrollbar {
  width: 10px;
}

.letter-modal-body-scroll::-webkit-scrollbar-track {
  background: rgba(125, 76, 37, 0.1);
  border-radius: 6px;
  margin: 4px 0;
}

.letter-modal-body-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #D4AF37 0%, #996515 100%);
  border-radius: 6px;
  border: 2px solid #FDF8ED;
  box-shadow: inset 0 0 4px rgba(0,0,0,0.2), 0 0 6px rgba(255, 184, 46, 0.4);
}

.letter-modal-body-scroll::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #FFCF66 0%, #D4AF37 100%);
  box-shadow: 0 0 10px rgba(255, 184, 46, 0.8);
}

.letter-modal-text {
  font-size: 1.08rem;
  line-height: 1.85;
  color: #321A07;
  text-align: justify;
  font-family: 'Cinzel', serif, Georgia;
  font-weight: 400;
  letter-spacing: 0.2px;
}

.letter-modal-text p {
  margin-bottom: 1.1rem;
}

/* Letra Capitular Iluminada en el Primer Párrafo */
.letter-modal-text p:first-of-type::first-letter {
  font-family: 'Cinzel', serif;
  font-size: 2.8rem;
  float: left;
  line-height: 0.85;
  margin: 0.15rem 0.55rem 0 0;
  color: #8A1E06;
  font-weight: 700;
  text-shadow: 1px 1px 2px rgba(255, 184, 46, 0.4);
}

.letter-modal-signature {
  font-family: var(--font-handwriting);
  font-size: 1.85rem;
  color: #3E2410;
  font-weight: 700;
  display: inline-block;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* Botón de Confirmación con Sello y Destello */
.btn-seal-confirm {
  background: linear-gradient(135deg, var(--moss-vivid) 0%, var(--moss-primary) 100%);
  color: #FFFFFF;
  border: 2px solid #FFCF66;
  border-radius: 30px;
  padding: 10px 28px;
  font-weight: 700;
  font-size: 0.94rem;
  letter-spacing: 0.4px;
  box-shadow: 0 8px 24px rgba(59, 107, 52, 0.35), 0 0 15px rgba(255, 184, 46, 0.4);
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-seal-confirm:hover {
  background: linear-gradient(135deg, #FFB82E 0%, #DE633D 100%);
  color: #1E381A;
  border-color: #FFFDF0;
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 12px 30px rgba(222, 99, 61, 0.45), 0 0 25px rgba(255, 184, 46, 0.7);
}

@media (max-width: 576px) {
  .letter-modal-paper {
    padding: 1.8rem 1.2rem 1.4rem;
    max-height: calc(100vh - 2rem);
  }
  .letter-modal-title {
    font-size: 1.15rem;
  }
  .letter-modal-seal {
    width: 52px;
    height: 52px;
    font-size: 1.35rem;
  }
  .letter-modal-body-scroll {
    max-height: 48vh !important;
    padding: 0.6rem 0.8rem 1.2rem 0.4rem;
  }
  .letter-modal-text {
    font-size: 0.98rem;
    line-height: 1.7;
    text-align: left;
  }
  .letter-modal-signature {
    font-size: 1.5rem;
  }
}

/* ==========================================================================
   MAPA DINÁMICO & HITOS EN VILLA HAYES
   ========================================================================== */
.map-card {
  background: var(--glass-bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 32px;
  padding: 2.2rem 1.8rem;
  margin-bottom: 2.4rem;
  border: 2px solid var(--moss-glass-border);
  box-shadow: var(--glass-shadow);
  position: relative;
  z-index: 2;
}

.map-card::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border: 1.5px dashed var(--thread-yarn);
  border-radius: 24px;
  pointer-events: none;
  opacity: 0.5;
}

#map {
  width: 100%;
  height: 400px;
  border-radius: 24px;
  border: 2px solid var(--moss-soft);
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.12), 0 8px 24px rgba(30, 56, 26, 0.1);
  margin-top: 1.2rem;
  margin-bottom: 1.4rem;
  z-index: 10;
  overflow: hidden;
}

/* Stepper de Hitos */
.milestones-stepper {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: thin;
  margin-bottom: 0.6rem;
}

.milestones-stepper::-webkit-scrollbar {
  height: 5px;
}
.milestones-stepper::-webkit-scrollbar-thumb {
  background: var(--gold-antique);
  border-radius: 5px;
}

.milestone-chip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  border: 1.5px solid var(--moss-soft);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--moss-dark);
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}

.milestone-chip:hover {
  border-color: #FFB82E;
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(59, 107, 52, 0.2);
}

.milestone-chip.active {
  background: linear-gradient(135deg, var(--moss-vivid) 0%, var(--moss-primary) 100%);
  color: #fff;
  border-color: #FFB82E;
  box-shadow: 0 6px 18px rgba(59, 107, 52, 0.35), 0 0 15px rgba(255, 184, 46, 0.4);
}

.milestone-chip .chip-icon {
  font-size: 1.25rem;
}

/* Leaflet Custom Marker Styling */
.custom-milestone-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1.4rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.custom-milestone-marker:hover {
  transform: scale(1.3);
}

.marker-step {
  background: radial-gradient(circle, #FFFDF8 0%, #D8EAD4 100%);
  border: 3px solid var(--moss-primary);
}

.marker-start {
  background: radial-gradient(circle, #FFF3D6 0%, #FFB82E 100%);
  border: 3px solid #8A4F08;
}

.marker-dest {
  background: radial-gradient(circle, #FFE4E4 0%, #E63946 100%);
  border: 3.5px solid #8A0E18;
  animation: pulseDestGlow 2.2s infinite ease-in-out;
}

.marker-user {
  background: radial-gradient(circle, #FFFFFF 0%, #FF6584 100%);
  border: 3.5px solid #D90429;
  animation: pulseUserGlow 1.8s infinite ease-in-out;
}

@keyframes pulseDestGlow {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(230, 57, 70, 0.7); }
  50% { transform: scale(1.18); box-shadow: 0 0 0 14px rgba(230, 57, 70, 0); }
}

@keyframes pulseUserGlow {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(217, 4, 41, 0.7); }
  50% { transform: scale(1.2); box-shadow: 0 0 0 16px rgba(217, 4, 41, 0); }
}

/* Toolbar de Simulación */
.sim-controls-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(59, 107, 52, 0.08);
  border: 1px solid var(--moss-soft);
  border-radius: 20px;
  padding: 12px 18px;
}

body.candlelight-mode .sim-controls-toolbar {
  background: rgba(24, 42, 26, 0.8);
  border-color: rgba(245, 206, 104, 0.3);
}

.btn-rustic {
  background: linear-gradient(135deg, var(--thread-caramel) 0%, var(--thread-brown) 100%);
  color: #FFFDF8;
  border: none;
  font-weight: 600;
  transition: all 0.35s ease;
}

.btn-rustic:hover {
  background: linear-gradient(135deg, var(--thread-brown) 0%, #4E280E 100%);
  color: #FFFFFF;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(125, 76, 37, 0.4);
}

.btn-eucalyptus {
  background: linear-gradient(135deg, var(--moss-vivid) 0%, var(--moss-primary) 100%);
  color: #FFFFFF;
  border: none;
  font-weight: 600;
  transition: all 0.35s ease;
}

.btn-eucalyptus:hover {
  background: linear-gradient(135deg, var(--moss-primary) 0%, var(--moss-dark) 100%);
  color: #FFFFFF;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(59, 107, 52, 0.4), 0 0 14px rgba(255, 184, 46, 0.3);
}

/* ==========================================================================
   RADAR GPS ASTROLABIO 3D
   ========================================================================== */
.radar-card {
  background: var(--glass-bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 32px;
  padding: 2.2rem 1.8rem;
  margin-bottom: 2.4rem;
  border: 2px solid var(--moss-glass-border);
  box-shadow: var(--glass-shadow);
  position: relative;
  z-index: 2;
}

.radar-card::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border: 1.5px dashed var(--thread-yarn);
  border-radius: 24px;
  pointer-events: none;
  opacity: 0.5;
}

.radar-compass-wrapper {
  position: relative;
  width: 154px;
  height: 154px;
  margin: 0 auto 1.4rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 107, 52, 0.1) 0%, rgba(30, 56, 26, 0.3) 100%);
  border: 3.5px solid #FFB82E;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), 0 0 20px rgba(255, 184, 46, 0.4);
}

.radar-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px dashed rgba(255, 184, 46, 0.45);
}
.radar-ring.outer { width: 132px; height: 132px; }
.radar-ring.middle { width: 92px; height: 92px; }
.radar-ring.inner { width: 52px; height: 52px; }

/* Radar Sonar Sweep Scan con Brillo Dorado */
.radar-pulse {
  position: absolute;
  width: 154px;
  height: 154px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0deg, transparent 270deg, rgba(255, 184, 46, 0.45) 360deg);
  animation: sonarScanGold 3s linear infinite;
  pointer-events: none;
}

@keyframes sonarScanGold {
  100% { transform: rotate(360deg); }
}

.radar-needle {
  position: absolute;
  width: 5px;
  height: 68px;
  background: linear-gradient(to top, transparent 0%, #FFCF66 40%, #E63946 100%);
  border-radius: 3px;
  top: 9px;
  transform-origin: bottom center;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 12px rgba(255, 184, 46, 0.9);
}

.radar-center-icon {
  font-size: 2rem;
  position: relative;
  z-index: 3;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}

.distance-highlight {
  font-family: var(--font-serif);
  font-size: 2.9rem;
  font-weight: 700;
  color: var(--moss-primary);
  line-height: 1;
}

body.candlelight-mode .distance-highlight {
  color: #FFCF66;
  text-shadow: 0 0 20px rgba(255, 207, 102, 0.5);
}

.distance-progress-bar {
  width: 100%;
  height: 12px;
  background: rgba(59, 107, 52, 0.14);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 1rem;
  border: 1px solid var(--moss-soft);
}

.distance-progress-fill {
  height: 100%;
  width: 20%;
  background: linear-gradient(90deg, var(--moss-light) 0%, var(--moss-vivid) 50%, #FFB82E 100%);
  border-radius: 12px;
  transition: width 0.6s ease;
  box-shadow: 0 0 12px rgba(255, 184, 46, 0.5);
}

.status-pill {
  display: inline-block;
  padding: 9px 26px;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.status-pill.locked {
  background: #FFF3CD;
  color: #856404;
  border: 1.5px solid #FFEEBA;
}

.status-pill.unlocked {
  background: linear-gradient(135deg, var(--moss-vivid) 0%, var(--moss-dark) 100%);
  color: #FFFFFF;
  border: 2px solid #FFB82E;
  box-shadow: 0 0 25px rgba(59, 107, 52, 0.6), 0 0 15px rgba(255, 184, 46, 0.5);
}

/* ==========================================================================
   TENDEDERO DE RECUERDOS (POLAROIDS 3D EN CUERDA DE YUTE)
   ========================================================================== */
.tendedero-section {
  position: relative;
  margin-bottom: 3rem;
  z-index: 2;
}

.tendedero-rope-wrapper {
  position: relative;
  width: 100%;
  height: 32px;
  margin-bottom: 1.8rem;
  display: flex;
  align-items: center;
}

.jute-rope {
  width: 100%;
  height: 5px;
  background: repeating-linear-gradient(
    45deg,
    #7D4C25,
    #7D4C25 10px,
    #A06432 10px,
    #A06432 20px,
    #D9AC7C 20px,
    #D9AC7C 25px
  );
  box-shadow: 0 5px 12px rgba(125, 76, 37, 0.5);
  border-radius: 3px;
}

.jute-rope-end-left, .jute-rope-end-right {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #4E280E;
  border: 2px solid #D9AC7C;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
}

.polaroids-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 28px;
  padding: 12px 6px;
}

/* Polaroid Card 3D */
.polaroid-card {
  background: #FFFFFF;
  border-radius: 14px;
  padding: 15px 15px 20px;
  box-shadow: 0 16px 40px rgba(30, 56, 26, 0.16);
  border: 1px solid rgba(0, 0, 0, 0.08);
  position: relative;
  transition: all 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  user-select: none;
}

/* Rotación orgánica de tendedero */
.polaroids-container > div:nth-child(1) { transform: rotate(-2deg); }
.polaroids-container > div:nth-child(2) { transform: rotate(2.5deg); }
.polaroids-container > div:nth-child(3) { transform: rotate(-1.5deg); }
.polaroids-container > div:nth-child(4) { transform: rotate(2deg); }
.polaroids-container > div:nth-child(5) { transform: rotate(-2.5deg); }

.polaroid-card:hover {
  transform: translateY(-10px) scale(1.05) rotate(0deg) !important;
  box-shadow: 0 25px 55px rgba(30, 56, 26, 0.28), 0 0 25px rgba(255, 184, 46, 0.3);
  z-index: 10;
}

.polaroid-photo-frame {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: #18281B;
  margin-bottom: 14px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
}

.polaroid-photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.polaroid-card:hover .polaroid-photo-frame img {
  transform: scale(1.08);
}

.polaroid-caption {
  text-align: center;
}

.polaroid-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--moss-dark);
  margin-bottom: 3px;
}

.polaroid-date {
  font-size: 0.78rem;
  color: var(--moss-vivid);
  margin-bottom: 8px;
  font-weight: 600;
}

.polaroid-note {
  font-family: var(--font-handwriting);
  font-size: 1.35rem;
  color: var(--thread-brown);
  line-height: 1.25;
}

/* Broche de Madera Rústico */
.wooden-clothespin {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 36px;
  z-index: 10;
  pointer-events: none;
}

.clothespin-body {
  width: 20px;
  height: 36px;
  background: linear-gradient(to right, #B07C4A 0%, #E0B07A 50%, #875429 100%);
  border-radius: 4px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.35);
  position: relative;
}

.clothespin-split {
  position: absolute;
  bottom: 0;
  left: 8px;
  width: 4px;
  height: 18px;
  background: #3A1F0C;
}

.clothespin-spring {
  position: absolute;
  top: 11px;
  left: 2px;
  width: 16px;
  height: 5px;
  background: #C4C4C4;
  border-radius: 2px;
  border: 1px solid #666;
}

/* Acciones en Polaroid */
.polaroid-actions-overlay {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 8px;
  opacity: 0.9;
  transition: opacity 0.2s ease;
}

.polaroid-card:hover .polaroid-actions-overlay {
  opacity: 1;
}

.btn-polaroid-action {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.15);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--moss-dark);
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-polaroid-action:hover {
  transform: scale(1.2);
  background: var(--moss-primary);
  color: #fff;
  border-color: #FFB82E;
  box-shadow: 0 0 12px rgba(255, 184, 46, 0.6);
}

/* ==========================================================================
   MODAL PERGAMINO REALISTA (MANUSCRITO DE AMOR VINTAGE)
   ========================================================================== */
.letter-modal-paper {
  background: #FAF4E6;
  background-image: 
    radial-gradient(ellipse at 50% 30%, #FFFDF5 0%, #F5EBD7 55%, #E5CEAA 95%, #D4BA90 100%),
    repeating-linear-gradient(0deg, transparent, transparent 27px, rgba(125, 76, 37, 0.08) 28px);
  border: 3px solid #C89C6B;
  border-radius: 28px;
  padding: 3rem 2.4rem 2.6rem;
  box-shadow: 
    inset 0 0 55px rgba(120, 70, 30, 0.28),
    0 35px 85px rgba(10, 20, 10, 0.6),
    0 0 35px rgba(255, 184, 46, 0.3);
  position: relative;
  overflow: hidden;
}

/* Bordes Decorativos del Pergamino Antiguo */
.letter-modal-paper::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border: 1.5px dashed rgba(160, 100, 50, 0.45);
  border-radius: 22px;
  pointer-events: none;
}

.letter-modal-seal {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #FFE28A 0%, #FFB82E 65%, #B8760B 100%);
  color: #1E381A;
  border: 3.5px solid #FFFDF0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.7rem;
  margin: 0 auto 14px;
  box-shadow: 0 10px 26px rgba(255, 184, 46, 0.65), inset 0 2px 6px rgba(255, 255, 255, 0.8);
}

.letter-modal-text {
  font-family: var(--font-sans);
  font-size: 1.12rem;
  line-height: 1.9;
  color: #2D2214;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.6);
  position: relative;
  z-index: 2;
}

body.candlelight-mode .letter-modal-text {
  color: #F8F1E2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Ghost Overlay Modal (Plaza Héroes del Chaco) */
.ghost-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(11, 21, 13, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.ghost-character {
  font-size: 7rem;
  animation: ghostFloat 2.2s infinite ease-in-out alternate;
  filter: drop-shadow(0 0 30px rgba(255, 255, 255, 0.9));
}

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

.ghost-dialog-box {
  background: #FFFFFF;
  border-radius: 24px;
  padding: 24px 28px;
  max-width: 400px;
  margin: 16px auto 0;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  border: 2px solid #FFB82E;
}

/* Toast de Pistas Flotante */
.toast-clue-card {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--glass-bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 2px solid #FFB82E;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 184, 46, 0.35);
  border-radius: 24px;
  padding: 16px 22px;
  z-index: 1050;
  max-width: 90vw;
  width: 440px;
}

/* ==========================================================================
   REPRODUCTOR DE PLAYLIST FLOTANTE & LISTA DE CANCIONES
   ========================================================================== */
.floating-audio-bar {
  position: fixed;
  bottom: 24px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--glass-bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 2px solid var(--moss-primary);
  box-shadow: 0 16px 40px rgba(30, 56, 26, 0.25), 0 0 18px rgba(255, 184, 46, 0.2);
  border-radius: 40px;
  padding: 8px 18px 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 1045;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 95vw;
}

.floating-audio-bar:hover {
  transform: translateX(-50%) translateY(-4px);
  box-shadow: 0 22px 50px rgba(30, 56, 26, 0.35), 0 0 25px rgba(255, 184, 46, 0.4);
  border-color: #FFB82E;
}

.audio-control-btn {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--moss-soft);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--moss-dark);
  font-size: 0.85rem;
  transition: all 0.25s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  flex-shrink: 0;
}

.audio-control-btn:hover {
  background: var(--moss-primary);
  color: #FFFFFF;
  border-color: #FFB82E;
  transform: scale(1.15);
  box-shadow: 0 0 10px rgba(255, 184, 46, 0.5);
}

.audio-control-btn.playlist-toggle-btn {
  font-size: 0.95rem;
}

.audio-play-disk {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--moss-vivid) 0%, var(--moss-dark) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2.5px solid #FFCF66;
  box-shadow: 0 4px 14px rgba(59, 107, 52, 0.4);
  transition: transform 0.3s ease;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.audio-play-disk.rotating {
  animation: spinRecord 4s linear infinite;
  box-shadow: 0 0 20px rgba(255, 184, 46, 0.7);
}

@keyframes spinRecord {
  100% { transform: rotate(360deg); }
}

.audio-track-info {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  min-width: 140px;
  max-width: 220px;
  padding: 0 4px;
}

.audio-track-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--moss-dark);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audio-track-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted-custom);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Items de la Playlist Modal */
.playlist-track-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(59, 107, 52, 0.06);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.25s ease;
}

.playlist-track-item:hover {
  background: rgba(255, 184, 46, 0.15);
  border-color: #FFB82E;
  transform: translateX(4px);
}

.playlist-track-item.active {
  background: linear-gradient(135deg, var(--moss-vivid) 0%, var(--moss-primary) 100%);
  color: #FFFFFF;
  border-color: #FFB82E;
  box-shadow: 0 4px 14px rgba(59, 107, 52, 0.3), 0 0 12px rgba(255, 184, 46, 0.35);
}

.playlist-track-item.active .track-artist {
  color: #FFCF66 !important;
}

.playlist-track-item.active .track-num {
  background: #FFB82E;
  color: #1E381A;
}

.track-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(59, 107, 52, 0.15);
  color: var(--moss-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}

.track-info-col {
  flex-grow: 1;
  padding: 0 10px;
}

.track-title {
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
}

.track-artist {
  font-size: 0.74rem;
  color: var(--text-muted-custom);
}

/* Ondas del Ecualizador */
.audio-waveform-bars {
  display: flex;
  align-items: flex-end;
  gap: 3.5px;
  height: 22px;
  padding-right: 2px;
  flex-shrink: 0;
}

.wave-bar {
  width: 4px;
  height: 4px;
  background: var(--moss-primary);
  border-radius: 2px;
  transition: height 0.15s ease;
}

.floating-audio-bar.playing .wave-bar:nth-child(1) { animation: waveBounceGold 0.8s ease-in-out infinite alternate; }
.floating-audio-bar.playing .wave-bar:nth-child(2) { animation: waveBounceGold 0.6s ease-in-out 0.2s infinite alternate; }
.floating-audio-bar.playing .wave-bar:nth-child(3) { animation: waveBounceGold 0.9s ease-in-out 0.4s infinite alternate; }
.floating-audio-bar.playing .wave-bar:nth-child(4) { animation: waveBounceGold 0.7s ease-in-out 0.1s infinite alternate; }
.floating-audio-bar.playing .wave-bar:nth-child(5) { animation: waveBounceGold 0.85s ease-in-out 0.3s infinite alternate; }

@keyframes waveBounceGold {
  0% { height: 4px; background: var(--moss-light); }
  100% { height: 22px; background: #FFB82E; box-shadow: 0 0 8px #FFB82E; }
}

/* ==========================================================================
   PWA INSTALL FLOATING BANNER
   ========================================================================== */
.pwa-install-banner {
  position: fixed;
  bottom: 88px;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: var(--glass-bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1.5px solid var(--moss-primary);
  box-shadow: 0 14px 40px rgba(30, 56, 26, 0.3);
  border-radius: 26px;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  z-index: 1046;
  max-width: 92vw;
  width: 480px;
}

/* ==========================================================================
   RESPONSIVE DESIGN BREAKPOINTS
   ========================================================================== */
@media (max-width: 768px) {
  .letters-grid {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .envelope-item {
    min-height: 240px;
    margin-bottom: 12px;
  }
  
  .time-counter-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .hero-card {
    padding: 2rem 1.4rem 1.6rem;
  }
  
  .letters-section, .map-card, .radar-card {
    padding: 1.6rem 1.2rem;
  }

  .floating-audio-bar {
    width: calc(100% - 24px);
    max-width: 440px;
    bottom: 16px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    gap: 6px;
    padding: 6px 12px 6px 10px;
    border-radius: 30px;
    z-index: 1045;
  }

  .audio-control-btn {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }

  .audio-play-disk {
    width: 38px;
    height: 38px;
    font-size: 0.95rem;
  }

  .audio-track-info {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    padding: 0 4px;
  }

  .audio-track-title {
    font-size: 0.8rem;
  }

  .audio-track-subtitle {
    font-size: 0.68rem;
  }

  .audio-waveform-bars {
    display: none;
  }

  .pwa-install-banner {
    width: calc(100% - 24px);
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    padding: 10px 14px;
    border-radius: 20px;
  }
}

@media (max-width: 390px) {
  .floating-audio-bar {
    width: calc(100% - 16px);
    gap: 4px;
    padding: 5px 8px;
  }

  .audio-control-btn {
    width: 28px;
    height: 28px;
    font-size: 0.72rem;
  }

  .audio-play-disk {
    width: 34px;
    height: 34px;
    font-size: 0.85rem;
  }

  .audio-track-title {
    font-size: 0.75rem;
  }

  .audio-track-subtitle {
    display: none;
  }
}

