/* ================================================================
   PARA ELIS — style.css
   Estética: tierna y nostálgica · álbum vintage · papel y tinta
   ================================================================ */

/* ----------------------------------------------------------------
   VARIABLES
---------------------------------------------------------------- */
:root {
  /* Paleta */
  --cream:        #F5EDD8;
  --paper:        #FDF6E3;
  --paper-dark:   #F0E6C8;
  --warm-dark:    #3D2B1F;
  --sepia:        #6B4C3B;
  --sepia-light:  #9B7B6A;
  --rose:         #C45C5C;
  --rose-light:   #E8A0A0;
  --rose-pale:    #F5D5D5;
  --amber:        #C4843A;
  --gold:         #D4A85A;
  --gold-light:   #EDD89A;
  --ink:          #2C1A10;

  /* Tipografía */
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-script:  'Dancing Script', cursive;
  --font-body:    'Lato', system-ui, sans-serif;

  /* Espaciado */
  --section-gap:  clamp(5rem, 10vw, 9rem);
  --chapter-px:   clamp(1.25rem, 6vw, 5rem);
}

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

html { scroll-behavior: smooth; }

body {
  background-color: var(--cream);
  color: var(--warm-dark);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.75;
  overflow-x: hidden;
  min-height: 100dvh;
}

/* Textura de grano sobre todo */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9000;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.88' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px;
}

img { display: block; max-width: 100%; height: auto; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ----------------------------------------------------------------
   CANVAS DE ESTRELLAS
---------------------------------------------------------------- */
#starsCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
}

/* ----------------------------------------------------------------
   SISTEMA DE PANTALLAS
---------------------------------------------------------------- */
.screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.screen.active {
  opacity: 1;
  pointer-events: all;
}

/* Experience (main) es scroll normal, no fixed */
#experience {
  position: fixed;
  inset: 0;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s ease;
  background: var(--cream);
  overflow: hidden;
}

#experience.active {
  opacity: 1;
  pointer-events: all;
}

/* ================================================================
   HEADER GLOBAL — CONTADOR SIEMPRE VISIBLE
=============================================================== */
.global-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  background: linear-gradient(180deg, rgba(245,237,216,0.97) 60%, rgba(245,237,216,0));
  padding: 0.6rem 1rem 1.2rem;
  pointer-events: none;
}

.global-header-inner {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  max-width: 1100px;
  margin: 0 auto;
}

.header-menu-btn {
  pointer-events: all;
  background: rgba(61,43,31,0.08);
  border: 1px solid rgba(196,132,58,0.2);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sepia);
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.3s ease;
  margin-top: 0.2rem;
}

.header-menu-btn:hover {
  background: var(--rose);
  color: white;
  border-color: var(--rose);
  transform: scale(1.08);
}

.global-header-info {
  flex: 1;
  min-width: 0;
  pointer-events: none;
}

.global-header-info .header-eyebrow {
  font-size: 0.6rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 0.2rem;
  font-weight: 400;
}

.global-header-info .header-title {
  font-family: var(--font-display);
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  font-weight: 300;
  color: var(--ink);
  line-height: 1.2;
}

.global-header-info .header-title em {
  font-style: italic;
  color: var(--rose);
  font-weight: 400;
}

#relationshipCounter {
  pointer-events: all;
  flex-shrink: 0;
}

#relationshipCounter h3 {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 400;
  font-style: italic;
  color: var(--sepia);
  margin-bottom: 0.2rem;
  letter-spacing: 0.03em;
}

.counter-card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  min-width: unset;
  box-shadow: none;
}

.counter-display {
  font-family: var(--font-display);
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  font-weight: 600;
  color: var(--rose);
  line-height: 1.2;
  margin-bottom: 0.2rem;
}

.counter-milestone {
  font-size: 0.6rem;
  color: var(--sepia-light);
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}

.milestone-bar {
  height: 3px;
  background: var(--paper-dark);
  border-radius: 99px;
  overflow: hidden;
}

.milestone-progress {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--rose-light), var(--rose));
  border-radius: 99px;
  transition: width 1.5s cubic-bezier(.22,1,.36,1);
}

/* ================================================================
   PANTALLA 1 — INTRO
================================================================ */
#introScreen {
  background: linear-gradient(160deg, #1C0F08 0%, #3A1E12 45%, #2A150D 100%);
  flex-direction: column;
  overflow: hidden;
}

/* Partículas flotantes */
#introParticles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  bottom: -10%;
  font-size: clamp(0.9rem, 2vw, 1.4rem);
  opacity: 0;
  animation: floatParticle linear infinite;
  user-select: none;
}

/* Contenido intro */
.intro-content {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem;
  padding: 2rem;
  text-align: center;
  animation: fadeSlideUp 1.4s cubic-bezier(.22,1,.36,1) both;
}

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

/* Sello de cera */
.wax-seal {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #D4A85A, #9B5C1A);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(196, 132, 58, 0.5), inset 0 1px 3px rgba(255,255,255,0.2);
  animation: sealPulse 3s ease infinite;
}

@keyframes sealPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(196,132,58,0.5), inset 0 1px 3px rgba(255,255,255,0.2); }
  50%       { box-shadow: 0 4px 35px rgba(196,132,58,0.8), inset 0 1px 3px rgba(255,255,255,0.2); }
}

.wax-letter {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  color: #FDF6E3;
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
  line-height: 1;
  margin-top: 3px;
}

/* Textos intro */
.intro-eyebrow {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.8;
}

.intro-title {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 8vw, 5.5rem);
  font-weight: 300;
  color: var(--paper);
  line-height: 1.1;
  text-shadow: 0 2px 30px rgba(0,0,0,0.5);
}

.intro-title em {
  font-style: italic;
  color: var(--rose-light);
  font-weight: 400;
}

.intro-sub {
  font-family: var(--font-display);
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  font-style: italic;
  color: rgba(253,246,227,0.55);
  line-height: 1.7;
  max-width: 36ch;
}

.intro-divider {
  width: 50px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* Botón intro */
.intro-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-script);
  font-size: 1.35rem;
  color: var(--gold);
  border: 1px solid rgba(212,168,90,0.35);
  padding: 0.75rem 2.5rem;
  border-radius: 50px;
  background: transparent;
  transition: all 0.3s ease;
  animation: glowPulse 2.5s ease infinite;
}

