/* =====================================================================
   Colores y tipografía (los colores también se pueden cambiar en script.js)
   ===================================================================== */
:root {
  --fondo: #f8f1f3;
  --texto: #4a3540;
  --suave: #957f8a;
  --acento: #a8506f;               /* malva */
  --acento-suave: #d58ea3;         /* rosa empolvado */
  --acento-rgb: 168, 80, 111;      /* el mismo acento en R, G, B (lo actualiza script.js) */
  --acento-suave-rgb: 213, 142, 163;
  --dorado: #d4af6a;
  --sombra-rgb: 70, 40, 55;
  --papel: #ecd9df;                /* color del sobre */
  --papel-carta: #fffafa;          /* color de la hoja */
  --blanco-papel: #fffdfd;
  --tinta-carta: #4a3540;
  --serif: 'Cormorant Garamond', 'Playfair Display', Georgia, 'Times New Roman', serif;
  --manuscrita: 'Great Vibes', 'Brush Script MT', cursive;
  /* Textura de papel (ruido muy suave) */
  --textura: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .3 0 0 0 0 .16 0 0 0 .1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@page {
  size: A6;
  margin: 0;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--fondo);
  color: var(--texto);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

button { font-family: inherit; }

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.stop-claro { stop-color: var(--acento-suave); }
.stop-oscuro { stop-color: var(--acento); }

/* =====================================================================
   Capas de ambiente: corazones flotantes, pétalos y música
   ===================================================================== */
.fondo-flotante {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.flotante {
  position: absolute;
  bottom: -40px;
  left: var(--x);
  width: var(--t);
  color: var(--acento);
  opacity: 0;
  animation: flotar var(--d) linear var(--r) infinite;
}

.flotante svg {
  display: block;
  width: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  animation: vaiven 5s ease-in-out infinite alternate;
}

.confeti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  pointer-events: none;
}

.boton-musica {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 60;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(var(--acento-rgb), 0.2);
  background: rgba(255, 253, 249, 0.8);
  backdrop-filter: blur(6px);
  color: var(--acento);
  cursor: pointer;
}

.boton-musica svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.barra-eq {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: eq 0.9s ease-in-out infinite alternate;
}

.barra-eq:nth-child(2) { animation-duration: 0.65s; }
.barra-eq:nth-child(3) { animation-duration: 1.2s; }

.icono-play { display: none; }
.boton-musica.pausada .barra-eq { display: none; }
.boton-musica.pausada .icono-play { display: inline; }

/* =====================================================================
   1. Pantalla de desbloqueo
   ===================================================================== */
.desbloqueo {
  --p: 0;
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  text-align: center;
  background: radial-gradient(circle at 50% 52%, rgba(var(--acento-suave-rgb), calc(0.05 + var(--p) * 0.16)) 0, transparent 52%);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.desbloqueo.saliendo {
  opacity: 0;
  transform: scale(1.03);
  pointer-events: none;
}

.antetitulo {
  margin: 0 0 6px;
  font-size: 0.74rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--suave);
}

.nombre {
  margin: 0;
  font-family: var(--manuscrita);
  font-weight: 400;
  font-size: clamp(3.2rem, 15vw, 4.2rem);
  line-height: 1.1;
  color: var(--acento);
}

.instruccion {
  margin: 8px 0 10px;
  min-height: 1.6em;
  font-style: italic;
  font-size: 1.2rem;
  color: var(--suave);
}

.instruccion.cambio { animation: aparecer-texto 0.5s ease; }

.zona-corazon {
  position: relative;
  display: grid;
  place-items: center;
  width: 180px;
  height: 180px;
}

.corazon {
  position: relative;
  z-index: 2;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.corazon:focus-visible {
  outline: 1.5px solid var(--acento);
  outline-offset: 8px;
}

.corazon-pop,
.corazon-latido { display: block; }

.corazon-pop.pop { animation: pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1); }

.corazon.latiendo .corazon-latido { animation: latido 0.8s ease-in-out infinite; }

.corazon svg {
  display: block;
  width: 128px;
  height: 128px;
  overflow: visible;
  transform: scale(calc(1 + var(--p) * 0.1));
  filter: drop-shadow(0 8px calc(8px + var(--p) * 22px) rgba(var(--acento-rgb), calc(0.16 + var(--p) * 0.4)));
}

.corazon-fondo { fill: rgba(var(--acento-suave-rgb), 0.07); }

.corazon-borde {
  fill: none;
  stroke: var(--acento);
  stroke-width: 0.7;
  stroke-linejoin: round;
}

.ola {
  fill: url(#grad-liquido);
  animation: ola 2.2s linear infinite;
}

.ola-atras {
  fill: var(--acento-suave);
  opacity: 0.35;
  animation-duration: 3.4s;
  animation-direction: reverse;
}

.brillo {
  fill: none;
  stroke: rgba(255, 255, 255, 0.75);
  stroke-width: 0.8;
  stroke-linecap: round;
}

.onda {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  border: 1px solid var(--acento);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  animation: onda 1s ease-out forwards;
}

.mini-corazon {
  position: absolute;
  left: 50%;
  top: 40%;
  width: 13px;
  margin-left: -6.5px;
  color: var(--acento-suave);
  opacity: 0;
  pointer-events: none;
  animation: subir 1.4s ease-out var(--d) forwards;
}

.mini-corazon svg {
  display: block;
  width: 100%;
  fill: currentColor;
}

.barra {
  width: min(220px, 64vw);
  height: 3px;
  margin-top: 18px;
  border-radius: 99px;
  background: rgba(var(--acento-rgb), 0.12);
  overflow: hidden;
}

.barra-relleno {
  height: 100%;
  width: calc(var(--p) * 100%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--acento-suave), var(--acento));
}

.porcentaje {
  margin: 10px 0 0;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  color: var(--suave);
  font-variant-numeric: tabular-nums;
}

.ayuda {
  margin: 22px 0 0;
  font-size: 0.88rem;
  font-style: italic;
  color: var(--suave);
  animation: respirar-opacidad 2.8s ease-in-out infinite;
  transition: opacity 0.4s ease;
}

.desbloqueo.completo .ayuda { opacity: 0; animation: none; }
.desbloqueo.completo .corazon svg { animation: estallido 1s ease forwards; }

/* =====================================================================
   2. Portada y carrusel polaroid
   ===================================================================== */
.principal {
  position: relative;
  z-index: 2;
  max-width: 440px;
  margin: 0 auto;
  padding: 60px 16px 110px;
  text-align: center;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.principal.visible { opacity: 1; }

.revelar {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 1.1s ease, transform 1.1s ease;
}

.revelar.visible {
  opacity: 1;
  transform: none;
}

.titulo {
  margin: 0;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.75rem, 7.5vw, 2.15rem);
  line-height: 1.2;
}

.fecha {
  margin: 12px 0 0;
  font-size: 0.76rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--suave);
}

