/* ==========================================================================
   CARTA DE AMOR INTERACTIVA Y DINÁMICA (MOBILE-FIRST)
   Diseño de Carta Antigua con Renglones Subrayados y Fotos Intercaladas
   ========================================================================== */

/* --------------------------------------------------------------------------
   SISTEMA DE TEMAS CROMÁTICOS (Atardecer Formal por Defecto)
   -------------------------------------------------------------------------- */

:root,
[data-theme="lovepaper-dark"],
[data-theme="lovepaper"] {
  /* Fondo general LovePaper (Noche Ciruela Profunda con resplandor frambuesa) */
  --bg-main: #0c0509;
  --bg-gradient: 
    radial-gradient(ellipse 75% 60% at 50% 18%, #2a0c18 0%, #1a0810 45%, #0c0509 100%),
    radial-gradient(circle at 85% 85%, rgba(241, 39, 123, 0.16) 0%, transparent 60%),
    radial-gradient(circle at 15% 75%, rgba(237, 43, 110, 0.14) 0%, transparent 60%);

  /* Papel de la carta: 2luv Algodón Día (Papel crema suave y cálido textura algodón) */
  --bg-paper: #fbf6ec;
  --paper-border: rgba(142, 36, 51, 0.24);
  --paper-shadow: 0 30px 85px rgba(0, 0, 0, 0.95), 0 0 50px rgba(241, 39, 123, 0.22);
  --ruled-line: rgba(142, 36, 51, 0.20);
  --ruled-line-paper: rgba(81, 45, 30, 0.08);
  --paper-texture: radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.5) 0%, rgba(235, 222, 206, 0.35) 100%);

  /* Textos de la interfaz ambiental y sobre (sobre fondo oscuro) */
  --text-main: #f7e9ee;        /* Marfil luminoso con matiz rosa */
  --text-secondary: #d8b8c6;   /* Rosa malva suave */
  --text-muted: #9e7a8c;       /* Muted berry */

  /* Textos de la carta en papel algodón (2luv Algodón Día) */
  --text-letter: #2b1d16;          /* Tinta espresso profunda, nítida y legible */
  --text-letter-secondary: #523b2f;/* Tinta sepia cálida */
  --text-letter-muted: #7d6556;    /* Sepia suave */
  --text-letter-title: #8e2433;    /* Vino tinto noble para encabezados y orlas */
  --signature-shadow: 0 1px 2px rgba(142, 36, 51, 0.15);

  /* Acentos LovePaper (Frambuesa Neón #f1277b y Rosa Suave #ff7aa8) */
  --accent-primary: #f1277b;   /* LovePaper Passion Pink */
  --accent-secondary: #ff7aa8; /* Soft Rose */
  --accent-glow: rgba(241, 39, 123, 0.45);

  /* Elementos del sobre completo (2luv Algodón Día: Sobre Crema Algodón) */
  --envelope-body: #ece2d4;
  --envelope-flap: #e2d5c4;
  --envelope-border: rgba(142, 36, 51, 0.22);
  --envelope-shadow: 0 25px 65px rgba(0, 0, 0, 0.75), 0 0 40px rgba(241, 39, 123, 0.22);
  --envelope-text: #2b1d16;    /* Tinta oscura para rotular "Para: Mi Niña Hermosa" */
  --envelope-accent: #8e2433;  /* Subtítulo y detalles en vino tinto */
  --seal-base: #8e2433;        /* Sello de cera en vino tinto 2luv */
  --seal-shadow: #5c141f;
  --seal-gold: #f2d7a8;

  /* Polaroid en papel algodón */
  --polaroid-bg: #ffffff;
  --polaroid-text: #2b1d16;    /* Tinta espresso oscura */
  --polaroid-shadow: 0 16px 36px rgba(43, 29, 22, 0.22);
  --washi-tape: rgba(241, 39, 123, 0.75);

  /* Botones y controles LovePaper */
  --btn-bg: #f1277b;           /* Botón neón LovePaper */
  --btn-hover: #d11a68;
  --btn-text: #ffffff;
  --btn-border: #ff7aa8;
  --glass-bg: rgba(26, 8, 16, 0.88);
  --glass-border: rgba(241, 39, 123, 0.38);
}