.intro-btn:hover {
  background: rgba(212,168,90,0.12);
  border-color: var(--gold);
  transform: scale(1.04);
}

.btn-icon { font-size: 1rem; opacity: 0.8; }

.intro-hint {
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: rgba(253,246,227,0.22);
  text-transform: uppercase;
}

/* ================================================================
   PANTALLA 2 — CONTRASEÑA
================================================================ */
#passwordScreen {
  background: linear-gradient(160deg, #1C0F08 0%, #3A1E12 100%);
}

.password-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  padding: clamp(2rem, 5vw, 3.5rem) clamp(2rem, 6vw, 4rem);
  background: rgba(253,246,227,0.05);
  border: 1px solid rgba(212,168,90,0.2);
  border-radius: 20px;
  backdrop-filter: blur(8px);
  max-width: 400px;
  width: 90%;
  text-align: center;
  animation: fadeSlideUp 0.8s ease both;
}

.lock-icon { font-size: 2.5rem; }

.password-card h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 400;
  color: var(--paper);
}

.password-card p {
  font-size: 0.95rem;
  color: rgba(253,246,227,0.55);
}

.password-wrapper {
  position: relative;
  width: 100%;
}

#passwordInput {
  width: 100%;
  padding: 0.85rem 1.2rem;
  background: rgba(253,246,227,0.08);
  border: 1px solid rgba(212,168,90,0.3);
  border-radius: 10px;
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 1.1rem;
  letter-spacing: 0.35em;
  text-align: center;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#passwordInput::placeholder { color: rgba(253,246,227,0.25); letter-spacing: 0.15em; }

#passwordInput:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,168,90,0.15);
}

/* Botón primario reutilizable */
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-script);
  font-size: 1.2rem;
  color: var(--ink);
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  border-radius: 50px;
  padding: 0.75rem 2.2rem;
  transition: all 0.25s ease;
  box-shadow: 0 4px 14px rgba(196,132,58,0.3);
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(196,132,58,0.45);
}

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

/* #passwordBtn hereda de .primary-btn en el HTML */

.password-msg {
  font-size: 0.85rem;
  min-height: 1.2em;
  color: var(--rose-light);
  transition: opacity 0.3s;
}

/* ================================================================
   EXPERIENCIA PRINCIPAL — LAYOUT
================================================================ */
#experience {
  padding-bottom: var(--section-gap);
}

/* ----------------------------------------------------------------
   BOTÓN DE MÚSICA
---------------------------------------------------------------- */
.music-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 8000;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(61,43,31,0.85);
  border: 1px solid rgba(212,168,90,0.4);
  color: var(--gold);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  transition: all 0.25s ease;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.music-btn:hover {
  background: rgba(61,43,31,0.95);
  border-color: var(--gold);
  transform: scale(1.08);
}


/* ----------------------------------------------------------------
   CAPÍTULOS (secciones generales)
---------------------------------------------------------------- */
.chapter {
  position: relative;
  max-width: 900px;
  margin: 0 auto var(--section-gap);
  padding: 0 var(--chapter-px);
}

/* Fondos personalizados por capítulo */
/* Capítulos con fondo de imagen personalizado */
.chapter.has-bg {
  padding-top: 4rem;
  padding-bottom: 4rem;
  margin-top: 0;
  margin-bottom: 0;
}

.chapter.has-bg::before {
  display: none;
}

.chapter.has-bg .chapter-bg {
  position: absolute;
  inset: 0;
  width: 100vw;
  left: 50%;
  transform: translateX(-50%);
  background-image: var(--bg-img);
  background-size: cover;
  background-position: center;
  background-attachment: scroll;
  z-index: -2;
  pointer-events: none;
}

.chapter-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(245,237,216,0.82);
  z-index: -1;
  pointer-events: none;
}

.chapter.has-bg > .chapter-label,
.chapter.has-bg > h2,
.chapter.has-bg > .section-subtitle {
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 4px rgba(253,246,227,0.6);
}

.chapter-label {
  font-size: 0.7rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 400;
  margin-bottom: 0.5rem;
  opacity: 0.75;
}

.chapter h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 400;
  font-style: italic;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 0.5rem;
  position: relative;
  display: inline-block;
  transition: color 0.3s ease, text-shadow 0.3s ease;
  text-shadow: 0 0 0 transparent;
}
.chapter h2::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 0;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, var(--rose-light), transparent);
  transition: width 0.4s cubic-bezier(.22,1,.36,1), left 0.4s ease;
  pointer-events: none;
}
.chapter:hover h2::after {
  width: 60%;
  left: 20%;
}
.chapter:hover h2 {
  color: var(--rose);
  text-shadow: 0 0 20px rgba(196,92,92,0.08);
}

.section-subtitle {
  font-size: 1rem;
  color: var(--sepia-light);
  font-style: italic;
  margin-bottom: 2.5rem;
}

/* Separador decorativo entre secciones */
.chapter::before {
  content: '— … —';
  display: block;
  text-align: center;
  font-size: 0.9rem;
  color: var(--gold);
  opacity: 0.4;
  margin-bottom: 3rem;
  letter-spacing: 0.3em;
}

#capituloInicio::before { display: none; }

/* ----------------------------------------------------------------
   CAPÍTULO 1 — LIBRO / PÁGINA
---------------------------------------------------------------- */
.book-page {
  background: var(--paper);
  border: 1px solid rgba(196,132,58,0.2);
  border-radius: 4px 18px 18px 4px;
  border-left: 5px solid var(--rose-light);
  padding: 2.5rem 3rem;
  box-shadow: 4px 6px 24px rgba(61,43,31,0.08);
  position: relative;
}

.book-page::before {
  content: '"';
  position: absolute;
  top: 0.5rem;
  left: 1.5rem;
  font-family: var(--font-display);
  font-size: 5rem;
  color: var(--rose-pale);
  line-height: 1;
}

.book-page p {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.5vw, 1.3rem);
  line-height: 1.85;
  color: var(--sepia);
  margin-bottom: 1rem;
}

.book-page p:last-child { margin-bottom: 0; }

/* ----------------------------------------------------------------
   CAPÍTULO 2 — TIMELINE
---------------------------------------------------------------- */
.timeline {
  position: relative;
  padding-left: 2.5rem;
}