.polaroid {
  width: min(320px, 100%);
  margin: 34px auto 8px;
  padding: 14px 14px 8px;
  background: var(--textura), var(--blanco-papel);
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(var(--sombra-rgb), 0.08), 0 16px 36px -6px rgba(var(--sombra-rgb), 0.18);
  transform: rotate(-1.2deg);
}

.carrusel {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #efe3e8;
  touch-action: pan-y;
  cursor: grab;
}

.carrusel:active { cursor: grabbing; }

.pista {
  display: flex;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.22, 0.8, 0.24, 1);
  will-change: transform;
}

.pista img {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.pista img.rota {
  object-fit: contain;
  background: #efe3e8;
}

.puntos {
  display: flex;
  justify-content: center;
  gap: 7px;
  min-height: 6px;
  margin: 12px 0 2px;
}

.punto {
  width: 6px;
  height: 6px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #e3d0d8;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.3s ease;
}

.punto.activo {
  background: var(--acento);
  transform: scale(1.3);
}

.adorno {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.banderines {
  width: 124px;
  height: 20px;
  transform-origin: 50% 0;
  animation: mecer 4.5s ease-in-out infinite;
}

.chispa {
  width: 13px;
  height: 13px;
  fill: var(--dorado);
  animation: titilar 2.6s ease-in-out infinite;
}

.chispa-2 { animation-delay: -1.3s; }

.separador {
  display: block;
  width: 56px;
  height: 16px;
  margin: 26px auto 0;
  color: var(--suave);
  opacity: 0.7;
}

.separador path {
  stroke-dasharray: 80;
  stroke-dashoffset: 80;
  transition: stroke-dashoffset 1.8s ease 0.3s;
}

.separador.visible path { stroke-dashoffset: 0; }

/* =====================================================================
   3. Sobre
   ===================================================================== */
.escena-carta {
  width: min(340px, 100%);
  margin: 0 auto;
  padding-top: 70px;
}

.sobre {
  position: relative;
  width: 100%;
  aspect-ratio: 340 / 228;
  perspective: 1100px;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.escena-carta.retirando .sobre {
  opacity: 0;
  transform: translateY(28px) scale(0.96);
}

.sobre-interior {
  position: absolute;
  inset: 0;
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(var(--sombra-rgb), 0.28), rgba(var(--sombra-rgb), 0.1) 60%), var(--textura), var(--papel);
  box-shadow: 0 24px 38px -16px rgba(var(--sombra-rgb), 0.45), 0 3px 8px rgba(var(--sombra-rgb), 0.12);
}

.carta-asomada {
  position: absolute;
  left: 7%;
  right: 7%;
  top: 7%;
  height: 84%;
  z-index: 2;
  padding: 30px 24px;
  border-radius: 2px;
  background:
    repeating-linear-gradient(180deg, transparent 0 13px, rgba(var(--sombra-rgb), 0.14) 13px 14px) content-box,
    var(--textura),
    var(--papel-carta);
  box-shadow: 0 1px 3px rgba(var(--sombra-rgb), 0.15);
  transition: transform 1.2s cubic-bezier(0.3, 0.7, 0.2, 1);
}

.sobre.abierta .carta-asomada {
  transform: translateY(-58%);
  transition-delay: 0.85s;
}

.capa {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  filter: drop-shadow(0 -1px 1.5px rgba(var(--sombra-rgb), 0.2));
}

.pliegue {
  position: absolute;
  inset: 0;
  border-radius: 5px;
}

.pliegue.izq {
  clip-path: polygon(0 0, 51% 55%, 0 100%);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.16), rgba(0, 0, 0, 0.02)), var(--textura), var(--papel);
}