[data-theme="lovepaper-paper"] {
  /* LovePaper Pergamino Cálido & Rosa Neón */
  --bg-main: #140810;
  --bg-gradient: radial-gradient(ellipse at 50% 15%, #2c0e1e 0%, #0c0509 100%);

  --bg-paper: #fbf3e8;
  --paper-border: rgba(241, 39, 123, 0.32);
  --paper-shadow: 0 25px 65px rgba(0, 0, 0, 0.8), 0 0 40px rgba(241, 39, 123, 0.22);
  --ruled-line: rgba(120, 70, 90, 0.22);
  --ruled-line-paper: rgba(120, 70, 90, 0.10);
  --paper-texture: radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.4) 0%, rgba(245, 230, 238, 0.25) 100%);

  --text-main: #f7e9ee;
  --text-secondary: #d8b8c6;
  --text-muted: #9e7a8c;

  --text-letter: #241118;
  --text-letter-secondary: #57293b;
  --text-letter-muted: #8c576f;
  --text-letter-title: #f1277b;
  --signature-shadow: 0 1px 2px rgba(241, 39, 123, 0.2);

  --accent-primary: #f1277b;
  --accent-secondary: #ff7aa8;
  --accent-glow: rgba(241, 39, 123, 0.38);

  --envelope-body: #241118;
  --envelope-flap: #301721;
  --envelope-shadow: 0 25px 60px rgba(0, 0, 0, 0.9);
  --seal-base: #f1277b;
  --seal-shadow: #8a103c;
  --seal-gold: #ffffff;

  --polaroid-bg: #ffffff;
  --polaroid-text: #241118;
  --polaroid-shadow: 0 16px 36px rgba(0, 0, 0, 0.3);
  --washi-tape: rgba(241, 39, 123, 0.7);

  --btn-bg: #f1277b;
  --btn-hover: #d11a68;
  --btn-text: #ffffff;
  --btn-border: #ff7aa8;
  --glass-bg: rgba(36, 17, 24, 0.9);
  --glass-border: rgba(241, 39, 123, 0.32);
}

[data-theme="2luv-bloom"],
[data-theme="atardecer-formal"] {
  /* Fondo general 2-luv.com (Café Espresso Profundo con resplandor vino y oro) */
  --bg-main: #140d09;
  --bg-gradient: 
    radial-gradient(ellipse 70% 55% at 50% 12%, rgba(142, 36, 51, 0.25) 0%, transparent 68%),
    radial-gradient(ellipse 60% 45% at 85% 85%, rgba(217, 180, 124, 0.14) 0%, transparent 65%),
    radial-gradient(circle at 15% 70%, rgba(163, 49, 63, 0.16) 0%, transparent 60%),
    #120b08;

  /* Papel de la carta (Cacao intenso y cálido estilo 2-luv) */
  --bg-paper: #1d130e;
  --paper-border: rgba(217, 180, 124, 0.32);
  --paper-shadow: 0 30px 80px rgba(0, 0, 0, 0.92), 0 0 50px rgba(142, 36, 51, 0.22);
  --ruled-line: rgba(242, 215, 168, 0.22);
  --ruled-line-paper: rgba(242, 215, 168, 0.10);
  --paper-texture: radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.02) 0%, rgba(0, 0, 0, 0.22) 100%);

  /* Tipografía romántica (Marfil cálido y sepia claro) */
  --text-main: #fbf1e3;
  --text-secondary: #d3c1ad;
  --text-muted: #9e8b7d;

  --text-letter: #fbf1e3;
  --text-letter-secondary: #d3c1ad;
  --text-letter-muted: #9e8b7d;
  --text-letter-title: #d9b47c;
  --signature-shadow: 0 2px 10px var(--accent-glow);

  /* Acentos 2-luv (Vino #8e2433 y Oro Champagne #d9b47c) */
  --accent-primary: #8e2433;
  --accent-secondary: #d9b47c;
  --accent-glow: rgba(217, 180, 124, 0.38);

  /* Elementos del sobre y sellos */
  --envelope-body: #1d130e;
  --envelope-flap: #261a13;
  --envelope-shadow: 0 25px 60px rgba(0, 0, 0, 0.95), 0 0 35px rgba(142, 36, 51, 0.25);
  --seal-base: #8e2433;
  --seal-shadow: #5c141f;
  --seal-gold: #d9b47c;

  /* Polaroid estilo 2-luv */
  --polaroid-bg: #fbf6ec;
  --polaroid-text: #2b1d16;
  --polaroid-shadow: 0 18px 45px rgba(0, 0, 0, 0.65), 0 0 20px rgba(142, 36, 51, 0.15);
  --washi-tape: rgba(217, 180, 124, 0.75);

  /* Botones y controles de cristal */
  --btn-bg: #8e2433;
  --btn-hover: #a3313f;
  --btn-text: #fff8f2;
  --btn-border: rgba(242, 215, 168, 0.5);
  --glass-bg: rgba(29, 19, 14, 0.88);
  --glass-border: rgba(217, 180, 124, 0.35);
}