/* Línea vertical */
.timeline::before {
  content: '';
  position: absolute;
  left: 0.6rem;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: linear-gradient(180deg, transparent, var(--rose-light) 10%, var(--rose-light) 90%, transparent);
}

.timeline-item {
  position: relative;
  margin-bottom: 2.8rem;
  animation: fadeSlideUp 0.6s ease both;
}

.timeline-item:last-child { margin-bottom: 0; }

/* Punto de la timeline */
.timeline-dot {
  position: absolute;
  left: -2.5rem;
  top: 0.3rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--paper);
  border: 2.5px solid var(--rose-light);
  transition: all 0.3s ease;
}

.timeline-item.highlight .timeline-dot {
  background: var(--rose);
  border-color: var(--rose);
  box-shadow: 0 0 0 4px rgba(196,92,92,0.2);
  width: 17px;
  height: 17px;
  left: calc(-2.5rem - 1.5px);
}

.timeline-item:hover .timeline-dot {
  background: var(--rose-light);
  transform: scale(1.15);
}

/* Contenido */
.timeline-content {
  background: var(--paper);
  border: 1px solid rgba(196,132,58,0.18);
  border-radius: 14px;
  padding: 1.4rem 1.8rem;
  box-shadow: 0 4px 18px rgba(61,43,31,0.06);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.timeline-item:hover .timeline-content {
  transform: translateX(4px);
  box-shadow: 0 6px 24px rgba(61,43,31,0.1);
}

.timeline-item.highlight .timeline-content {
  border-color: rgba(196,92,92,0.3);
  background: linear-gradient(135deg, var(--paper), rgba(245,213,213,0.25));
}

.timeline-date {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--amber);
  font-weight: 400;
  margin-bottom: 0.4rem;
}

.timeline-content h4 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 0.4rem;
}

.timeline-content p {
  font-size: 0.95rem;
  color: var(--sepia);
  line-height: 1.65;
}

/* ----------------------------------------------------------------
   CAPÍTULO 3 — ÁLBUM (POLAROID)
---------------------------------------------------------------- */
/* ── Lightbox (antes inyectado por album.js) ───────────────── */
#albumLightbox {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
#albumLightbox.lb-visible {
  opacity: 1;
  pointer-events: all;
}
.lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 15, 8, 0.92);
  backdrop-filter: blur(6px);
}
.lb-box {
  position: relative;
  z-index: 10;
  max-width: min(90vw, 680px);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
}
.lb-img-wrap {
  width: 100%;
  background: var(--paper);
  padding: 0.9rem 0.9rem 3.5rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  border-radius: 3px;
}
.lb-img {
  width: 100%;
  max-height: 65vh;
  object-fit: contain;
  display: block;
  border-radius: 1px;
  transition: opacity 0.3s ease;
}
.lb-caption {
  font-family: var(--font-script);
  font-size: 1.2rem;
  color: var(--gold);
  text-align: center;
  margin-top: -0.5rem;
}
.lb-close {
  position: absolute;
  top: -0.5rem;
  right: -0.5rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(61,43,31,0.9);
  border: 1px solid rgba(212,168,90,0.3);
  color: var(--paper);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  cursor: pointer;
}
.lb-close:hover { background: var(--rose); transform: scale(1.1); }
.lb-prev, .lb-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(61,43,31,0.75);
  border: 1px solid rgba(212,168,90,0.25);
  color: var(--paper);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  cursor: pointer;
  line-height: 1;
}
.lb-prev { left: -1.2rem; }
.lb-next { right: -1.2rem; }
.lb-prev:hover:not(:disabled),
.lb-next:hover:not(:disabled) {
  background: rgba(61,43,31,0.95);
  border-color: var(--gold);
}
.lb-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}
.lb-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(253,246,227,0.3);
  transition: all 0.2s ease;
  cursor: pointer;
}
.lb-dot.active {
  background: var(--rose-light);
  transform: scale(1.3);
}
.lb-dot:hover { background: var(--gold); }
@media (max-width: 480px) {
  .lb-prev { left: 0.2rem; }
  .lb-next { right: 0.2rem; }
  .lb-img-wrap { padding: 0.7rem 0.7rem 2.8rem; }
}

/* ── Modal de cartas futuras (antes inyectado por future-letters.js) ─ */
#letterModal {
  position: fixed;
  inset: 0;
  z-index: 6000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
#letterModal.lm-visible {
  opacity: 1;
  pointer-events: all;
}
.lm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28,15,8,0.88);
  backdrop-filter: blur(6px);
}
.lm-box {
  position: relative;
  z-index: 10;
  background: var(--paper);
  border: 1px solid rgba(196,132,58,0.2);
  border-radius: 18px;
  max-width: min(92vw, 560px);
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2.5rem 2rem 2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  animation: zoomIn 0.4s cubic-bezier(.22,1,.36,1) both;
}
.lm-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(61,43,31,0.08);
  color: var(--sepia);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
}
.lm-close:hover { background: var(--rose); color: white; }
.lm-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}
.lm-icon { font-size: 2.5rem; }
.lm-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 400;
  font-style: italic;
  color: var(--ink);
}
.lm-body { text-align: left; width: 100%; }
.lm-body p {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-style: italic;
  color: var(--sepia);
  line-height: 1.85;
  margin-bottom: 0.8rem;
}
.lm-password-panel {
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
}
.lm-password-hint {
  font-size: 0.9rem;
  color: var(--sepia-light);
  font-style: italic;
  line-height: 1.6;
}
.lm-password-input {
  width: 100%;
  max-width: 260px;
  padding: 0.75rem 1rem;
  background: rgba(61,43,31,0.05);
  border: 1px solid rgba(196,132,58,0.3);
  border-radius: 10px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  letter-spacing: 0.2em;
  text-align: center;
  outline: none;
  transition: border-color 0.3s ease;
}
.lm-password-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,168,90,0.15);
}
.lm-password-msg {
  font-size: 0.82rem;
  color: var(--rose);
  min-height: 1em;
  font-style: italic;
}
.future-letter.unlocked {
  border-color: rgba(212,168,90,0.4);
  cursor: pointer;
}
.future-letter.locked {
  cursor: pointer;
  opacity: 0.9;
}
.future-letter:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(61,43,31,0.12);
}

