/* ===== Tokens ===== */
:root {
  --night: #170b0a;
  --night-2: #241210;
  --cocoa: #3a201a;
  --wine: #6e1f2c;
  --wine-2: #8f2c3d;
  --pine: #1d3a2f;
  --pine-2: #2a5241;
  --cream: #f5ede1;
  --cream-2: #ebdfcd;
  --kraft: #c7a47c;
  --kraft-2: #b48c62;
  --gold: #d8b26e;
  --gold-2: #f3dca6;
  --ink: #2b1b17;
  --ink-soft: #6a554d;
  --ok: #4f7d5c;

  --serif: 'Instrument Serif', 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --hand: 'Caveat', 'Bradley Hand', cursive;

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --radius: 18px;
  --gutter: max(16px, env(safe-area-inset-left));

  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100svh;
  font-family: var(--sans);
  color: var(--cream);
  background:
    radial-gradient(120% 70% at 50% -10%, #4a1d1c 0%, transparent 60%),
    radial-gradient(90% 60% at 100% 100%, #1f1512 0%, transparent 70%),
    var(--night);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
img { max-width: 100%; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* grano de papel/película sobre todo */
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 60; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

#snow, #fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#snow { z-index: 0; }
#fx { z-index: 80; }

/* ===== Guirnalda ===== */
.garland { position: fixed; top: 0; left: 0; right: 0; height: 74px; z-index: 5; pointer-events: none; padding-top: env(safe-area-inset-top); }
.garland svg { width: 100%; height: 74px; overflow: visible; }
.bulb { transform-box: fill-box; transform-origin: center top; animation: flicker var(--d, 3s) ease-in-out infinite; animation-delay: var(--dl, 0s); }
@keyframes flicker {
  0%, 100% { opacity: 1; }
  45% { opacity: .55; }
  50% { opacity: .9; }
  70% { opacity: .65; }
}

/* ===== Botones ===== */
.btn {
  border: 0; border-radius: 999px; padding: 14px 22px; font-weight: 600; font-size: 15px; letter-spacing: .01em;
  transition: transform .18s var(--ease-out), box-shadow .3s, background .3s, opacity .3s;
}
.btn:active { transform: scale(.96); }
.btn-gold { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--ink); box-shadow: 0 6px 20px -6px rgba(216, 178, 110, .6), inset 0 1px 0 rgba(255,255,255,.6); }
.btn-wine { background: var(--wine); color: var(--cream); box-shadow: 0 6px 20px -8px rgba(110, 31, 44, .8); }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px rgba(43,27,23,.25); }
.btn[disabled] { opacity: .45; pointer-events: none; }

.eyebrow { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); margin: 0 0 10px; font-weight: 600; }

/* ===== Entrada ===== */
.gate { position: relative; z-index: 10; min-height: 100svh; display: grid; place-items: center; padding: 90px var(--gutter) 40px; }
.envelope {
  position: relative; width: min(420px, 100%); text-align: center; padding: 56px 28px 34px; border-radius: 26px;
  background: linear-gradient(180deg, var(--cream), var(--cream-2)); color: var(--ink);
  box-shadow: 0 40px 80px -30px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.4) inset;
  animation: rise .9s var(--ease-out) both;
}
.envelope::before { /* solapa */
  content: ''; position: absolute; inset: 0 0 auto; height: 84px; border-radius: 26px 26px 0 0;
  background: linear-gradient(162deg, transparent 49.6%, rgba(43,27,23,.07) 50%, transparent 50.6%), linear-gradient(198deg, transparent 49.6%, rgba(43,27,23,.07) 50%, transparent 50.6%);
}
.seal {
  position: absolute; top: -34px; left: 50%; translate: -50% 0; width: 68px; height: 68px; border-radius: 50%;
  display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, var(--wine-2), var(--wine) 60%, #4b1520);
  box-shadow: 0 10px 24px -6px rgba(110,31,44,.7), inset 0 -3px 8px rgba(0,0,0,.3);
  font-family: var(--serif); font-style: italic; font-size: 34px; color: var(--gold-2);
}
.seal::after { content: ''; position: absolute; inset: 6px; border-radius: 50%; border: 1.5px dashed rgba(243,220,166,.35); }
.envelope .eyebrow { color: var(--wine); }
.gate-title { font-family: var(--serif); font-weight: 400; font-size: 48px; line-height: 1; margin: 0 0 14px; }
.gate-title em { color: var(--wine); }
.gate-text { color: var(--ink-soft); line-height: 1.55; margin: 0 0 24px; font-size: 15px; }
.gate-text strong { color: var(--ink); font-weight: 600; }
.date-form { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.date-form input {
  width: 72px; height: 62px; text-align: center; font-family: var(--serif); font-size: 32px; color: var(--ink);
  border: 0; border-radius: 14px; background: #fff; box-shadow: inset 0 0 0 1.5px rgba(43,27,23,.15), 0 2px 0 rgba(43,27,23,.04);
  outline: none; transition: box-shadow .2s;
}
.date-form input:focus { box-shadow: inset 0 0 0 2px var(--wine); }
.date-form input::placeholder { color: rgba(43,27,23,.25); }
.slash { font-family: var(--serif); font-size: 32px; color: rgba(43,27,23,.35); }
.date-form .btn { width: 100%; margin-top: 14px; }
.gate-error { min-height: 20px; margin: 10px 0 -10px; color: var(--wine); font-size: 14px; font-weight: 500; }
.shake { animation: shake .45s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake { 10%, 90% { translate: -1px 0; } 20%, 80% { translate: 3px 0; } 30%, 50%, 70% { translate: -6px 0; } 40%, 60% { translate: 6px 0; } }
.gate.leaving .envelope { animation: leave .7s var(--ease-out) forwards; }
@keyframes leave { to { opacity: 0; transform: translateY(-30px) scale(.94); filter: blur(6px); } }
.gate.leaving .seal { animation: sealpop .5s var(--ease-out) forwards; }
@keyframes sealpop { 40% { transform: scale(1.25) rotate(-8deg); } 100% { transform: scale(.2) rotate(30deg); opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.97); } }

/* ===== App ===== */
.app { position: relative; z-index: 10; padding: calc(84px + env(safe-area-inset-top)) var(--gutter) calc(32px + env(safe-area-inset-bottom)); max-width: 980px; margin: 0 auto; }
.hero { text-align: center; margin-bottom: 30px; }
.hero > * { animation: rise .9s var(--ease-out) both; }
.hero > :nth-child(2) { animation-delay: .08s; }
.hero > :nth-child(3) { animation-delay: .16s; }
.title { margin: 0; line-height: .9; position: relative; display: inline-block; }
.title-word { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: clamp(76px, 22vw, 150px); letter-spacing: -.02em;
  background: linear-gradient(180deg, var(--cream) 30%, var(--gold-2) 75%, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 60px rgba(243,220,166,.15); padding: 0 .08em; }
.for { position: absolute; right: -2px; bottom: -14px; font-family: var(--hand); font-size: clamp(26px, 7vw, 40px); color: var(--gold); transform: rotate(-6deg); font-weight: 500; white-space: nowrap; }
.status { margin: 26px auto 0; font-size: 15px; color: rgba(245,237,225,.72); min-height: 22px; }
.status b { color: var(--gold-2); font-weight: 600; }
.status .count { font-variant-numeric: tabular-nums; }
.preview-badge { display: inline-block; margin: 12px 0 0; font-size: 12px; padding: 6px 12px; border-radius: 99px; background: rgba(216,178,110,.14); color: var(--gold-2); letter-spacing: .02em; }

/* ===== Tablero ===== */
.board {
  display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: minmax(84px, 22vw); grid-auto-flow: dense; gap: 10px;
}
@media (min-width: 720px) {
  .board { grid-template-columns: repeat(6, 1fr); grid-auto-rows: 128px; gap: 14px; }
  .door.dw { grid-column: span 2; }
}

.door {
  position: relative; border: 0; padding: 0; border-radius: var(--radius); background: transparent;
  transform-style: preserve-3d; isolation: isolate;
  animation: doorIn .8s var(--ease-out) both; animation-delay: calc(var(--i) * 28ms + .2s);
}
@keyframes doorIn { from { opacity: 0; transform: translateY(18px) scale(.94); } }
.door:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 3px; }

/* interior (lo que se ve al abrir) */
.door-inner {
  position: absolute; inset: 0; border-radius: var(--radius); overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #3b1d18, #160a09 75%);
  box-shadow: inset 0 0 0 1px rgba(216,178,110,.18), inset 0 10px 30px rgba(0,0,0,.6);
  display: grid; place-items: center; text-align: center; padding: 8px 6px 8px 24%;
}
.door-inner .ic { font-size: clamp(26px, 8vw, 40px); filter: drop-shadow(0 4px 10px rgba(0,0,0,.5)); }
.door-inner .tt { display: block; margin-top: 4px; font-size: 11px; color: rgba(245,237,225,.7); line-height: 1.2; max-width: 14ch; margin-inline: auto; }
.door-inner .n2 { position: absolute; top: 8px; left: 10px; font-family: var(--serif); font-size: 15px; color: var(--gold); opacity: .8; }

/* hoja (la puerta) */
.door-leaf {
  position: absolute; inset: 0; border-radius: var(--radius); overflow: hidden;
  transform-origin: left center; transform: perspective(700px) rotateY(0);
  transition: transform .9s var(--ease-out), box-shadow .9s var(--ease-out), filter .3s;
  box-shadow: 0 10px 24px -14px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.12);
  display: flex; align-items: flex-start; justify-content: flex-start; padding: 10px 12px;
}
.door-leaf::before { /* borde troquelado */
  content: ''; position: absolute; inset: 6px; border-radius: calc(var(--radius) - 6px); border: 1px dashed currentColor; opacity: .28; pointer-events: none;
}
.door-leaf::after { /* tirador */
  content: ''; position: absolute; right: 10px; top: 50%; width: 6px; height: 6px; border-radius: 50%; translate: 0 -50%;
  background: radial-gradient(circle at 35% 35%, var(--gold-2), var(--gold) 60%, #8a6a35); box-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.num { font-family: var(--serif); font-size: clamp(30px, 9vw, 46px); line-height: 1; position: relative; z-index: 1; }
.door.big .num { font-size: clamp(54px, 16vw, 84px); }
.lock { position: absolute; right: 10px; bottom: 9px; width: 14px; height: 14px; opacity: .55; }
.door.big .lock { width: 16px; height: 16px; }

/* temas de puerta */
.t-cream .door-leaf { background: linear-gradient(160deg, #fbf5ec, var(--cream-2)); color: var(--wine); }
.t-cream .door-leaf { background-image: radial-gradient(rgba(110,31,44,.10) 1.1px, transparent 1.3px), linear-gradient(160deg, #fbf5ec, var(--cream-2)); background-size: 12px 12px, 100% 100%; }
.t-wine .door-leaf { background: linear-gradient(160deg, var(--wine-2), var(--wine) 70%); color: var(--gold-2); }
.t-wine .door-leaf { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.045) 0 8px, transparent 8px 16px), linear-gradient(160deg, var(--wine-2), var(--wine) 70%); }
.t-pine .door-leaf { background: linear-gradient(160deg, var(--pine-2), var(--pine)); color: var(--cream); }
.t-pine .door-leaf { background-image:
  repeating-linear-gradient(0deg, rgba(216,178,110,.10) 0 2px, transparent 2px 18px),
  repeating-linear-gradient(90deg, rgba(216,178,110,.10) 0 2px, transparent 2px 18px),
  linear-gradient(160deg, var(--pine-2), var(--pine)); }
.t-kraft .door-leaf { background: linear-gradient(160deg, #d4b48d, var(--kraft-2)); color: var(--ink); }
.t-kraft .door-leaf { background-image: linear-gradient(90deg, transparent 46%, rgba(110,31,44,.85) 46% 54%, transparent 54%), linear-gradient(160deg, #d4b48d, var(--kraft-2)); }
.t-cocoa .door-leaf { background: linear-gradient(160deg, #4d2b22, var(--cocoa)); color: var(--gold-2); }

/* estados */
.door.is-locked .door-leaf { filter: saturate(.75) brightness(.86); }
.door.is-locked:active .door-leaf { transform: perspective(700px) rotateY(-6deg); transition-duration: .2s; }
.door.is-ready .door-leaf { animation: ready 2.6s ease-in-out infinite; }
@keyframes ready { 0%, 100% { transform: perspective(700px) rotateY(0); } 50% { transform: perspective(700px) rotateY(-9deg); } }
.door.is-today::before {
  content: ''; position: absolute; inset: -4px; border-radius: calc(var(--radius) + 4px); z-index: -1;
  background: conic-gradient(from var(--a, 0deg), var(--gold), transparent 30%, var(--gold-2) 50%, transparent 75%, var(--gold));
  animation: spin 4s linear infinite; filter: blur(.5px);
}
.door.is-today::after {
  content: 'HOY'; position: absolute; top: -9px; right: 10px; z-index: 3; font-size: 9px; font-weight: 700; letter-spacing: .16em;
  padding: 4px 7px; border-radius: 99px; background: var(--gold-2); color: var(--ink); box-shadow: 0 4px 12px -4px rgba(216,178,110,.8);
}
@property --a { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
@keyframes spin { to { --a: 360deg; } }
.door.is-open .door-leaf {
  transform: perspective(700px) rotateY(-74deg); box-shadow: 18px 0 30px -8px rgba(0,0,0,.65);
  pointer-events: none; filter: brightness(.82);
}
.door.is-open.is-today::after { content: 'ABIERTA'; }
.door.opening .door-leaf { transition-duration: 1.05s; transition-timing-function: cubic-bezier(.22, 1.2, .36, 1); }
.door.wiggle { animation: wiggle .5s ease; }
@keyframes wiggle { 0%,100% { transform: none; } 25% { transform: rotate(-2.5deg); } 50% { transform: rotate(2deg); } 75% { transform: rotate(-1deg); } }

.foot { text-align: center; margin-top: 46px; color: rgba(245,237,225,.38); font-size: 12px; }
.foot p { margin: 0; font-family: var(--hand); font-size: 18px; }

/* ===== Hoja de casilla abierta ===== */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 720px) { .sheet-wrap { align-items: center; padding: 30px; } }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(12,5,5,.62); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); opacity: 0; transition: opacity .45s var(--ease-out); }
.sheet-wrap.on .sheet-backdrop { opacity: 1; }
.sheet {
  position: relative; width: min(600px, 100%); max-height: calc(100svh - 28px - env(safe-area-inset-top)); overflow: hidden;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #fbf6ee, var(--cream) 30%, var(--cream-2)); color: var(--ink);
  border-radius: 28px 28px 0 0; box-shadow: 0 -20px 60px -10px rgba(0,0,0,.6);
  transform-origin: center bottom; will-change: transform;
}
@media (min-width: 720px) { .sheet { border-radius: 28px; max-height: min(860px, calc(100svh - 60px)); } }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 30px 24px calc(34px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
@media (min-width: 720px) { .sheet-body { padding: 40px 44px 44px; } }
.sheet-grabber { position: absolute; top: 8px; left: 50%; translate: -50% 0; width: 40px; height: 5px; border-radius: 9px; background: rgba(43,27,23,.18); }
@media (min-width: 720px) { .sheet-grabber { display: none; } }
.sheet-close { position: absolute; top: 14px; right: 14px; z-index: 3; width: 38px; height: 38px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(43,27,23,.07); color: var(--ink); transition: background .2s, transform .2s; }
.sheet-close:active { transform: scale(.92); }
.sheet-close:hover { background: rgba(43,27,23,.12); }

.sheet .kicker { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--wine); font-weight: 600; margin: 0 0 10px; display: flex; gap: 10px; align-items: center; }
.sheet .kicker .big-ic { font-size: 22px; letter-spacing: 0; }
.sheet h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(36px, 10vw, 50px); line-height: .98; margin: 0 0 14px; letter-spacing: -.01em; }
.sheet .lead { font-size: 16px; line-height: 1.6; color: var(--ink-soft); margin: 0 0 26px; }
.sheet .stagger > * { animation: rise .7s var(--ease-out) both; }
.sheet .stagger > :nth-child(1) { animation-delay: .12s; }
.sheet .stagger > :nth-child(2) { animation-delay: .2s; }
.sheet .stagger > :nth-child(3) { animation-delay: .28s; }
.sheet .stagger > :nth-child(4) { animation-delay: .36s; }
.sheet .stagger > :nth-child(5) { animation-delay: .44s; }
.sheet .stagger > :nth-child(n+6) { animation-delay: .5s; }
.module { margin-top: 8px; }
.module + .module { margin-top: 26px; }
.hint { font-size: 13px; color: var(--ink-soft); text-align: center; margin: 12px 0 0; }

/* ----- Ticket regalo ----- */
.ticket {
  position: relative; display: grid; grid-template-columns: 74px 1fr; min-height: 150px; color: var(--ink);
  filter: drop-shadow(0 14px 22px rgba(58,32,26,.22));
}
.ticket > * {
  --notch: radial-gradient(circle at 0 50%, transparent 11px, #000 11.5px);
}
.ticket-stub, .ticket-main { position: relative; }
.ticket-stub {
  background: var(--wine); color: var(--gold-2); border-radius: 16px 0 0 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  -webkit-mask: radial-gradient(circle at 100% 0, transparent 10px, #000 10.5px) top / 100% 51% no-repeat, radial-gradient(circle at 100% 100%, transparent 10px, #000 10.5px) bottom / 100% 51% no-repeat;
          mask: radial-gradient(circle at 100% 0, transparent 10px, #000 10.5px) top / 100% 51% no-repeat, radial-gradient(circle at 100% 100%, transparent 10px, #000 10.5px) bottom / 100% 51% no-repeat;
}
.ticket-stub small { font-size: 9px; letter-spacing: .2em; opacity: .75; }
.ticket-stub b { font-family: var(--serif); font-weight: 400; font-size: 38px; line-height: 1; }
.ticket-main {
  background: linear-gradient(160deg, #f2e2c8, #e3caa4); border-radius: 0 16px 16px 0; padding: 18px 18px 16px 22px;
  border-left: 2px dashed rgba(110,31,44,.35);
  -webkit-mask: radial-gradient(circle at 0 0, transparent 10px, #000 10.5px) top / 100% 51% no-repeat, radial-gradient(circle at 0 100%, transparent 10px, #000 10.5px) bottom / 100% 51% no-repeat;
          mask: radial-gradient(circle at 0 0, transparent 10px, #000 10.5px) top / 100% 51% no-repeat, radial-gradient(circle at 0 100%, transparent 10px, #000 10.5px) bottom / 100% 51% no-repeat;
  overflow: hidden;
}
.ticket-main .lbl { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--wine); font-weight: 600; margin: 0 0 8px; }
.ticket-main .riddle { font-family: var(--serif); font-style: italic; font-size: 21px; line-height: 1.3; margin: 0 0 14px; white-space: pre-line; }
.ticket-main .btn { padding: 10px 16px; font-size: 13px; }
.stamp {
  position: absolute; right: 14px; bottom: 14px; padding: 6px 12px; border: 3px solid var(--wine); color: var(--wine); border-radius: 8px;
  font-weight: 800; letter-spacing: .14em; font-size: 15px; transform: rotate(-12deg); opacity: .85;
  mix-blend-mode: multiply; animation: stamp .45s var(--ease-spring) both;
}
@keyframes stamp { from { transform: rotate(-12deg) scale(2.4); opacity: 0; } 60% { opacity: .9; } }
.ticket-note { font-size: 13px; color: var(--ink-soft); margin: 12px 2px 0; text-align: center; }

/* ----- Quiz ----- */
.quiz-photo { position: relative; aspect-ratio: 4 / 5; max-height: 52svh; width: 100%; border-radius: 20px; overflow: hidden; background: #ddd; box-shadow: 0 18px 30px -18px rgba(0,0,0,.5); }
.quiz-photo img { width: 100%; height: 100%; object-fit: cover; animation: photoIn .7s var(--ease-out) both; }
@keyframes photoIn { from { opacity: 0; transform: scale(1.06); filter: blur(8px); } }
.quiz-step { position: absolute; top: 12px; left: 12px; font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 99px; background: rgba(255,255,255,.85); backdrop-filter: blur(6px); color: var(--ink); }
.quiz-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.opt { border: 0; padding: 14px 12px; border-radius: 14px; background: #fff; box-shadow: inset 0 0 0 1.5px rgba(43,27,23,.1); font-weight: 500; font-size: 14px; color: var(--ink); transition: transform .15s, background .3s, color .3s, box-shadow .3s; }
.opt:active { transform: scale(.97); }
.opt.right { background: var(--ok); color: #fff; box-shadow: none; }
.opt.wrong { background: var(--wine); color: #fff; box-shadow: none; animation: shake .4s; }
.opt[disabled] { pointer-events: none; }
.quiz-note { margin: 14px 0 0; font-family: var(--hand); font-size: 23px; line-height: 1.2; color: var(--wine); text-align: center; animation: rise .5s var(--ease-out) both; }
.quiz-foot { display: flex; justify-content: center; margin-top: 14px; }
.score { text-align: center; padding: 26px 10px; }
.score b { display: block; font-family: var(--serif); font-size: 76px; line-height: 1; color: var(--wine); font-weight: 400; }

/* ----- Memory ----- */
.mem-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; perspective: 800px; }
.card { position: relative; aspect-ratio: 3 / 4; border: 0; padding: 0; background: none; transform-style: preserve-3d; transition: transform .55s var(--ease-out); }
.card.up, .card.done { transform: rotateY(180deg); }
.card .face { position: absolute; inset: 0; border-radius: 12px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.card .back { background: radial-gradient(circle at 50% 50%, var(--wine-2), var(--wine)); display: grid; place-items: center; color: var(--gold-2); font-size: 22px; box-shadow: inset 0 0 0 3px rgba(243,220,166,.25); }
.card .back::before { content: ''; position: absolute; inset: 6px; border-radius: 8px; border: 1px solid rgba(243,220,166,.25); }
.card .front { transform: rotateY(180deg); background: #ccc; }
.card .front img { width: 100%; height: 100%; object-fit: cover; }
.card.done .front { box-shadow: 0 0 0 3px var(--gold); }
.card.done { animation: pop .5s var(--ease-spring); }
@keyframes pop { 50% { transform: rotateY(180deg) scale(1.08); } }
.mem-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 13px; color: var(--ink-soft); }
.mem-bar b { color: var(--ink); }

/* ----- Timeline ----- */
.tl { display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 12px 24px 26px; margin: 0 -24px; scrollbar-width: none; }
.tl::-webkit-scrollbar { display: none; }
@media (min-width: 720px) { .tl { margin: 0 -44px; padding-inline: 44px; } }
.pola { flex: 0 0 72%; max-width: 300px; scroll-snap-align: center; background: #fff; padding: 10px 10px 16px; border-radius: 6px; box-shadow: 0 16px 30px -16px rgba(0,0,0,.45); transform: rotate(var(--r, -1.5deg)); }
.pola:nth-child(even) { --r: 1.8deg; }
.pola .ph { aspect-ratio: 4 / 5; overflow: hidden; border-radius: 2px; background: #eee; }
.pola img { width: 100%; height: 100%; object-fit: cover; }
.pola .d { font-family: var(--hand); font-size: 26px; color: var(--wine); margin: 8px 4px 0; line-height: 1; }
.pola .c { font-size: 13px; color: var(--ink-soft); margin: 4px 4px 0; line-height: 1.4; }
.tl-dots { display: flex; justify-content: center; gap: 6px; }
.tl-dots i { width: 6px; height: 6px; border-radius: 9px; background: rgba(43,27,23,.18); transition: width .3s var(--ease-out), background .3s; }
.tl-dots i.on { width: 20px; background: var(--wine); }

/* ----- Puzzle ----- */
.pz { position: relative; width: 100%; max-width: 380px; margin: 0 auto; aspect-ratio: 1; border-radius: 16px; overflow: hidden; background: var(--cocoa); box-shadow: 0 18px 30px -18px rgba(0,0,0,.6); touch-action: none; }
.tile { position: absolute; width: calc(100% / 3); height: calc(100% / 3); border: 0; padding: 0; background-size: 300% 300%; transition: transform .22s var(--ease-out); box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }
.pz.solved .tile { box-shadow: none; transition: transform .22s, box-shadow .6s; }
.pz-full { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; transition: opacity .6s; pointer-events: none; }
.pz.peek .pz-full, .pz.solved .pz-full { opacity: 1; }
.pz-bar { display: flex; justify-content: center; gap: 8px; margin-top: 14px; }

/* ----- Rasca ----- */
.scratch { position: relative; border-radius: 20px; overflow: hidden; aspect-ratio: 1.55; max-width: 440px; margin: 0 auto; box-shadow: 0 18px 30px -18px rgba(0,0,0,.5); touch-action: none; }
.scratch .prize { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px;
  background: radial-gradient(circle at 50% 30%, #fff8ea, #f1dfbf); }
.scratch .prize .p1 { font-family: var(--serif); font-size: clamp(24px, 6.4vw, 32px); line-height: 1.08; color: var(--wine); margin: 6px 0 8px; }
.scratch .prize .p2 { font-size: 13px; color: var(--ink-soft); line-height: 1.45; max-width: 32ch; margin: 0; }
.scratch .prize .p0 { font-size: 34px; }
.scratch canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; transition: opacity .6s; }
.scratch.done canvas { opacity: 0; pointer-events: none; }

/* décimo */
.decimo { position: relative; border-radius: 14px; overflow: hidden; background: linear-gradient(160deg, #f8efdc, #ecd9b7); padding: 18px 18px 16px; box-shadow: 0 18px 30px -18px rgba(0,0,0,.5); }
.decimo::before { content: ''; position: absolute; inset: 0; background: repeating-radial-gradient(circle at 80% 20%, rgba(110,31,44,.05) 0 2px, transparent 2px 12px); pointer-events: none; }
.decimo-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--wine); font-weight: 700; }
.decimo-num { font-family: var(--serif); font-size: clamp(56px, 18vw, 82px); letter-spacing: .06em; line-height: 1; color: var(--ink); margin: 10px 0 2px; text-align: center; }
.decimo-sub { text-align: center; font-size: 11px; color: var(--ink-soft); letter-spacing: .1em; margin-bottom: 14px; }
.decimo .scratch { aspect-ratio: 2.4; border-radius: 12px; box-shadow: inset 0 0 0 1px rgba(110,31,44,.2); }

/* ----- Misterio ----- */
.case { background: #fff; border-radius: 16px; padding: 18px; box-shadow: inset 0 0 0 1.5px rgba(43,27,23,.08); }
.case p { margin: 0; line-height: 1.55; }
.suspects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 0; }
.suspect { border: 0; border-radius: 14px; padding: 14px 8px; background: var(--cream-2); color: var(--ink); text-align: center; transition: transform .15s, background .3s, box-shadow .3s; }
.suspect .face { font-size: 30px; display: block; }
.suspect .nm { display: block; font-weight: 600; font-size: 13px; margin-top: 4px; }
.suspect.sel { background: var(--wine); color: var(--cream); }
.suspect.guilty { background: var(--wine); color: var(--cream); box-shadow: 0 0 0 3px var(--gold); }
.suspect.cleared { opacity: .35; }
.alibi { font-size: 13px; color: var(--ink-soft); margin: 10px 2px 0; min-height: 20px; font-style: italic; }
.clues { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.clues li { background: #fff7e8; border-left: 3px solid var(--gold); padding: 12px 14px; border-radius: 4px 12px 12px 4px; font-size: 14px; line-height: 1.45; animation: rise .5s var(--ease-out) both; }
.verdict { font-family: var(--hand); font-size: 25px; line-height: 1.2; color: var(--wine); text-align: center; margin: 16px 0 0; animation: rise .5s var(--ease-out) both; }

/* ----- Canción ----- */
.song iframe { width: 100%; height: 352px; border: 0; border-radius: 16px; }
.song .empty { text-align: center; padding: 30px 16px; background: #fff; border-radius: 16px; color: var(--ink-soft); }

/* ----- Final ----- */
.slides { position: relative; aspect-ratio: 4 / 5; max-height: 56svh; width: 100%; border-radius: 20px; overflow: hidden; background: var(--night); box-shadow: 0 18px 30px -18px rgba(0,0,0,.6); }
.slides img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.12); transition: opacity 1.4s ease, transform 6s linear; }
.slides img.on { opacity: 1; transform: scale(1); }
.slides .bar { position: absolute; left: 12px; right: 12px; top: 12px; display: flex; gap: 4px; z-index: 2; }
.slides .bar i { flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,.35); overflow: hidden; }
.slides .bar i::after { content: ''; display: block; height: 100%; width: 0; background: #fff; }
.slides .bar i.past::after { width: 100%; }
.slides .bar i.now::after { animation: fill var(--dur, 3.6s) linear forwards; }
@keyframes fill { to { width: 100%; } }
.letter { position: relative; background: #fffaf1; padding: 26px 22px 24px; border-radius: 6px; box-shadow: 0 16px 30px -18px rgba(0,0,0,.4); font-family: var(--hand); font-size: 23px; line-height: 32px; color: #3a2420; white-space: pre-line;
  background-image: repeating-linear-gradient(180deg, transparent 0 31px, rgba(110,31,44,.10) 31px 32px); background-position: 0 25px; }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 90; translate: -50% 20px; opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 99px; font-size: 14px; font-weight: 500; text-align: center;
  background: rgba(245,237,225,.95); color: var(--ink); box-shadow: 0 12px 30px -10px rgba(0,0,0,.6);
  transition: opacity .3s, translate .45s var(--ease-spring);
}
.toast.on { opacity: 1; translate: -50% 0; }

/* ===== Accesibilidad: menos movimiento ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