.pliegue.der {
  clip-path: polygon(100% 0, 49% 55%, 100% 100%);
  background: linear-gradient(270deg, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.01)), var(--textura), var(--papel);
}

.pliegue.abajo {
  clip-path: polygon(0 100%, 50% 43%, 100% 100%);
  background: linear-gradient(0deg, rgba(255, 255, 255, 0.14), rgba(0, 0, 0, 0.03)), var(--textura), var(--papel);
}

.solapa-giro {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  transform-origin: 50% 0;
  filter: drop-shadow(0 2px 2px rgba(var(--sombra-rgb), 0.22));
  transition: transform 0.9s cubic-bezier(0.45, 0.05, 0.25, 1), z-index 0s linear 0.45s;
}

.solapa {
  position: absolute;
  inset: 0;
  border-radius: 5px 5px 0 0;
  clip-path: polygon(0 0, 100% 0, 50% 57%);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(255, 255, 255, 0.12) 70%), var(--textura), var(--papel);
  transition: filter 0.9s ease;
}

.sobre.abierta .solapa-giro {
  transform: rotateX(180deg);
  z-index: 1;
  transition: transform 0.9s cubic-bezier(0.45, 0.05, 0.25, 1) 0.3s, z-index 0s linear 0.75s;
}

.sobre.abierta .solapa { filter: brightness(0.9); }