/* Lightbox */
#albumLightbox {
  position: fixed; inset: 0; z-index: 5000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.35s ease;
}
#albumLightbox.lb-visible { opacity: 1; pointer-events: all; }
.lb-backdrop {
  position: absolute; inset: 0;
  background: rgba(28,15,8,0.92); backdrop-filter: blur(6px);
}
.lb-box {
  position: relative; z-index: 10;
  max-width: min(90vw,680px); width: 100%;
  display: flex; flex-direction: column; align-items: center;
  gap: 1rem; padding: 1.5rem;
}
.lb-img-wrap {
  width: 100%; background: var(--paper);
  padding: 0.9rem 0.9rem 3.5rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5); border-radius: 3px;
}
.lb-img {
  width: 100%; max-height: 65vh; object-fit: contain;
  display: block; border-radius: 1px; transition: opacity 0.3s ease;
}
.lb-caption {
  font-family: var(--font-script);
  font-size: 1.2rem; color: var(--gold);
  text-align: center; margin-top: -0.5rem;
}
.lb-close {
  position: absolute; top: -0.5rem; right: -0.5rem;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(61,43,31,0.9);
  border: 1px solid rgba(212,168,90,0.3);
  color: var(--paper); font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease; cursor: pointer;
}
.lb-close:hover { background: var(--rose); transform: scale(1.1); }
.lb-prev, .lb-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(61,43,31,0.75);
  border: 1px solid rgba(212,168,90,0.25);
  color: var(--paper); font-size: 1.5rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease; cursor: pointer; line-height: 1;
}
.lb-prev { left: -1.2rem; }
.lb-next { right: -1.2rem; }
.lb-prev:hover:not(:disabled),
.lb-next:hover:not(:disabled) {
  background: rgba(61,43,31,0.95);
  border-color: var(--gold);
}
.lb-dots { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.lb-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(253,246,227,0.3);
  transition: all 0.2s ease; cursor: pointer;
}
.lb-dot.active { background: var(--rose-light); transform: scale(1.3); }
.lb-dot:hover { background: var(--gold); }
@media (max-width:480px) {
  .lb-prev { left: 0.2rem; }
  .lb-next { right: 0.2rem; }
  .lb-img-wrap { padding: 0.7rem 0.7rem 2.8rem; }
}

/* Letter modal */
#letterModal {
  position: fixed; inset: 0; z-index: 6000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.35s ease;
}
#letterModal.lm-visible { opacity: 1; pointer-events: all; }
.lm-backdrop {
  position: absolute; inset: 0;
  background: rgba(28,15,8,0.88); backdrop-filter: blur(6px);
}
.lm-box {
  position: relative; z-index: 10;
  background: var(--paper);
  border: 1px solid rgba(196,132,58,0.2); border-radius: 18px;
  max-width: min(92vw,560px); width: 100%;
  max-height: 85vh; overflow-y: auto;
  padding: 2.5rem 2rem 2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  animation: zoomIn 0.4s cubic-bezier(.22,1,.36,1) both;
}
.lm-close {
  position: absolute; top: 1rem; right: 1rem;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(61,43,31,0.08);
  color: var(--sepia); font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease; cursor: pointer; border: none;
}
.lm-close:hover { background: var(--rose); color: white; }
.lm-content { display: flex; flex-direction: column; align-items: center; gap: 1rem; text-align: center; }
.lm-icon { font-size: 2.5rem; }
.lm-title {
  font-family: var(--font-display);
  font-size: 1.6rem; font-weight: 400;
  font-style: italic; color: var(--ink);
}
.lm-body { text-align: left; width: 100%; }
.lm-body p {
  font-family: var(--font-display);
  font-size: 1.1rem; font-style: italic;
  color: var(--sepia); line-height: 1.85; margin-bottom: 0.8rem;
}
.lm-password-panel { flex-direction: column; align-items: center; gap: 0.8rem; width: 100%; }
.lm-password-hint {
  font-size: 0.9rem; color: var(--sepia-light);
  font-style: italic; line-height: 1.6;
}
.lm-password-input {
  width: 100%; max-width: 260px; padding: 0.75rem 1rem;
  background: rgba(61,43,31,0.05);
  border: 1px solid rgba(196,132,58,0.3); border-radius: 10px;
  color: var(--ink); font-family: var(--font-body);
  font-size: 1rem; letter-spacing: 0.2em;
  text-align: center; outline: none; transition: border-color 0.3s ease;
}
.lm-password-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,168,90,0.15);
}
.lm-password-msg {
  font-size: 0.82rem; color: var(--rose);
  min-height: 1em; font-style: italic;
}
.future-letter.unlocked { border-color: rgba(212,168,90,0.4); cursor: pointer; }
.future-letter.locked { cursor: pointer; opacity: 0.9; }