[data-theme="2luv-algodon"],
[data-theme="sepia-sofisticado"] {
  /* 2luv Papel Algodón (Bloom Día: Crema, Vino y Café) */
  --bg-main: #f4ece0;
  --bg-gradient: radial-gradient(ellipse at 50% 15%, #fdf9f3 0%, #ede3d3 100%);

  --bg-paper: #fbf6ec;
  --paper-border: rgba(142, 36, 51, 0.24);
  --paper-shadow: 0 20px 55px rgba(43, 29, 22, 0.18), 0 0 30px rgba(142, 36, 51, 0.12);
  --ruled-line: rgba(142, 36, 51, 0.18);
  --ruled-line-paper: rgba(81, 45, 30, 0.08);
  --paper-texture: radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.5) 0%, rgba(235, 222, 206, 0.35) 100%);

  --text-main: #2b1d16;
  --text-secondary: #523b2f;
  --text-muted: #7d6556;

  --text-letter: #2b1d16;
  --text-letter-secondary: #523b2f;
  --text-letter-muted: #7d6556;
  --text-letter-title: #8e2433;
  --signature-shadow: none;

  --accent-primary: #8e2433;
  --accent-secondary: #8e2433;
  --accent-glow: rgba(142, 36, 51, 0.28);

  --envelope-body: #ece2d4;
  --envelope-flap: #e2d5c4;
  --envelope-shadow: 0 20px 50px rgba(43, 29, 22, 0.22);
  --seal-base: #8e2433;
  --seal-shadow: #5c141f;
  --seal-gold: #f2d7a8;

  --polaroid-bg: #ffffff;
  --polaroid-text: #2b1d16;
  --polaroid-shadow: 0 16px 36px rgba(43, 29, 22, 0.2);
  --washi-tape: rgba(217, 180, 124, 0.65);

  --btn-bg: #8e2433;
  --btn-hover: #a3313f;
  --btn-text: #ffffff;
  --btn-border: #f2d7a8;
  --glass-bg: rgba(251, 246, 236, 0.92);
  --glass-border: rgba(142, 36, 51, 0.28);
}

/* --------------------------------------------------------------------------
   RESETEO BASE
   -------------------------------------------------------------------------- */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  background-color: var(--bg-main);
  background-image: var(--bg-gradient);
  color: var(--text-main);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 18px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.5s ease, color 0.4s ease;
}

/* Canvas ambiental de estrellas/partículas */
.ambient-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   CONTROLES FLOTANTES SUPERIORES (Diseño Mobile)
   -------------------------------------------------------------------------- */

