/* ============================================================
   Jesús & Adriana · Estilo Marfil y Oro
   ============================================================ */

/* Colores animables: al pasar a la noche la paleta cambia suavemente */
@property --bg     { syntax: '<color>'; inherits: true; initial-value: #F8F4EC; }
@property --paper  { syntax: '<color>'; inherits: true; initial-value: #FFFDF8; }
@property --ink    { syntax: '<color>'; inherits: true; initial-value: #2B2622; }
@property --muted  { syntax: '<color>'; inherits: true; initial-value: #877B6E; }
@property --acc    { syntax: '<color>'; inherits: true; initial-value: #B08D57; }
@property --acc2   { syntax: '<color>'; inherits: true; initial-value: #EADFC9; }
@property --line   { syntax: '<color>'; inherits: true; initial-value: rgba(176,141,87,.42); }
@property --sel    { syntax: '<color>'; inherits: true; initial-value: #FBF3E4; }

:root {
  --bg: #F8F4EC;
  --paper: #FFFDF8;
  --ink: #2B2622;
  --muted: #877B6E;
  --acc: #B08D57;
  --acc2: #EADFC9;
  --line: rgba(176,141,87,.42);
  --sel: #FBF3E4;
  --on-acc: #FFFDF8;
  --petal: #E9D2B4;
  --star: #F3EBDD;
  --ok: #7C8A5A;

  --fd: 'Cormorant Garamond', 'Cormorant', Georgia, 'Times New Roman', serif;
  --fb: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fs: 'Pinyon Script', 'Cormorant Garamond', cursive;

  --ease: cubic-bezier(.2,.7,.2,1);
  --ease-io: cubic-bezier(.65,0,.35,1);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);

  color-scheme: light;
  transition: --bg 1.4s ease, --paper 1.4s ease, --ink 1.4s ease, --muted 1.4s ease,
              --acc 1.4s ease, --acc2 1.4s ease, --line 1.4s ease, --sel 1.4s ease;
}

:root.night {
  --bg: #1E1A16;
  --paper: #28221C;
  --ink: #F3EBDD;
  --muted: #B5A891;
  --acc: #D2B377;
  --acc2: #3A3129;
  --line: rgba(210,179,119,.34);
  --sel: #332A20;
  --on-acc: #1E1A16;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 13.5px/1.6 var(--fb);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
::selection { background: var(--acc2); color: var(--ink); }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
.ck { display: grid; flex: none; }
.ck svg { width: 100%; height: 100%; display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Contenedor ---------- */
#app {
  position: relative;
  height: 100%;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
  overflow: clip;
  isolation: isolate;
  background: var(--bg);
}
#app::before { /* resplandor de noche */
  content: "";
  position: absolute; inset: 0; z-index: 0;
  background: radial-gradient(90% 55% at 50% 0%, #3A2F24 0%, transparent 70%);
  opacity: 0;
  transition: opacity 1.4s ease;
  pointer-events: none;
}
.night #app::before { opacity: 1; }

.desk-note { display: none; }

/* En ordenador se ve dentro de un marco de móvil */
@media (min-width: 720px) and (min-height: 720px) {
  body {
    display: grid;
    place-items: center;
    gap: 18px;
    background: #E7E0D3;
    background-image: radial-gradient(circle at 50% 30%, #F1EBE0, #E2D9C9 70%);
  }
  .night body, :root.night body { background: #14110E; background-image: radial-gradient(circle at 50% 30%, #2A241D, #110F0C 70%); }
  #app {
    width: 390px;
    height: min(844px, calc(100vh - 80px));
    border-radius: 46px;
    box-shadow: 0 0 0 10px #0E0C0B, 0 0 0 11.5px #3B3633, 0 50px 90px -30px rgba(0,0,0,.55);
  }
  .desk-note {
    display: block;
    margin: 0;
    font-size: 11px;
    letter-spacing: .28em;
    text-transform: uppercase;
    color: var(--muted);
  }
}

/* ---------- Marco dorado ---------- */
.frame {
  position: absolute; inset: 12px; z-index: 5;
  border: 1px solid var(--line);
  border-radius: 28px;
  pointer-events: none;
}
.frame::after {
  content: "";
  position: absolute; inset: 4px;
  border: 1px solid var(--line);
  border-radius: 24px;
  opacity: .55;
}
@media (min-width: 720px) and (min-height: 720px) { .frame { border-radius: 34px; } .frame::after { border-radius: 30px; } }

.sky { position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: 0; transition: opacity 1.6s ease; }
.night .sky { opacity: 1; }
.star { position: absolute; border-radius: 50%; background: var(--star); opacity: .3; animation: twinkle 3s ease-in-out infinite; }

/* ---------- Barra superior ---------- */
.topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 6;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  padding: calc(var(--safe-t) + 22px) 22px 0;
  transition: opacity .6s ease, transform .6s var(--ease);
}
.topbar.is-hidden { opacity: 0; transform: translateY(-8px); pointer-events: none; }
.prog { display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; }
.prog i { width: 5px; height: 5px; border-radius: 3px; background: var(--line); transition: width .5s var(--ease), background-color .5s, opacity .5s; }
.prog i.done { background: var(--acc); opacity: .45; }
.prog i.on { width: 20px; background: var(--acc); opacity: 1; }
.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 0; background: transparent; color: var(--acc);
  border-radius: 50%;
  cursor: pointer;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:focus-visible, .btn:focus-visible, .opt:focus-visible, .tile:focus-visible, .ans:focus-visible, .link:focus-visible, .sheet-item:focus-visible { outline: 1.5px solid var(--acc); outline-offset: 3px; }
.icon-btn.back { justify-self: start; }
.icon-btn.menu { justify-self: end; }

/* ---------- Etapas ---------- */
#stages { position: absolute; inset: 0; z-index: 2; }
.stage {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  padding: calc(var(--safe-t) + 70px) 28px calc(var(--safe-b) + 30px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  visibility: hidden;
}
.stage::-webkit-scrollbar { display: none; }
.stage.is-active { visibility: visible; }
.stage-portada { padding-top: calc(var(--safe-t) + 54px); }
.grow { flex: 1; display: grid; place-items: center; min-height: 0; }
.push { margin-top: auto; }

/* ---------- Tipografía ---------- */
.eyebrow { font-size: 10px; letter-spacing: .32em; text-transform: uppercase; color: var(--acc); text-align: center; margin: 0; }
.h { font-family: var(--fd); font-style: italic; font-weight: 300; font-size: 38px; line-height: 1.05; text-align: center; margin: 10px 0 0; text-wrap: balance; }
.sub { font-weight: 300; font-size: 12.5px; color: var(--muted); text-align: center; margin: 10px auto 0; max-width: 30ch; text-wrap: balance; }
.names { font-family: var(--fs); font-style: normal; font-weight: 400; font-size: 48px; line-height: 1.1; }
.names i { font-family: var(--fd); font-style: italic; font-size: 26px; color: var(--acc); padding: 0 2px; }
.date { font-family: var(--fd); font-style: italic; text-align: center; font-size: 15px; color: var(--muted); letter-spacing: .3em; margin: 0 0 4px; font-variant-numeric: tabular-nums; }

/* ---------- Botones ---------- */
.btn {
  position: relative;
  display: block; width: 100%;
  margin-top: 18px;
  padding: 16px 18px;
  border: 1px solid var(--acc);
  background: transparent;
  color: var(--ink);
  font-family: var(--fb);
  font-size: 10.5px;
  letter-spacing: .32em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .35s ease, color .35s ease, opacity .35s ease;
}
.btn::after { content: ""; position: absolute; inset: 3px; border: 1px solid var(--line); pointer-events: none; transition: border-color .35s; }
.btn:active, .btn.solid { background: var(--acc); color: var(--on-acc); }
.btn:active::after, .btn.solid::after { border-color: rgba(255,255,255,.35); }
.btn[disabled] { opacity: .35; pointer-events: none; }
.btn.small { padding: 12px 14px; font-size: 9.5px; margin-top: 10px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-row .btn { margin-top: 10px; }
.link {
  display: block; margin: 14px auto 0;
  background: none; border: 0; padding: 4px 8px;
  font-family: var(--fd); font-style: italic; font-size: 15px;
  color: var(--muted); cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px;
}

/* ---------- Animaciones de entrada ----------
   Solo se ejecutan en la etapa activa; así se repiten al volver. */
.is-active .rv       { animation: up .95s var(--ease) both;   animation-delay: var(--d, 0s); }
.is-active .rv-fade  { animation: fade 1.3s ease both;         animation-delay: var(--d, 0s); }
.is-active .rv-blur  { animation: blurin 1.6s var(--ease) both; animation-delay: var(--d, 0s); }
.is-active .draw     { animation: draw 2.4s var(--ease-io) both; animation-delay: var(--d, 0s); }
.draw { fill: none; stroke: var(--acc); stroke-dasharray: 1; stroke-dashoffset: 1; }
.is-active .draw.done-draw { stroke-dashoffset: 0; }

@keyframes up      { from { opacity: 0; transform: translateY(16px); } }
@keyframes fade    { from { opacity: 0; } }
@keyframes blurin  { from { opacity: 0; filter: blur(10px); letter-spacing: .12em; } }
@keyframes draw    { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes twinkle { 0%, 100% { opacity: .15; transform: scale(.8); } 50% { opacity: .95; transform: scale(1.15); } }
@keyframes pop     { from { opacity: 0; transform: scale(.5); } }
@keyframes shake   { 0%,100% { transform: none; } 15% { transform: translateX(-8px); } 30% { transform: translateX(8px); } 45% { transform: translateX(-6px); } 60% { transform: translateX(5px); } 75% { transform: translateX(-3px); } 90% { transform: translateX(2px); } }

/* ---------- Transición entre etapas ---------- */
#veil {
  position: absolute; inset: 0; z-index: 20;
  display: grid; place-items: center;
  background: var(--bg);
  opacity: 0; visibility: hidden;
  pointer-events: none;
}
#veil .veil-line { width: 120px; height: 1px; background: var(--acc); transform: scaleX(0); }
#veil .veil-dia { position: absolute; width: 8px; height: 8px; border: 1px solid var(--acc); transform: rotate(45deg) scale(0); background: var(--bg); }

/* ---------- 1 · Portada ---------- */
.mono { position: relative; width: 220px; height: 220px; }
.mono svg { width: 100%; height: 100%; overflow: visible; }
.mono circle.draw { stroke-width: 1; }
.mono .thin { stroke-width: .6; opacity: .7; }
.mono .dia { fill: var(--acc); }
.mono-t { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--fs); font-size: 70px; line-height: 1; padding-top: 8px; }
.mono-t em { font-family: var(--fd); font-size: 26px; color: var(--acc); margin: 0 3px; align-self: center; }
.spk { fill: var(--acc); transform-box: fill-box; transform-origin: center; animation: twinkle 2.6s ease-in-out infinite; }

/* ---------- 2 · Carta ---------- */
.letter-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: 16px; }
.letter {
  position: relative;
  flex: 1; min-height: 240px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 20px 36px -28px rgba(90,70,40,.55);
  overflow: hidden;
}
.letter::before { content: ""; position: absolute; inset: 5px; border: 1px solid var(--line); opacity: .5; pointer-events: none; z-index: 1; }
.letter-scroll {
  position: absolute; inset: 0;
  overflow-y: auto;
  padding: 26px 24px 30px;
  font-family: var(--fd);
  font-size: 17.5px;
  line-height: 1.55;
  scrollbar-width: none;
}
.letter-scroll::-webkit-scrollbar { display: none; }
.letter-scroll p { margin: 0 0 12px; }
.letter .sal { font-family: var(--fs); color: var(--acc); font-size: 30px; line-height: 1.1; }
.letter .bye { font-style: italic; text-align: right; margin: 18px 0 0; }
.letter .sign { font-family: var(--fs); color: var(--acc); font-size: 38px; text-align: right; line-height: 1; margin: 2px 0 0; }
.letter .ln { opacity: 0; }
.letter.is-shown .ln { opacity: 1; animation: up .9s var(--ease) both; animation-delay: var(--d, 0s); }
.letter.is-read .ln { opacity: 1; animation: none; }
.letter-actions { opacity: 0; transform: translateY(10px); transition: opacity .8s ease, transform .8s var(--ease); pointer-events: none; }
.letter-actions.is-shown { opacity: 1; transform: none; pointer-events: auto; }

.envelope {
  position: absolute; inset: 0; z-index: 8;
  display: grid; place-items: center; align-content: center; gap: 28px;
  background: var(--bg);
  border: 0; width: 100%;
  cursor: pointer;
  padding: 0;
}
.envelope.is-gone { animation: envOut 1s var(--ease-io) forwards; pointer-events: none; }
.env { position: relative; width: 236px; height: 152px; perspective: 800px; }
.env-back { position: absolute; inset: 0; z-index: 0; background: var(--acc2); border-radius: 3px; }
.env-letter { position: absolute; z-index: 2; left: 14px; right: 14px; top: 10px; height: 128px; background: var(--paper); border: 1px solid var(--line); }
.env-letter::before { content: ""; position: absolute; left: 20px; right: 50px; top: 26px; height: 36px; background: repeating-linear-gradient(var(--line) 0 1px, transparent 1px 10px); }
.env-front { position: absolute; inset: 0; z-index: 3; background: var(--paper); clip-path: polygon(0 0, 50% 56%, 100% 0, 100% 100%, 0 100%); filter: brightness(.97); border-radius: 3px; }
.env-front::after { content: ""; position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; }
.flap { position: absolute; left: 0; right: 0; top: 0; height: 88px; background: var(--paper); filter: brightness(.93); clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: top; z-index: 4; }
.seal {
  position: absolute; left: 50%; top: 66px; z-index: 5;
  width: 46px; height: 46px; margin-left: -23px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #C9A56A, #9C7A45 70%);
  color: #FFF8EA;
  display: grid; place-items: center;
  font-family: var(--fs); font-size: 20px; line-height: 1;
  box-shadow: 0 2px 6px rgba(80,55,20,.3), inset 0 0 0 3px rgba(255,255,255,.12);
}
.env-to { font-family: var(--fs); font-size: 34px; color: var(--ink); margin: 0; line-height: 1.15; max-width: 86%; padding-inline: 12px; text-align: center; text-wrap: balance; }
/* De noche el sobre sigue siendo de papel marfil para que destaque */
.night .env-back { background: #CDBB9C; }
.night .env-front { background: #F1E7D6; }
.night .flap { background: #E7D9C3; }
.night .env-letter { background: #FBF6EE; }
.env-hint { font-size: 10px; letter-spacing: .32em; text-transform: uppercase; color: var(--muted); margin: -12px 0 0; animation: breathe 2.4s ease-in-out infinite; }
.envelope.is-opening .seal { animation: sealOff .6s ease forwards; }
.envelope.is-opening .flap { animation: flap 1s var(--ease-io) .35s both; }
.envelope.is-opening .env-letter { animation: rise 1s var(--ease) 1.3s both; }
.envelope.is-opening .env-hint, .envelope.is-opening .env-to { transition: opacity .4s; opacity: 0; }
.is-active .envelope:not(.is-opening) .env { animation: float 4s ease-in-out infinite; }
/* La solapa va por delante mientras está cerrada y, al pasar la vertical, queda detrás de la carta (capa 1) */
@keyframes flap { 0% { transform: rotateX(0); z-index: 4; filter: brightness(.93); } 50% { z-index: 4; } 51% { z-index: 1; } 100% { transform: rotateX(180deg); z-index: 1; filter: brightness(.86); } }
@keyframes sealOff { 40% { transform: scale(1.1); } to { opacity: 0; transform: scale(1.6); } }
@keyframes rise { to { transform: translateY(-70px); } }
@keyframes envOut { to { opacity: 0; visibility: hidden; transform: scale(1.06); } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes breathe { 0%,100% { opacity: .5; } 50% { opacity: 1; } }

/* ---------- 3 · Juego de fotos ---------- */
.qrow { display: flex; justify-content: space-between; align-items: center; font-size: 9.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); margin-top: 16px; font-variant-numeric: tabular-nums; }
.quiz { display: flex; flex-direction: column; flex: 1; }
.photo { margin: 14px auto 0; width: 100%; max-width: 300px; }
.quiz.enter .photo { animation: flipIn 1.1s var(--ease) both; }
.quiz.enter .q, .quiz.enter .ans { animation: up .8s var(--ease) both; animation-delay: var(--d, 0s); }
.pf {
  position: relative; margin: 0;
  background: #FFFFFF;
  padding: 9px 9px 34px;
  transform: rotate(-1.6deg);
  box-shadow: 0 16px 26px -18px rgba(60,45,25,.6);
}
.night .pf { background: #F6EFE2; }
.pf-img { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--acc2); }
.pf-img img, .pf-img svg { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Fotos verticales: marco más estrecho y alto para no cortar las caras */
.pf--v { max-width: 250px; margin-inline: auto; }
.pf--v .pf-img { aspect-ratio: 4 / 5; }
.summary-stack .pf .pf-img { aspect-ratio: auto; height: 100%; }
.pf figcaption { position: absolute; left: 0; right: 0; bottom: 5px; text-align: center; font-family: var(--fs); font-size: 20px; color: #877B6E; }
.ph-sky { fill: var(--acc2); } .ph-sun { fill: var(--paper); opacity: .85; }
.ph-h1 { fill: var(--acc); opacity: .4; } .ph-h2 { fill: var(--acc); opacity: .75; }
.ph-bird { fill: none; stroke: var(--ink); stroke-width: 1.1; opacity: .5; } .ph-pair { fill: var(--ink); opacity: .8; }
.q { font-family: var(--fd); font-style: italic; font-size: 23px; line-height: 1.2; text-align: center; margin: 18px 0 12px; text-wrap: balance; }
.ans-list { display: grid; gap: 8px; }
.ans {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--line); background: var(--paper);
  font-size: 12.5px; text-align: left; cursor: pointer;
  transition: background-color .4s, border-color .4s, opacity .4s;
}
.ans b { font-family: var(--fd); font-weight: 400; font-size: 16px; color: var(--acc); width: 14px; }
.ans span { flex: 1; }
.ans .ck { flex: 0 0 18px; width: 18px; height: 18px; color: var(--acc); opacity: 0; }
@media (max-height: 700px) { .photo { max-width: 230px; } .pf--v { max-width: 190px; } .q { margin-top: 12px; } }
.ans.ok { background: var(--sel); border-color: var(--acc); }
.ans.ok .ck { opacity: 1; }
.ans.ok .ck path { animation: draw .6s ease both; }
.quiz .ans.bad { animation: shake .5s ease; opacity: .4; pointer-events: none; }
.ans[disabled] { cursor: default; }
.memory { font-family: var(--fd); font-style: italic; font-size: 17px; text-align: center; color: var(--acc); margin: 14px 0 0; min-height: 1.4em; }
.memory.is-shown { animation: up .8s var(--ease) both; }
.memory.miss { color: var(--muted); font-size: 15px; }
@keyframes flipIn { from { opacity: 0; transform: perspective(800px) rotateY(-80deg) scale(.9); } }

.summary-stack { position: relative; width: 190px; height: 220px; margin: 10px auto 0; }
.summary-stack .pf { position: absolute; inset: 0; padding: 7px 7px 26px; }
.summary-stack .pf:nth-child(1) { transform: rotate(-9deg) translateX(-18px); }
.summary-stack .pf:nth-child(2) { transform: rotate(6deg) translateX(16px); }
.summary-stack .pf:nth-child(3) { transform: rotate(-1deg); }
.is-active .summary-stack .pf { animation: pop .8s var(--ease) both; }
.is-active .summary-stack .pf:nth-child(2) { animation-delay: .15s; }
.is-active .summary-stack .pf:nth-child(3) { animation-delay: .3s; }
.score { font-family: var(--fd); font-size: 64px; font-weight: 300; line-height: 1; text-align: center; margin: 20px 0 0; font-variant-numeric: tabular-nums; }
.score small { font-size: 26px; color: var(--muted); }

/* ---------- Juegos ---------- */
.game-area {
  position: relative;
  flex: 1; min-height: 300px;
  margin-top: 20px;
  display: flex; flex-direction: column;
}
.game-placeholder {
  flex: 1;
  display: grid; place-items: center; align-content: center; gap: 14px;
  padding: 28px 20px;
  border: 1px solid var(--line);
  background:
    repeating-linear-gradient(45deg, transparent 0 14px, rgba(176,141,87,.06) 14px 15px),
    var(--paper);
  text-align: center;
}
.game-placeholder .gp-icon { width: 64px; height: 64px; color: var(--acc); }
.game-placeholder .gp-num { font-family: var(--fd); font-style: italic; font-size: 60px; font-weight: 300; line-height: 1; color: var(--acc); }
.game-placeholder p { margin: 0; color: var(--muted); font-size: 12px; max-width: 26ch; }
.game-placeholder .gp-tag { font-size: 9.5px; letter-spacing: .3em; text-transform: uppercase; color: var(--acc); }

/* ---------- Elecciones ---------- */
.opts { display: grid; gap: 10px; margin-top: 22px; }
.opt {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 14px 16px;
  background: var(--paper); border: 1px solid var(--line);
  text-align: left; cursor: pointer;
  transition: background-color .4s, border-color .4s, transform .3s var(--ease);
}
.opt:active { transform: scale(.985); }
.opt .oi { flex: 0 0 42px; height: 42px; display: grid; place-items: center; color: var(--acc); border: 1px solid var(--line); border-radius: 50%; transition: background-color .4s, color .4s, border-color .4s; }
.opt .oi svg, .tile .ic svg { width: 24px; height: 24px; }
.opt .ot { flex: 1; display: grid; line-height: 1.25; }
.opt .ot b { font-family: var(--fd); font-weight: 400; font-size: 20px; }
.opt .ot small { font-size: 10px; letter-spacing: .08em; color: var(--muted); margin-top: 3px; }
.opt .ck { width: 20px; height: 20px; color: var(--acc); opacity: 0; transition: opacity .3s; }
.opt.is-sel, .tile.is-sel { background: var(--sel); border-color: var(--acc); }
.opt.is-sel .oi, .tile.is-sel .ic { background: var(--acc); color: var(--on-acc); border-color: var(--acc); }
.opt.is-sel .ck { opacity: 1; }
.opt.is-sel .ck path { animation: draw .5s ease both; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 22px; }
.tile {
  display: grid; justify-items: center; align-content: start; gap: 10px;
  padding: 18px 4px 14px;
  background: var(--paper); border: 1px solid var(--line);
  text-align: center; cursor: pointer;
  transition: background-color .4s, border-color .4s, transform .3s var(--ease);
}
.tile:active { transform: scale(.97); }
.tile .ic { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); color: var(--acc); transition: background-color .4s, color .4s, border-color .4s; }
.tile b { font-family: var(--fd); font-weight: 400; font-size: 15px; line-height: 1.2; }
.tile small { font-size: 9.5px; color: var(--muted); line-height: 1.3; }

.ticket {
  position: relative;
  margin-top: 26px;
  padding: 22px 22px 20px;
  border: 1px dashed var(--acc);
  display: grid; gap: 4px;
  text-align: center;
  background: var(--paper);
}
.ticket::before, .ticket::after {
  content: ""; position: absolute; top: 50%;
  width: 18px; height: 18px; margin-top: -9px;
  border-radius: 50%; background: var(--bg);
  border: 1px dashed var(--acc);
}
.ticket::before { left: -10px; clip-path: inset(0 0 0 50%); }
.ticket::after { right: -10px; clip-path: inset(0 50% 0 0); }
.ticket .k { font-size: 9.5px; letter-spacing: .3em; text-transform: uppercase; color: var(--acc); }
.ticket .t-icon { width: 40px; height: 40px; margin: 4px auto 2px; color: var(--acc); }
.ticket b { font-family: var(--fd); font-style: italic; font-weight: 400; font-size: 28px; line-height: 1.15; }
.ticket small { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ticket .t-rule { height: 1px; background: var(--line); margin: 10px 20px 6px; }
.chosen.enter .ticket { animation: ticketIn 1s var(--ease) both; }
.chosen.enter .after { animation: up .8s var(--ease) .5s both; }
@keyframes ticketIn { from { opacity: 0; transform: translateY(24px) scale(.96); } }

/* ---------- Espera ---------- */
.wait-icon { position: relative; width: 150px; height: 150px; display: grid; place-items: center; }
.wait-icon svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.wait-icon .draw { stroke-width: 1; }
.wait-icon span { width: 64px; height: 64px; color: var(--acc); }
.wait-icon span svg { position: static; }
.is-active .wait-icon span { animation: breathe-soft 3.6s ease-in-out 1s infinite; }
@keyframes breathe-soft { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.wait-place { font-family: var(--fs); font-size: 34px; line-height: 1.1; color: var(--acc); text-align: center; margin: 8px 0 0; }

/* ---------- Noche ---------- */
.moon { width: 60px; height: 60px; margin: 0 auto 8px; position: relative; }
.moon::before { content: ""; position: absolute; inset: -22px; border-radius: 50%; background: radial-gradient(circle, rgba(255,236,200,.2), transparent 65%); }
.moon svg { width: 100%; height: 100%; overflow: visible; }
.moon .draw { stroke-width: 1.1; }
.tl { display: grid; margin-top: 26px; }
.tl-i { display: grid; grid-template-columns: 52px 14px 1fr; gap: 10px; align-items: start; padding-bottom: 22px; }
.tl-i:last-child { padding-bottom: 0; }
.tl-i time { font-family: var(--fd); font-size: 18px; color: var(--acc); font-variant-numeric: tabular-nums; line-height: 1.2; }
.tl-d { position: relative; align-self: stretch; }
.tl-d::before { content: ""; position: absolute; top: 6px; left: 3px; width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--acc); background: var(--bg); }
.tl-d::after { content: ""; position: absolute; top: 18px; bottom: -18px; left: 7px; width: 1px; background: var(--line); }
.tl-i:last-child .tl-d::after { display: none; }
.tl-t { display: grid; line-height: 1.3; }
.tl-t b { font-family: var(--fd); font-weight: 400; font-size: 19px; }
.tl-t small { color: var(--muted); font-size: 11.5px; display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.tl-t small svg { width: 13px; height: 13px; color: var(--acc); flex: none; }
.dress { margin-top: 28px; text-align: center; font-size: 9.5px; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------- Candado ---------- */
.lock-glow { position: absolute; top: 90px; left: 50%; width: 260px; height: 260px; margin-left: -130px; border-radius: 50%; background: radial-gradient(circle, rgba(230,200,140,.15), transparent 65%); pointer-events: none; transition: transform 1.2s var(--ease), opacity 1.2s; }
.lock { width: 88px; height: 100px; margin: 10px auto 0; color: var(--acc); position: relative; }
.lock svg { width: 100%; height: 100%; overflow: visible; }
.lock .shk { fill: none; stroke: currentColor; stroke-width: 1.3; transition: transform .9s var(--ease); transform-origin: 62px 44px; transform-box: view-box; }
.lock .body { fill: none; stroke: currentColor; stroke-width: 1.3; }
.lock .kh { fill: currentColor; }
.lock.is-open .shk { transform: translateY(-12px) rotate(-18deg); }
.lock.is-wrong { animation: shake .55s ease; }
.lock.is-open + .lock-burst { opacity: 1; transform: scale(1.3); }
.key-form { margin-top: 30px; display: grid; gap: 4px; }
.key-field {
  width: 100%;
  padding: 12px 8px;
  border: 0; border-bottom: 1px solid var(--acc);
  background: transparent;
  color: var(--ink);
  font-family: var(--fd); font-style: italic; font-size: 26px;
  text-align: center; letter-spacing: .08em;
  border-radius: 0;
  outline: none;
  transition: border-color .3s;
}
.key-field::placeholder { color: var(--muted); opacity: .6; font-size: 20px; letter-spacing: .04em; }
.key-field:focus { border-bottom-color: var(--ink); }
.key-form.is-wrong .key-field { animation: shake .55s ease; }
.err { text-align: center; font-family: var(--fd); font-style: italic; font-size: 16px; color: var(--acc); margin: 10px 0 0; min-height: 1.4em; }
.err.is-shown { animation: up .6s var(--ease) both; }
.hint { text-align: center; font-size: 11px; color: var(--muted); margin: 18px 0 0; }

/* ---------- Se hace de noche ---------- */
.dusk { width: min(100%, 300px); }
.dusk svg { width: 100%; height: auto; overflow: visible; display: block; }
.dusk-glow { fill: #F6C98A; opacity: .28; }
.dusk-sun { fill: #F2C77B; }
.dusk-line { stroke: var(--acc); stroke-width: 1.2; fill: none; stroke-linecap: round; }
.dusk-line.thin { stroke-width: .7; opacity: .55; }
.dusk-moon { fill: none; stroke: var(--acc); stroke-width: 1.3; opacity: 0; }
.dusk-stars { opacity: 0; }
.is-active .dusk-sun { animation: sunset 2.8s cubic-bezier(.55,0,.35,1) .3s both; }
.is-active .dusk-glow { animation: glow-out 1.4s ease .3s both; }
.is-active .dusk-moon { animation: moonrise 1.6s var(--ease) 2s both; }
.is-active .dusk-stars { animation: stars-in 1.4s ease 2.4s both; }
.dusk-stars .spk { animation-duration: 3s; }
@keyframes sunset { 0% { transform: translateY(0); fill: #F2C77B; } 100% { transform: translateY(92px); fill: #D9735A; } }
@keyframes glow-out { 0% { opacity: .28; } 100% { opacity: 0; } }
@keyframes moonrise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes stars-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Carta final ---------- */
.petals { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.petal { position: absolute; top: -30px; animation: fall linear infinite; }
.petal svg { width: 100%; height: 100%; fill: var(--petal); opacity: .85; animation: sway 3s ease-in-out infinite alternate; }
@keyframes fall { from { transform: translateY(0) rotate(0); } to { transform: translateY(110vh) rotate(320deg); } }
@keyframes sway { from { transform: translateX(-12px) rotate(-20deg); } to { transform: translateX(12px) rotate(25deg); } }
.stage-candado .letter-wrap, .stage-candado .letter-actions, .stage-candado > .eyebrow { position: relative; z-index: 1; }
.fin-end { margin: 18px 0 0; text-align: center; font-family: var(--fs); font-size: 46px; line-height: 1.1; color: var(--acc); }
.fin-names { margin: 2px 0 0; text-align: center; font-family: var(--fd); font-style: italic; font-size: 18px; color: var(--muted); }
.fin-names i { color: var(--acc); }

/* ---------- Itinerario (menú) ---------- */
.sheet { position: absolute; inset: 0; z-index: 30; display: flex; align-items: flex-end; visibility: hidden; }
.sheet.is-open { visibility: visible; }
.sheet-bg { position: absolute; inset: 0; background: rgba(30,24,18,.45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); opacity: 0; transition: opacity .5s ease; border: 0; width: 100%; cursor: pointer; }
.sheet.is-open .sheet-bg { opacity: 1; }
.sheet-panel {
  position: relative; width: 100%;
  max-height: 82%;
  overflow-y: auto;
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 26px 26px calc(var(--safe-b) + 26px);
  transform: translateY(100%);
  transition: transform .6s var(--ease);
}
.sheet.is-open .sheet-panel { transform: none; }
.sheet-panel .h { font-size: 32px; margin-top: 6px; }
.sheet-list { list-style: none; margin: 20px 0 0; padding: 0; display: grid; }
.sheet-item {
  display: grid; grid-template-columns: 34px 1fr 20px; align-items: center; gap: 12px;
  width: 100%; padding: 13px 4px;
  background: none; border: 0; border-bottom: 1px solid var(--line);
  text-align: left; cursor: pointer;
}
.sheet-item[disabled] { cursor: default; opacity: .45; }
.sheet-item .n { font-family: var(--fd); font-style: italic; font-size: 18px; color: var(--acc); }
.sheet-item .t { display: grid; line-height: 1.25; }
.sheet-item .t b { font-family: var(--fd); font-weight: 400; font-size: 19px; }
.sheet-item .t small { font-size: 9.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.sheet-item svg { width: 18px; height: 18px; color: var(--acc); }
.sheet-item.is-current .t b { font-style: italic; color: var(--acc); }

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .petals { display: none; }
}