/* Quiz */
#qz-wrap { max-width: 540px; margin: 0 auto; font-family: var(--font-body); }
.qz-bar-bg {
  width: 100%; height: 5px;
  background: var(--paper-dark);
  border-radius: 99px; overflow: hidden; margin-bottom: 0.4rem;
}
.qz-bar-fill {
  height: 100%;
  background: linear-gradient(90deg,var(--rose-light),var(--rose));
  border-radius: 99px; transition: width 0.5s ease;
}
.qz-counter-txt {
  font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--sepia-light); text-align: right; margin-bottom: 1rem;
}
.qz-card {
  background: var(--paper);
  border: 1px solid rgba(196,132,58,0.2);
  border-radius: 18px; padding: 2rem 1.6rem;
  box-shadow: 0 6px 28px rgba(61,43,31,0.08);
  display: flex; flex-direction: column; align-items: center; gap: 1.1rem;
}
.qz-emoji-big { font-size: 2.4rem; line-height: 1; }
.qz-q-text {
  font-family: var(--font-display);
  font-size: clamp(1.15rem,3vw,1.4rem); font-weight: 500;
  color: var(--ink); text-align: center; line-height: 1.45; margin: 0;
}
.qz-opts { width: 100%; display: flex; flex-direction: column; gap: 0.6rem; }
.qz-opt {
  display: flex; align-items: center; gap: 0.85rem; width: 100%;
  padding: 0.85rem 1.1rem; background: transparent;
  border: 1.5px solid rgba(196,132,58,0.22); border-radius: 12px;
  cursor: pointer; text-align: left; font-family: var(--font-body);
  font-size: 0.97rem; color: var(--sepia);
  transition: border-color 0.18s, background 0.18s, transform 0.18s;
}
.qz-opt:hover:not(:disabled) {
  border-color: var(--gold);
  background: rgba(212,168,90,0.07);
  transform: translateX(3px);
}
.qz-opt:disabled { cursor: default; }
.qz-opt-ltr {
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(196,132,58,0.1); color: var(--amber);
  font-size: 0.72rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background 0.2s, color 0.2s;
}
.qz-opt.correct { border-color: #5CA87A; background: rgba(92,168,122,0.1); }
.qz-opt.correct .qz-opt-ltr { background: #5CA87A; color: #fff; }
.qz-opt.wrong { border-color: var(--rose); background: rgba(196,92,92,0.08); }
.qz-opt.wrong .qz-opt-ltr { background: var(--rose); color: #fff; }
.qz-feedback {
  width: 100%; display: flex; align-items: flex-start; gap: 0.65rem;
  padding: 0.9rem 1.1rem; border-radius: 12px;
  font-family: var(--font-display); font-style: italic;
  font-size: 1rem; line-height: 1.6; color: var(--sepia);
}
.qz-feedback.fb-ok { background: rgba(92,168,122,0.1); border: 1px solid rgba(92,168,122,0.35); color: #3A6E52; }
.qz-feedback.fb-fail { background: rgba(196,132,58,0.07); border: 1px solid rgba(196,132,58,0.22); }
.qz-fb-ico { font-size: 1.05rem; flex-shrink: 0; margin-top: 2px; }
.qz-next-btn {
  align-self: flex-end; font-family: var(--font-script);
  font-size: 1.1rem; color: var(--ink);
  background: linear-gradient(135deg,var(--gold-light),var(--gold));
  border: none; border-radius: 50px; padding: 0.6rem 1.8rem;
  cursor: pointer; box-shadow: 0 4px 14px rgba(196,132,58,0.3);
  transition: transform 0.2s, box-shadow 0.2s; margin-top: 0.3rem;
}
.qz-next-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(196,132,58,0.4);
}
.qz-result {
  text-align: center; display: flex; flex-direction: column;
  align-items: center; gap: 1.1rem;
  background: var(--paper);
  border: 1px solid rgba(196,132,58,0.2); border-radius: 18px;
  padding: 2.5rem 2rem; box-shadow: 0 6px 28px rgba(61,43,31,0.08);
}
.qz-res-emoji { font-size: 3.2rem; }
.qz-res-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem,4vw,2rem);
  font-style: italic; font-weight: 400; color: var(--ink); margin: 0;
}
.qz-res-msg {
  font-family: var(--font-display); font-style: italic;
  font-size: clamp(1rem,2.5vw,1.2rem);
  color: var(--sepia); max-width: 38ch; line-height: 1.7; margin: 0;
}
.qz-ring-wrap { position: relative; width: 110px; height: 110px; }
.qz-ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.qz-ring-bg { fill: none; stroke: var(--paper-dark); stroke-width: 8; }
.qz-ring-fill { fill: none; stroke: var(--rose); stroke-width: 8; stroke-linecap: round; }
.qz-ring-pct {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 1.5rem;
  font-weight: 600; color: var(--rose);
}
.qz-retry-btn {
  font-family: var(--font-script); font-size: 1.1rem; color: var(--ink);
  background: linear-gradient(135deg,var(--gold-light),var(--gold));
  border: none; border-radius: 50px; padding: 0.7rem 2rem;
  cursor: pointer; box-shadow: 0 4px 14px rgba(196,132,58,0.3);
  transition: transform 0.2s; margin-top: 0.5rem;
}
.qz-retry-btn:hover { transform: translateY(-2px); }
@media (max-width:480px) { .qz-card { padding: 1.5rem 1.1rem; } }

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.8rem;
  margin-top: 0.5rem;
}

.photo-card {
  background: var(--paper);
  padding: 0.9rem 0.9rem 2.5rem;
  box-shadow: 0 6px 24px rgba(61,43,31,0.12), 0 1px 4px rgba(61,43,31,0.08);
  border-radius: 3px;
  transition: transform 0.35s cubic-bezier(.22,1,.36,1), box-shadow 0.35s ease;
  cursor: pointer;
  /* rotación alterna para efecto polaroid */
}

.photo-card:nth-child(odd)  { transform: rotate(-1.2deg); }
.photo-card:nth-child(even) { transform: rotate(1.1deg); }

.photo-card:hover {
  transform: rotate(0deg) translateY(-8px) scale(1.04) !important;
  box-shadow: 0 16px 40px rgba(61,43,31,0.2);
  z-index: 10;
  position: relative;
}