.sello {
  position: absolute;
  left: 50%;
  top: 57%;
  z-index: 5;
  width: 88px;
  height: 88px;
  margin: -44px 0 0 -44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  filter: drop-shadow(0 5px 6px rgba(120, 85, 20, 0.35));
  animation: respirar 2.8s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
}

.sello:focus-visible {
  outline: 1.5px solid var(--texto);
  outline-offset: 4px;
}

.sello-mitad {
  position: absolute;
  inset: 0;
  transition: transform 0.8s cubic-bezier(0.3, 0.6, 0.3, 1), opacity 0.5s ease 0.25s;
}

.sello-mitad svg {
  display: block;
  width: 100%;
  height: 100%;
}

.sello-mitad.izq { clip-path: polygon(0 0, 53% 0, 46% 28%, 55% 52%, 47% 76%, 52% 100%, 0 100%); }
.sello-mitad.der { clip-path: polygon(53% 0, 100% 0, 100% 100%, 52% 100%, 47% 76%, 55% 52%, 46% 28%); }

.sobre.abierta .sello {
  animation: none;
  pointer-events: none;
}

.sobre.abierta .sello-mitad.izq {
  transform: translate(-16px, 16px) rotate(-22deg);
  opacity: 0;
}

.sobre.abierta .sello-mitad.der {
  transform: translate(16px, 20px) rotate(20deg);
  opacity: 0;
}

.pista-sello {
  margin: 22px 0 0;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--suave);
  animation: respirar-opacidad 2.8s ease-in-out infinite;
  transition: opacity 0.4s ease;
}

.pista-sello.oculta {
  opacity: 0;
  animation: none;
}

/* =====================================================================
   3b. Carta
   ===================================================================== */
.carta {
  position: relative;
  padding: 48px 24px 44px;
  text-align: center;
  color: var(--tinta-carta);
  border-radius: 3px;
  background-color: var(--papel-carta);
  background-image:
    linear-gradient(180deg, transparent 32.9%, rgba(var(--sombra-rgb), 0.09) 33.2%, rgba(255, 255, 255, 0.7) 33.5%, transparent 34%),
    linear-gradient(180deg, transparent 66.2%, rgba(var(--sombra-rgb), 0.09) 66.5%, rgba(255, 255, 255, 0.7) 66.8%, transparent 67.3%),
    var(--textura),
    linear-gradient(165deg, rgba(255, 255, 255, 0.85), rgba(240, 220, 228, 0.35));
  box-shadow:
    0 1px 1px rgba(var(--sombra-rgb), 0.06),
    0 12px 24px -8px rgba(var(--sombra-rgb), 0.2),
    0 40px 60px -30px rgba(var(--sombra-rgb), 0.28);
  transform-origin: 50% 0;
  scroll-margin-top: 20px;
}

.carta::before,
.carta::after {
  content: '';
  position: absolute;
  border-radius: 2px;
  pointer-events: none;
}

.carta::before {
  inset: 12px;
  border: 1px solid rgba(var(--acento-rgb), 0.2);
}

.carta::after {
  inset: 16px;
  border: 0.5px solid rgba(var(--acento-rgb), 0.12);
}