.floating-controls {
  position: fixed;
  top: 14px;
  left: 0;
  width: 100%;
  padding: 0 16px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  z-index: 100;
  pointer-events: none;
  box-sizing: border-box;
}

.floating-controls > div {
  pointer-events: auto;
}

.theme-menu-container,
.audio-control-container {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.control-btn {
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: 30px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.control-btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent-secondary);
}

.control-btn.icon-only {
  padding: 8px;
  border-radius: 50%;
}

.control-btn .icon {
  width: 16px;
  height: 16px;
}

/* Ecualizador animado */
.equalizer-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  width: 11px;
}

.equalizer-bars .bar {
  width: 2.2px;
  background-color: var(--accent-secondary);
  border-radius: 2px;
  height: 3px;
  transition: height 0.2s ease;
}

.playing .equalizer-bars .bar-1 {
  animation: eq-bounce 0.8s infinite ease-in-out alternate;
}
.playing .equalizer-bars .bar-2 {
  animation: eq-bounce 1.1s infinite 0.2s ease-in-out alternate;
}
.playing .equalizer-bars .bar-3 {
  animation: eq-bounce 0.9s infinite 0.4s ease-in-out alternate;
}

@keyframes eq-bounce {
  0% { height: 2px; }
  100% { height: 13px; }
}

/* Dropdown de Temas */
.theme-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 260px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.65);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 101;
}

.theme-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-header {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 4px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.theme-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  width: 100%;
}

.theme-opt:hover {
  background: rgba(255, 255, 255, 0.08);
}

.theme-opt.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent-secondary);
}

.theme-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
}

.theme-info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.theme-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
}

.theme-desc {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.theme-check {
  font-size: 0.85rem;
  color: var(--accent-secondary);
  opacity: 0;
}

.theme-opt.active .theme-check {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   MODAL DE AJUSTES DE AUDIO
   -------------------------------------------------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  border-radius: 16px;
  padding: 24px 20px;
  max-width: 440px;
  width: 100%;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 30px var(--accent-glow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}

.modal-heading {
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  color: var(--text-main);
  margin-bottom: 2px;
}

.modal-sub {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.music-option-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.music-option-label {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.82rem;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.file-input {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.78rem;
  color: var(--text-secondary);
  padding: 4px 0;
}

.input-with-btn {
  display: flex;
  gap: 6px;
}

.text-input {
  flex-grow: 1;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--paper-border);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text-main);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.82rem;
}

.text-input:focus {
  outline: none;
  border-color: var(--accent-secondary);
}

.btn-subtle {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--paper-border);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.78rem;
}

.btn-subtle:hover {
  background: var(--accent-primary);
  color: #fff;
}

.volume-slider-group {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.82rem;
}

.volume-slider-group input[type="range"] {
  accent-color: var(--accent-secondary);
  flex-grow: 1;
}

/* --------------------------------------------------------------------------
   ESCENARIO PRINCIPAL (Mobile-First Centered Container)
   -------------------------------------------------------------------------- */

.experience-viewport {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 64px 12px 14px;
  z-index: 10;
  overflow: hidden;
  box-sizing: border-box;
}

.step-view {
  width: 100%;
  height: 100%;
  max-width: 540px; /* Ancho óptimo y elegante para lectura en pantalla móvil */
  display: flex;
  justify-content: center;
  align-items: center;
}

.hidden,
[hidden],
.step-view.hidden,
.letter-closing-section.hidden {
  display: none !important;
}


/* --------------------------------------------------------------------------
   PASO 0: EL SOBRE DIGITAL (ADAPTADO A MÓVIL)
   -------------------------------------------------------------------------- */

.envelope-scene {
  perspective: 1000px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 360px;
}

.envelope-outer {
  position: relative;
  width: 320px;
  height: 220px;
  background: var(--envelope-body);
  border-radius: 10px;
  box-shadow: var(--envelope-shadow);
  cursor: pointer;
  border: 1px solid var(--envelope-border, rgba(142, 36, 51, 0.22));
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.envelope-outer:hover {
  transform: translateY(-4px) scale(1.02);
}

.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 115px;
  z-index: 30;
  transform-origin: top center;
  transition: transform 0.65s cubic-bezier(0.4, 0, 0.2, 1), z-index 0s 0.35s;
}

.flap-triangle {
  width: 0;
  height: 0;
  border-left: 160px solid transparent;
  border-right: 160px solid transparent;
  border-top: 115px solid var(--envelope-flap);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.22));
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