/* ── Quiz "Me conoces?" (antes inyectado por quiz.js) ────────── */
#qz-wrap {
  max-width: 540px;
  margin: 0 auto;
  font-family: var(--font-body);
}
.qz-bar-bg {
  width: 100%; height: 5px;
  background: var(--paper-dark);
  border-radius: 99px; overflow: hidden; margin-bottom: 0.4rem;
}
.qz-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--rose-light), var(--rose));
  border-radius: 99px; transition: width 0.5s ease;
}
.qz-counter-txt {
  font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--sepia-light); text-align: right; margin-bottom: 1rem;
}
.qz-card {
  background: var(--paper);
  border: 1px solid rgba(196,132,58,0.2);
  border-radius: 18px; padding: 2rem 1.6rem;
  box-shadow: 0 6px 28px rgba(61,43,31,0.08);
  display: flex; flex-direction: column; align-items: center; gap: 1.1rem;
}
.qz-emoji-big { font-size: 2.4rem; line-height: 1; }
.qz-q-text {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 3vw, 1.4rem); font-weight: 500;
  color: var(--ink); text-align: center; line-height: 1.45; margin: 0;
}
.qz-opts { width: 100%; display: flex; flex-direction: column; gap: 0.6rem; }
.qz-opt {
  display: flex; align-items: center; gap: 0.85rem; width: 100%;
  padding: 0.85rem 1.1rem; background: transparent;
  border: 1.5px solid rgba(196,132,58,0.22); border-radius: 12px;
  cursor: pointer; text-align: left; font-family: var(--font-body);
  font-size: 0.97rem; color: var(--sepia);
  transition: border-color 0.18s, background 0.18s, transform 0.18s;
}
.qz-opt:hover:not(:disabled) {
  border-color: var(--gold);
  background: rgba(212,168,90,0.07);
  transform: translateX(3px);
}
.qz-opt:disabled { cursor: default; }
.qz-opt-ltr {
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(196,132,58,0.1); color: var(--amber);
  font-size: 0.72rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background 0.2s, color 0.2s;
}
.qz-opt.correct {
  border-color: #5CA87A; background: rgba(92,168,122,0.1);
}
.qz-opt.correct .qz-opt-ltr { background: #5CA87A; color: #fff; }
.qz-opt.wrong {
  border-color: var(--rose); background: rgba(196,92,92,0.08);
}
.qz-opt.wrong .qz-opt-ltr { background: var(--rose); color: #fff; }
.qz-feedback {
  width: 100%; display: flex; align-items: flex-start; gap: 0.65rem;
  padding: 0.9rem 1.1rem; border-radius: 12px;
  font-family: var(--font-display); font-style: italic;
  font-size: 1rem; line-height: 1.6; color: var(--sepia);
}
.qz-feedback.fb-ok {
  background: rgba(92,168,122,0.1); border: 1px solid rgba(92,168,122,0.35);
  color: #3A6E52;
}
.qz-feedback.fb-fail {
  background: rgba(196,132,58,0.07); border: 1px solid rgba(196,132,58,0.22);
}
.qz-fb-ico { font-size: 1.05rem; flex-shrink: 0; margin-top: 2px; }
.qz-next-btn {
  align-self: flex-end; font-family: var(--font-script);
  font-size: 1.1rem; color: var(--ink);
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  border: none; border-radius: 50px; padding: 0.6rem 1.8rem;
  cursor: pointer; box-shadow: 0 4px 14px rgba(196,132,58,0.3);
  transition: transform 0.2s, box-shadow 0.2s; margin-top: 0.3rem;
}
.qz-next-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(196,132,58,0.4);
}
.qz-result {
  text-align: center; display: flex; flex-direction: column;
  align-items: center; gap: 1.1rem;
  background: var(--paper);
  border: 1px solid rgba(196,132,58,0.2); border-radius: 18px;
  padding: 2.5rem 2rem; box-shadow: 0 6px 28px rgba(61,43,31,0.08);
}
.qz-res-emoji { font-size: 3.2rem; }
.qz-res-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-style: italic; font-weight: 400; color: var(--ink); margin: 0;
}
.qz-res-msg {
  font-family: var(--font-display); font-style: italic;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: var(--sepia); max-width: 38ch; line-height: 1.7; margin: 0;
}
.qz-ring-wrap {
  position: relative; width: 110px; height: 110px;
}
.qz-ring-wrap svg {
  width: 100%; height: 100%; transform: rotate(-90deg);
}
.qz-ring-bg   { fill: none; stroke: var(--paper-dark); stroke-width: 8; }
.qz-ring-fill { fill: none; stroke: var(--rose); stroke-width: 8; stroke-linecap: round; }
.qz-ring-pct {
  position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 1.5rem;
  font-weight: 600; color: var(--rose);
}
.qz-retry-btn {
  font-family: var(--font-script); font-size: 1.1rem; color: var(--ink);
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  border: none; border-radius: 50px; padding: 0.7rem 2rem;
  cursor: pointer; box-shadow: 0 4px 14px rgba(196,132,58,0.3);
  transition: transform 0.2s; margin-top: 0.5rem;
}
.qz-retry-btn:hover { transform: translateY(-2px); }
@media (max-width: 480px) {
  .qz-card { padding: 1.5rem 1.1rem; }
}

.photo-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--paper-dark);
  border-radius: 1px;
  /* Placeholder visual cuando no hay imagen */
  min-height: 160px;
}

/* Imagen rota / placeholder */
.photo-card img[src=""], .photo-card img:not([src]) {
  background: linear-gradient(135deg, var(--paper-dark), var(--cream));
}

.photo-card span {
  display: block;
  margin-top: 0.6rem;
  text-align: center;
  font-family: var(--font-script);
  font-size: 0.95rem;
  color: var(--sepia);
  line-height: 1;
}

/* ----------------------------------------------------------------
   CAPÍTULO 4 — CARTA DE AMOR
---------------------------------------------------------------- */
.letter-paper {
  background: var(--paper);
  border: 1px solid rgba(196,132,58,0.15);
  border-radius: 6px;
  padding: clamp(2rem, 5vw, 3.5rem) clamp(1.8rem, 5vw, 4rem);
  box-shadow:
    0 10px 40px rgba(61,43,31,0.1),
    0 1px 4px rgba(61,43,31,0.06),
    inset 0 0 60px rgba(240,230,200,0.3);
  position: relative;
  /* Líneas de papel simuladas */
  background-image: repeating-linear-gradient(
    transparent,
    transparent 34px,
    rgba(196,132,58,0.08) 34px,
    rgba(196,132,58,0.08) 35px
  );
  background-size: 100% 35px;
  background-position: 0 48px;
}

/* Margen izquierdo rojo clásico */
.letter-paper::before {
  content: '';
  position: absolute;
  left: clamp(2.5rem, 6vw, 4.5rem);
  top: 0; bottom: 0;
  width: 1px;
  background: rgba(196,92,92,0.25);
}

.letter-date {
  font-family: var(--font-script);
  font-size: 1.05rem;
  color: var(--sepia-light);
  text-align: right;
  margin-bottom: 1.8rem;
}

.letter-greeting {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-style: italic;
  color: var(--rose);
  margin-bottom: 1.2rem;
}

.letter-paper p {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  line-height: 2.19; /* alineado con líneas de fondo (35px) */
  color: var(--sepia);
  margin-bottom: 1.05rem;
}

.letter-closing {
  margin-top: 2rem;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--sepia);
  line-height: 1.8;
}

.letter-closing em {
  font-family: var(--font-script);
  font-size: 1.5rem;
  color: var(--rose);
  display: block;
  margin-top: 0.3rem;
}

/* ----------------------------------------------------------------
   CAPÍTULO 5 — "LO QUE NUNCA TE DIJE"
---------------------------------------------------------------- */
.thoughts-container {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  margin-top: 0.5rem;
}