.carta.desplegada { animation: desdoblar 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.carta.escribiendo { cursor: pointer; }

/* Cada letra aparece cuando el lápiz pasa por ella */
.letra {
  opacity: 0;
  transition: opacity 0.25s ease-out;
}

.letra.escrita { opacity: 1; }

/* Ícono y adorno: aparecen con un fundido corto */
.aparece {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.aparece.visible {
  opacity: 1;
  transform: none;
}

/* Lápiz: el contenedor se mueve, el cuerpo se inclina y "garabatea" */
.lapiz {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  width: 0;
  height: 0;
  pointer-events: none;
  transition-property: transform;
  transition-timing-function: linear;
  will-change: transform;
}

.lapiz-cuerpo {
  position: absolute;
  left: 0;
  top: -8px;
  width: 78px;
  height: 16px;
  overflow: visible;
  opacity: 0;
  transform-origin: 0 8px;
  transform: rotate(-38deg);
  filter: drop-shadow(3px 5px 3px rgba(var(--sombra-rgb), 0.22));
  transition: opacity 0.4s ease;
}

.lapiz-cuerpo .madera { fill: var(--acento-suave); }

.lapiz.escribiendo .lapiz-cuerpo {
  opacity: 1;
  animation: garabato 0.28s ease-in-out infinite alternate;
}

/* Aviso flotante mientras el lápiz escribe */
.pista-carta {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  margin: 0;
  padding: 7px 16px;
  border-radius: 999px;
  white-space: nowrap;
  font-style: italic;
  font-size: 0.9rem;
  color: var(--texto);
  background: rgba(255, 253, 249, 0.85);
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 18px -6px rgba(var(--sombra-rgb), 0.25);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.pista-carta.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.pista-carta.oculta {
  opacity: 0;
  transform: translate(-50%, 10px);
}

.icono-carta {
  display: block;
  width: 124px;
  height: auto;
  margin: 0 auto 6px;
  overflow: visible;
}

.icono-carta path,
.icono-carta rect,
.icono-carta ellipse {
  fill: none;
  stroke: var(--acento);
  stroke-width: 1.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icono-carta .cuerpo-globo { fill: rgba(var(--acento-suave-rgb), 0.14); }
.icono-carta .globo-der .cuerpo-globo { fill: rgba(var(--acento-rgb), 0.12); }
.icono-carta .nudo { fill: var(--acento); }
.icono-carta .reflejo { stroke: rgba(255, 255, 255, 0.9); stroke-width: 1.4; }
.icono-carta .hilo { stroke-width: 0.8; opacity: 0.7; }

.icono-carta .llama {
  fill: var(--acento-suave);
  stroke: none;
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: parpadeo 1.1s ease-in-out infinite alternate;
}

.halo-llama {
  fill: rgba(243, 201, 107, 0.4);
  animation: respirar-opacidad 1.6s ease-in-out infinite;
}

.globo {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: mecer-globo 3.8s ease-in-out infinite;
}

.globo-der { animation-delay: -1.9s; }

.icono-carta .destello,
.destello-choque {
  fill: var(--dorado);
  stroke: none;
  transform-box: fill-box;
  transform-origin: center;
  animation: titilar 2.4s ease-in-out infinite;
}

.icono-carta .d2 { animation-delay: -0.6s; }
.icono-carta .d3 { animation-delay: -1.2s; }
.icono-carta .d4 { animation-delay: -1.8s; }

.carta-saludo {
  margin: 0 0 18px;
  font-family: var(--manuscrita);
  font-size: 2.5rem;
  line-height: 1.2;
  color: var(--acento);
}

.carta-texto {
  font-weight: 300;
  font-size: 1.14rem;
  line-height: 1.75;
  color: var(--tinta-carta);
}

.linea {
  display: block;
  text-wrap: balance;
}
.linea.vacia { height: 0.9em; }

.adorno-carta {
  display: block;
  width: 96px;
  height: 12px;
  margin: 24px auto 16px;
  color: rgba(var(--acento-rgb), 0.55);
}

.carta-final {
  margin: 0;
  font-style: italic;
  font-weight: 400;
  font-size: 1.4rem;
  line-height: 1.35;
  color: var(--acento);
  text-wrap: balance;
}

.carta-firma {
  margin: 28px 0 0;
  font-family: var(--manuscrita);
  font-size: 2.1rem;
  line-height: 1.3;
  color: var(--texto);
}

.corazon-firma {
  display: block;
  width: 26px;
  height: 26px;
  margin: 8px auto 0;
  overflow: visible;
}

.corazon-firma path {
  fill: none;
  stroke: var(--acento);
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
}

/* =====================================================================
   4. Cierre
   ===================================================================== */
.cierre {
  margin-top: 56px;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 1.1s ease, transform 1.1s ease;
}

.cierre.visible {
  opacity: 1;
  transform: none;
}

.icono-copas {
  display: block;
  width: 112px;
  height: auto;
  margin: 0 auto;
  overflow: visible;
}

.icono-copas path {
  fill: none;
  stroke: var(--acento);
  stroke-width: 1.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icono-copas .liquido-copa {
  fill: rgba(243, 201, 107, 0.45);
  stroke: none;
}

.icono-copas .burbuja {
  fill: #fff6df;
  stroke: rgba(var(--acento-rgb), 0.35);
  stroke-width: 0.3;
  opacity: 0;
  animation: burbuja 2s ease-in infinite;
}

.icono-copas .b2 { animation-duration: 2.4s; animation-delay: -0.8s; }
.icono-copas .b3 { animation-duration: 1.8s; animation-delay: -1.4s; }

.copa {
  transform-box: fill-box;
  transform-origin: 50% 100%;
}

.copa-izq { animation: brindis-izq 3.2s ease-in-out infinite; }
.copa-der { animation: brindis-der 3.2s ease-in-out infinite; }

.icono-copas .destello-choque { animation: destello-choque 3.2s ease-out infinite; }

.halo-choque {
  fill: rgba(243, 201, 107, 0.35);
  transform-box: fill-box;
  transform-origin: center;
  animation: destello-choque 3.2s ease-out infinite;
}

.cierre-titulo {
  margin: 16px 0 26px;
  font-style: italic;
  font-weight: 300;
  font-size: 1.65rem;
  line-height: 1.25;
  color: var(--acento);
}

.foto-cierre {
  width: min(320px, 100%);
  margin: 0 auto;
  padding: 10px 10px 34px;
  background: var(--textura), var(--blanco-papel);
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(var(--sombra-rgb), 0.08), 0 16px 36px -6px rgba(var(--sombra-rgb), 0.18);
  transform: rotate(1.2deg);
}

.foto-cierre img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.cierre-mensaje {
  margin: 28px 0 24px;
  font-style: italic;
  font-size: 1.22rem;
  color: var(--suave);
}

.boton {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 26px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  color: #fff;
  font-style: italic;
  font-size: 1.1rem;
  background: linear-gradient(135deg, var(--acento-suave), var(--acento));
  box-shadow: 0 10px 22px -6px rgba(var(--acento-rgb), 0.45);
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.boton-icono {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.boton:active { transform: scale(0.97); }
.boton:disabled { opacity: 0.7; cursor: wait; }

.boton:focus-visible {
  outline: 1.5px solid var(--texto);
  outline-offset: 4px;
}

/* =====================================================================
   Tarjeta imprimible (tarjeta.html)
   ===================================================================== */
.pagina-tarjeta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 24px 16px 48px;
  background: #efe6ea;
}

.herramientas {
  width: min(105mm, 100%);
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
  color: #5a4550;
}

.herramientas p { margin: 0 0 8px; overflow-wrap: anywhere; }

.aviso {
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff4d6;
  border: 1px solid #f0d58a;
}

.herramientas .boton {
  font-family: var(--serif);
  margin-top: 4px;
}

.tarjeta-impresa {
  width: min(105mm, 100%);
  aspect-ratio: 105 / 148;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4mm;
  padding: 12mm 10mm;
  text-align: center;
  background: var(--blanco-papel);
  box-shadow: 0 10px 30px rgba(var(--sombra-rgb), 0.15);
}

.tarjeta-impresa h1 {
  margin: 0;
  font-family: var(--manuscrita);
  font-weight: 400;
  font-size: 2.6rem;
  line-height: 1.1;
  color: var(--texto);
}

.ti-subtitulo {
  margin: 0;
  font-style: italic;
  font-size: 1rem;
  color: var(--suave);
}

.ti-regalo {
  width: 22mm;
  height: 18mm;
}

.ti-qr {
  width: 42mm;
  height: 42mm;
  padding: 2mm;
  border: 1px solid #ecdfe4;
}

.ti-qr img,
.ti-qr canvas {
  width: 100% !important;
  height: 100% !important;
}

.ti-qr.qr-error {
  display: flex;
  align-items: center;
  font-family: system-ui, sans-serif;
  font-size: 0.75rem;
  color: var(--acento);
}

.ti-pie {
  margin: 0;
  font-size: 0.8rem;
  color: var(--suave);
}

@media print {
  .pagina-tarjeta {
    padding: 0;
    background: #fff;
  }

  .herramientas { display: none !important; }

  .tarjeta-impresa {
    width: 105mm;
    height: 148mm;
    box-shadow: none;
  }
}

/* =====================================================================
   Animaciones
   ===================================================================== */
@keyframes latido {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.08); }
  50% { transform: scale(0.98); }
  70% { transform: scale(1.04); }
}

@keyframes pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.14); }
  100% { transform: scale(1); }
}

@keyframes ola {
  from { transform: translateX(0); }
  to { transform: translateX(12px); }
}

@keyframes onda {
  from { transform: scale(0.6); opacity: 0.45; }
  to { transform: scale(1.7); opacity: 0; }
}

@keyframes subir {
  0% { opacity: 0; transform: translate(0, 0) scale(calc(var(--s) * 0.5)); }
  15% { opacity: 0.9; }
  100% { opacity: 0; transform: translate(var(--x), -120px) rotate(var(--r)) scale(var(--s)); }
}

@keyframes estallido {
  35% { transform: scale(1.16); }
  100% { transform: scale(1.5); opacity: 0; }
}

@keyframes respirar {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.045); }
}