.envelope-letter-peek {
  position: absolute;
  top: 12px;
  left: 5%;
  width: 90%;
  height: 190px;
  background: var(--bg-paper);
  border: 1px solid var(--paper-border);
  border-radius: 6px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px;
  transition: transform 0.85s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.peek-inner {
  width: 75%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.peek-line {
  height: 3px;
  background: var(--paper-border);
  border-radius: 2px;
  width: 100%;
}

.peek-line.short {
  width: 55%;
}

.envelope-body {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  overflow: hidden;
  border-radius: 10px;
}

.envelope-folds {
  position: absolute;
  inset: 0;
}

.fold-left {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 0;
  border-left: 160px solid var(--envelope-body);
  border-top: 110px solid transparent;
  border-bottom: 110px solid var(--envelope-body);
  opacity: 0.96;
}

.fold-right {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 0;
  height: 0;
  border-right: 160px solid var(--envelope-body);
  border-top: 110px solid transparent;
  border-bottom: 110px solid var(--envelope-body);
  opacity: 0.96;
}

.fold-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 0;
  border-left: 160px solid transparent;
  border-right: 160px solid transparent;
  border-bottom: 110px solid var(--envelope-body);
  filter: drop-shadow(0 -2px 6px rgba(0, 0, 0, 0.16));
}

.envelope-label {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 25;
  pointer-events: none;
  width: 92%;
}

.label-decor {
  font-size: 0.72rem;
  color: var(--envelope-accent, var(--accent-secondary));
  display: block;
  margin-bottom: 2px;
}

.label-to {
  font-family: 'Great Vibes', cursive;
  font-size: 1.45rem;
  color: var(--envelope-text, var(--text-main));
  font-weight: normal;
  line-height: 1.15;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.label-sub {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--envelope-accent, var(--accent-secondary));
  margin-top: 2px;
}

.wax-seal {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translate(-50%, 0);
  width: 68px;
  height: 68px;
  background: radial-gradient(circle at 35% 35%, var(--seal-gold) 0%, var(--seal-base) 45%, var(--seal-shadow) 100%);
  border-radius: 50%;
  z-index: 50; /* Por encima de solapa superior (z-index: 30) y del cuerpo/pliegue inferior (z-index: 20) */
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
}

.wax-seal:hover {
  transform: translate(-50%, -2px) scale(1.06);
}

.wax-inner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1.5px dashed rgba(255, 255, 255, 0.35);
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.12);
}

.seal-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  color: #fff;
}