.thought-card {
  background: var(--paper);
  border-left: 4px solid var(--rose-light);
  border-radius: 0 14px 14px 0;
  padding: 1.3rem 1.8rem;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  font-style: italic;
  color: var(--sepia);
  line-height: 1.7;
  box-shadow: 0 4px 16px rgba(61,43,31,0.06);
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.thought-card:hover {
  transform: translateX(6px);
  box-shadow: 0 6px 22px rgba(61,43,31,0.1);
}

.thought-card::before {
  content: '…';
  position: absolute;
  left: -0.6rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--paper);
  color: var(--rose-light);
  font-size: 0.6rem;
  padding: 2px 0;
}

/* ----------------------------------------------------------------
   CAPÍTULO 6 — ESTRELLAS / RAZONES
---------------------------------------------------------------- */
.stars-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 2rem;
  justify-content: center;
}

.love-star {
  font-size: 1.8rem;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
  filter: grayscale(0.3) brightness(0.9);
  line-height: 1;
  padding: 0.3rem;
}

.love-star:hover {
  transform: scale(1.3) rotate(-10deg);
  filter: grayscale(0) brightness(1.2);
}

.love-star.revealed {
  filter: grayscale(0) brightness(1.1);
  animation: starPop 0.4s cubic-bezier(.22,1,.36,1);
}

.love-message-box {
  min-height: 80px;
  background: var(--paper);
  border: 1px solid rgba(196,92,92,0.2);
  border-radius: 16px;
  padding: 1.5rem 2rem;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
  font-style: italic;
  color: var(--rose);
  text-align: center;
  line-height: 1.7;
  box-shadow: 0 4px 20px rgba(61,43,31,0.07);
  transition: opacity 0.4s ease, transform 0.4s ease;
  opacity: 0;
  transform: translateY(6px);
}

.love-message-box.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ----------------------------------------------------------------
   CAPÍTULO 7 — PUZZLE
---------------------------------------------------------------- */
.puzzle-container {
  background: var(--paper);
  border: 1px dashed rgba(196,132,58,0.3);
  border-radius: 16px;
  padding: 2.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.puzzle-placeholder {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-style: italic;
  color: var(--sepia-light);
  line-height: 1.9;
}

.puzzle-placeholder small {
  font-size: 0.8rem;
  color: var(--sepia-light);
  opacity: 0.6;
}

/* ----------------------------------------------------------------
   CAPÍTULO 8 — ESTADÍSTICA
---------------------------------------------------------------- */
.stats-box {
  background: var(--paper);
  border: 1px solid rgba(196,132,58,0.2);
  border-radius: 18px;
  padding: clamp(2rem, 5vw, 3.5rem);
  box-shadow: 0 8px 30px rgba(61,43,31,0.08);
  text-align: center;
}

.stats-box p {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.5vw, 1.3rem);
  font-style: italic;
  color: var(--sepia);
  line-height: 1.8;
  margin-bottom: 0.6rem;
}

.stats-formula-block {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4rem;
  margin: 1.5rem 0 0.5rem;
}

.stats-formula-title {
  font-family: 'Courier New', monospace;
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  color: var(--sepia);
  letter-spacing: 0.05em;
  margin: 0 !important;
}

/* Tabla de eventos */
.stats-chain {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stats-chain-row {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  background: rgba(196,132,58,0.05);
  border: 1px solid rgba(196,132,58,0.1);
  font-family: 'Courier New', monospace;
  font-size: clamp(0.75rem, 1.8vw, 0.88rem);
}

.stats-ci {
  color: var(--rose);
  font-weight: 700;
  font-size: 0.8rem;
}

.stats-cdesc {
  color: var(--sepia);
  text-align: left;
}

.stats-cval {
  color: var(--amber);
  font-weight: 600;
  white-space: nowrap;
}

/* Línea de igualdad con fracción */
.stats-equals {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-family: 'Courier New', monospace;
  font-size: clamp(0.8rem, 2vw, 0.95rem);
  color: var(--sepia-light);
}

.stats-lhs   { color: var(--sepia); }
.stats-eq-sign { color: var(--amber); font-weight: 700; }

.stats-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  vertical-align: middle;
}
.stats-num {
  font-size: 1rem;
  color: var(--sepia);
  border-bottom: 1.5px solid var(--sepia-light);
  padding: 0 0.3rem 1px;
  line-height: 1.4;
}
.stats-den {
  font-size: 0.68rem;
  color: var(--sepia-light);
  padding: 1px 0.3rem 0;
  line-height: 1.4;
}
.stats-tiny {
  color: var(--rose);
  font-weight: 700;
  font-size: 1rem;
}
.stats-tiny sup { font-size: 0.65em; }

/* Línea de Bayes */
.stats-bayes {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.2rem;
  font-family: 'Courier New', monospace;
  font-size: clamp(0.85rem, 2.2vw, 1rem);
  color: var(--sepia);
  background: rgba(196,92,92,0.06);
  border: 1px solid rgba(196,92,92,0.15);
  border-radius: 10px;
  padding: 0.7rem 1.2rem;
}
.stats-given {
  color: var(--amber);
  font-weight: 700;
  padding: 0 0.1rem;
}
.stats-one {
  color: var(--rose);
  font-size: 1.5em;
  margin-left: 0.1rem;
}

.stats-conclusion {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  font-style: italic;
  font-weight: 400;
  color: var(--rose) !important;
  margin-top: 0.5rem !important;
}

/* ----------------------------------------------------------------
   CAPÍTULO 9 — CARTAS FUTURAS
---------------------------------------------------------------- */
.future-letters {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.future-letter {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  background: var(--paper);
  border: 1px solid rgba(196,132,58,0.2);
  border-radius: 14px;
  padding: 1.3rem 1.8rem;
  box-shadow: 0 4px 16px rgba(61,43,31,0.06);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: default;
}

.future-letter:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(61,43,31,0.1);
}

.future-letter.locked { opacity: 0.85; }

.letter-icon { font-size: 1.8rem; flex-shrink: 0; }

.letter-info { flex: 1; }

.letter-info h4 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 0.2rem;
}

.letter-info p {
  font-size: 0.88rem;
  color: var(--sepia-light);
  font-style: italic;
}