@keyframes respirar-opacidad {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

@keyframes aparecer-texto {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

@keyframes flotar {
  0% { transform: translateY(0); opacity: 0; }
  12% { opacity: var(--o); }
  85% { opacity: var(--o); }
  100% { transform: translateY(-115vh); opacity: 0; }
}

@keyframes vaiven {
  from { transform: translateX(-10px) rotate(-10deg); }
  to { transform: translateX(10px) rotate(10deg); }
}

@keyframes eq {
  from { transform: scaleY(0.3); }
  to { transform: scaleY(1); }
}

@keyframes mecer {
  0%, 100% { transform: rotate(-1.5deg); }
  50% { transform: rotate(1.5deg); }
}

@keyframes titilar {
  0%, 100% { transform: scale(0.65) rotate(0deg); opacity: 0.45; }
  50% { transform: scale(1.05) rotate(45deg); opacity: 1; }
}

@keyframes desdoblar {
  0% { opacity: 0; transform: perspective(1100px) rotateX(-80deg); }
  35% { opacity: 1; }
  100% { opacity: 1; transform: perspective(1100px) rotateX(0deg); }
}

@keyframes garabato {
  from { transform: rotate(-40deg) translateY(0); }
  to { transform: rotate(-35deg) translateY(-1px); }
}

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

@keyframes mecer-globo {
  0%, 100% { transform: rotate(-5deg) translateY(0); }
  50% { transform: rotate(5deg) translateY(-2px); }
}

@keyframes burbuja {
  0% { transform: translateY(0); opacity: 0; }
  20% { opacity: 0.9; }
  100% { transform: translateY(-14px); opacity: 0; }
}

@keyframes brindis-izq {
  0%, 55%, 100% { transform: rotate(0deg); }
  72% { transform: rotate(7deg); }
  80% { transform: rotate(5deg); }
}

@keyframes brindis-der {
  0%, 55%, 100% { transform: rotate(0deg); }
  72% { transform: rotate(-7deg); }
  80% { transform: rotate(-5deg); }
}

@keyframes destello-choque {
  0%, 68%, 100% { opacity: 0; transform: scale(0.3); }
  76% { opacity: 1; transform: scale(1.1); }
  92% { opacity: 0; transform: scale(1.4); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}