.seal-icon svg {
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.envelope-instruction {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.85rem;
  animation: pulse-soft 2s infinite ease-in-out;
}

@keyframes pulse-soft {
  0%, 100% { opacity: 0.6; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

.envelope-outer.opened .envelope-flap {
  transform: rotateX(180deg);
  z-index: 2; /* Se coloca detrás de la carta */
  transition: transform 0.65s cubic-bezier(0.4, 0, 0.2, 1), z-index 0s 0.35s;
}

.envelope-outer.opened .envelope-letter-peek {
  transform: translateY(-145px);
  z-index: 15; /* Emerge y se muestra por DELANTE de la solapa abierta */
  /* Espera 0.65s a que la solapa termine de abrirse hacia arriba antes de levantarse */
  transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.65s;
}

.envelope-outer.opened .wax-seal {
  opacity: 0;
  transform: translate(-50%, -20px) scale(0.6);
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   DISEÑO DE CARTA ANTIGUA CON RENGLONES SUBRAYADOS
   -------------------------------------------------------------------------- */

#step-letter-container {
  width: 100%;
  padding: 0 16px;
  box-sizing: border-box;
}

.letter-sheet-wrapper {
  width: 100%;
  max-width: 480px;
  height: 100%;
  max-height: 820px;
  display: flex;
  justify-content: center;
  box-sizing: border-box;
}

.vintage-letter {
  --text-main: var(--text-letter, #2b1d16);
  --text-secondary: var(--text-letter-secondary, #523b2f);
  --text-muted: var(--text-letter-muted, #7d6556);
  --accent-secondary: var(--text-letter-title, #8e2433);
  color: var(--text-main);
  position: relative;
  width: 100%;
  height: 100%;
  max-height: 100%;
  background-color: var(--bg-paper);
  /* Textura de papel antiguo con renglones finos en el fondo */
  background-image: 
    repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 35px,
      var(--ruled-line-paper) 35px,
      var(--ruled-line-paper) 36px
    ),
    var(--paper-texture, radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.45) 0%, rgba(235, 222, 206, 0.3) 100%));
  border: 1px solid var(--paper-border);
  border-radius: 16px;
  box-shadow: var(--paper-shadow);
  padding: 24px 18px 14px;
  display: flex;
  flex-direction: column;
  transition: all 0.4s ease;
  overflow: hidden;
  box-sizing: border-box;
}

/* Doble orla decorativa interior estilo carta antigua */
.vintage-letter::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px dashed var(--paper-border);
  border-radius: 12px;
  pointer-events: none;
  opacity: 0.45;
}

/* Matasellos vintage postal */
.vintage-postal-stamp {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1.5px dashed var(--ruled-line);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0.65;
  transform: rotate(12deg);
  pointer-events: none;
  z-index: 2;
}

.postal-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
}

.stamp-text-top {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.48rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--accent-secondary);
}

.stamp-date {
  font-family: 'Playfair Display', serif;
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-main);
  margin: 3px 0;
}

.stamp-text-bottom {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.44rem;
  letter-spacing: 0.5px;
  color: var(--accent-primary);
}

/* Encabezado de la carta */
.parchment-header {
  margin-bottom: 6px;
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
}

.filigree-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 4px;
}

.filigree-line {
  flex-grow: 1;
  max-width: 90px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--paper-border), transparent);
}

.filigree-gem {
  color: var(--accent-secondary);
  font-size: 1rem;
}

.letter-meta-top {
  display: flex;
  justify-content: center;
  align-items: center;
}

.anniversary-badge {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent-secondary);
  font-weight: 600;
}

.current-step-indicator {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.74rem;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.step-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--accent-secondary);
  margin-bottom: 12px;
  line-height: 1.25;
  text-align: center;
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
}

/* --------------------------------------------------------------------------
   ÁREA CON SCROLL INTERNO DENTRO DE LA CARTA (Mobile Parchment Scroll)
   -------------------------------------------------------------------------- */

.letter-scroll-area {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 4px 6px 14px 2px;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--paper-border) transparent;
}

.letter-scroll-area::-webkit-scrollbar {
  width: 5px;
}

.letter-scroll-area::-webkit-scrollbar-track {
  background: transparent;
}

.letter-scroll-area::-webkit-scrollbar-thumb {
  background: var(--paper-border);
  border-radius: 4px;
}

.letter-scroll-area::-webkit-scrollbar-thumb:hover {
  background: var(--accent-secondary);
}

/* --------------------------------------------------------------------------
   FLUJO DINÁMICO DE CONTENIDO (TEXTO CON SUBRAYADO E IMÁGENES INTERCALADAS)
   -------------------------------------------------------------------------- */

.letter-dynamic-stream {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  z-index: 2;
}