.letter-lock {
  font-size: 1.1rem;
  opacity: 0.5;
  flex-shrink: 0;
}

/* ----------------------------------------------------------------
   FINAL
---------------------------------------------------------------- */
#finalSection {
  position: relative;
  text-align: center;
  padding: clamp(5rem, 10vw, 8rem) var(--chapter-px) clamp(5rem, 10vw, 8rem);
  overflow: hidden;
  max-width: 100%;
}

#finalSection::before { display: none; }

#finalParticles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.final-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 400;
  font-style: italic;
  color: var(--rose);
  line-height: 1.2;
  margin-bottom: 1.5rem;
  text-shadow: 0 2px 20px rgba(196,92,92,0.2);
  position: relative;
  z-index: 10;
}

.final-text {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  font-style: italic;
  color: var(--sepia);
  max-width: 50ch;
  margin: 0 auto 1.2rem;
  line-height: 1.75;
  position: relative;
  z-index: 10;
}

.final-sub {
  font-family: var(--font-script);
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  color: var(--amber);
  margin-bottom: 2.5rem;
  position: relative;
  z-index: 10;
}

.final-signature {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-style: italic;
  color: var(--sepia-light);
  position: relative;
  z-index: 10;
}

.final-signature em {
  font-family: var(--font-script);
  font-size: 1.8rem;
  color: var(--rose);
  display: block;
  margin-top: 0.3rem;
}

/* ================================================================
   PANTALLAS INTERNAS (menú, visor de capítulo)
=============================================================== */
.inner-screen {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s ease;
  padding-top: 5.5rem;
  padding-bottom: 4.5rem;
}

.inner-screen.active {
  opacity: 1;
  pointer-events: all;
}

/* ================================================================
   MENÚ DE CAPÍTULOS
=============================================================== */
#menuScreen {
  align-items: center;
  justify-content: flex-start;
}

.menu-intro {
  text-align: center;
  padding: 1rem 1.5rem 0.5rem;
}

.menu-heading {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 400;
  font-style: italic;
  color: var(--ink);
  margin-bottom: 0.3rem;
}

.menu-sub {
  font-family: var(--font-display);
  font-size: 1rem;
  font-style: italic;
  color: var(--sepia-light);
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
  padding: 0.8rem 1rem;
  max-width: 560px;
  width: 100%;
}

.menu-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1.2rem 0.8rem;
  background: var(--paper);
  border: 1px solid rgba(196,132,58,0.15);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(.22,1,.36,1);
  animation: menuCardIn 0.5s ease both;
  animation-delay: var(--delay, 0s);
  text-align: center;
  font-family: inherit;
  color: var(--sepia);
  overflow: hidden;
}

.menu-card:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--gold);
  box-shadow: 0 8px 28px rgba(196,132,58,0.15);
  background: linear-gradient(135deg, var(--paper), rgba(212,168,90,0.06));
}

.menu-card:active {
  transform: translateY(-1px) scale(0.98);
}

.menu-card-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.menu-card-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.3;
}

.menu-card-sub {
  font-size: 0.65rem;
  color: var(--sepia-light);
  font-style: italic;
  line-height: 1.3;
}

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

/* ================================================================
   VISOR DE CAPÍTULO
=============================================================== */
.ch-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--chapter-px) 1rem;
}

.ch-content .chapter {
  max-width: 900px;
  margin: 0 auto;
  padding: 0;
}

.ch-content .chapter.has-bg {
  padding-top: 2rem;
  padding-bottom: 2rem;
}

/* ================================================================
   BOTTOM NAV — BARRA DE NAVEGACIÓN INFERIOR
=============================================================== */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.6rem 1rem 0.8rem;
  background: linear-gradient(0deg, rgba(245,237,216,0.97) 60%, rgba(245,237,216,0));
  pointer-events: none;
}

.bn-btn {
  pointer-events: all;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--paper);
  border: 1.5px solid rgba(196,132,58,0.2);
  color: var(--sepia);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(.22,1,.36,1);
  position: relative;
  overflow: hidden;
}

.bn-btn:hover:not(:disabled) {
  background: var(--rose);
  color: white;
  border-color: var(--rose);
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(196,92,92,0.25);
}

.bn-btn:active:not(:disabled) {
  transform: scale(0.94);
}

.bn-btn:disabled {
  opacity: 0.25;
  cursor: default;
}

.bn-dots {
  pointer-events: all;
  display: flex;
  gap: 6px;
  align-items: center;
}

.bn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(107,76,59,0.2);
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.bn-dot:hover {
  background: var(--gold);
  transform: scale(1.2);
}

.bn-dot.active {
  background: var(--rose);
  box-shadow: 0 0 0 3px rgba(196,92,92,0.2);
  transform: scale(1.25);
  animation: dotPulse 1.8s ease infinite;
}

@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(196,92,92,0.2); }
  50%      { box-shadow: 0 0 0 6px rgba(196,92,92,0.1); }
}

/* ================================================================
   RIPPLE EFFECT (para todos los botones)
=============================================================== */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  pointer-events: none;
  animation: rippleAnim 0.6s ease-out forwards;
}

@keyframes rippleAnim {
  from { transform: scale(0); opacity: 1; }
  to   { transform: scale(2.5); opacity: 0; }
}

/* ================================================================
   FINAL CHAPTER (dentro del visor)
=============================================================== */
.final-chapter {
  text-align: center;
  padding-top: 2rem;
  padding-bottom: 2rem;
  position: relative;
  overflow: hidden;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.final-chapter::before {
  display: none;
}

/* ================================================================
   SCROLL REVEAL (clase aplicada por JS)
=============================================================== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ================================================================
   INSTALACIÓN PWA
=============================================================== */
.install-section {
  margin-top: 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
}

.install-divider {
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--sepia-light), transparent);
  opacity: 0.3;
}

.install-btn {
  font-size: 1rem;
}

.install-ios-msg {
  text-align: center;
  max-width: 280px;
}

.install-ios-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-style: italic;
  color: var(--sepia);
  margin-bottom: 0.5rem;
}

.install-ios-text {
  font-size: 0.85rem;
  color: var(--sepia-light);
  line-height: 1.6;
}

.ios-icon {
  display: inline-block;
  font-size: 1.1rem;
  vertical-align: middle;
}