/* Párrafo de carta antigua con tipografía romántica manuscrita y subrayado */
.vintage-paragraph {
  font-family: 'Caveat', 'Marck Script', 'Cormorant Garamond', cursive;
  font-size: 1.48rem;
  font-weight: 500;
  line-height: 38px; /* Coincide armónicamente con los renglones */
  color: var(--text-main);
  text-align: left; /* La escritura manuscrita luce natural alineada a la izquierda */
  text-indent: 1.2em;
  /* Subrayado elegante en cada línea de texto como renglón manuscrito */
  text-decoration: underline;
  text-decoration-color: var(--ruled-line);
  text-underline-offset: 8px;
  text-decoration-thickness: 1px;
  word-break: break-word;
  letter-spacing: 0.3px;
  position: relative;
}

.vintage-paragraph:first-letter {
  font-size: 1.35em;
  font-weight: 700;
  color: var(--accent-secondary);
  text-decoration: none;
}

/* Cursor del typewriter */
.typewriter-cursor {
  display: inline-block;
  width: 2px;
  height: 1.15em;
  background-color: var(--accent-secondary);
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: blink-cursor 0.75s infinite step-end;
}

@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* --------------------------------------------------------------------------
   FOTOGRAFÍA POLAROID INTERCALADA CON DESPLIEGUE SUAVE Y REVELADO PERMANENTE
   -------------------------------------------------------------------------- */

.polaroid-inline-container {
  display: block;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  margin: 0 auto;
  width: 100%;
  transform: translateY(14px) scale(0.97);
  transition: max-height 1.1s cubic-bezier(0.22, 1, 0.36, 1), 
              opacity 0.9s ease, 
              transform 0.9s cubic-bezier(0.16, 1, 0.3, 1),
              margin 0.9s ease;
}

.polaroid-inline-container.is-visible {
  opacity: 1;
  max-height: 520px;
  transform: translateY(0) scale(1);
  margin: 16px auto 20px auto;
}

.polaroid-inline-container.instant {
  transition: none !important;
  opacity: 1 !important;
  max-height: 520px !important;
  transform: none !important;
  margin: 16px auto 20px auto !important;
}

.polaroid-inline-inner {
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 2px 0 6px;
}

.polaroid-inline {
  background-color: var(--polaroid-bg);
  padding: 12px 12px 28px 12px;
  border-radius: 4px;
  box-shadow: var(--polaroid-shadow);
  position: relative;
  max-width: 275px;
  width: 100%;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.polaroid-inline:hover {
  transform: scale(1.03) rotate(0deg) !important;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.65), 0 0 24px var(--accent-glow);
}

.washi-tape-inline {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 72px;
  height: 20px;
  background-color: var(--washi-tape);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  border-radius: 2px;
  opacity: 0.88;
  clip-path: polygon(4% 0%, 96% 0%, 100% 100%, 0% 100%);
  z-index: 5;
}

.polaroid-photo-box {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 2px;
  background-color: #242020;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.25);
  position: relative;
}

.polaroid-inline-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 1.2s ease, transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.polaroid-inline-container.is-visible .polaroid-inline-img,
.polaroid-inline-container.instant .polaroid-inline-img {
  opacity: 1;
  transform: scale(1);
}

.polaroid-inline-caption {
  font-family: 'Great Vibes', 'Playfair Display', cursive;
  font-size: 1.35rem;
  color: var(--polaroid-text);
  text-align: center;
  margin-top: 10px;
  margin-bottom: -10px;
  line-height: 1.1;
  letter-spacing: 0.4px;
}

/* --------------------------------------------------------------------------
   SECCIÓN DE CIERRE (PASO 3) - REQUERIMIENTO EXACTO DEL USUARIO
   -------------------------------------------------------------------------- */

.letter-closing-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 18px;
  margin-top: 14px;
  padding-top: 18px;
  border-top: 1px dashed var(--paper-border);
  animation: fade-in-up 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.letter-closing-section.hidden {
  display: none !important;
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.special-date-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

.date-stars {
  font-size: 1.1rem;
  color: var(--accent-secondary);
  line-height: 1;
}

.date-highlight {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent-secondary);
  padding: 4px 14px;
  border-radius: 20px;
  background: rgba(142, 36, 51, 0.08);
  border: 1px solid var(--paper-border);
}

.signature-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.signature-intro {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.28rem;
  color: var(--text-secondary);
}

.signature-main {
  font-family: 'Great Vibes', 'Alex Brush', cursive;
  font-size: 3.2rem;
  font-weight: 400;
  color: var(--accent-secondary);
  line-height: 1.1;
  letter-spacing: 1px;
  text-shadow: var(--signature-shadow, 0 1px 2px rgba(142, 36, 51, 0.15));
}

.celebration-block {
  margin-top: 8px;
}

.btn-celebrate-final {
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--btn-text);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 12px 26px;
  border-radius: 30px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 20px var(--accent-glow);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-celebrate-final:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5), 0 0 28px var(--accent-glow);
}

.celebrate-heart {
  font-size: 1.15rem;
  animation: heart-pulse 1.3s infinite ease-in-out;
}

@keyframes heart-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.28); }
}

/* --------------------------------------------------------------------------
   BARRA INFERIOR: BOTÓN CON FLECHA (SOLO SECCIONES 1 Y 2)
   -------------------------------------------------------------------------- */

.single-action-footer {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--paper-border);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
  transition: opacity 0.4s ease;
}

.nav-arrow-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--btn-text);
  display: inline-flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

.nav-arrow-btn .arrow-icon {
  width: 22px;
  height: 22px;
  stroke: var(--btn-text);
  transition: transform 0.25s ease;
}

.nav-arrow-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 24px var(--accent-glow), 0 0 20px var(--accent-secondary);
}

.nav-arrow-btn:hover .arrow-icon {
  transform: translateX(3px);
}

/* Estado bloqueado: invisible mientras la sección se está escribiendo */
.nav-arrow-btn.locked {
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(0.8);
  pointer-events: none;
}

/* Estado desbloqueado: aparece con latido suave invitando a continuar */
.nav-arrow-btn.unlocked {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  animation: arrow-btn-pulse 2.2s infinite ease-in-out;
}

@keyframes arrow-btn-pulse {
  0%, 100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  }
  50% {
    transform: translateY(-2px) scale(1.07);
    box-shadow: 0 8px 24px var(--accent-glow), 0 0 20px var(--accent-secondary);
  }
}

/* --------------------------------------------------------------------------
   PARTÍCULAS DE CELEBRACIÓN (CORAZONES FLOTANTES)
   -------------------------------------------------------------------------- */

.floating-heart {
  position: fixed;
  pointer-events: none;
  z-index: 1000;
  animation: float-heart-up 3.5s cubic-bezier(0.2, 0.8, 0.4, 1) forwards;
}

@keyframes float-heart-up {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.4) rotate(0deg);
  }
  15% {
    opacity: 1;
  }
  80% {
    opacity: 0.85;
  }
  100% {
    opacity: 0;
    transform: translateY(-650px) scale(1.25) rotate(35deg);
  }
}

/* --------------------------------------------------------------------------
   AJUSTES EXTRA PARA PANTALLAS PEQUEÑAS (MÓVILES < 420px)
   -------------------------------------------------------------------------- */

@media (max-width: 480px) {
  .experience-viewport {
    padding: 56px 12px 12px;
  }

  #step-letter-container {
    padding: 0 8px;
  }

  .vintage-letter {
    padding: 22px 16px 12px;
  }
}

@media (max-width: 420px) {
  html, body {
    font-size: 16px;
  }

  .experience-viewport {
    padding: 56px 12px 10px;
  }

  #step-letter-container {
    padding: 0 6px;
  }

  .floating-controls {
    padding: 0 14px;
  }

  .vintage-letter {
    padding: 20px 14px 10px;
    border-radius: 14px;
  }

  .vintage-paragraph {
    font-size: 1.34rem;
    line-height: 35px;
  }

  .step-title {
    font-size: 1.5rem;
    margin-bottom: 10px;
  }

  .signature-main {
    font-size: 2.8rem;
  }
}
