/* Sopla un Deseo — base: prado de cuento. Marco de teléfono en computadora, botones-flor y botones-semilla, botón Soplar
   (cabeza de diente de león), contador de semillitas, pista, tarjeta de papel de acuarela, "¡cumple!", final y vitrina.
   Todo cuelga de html.sd; por dentro se mide contra el marco (.app es un contenedor: cqw/cqh), nunca contra la ventana. */
.sd {
  --ink: #3F2A58; --ink-2: #5B4476; --papel: #FFF8EE; --papel-2: #FBEBDD; --rosa: #B6246F; --rosa-2: #D64A96; --lila: #8E5FB5; --menta: #2F8F6A; --wa: #1F9F58;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --f-display: "Fuzzy Bubbles", "Quicksand", system-ui, sans-serif; --f-body: "Quicksand", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
.sd *, .sd *::before, .sd *::after { box-sizing: border-box; }
.sd body { margin: 0; font-family: var(--f-body); font-weight: 600; color: var(--ink); overflow: hidden; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
.sd button { font: inherit; color: inherit; }
.sd :focus-visible { outline: 3px solid #6B3AA8; outline-offset: 3px; border-radius: 10px; }
.sd .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sd .noscript { margin: 24px; font: 700 18px/1.5 var(--f-body); color: var(--ink); background: var(--papel); padding: 16px; border-radius: 14px; }

/* ---------- marco ---------- */
.sd .fondo { position: fixed; inset: 0; z-index: 0; pointer-events: none; background: radial-gradient(60% 40% at 50% 62%, #FFF3D8 0%, rgba(255, 243, 216, 0) 70%), linear-gradient(180deg, #A9BCF2 0%, #F4C6E2 52%, #FFE5BD 68%, #C7E5A8 68.2%, #94CC8B 100%); }
.sd .app { position: fixed; inset: 0; z-index: 1; overflow: hidden; isolation: isolate; container-type: size; container-name: marco; background: #FFE5BD; transition: opacity .5s ease; }
@media (min-width: 560px) and (min-height: 560px) {
  .sd .app { inset: auto; left: 50%; top: 50%; width: min(430px, 100vw - 32px); height: min(932px, 100dvh - 40px); transform: translate(-50%, -50%); border-radius: 40px; box-shadow: 0 0 0 5px #FFF8EE, 0 0 0 12px #E8A8CE, 0 30px 80px rgba(70, 40, 90, .35); }
}
.sd:not(.is-showcase) .fondo { filter: blur(6px); }
.sd.is-showcase .fondo { display: none; }
.sd.is-showcase .app { inset: 0 !important; width: auto !important; height: auto !important; transform: none !important; border-radius: 0 !important; box-shadow: none !important; }
.sd .stage { position: absolute; inset: 0; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; outline: none; }
.sd .gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity .7s ease; }
.sd .gl.is-on { opacity: 1; }
.sd .vineta { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(120% 78% at 50% 44%, rgba(0,0,0,0) 62%, rgba(92, 54, 112, .22) 100%), linear-gradient(180deg, rgba(120, 90, 150, .1) 0%, rgba(120, 90, 150, 0) 22%); }
.sd .sin-gl .stage { background: url("../assets/poster/fondo-sopla.webp") center / cover no-repeat, linear-gradient(180deg, #A9BCF2 0%, #F4C6E2 52%, #FFE5BD 68%, #C7E5A8 68.2%); }
.sd .ui { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
.sd .ui > * { pointer-events: auto; }
.sd .ui .pista, .sd .ui .manita, .sd .ui .cumple { pointer-events: none; }

/* ---------- botones-flor y botones-semilla ---------- */
.sd .flor-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px;
  border: 0; border-radius: 30px 26px 32px 24px / 28px 30px 26px 30px; background: linear-gradient(180deg, #C2307E, #A81F6B); color: #fff;
  font: 700 16px/1.15 var(--f-body); text-decoration: none; text-align: center; cursor: pointer; box-shadow: 0 2px 0 rgba(255, 255, 255, .34) inset, 0 3px 12px rgba(120, 30, 90, .32);
  transition: transform .14s ease, box-shadow .14s ease, filter .2s; touch-action: manipulation; user-select: none; -webkit-user-select: none; overflow: hidden;
}
.sd .flor-btn:active { transform: translateY(2px) scale(.985); }
.sd .flor-btn.is-papel { background: #FFF4E2; color: var(--ink); box-shadow: 0 0 0 2px #D9B9E0 inset, 0 3px 10px rgba(120, 80, 150, .2); }
.sd .flor-btn.is-wa { background: linear-gradient(180deg, #24A863, #1A8C4F); color: #fff; }
.sd .flor-btn.is-chica { min-height: 44px; padding: 0 16px; font-size: 15px; }
.sd .flor-btn.is-grande { min-height: 56px; font-size: 18px; border-radius: 30px; }
.sd .flor-btn.is-bloque { display: flex; width: 100%; }
.sd .flor-btn .pi { display: inline-flex; flex: none; }
.sd .semilla { display: inline-grid; place-items: center; width: 50px; height: 50px; border: 0; border-radius: 54% 46% 56% 44% / 50% 54% 46% 50%; background: rgba(255, 248, 238, .94); color: var(--ink); cursor: pointer; box-shadow: 0 0 0 2px rgba(190, 150, 210, .6) inset, 0 3px 10px rgba(90, 50, 110, .22); padding: 0; touch-action: manipulation; }
.sd .semilla:active { transform: scale(.94); }
.sd .enlace { min-height: 44px; padding: 8px 12px; border: 0; background: rgba(255, 248, 238, .86); border-radius: 18px; font: 700 15px var(--f-body); color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------- HUD: semillitas ---------- */
.sd .hud { position: absolute; left: 12px; right: 12px; top: calc(10px + var(--safe-t)); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sd .hud.is-intro { opacity: 0; }
.sd .deseos { display: flex; gap: 4px; margin: 0; padding: 5px 10px; border-radius: 99px; background: rgba(102, 70, 140, .62); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .34); }
.sd .deseos .ds { display: inline-flex; transition: transform .3s; }
.sd .deseos .ds.is-pop { animation: sd-pop .6s cubic-bezier(.3, 1.8, .4, 1); }
@keyframes sd-pop { 0% { transform: scale(.4); } 60% { transform: scale(1.5); } 100% { transform: scale(1); } }

/* ---------- inicio ---------- */
.sd .inicio { position: absolute; left: 0; right: 0; top: calc(70px + var(--safe-t)); display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 0 22px; text-align: center; transition: opacity .4s ease, transform .4s ease; }
.sd .inicio.is-out { opacity: 0; transform: translateY(-14px); pointer-events: none; }
.sd .inicio-letrero { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.sd .inicio-t { margin: 0; font: 700 min(11.2cqw, 46px)/1.08 var(--f-display); color: var(--ink); text-shadow: 0 0 16px rgba(255, 246, 230, .95), 0 0 2px #fff; }
.sd .inicio-sub { margin: 0; max-width: 360px; padding: 9px 16px; border-radius: 18px; font: 700 15.5px/1.32 var(--f-body); color: var(--ink); background: rgba(255, 248, 238, .86); box-shadow: 0 2px 10px rgba(90, 50, 110, .14); }
.sd .inicio-enlaces { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.sd .saltar-intro { position: absolute; right: 14px; bottom: calc(20px + var(--safe-b)); }

/* ---------- controles ---------- */
.sd .controles { position: absolute; left: 10px; right: 10px; bottom: calc(14px + var(--safe-b)); display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 6px; }
.sd .ctl-der { min-width: 0; display: flex; justify-content: flex-end; }
.sd .ctl-datos { max-width: 104px; font-size: 13.5px; line-height: 1.12; padding: 8px 8px; border-radius: 22px; }
.sd .sp-marco { position: relative; display: grid; place-items: center; }
.sd .soplar { position: relative; width: 132px; height: 132px; border: 0; padding: 0 0 12px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 0; background: radial-gradient(circle at 50% 28%, #D64A96 0%, #B6246F 62%, #9E1A60 100%); color: #fff; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; box-shadow: 0 0 0 4px rgba(255, 248, 238, .86), 0 10px 26px rgba(120, 30, 90, .42), inset 0 3px 0 rgba(255, 255, 255, .3); transition: transform .12s ease; }
.sd .soplar.is-soplando { transform: scale(.94); }
.sd .sp-diente { position: absolute; left: 20px; top: 8px; width: 92px; height: 92px; }
.sd .sp-t { position: relative; font: 700 19px/1 var(--f-display); text-shadow: 0 1px 2px rgba(90, 10, 60, .7); }
.sd .sp-anillo { position: absolute; inset: -9px; border-radius: 50%; background: conic-gradient(#FFD65C calc(var(--k, 0) * 360deg), rgba(255, 255, 255, .25) 0); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px)); mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px)); pointer-events: none; }
.sd .soplar .bt-rayo { transform-origin: 50px 50px; transform-box: view-box; }
.sd .soplar.is-soplando .bt-rayo { animation: sd-rayo .55s ease-out infinite; animation-delay: var(--d, 0s); }
@keyframes sd-rayo { 0% { transform: translate(0, 0); opacity: 1; } 80% { opacity: .8; } 100% { transform: translate(calc(cos(var(--a)) * 16px), calc(sin(var(--a)) * 16px)); opacity: 0; } }
.sd .voz { position: relative; justify-self: start; width: 104px; min-height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 8px 6px; border: 0; border-radius: 52% 48% 46% 54% / 50% 58% 42% 50%; background: rgba(255, 248, 238, .95); color: var(--ink); font: 700 13.5px/1.1 var(--f-body); text-align: center; cursor: pointer; box-shadow: 0 0 0 2px rgba(190, 150, 210, .6) inset, 0 4px 12px rgba(90, 50, 110, .24); touch-action: manipulation; }
.sd .voz.is-on { background: linear-gradient(180deg, #E9FBEA, #CFF3D3); }
.sd .vz-ic { display: inline-flex; color: var(--rosa); }
.sd .vz-t { max-width: 90px; }
.sd .vz-medidor { position: absolute; left: 16px; right: 16px; bottom: 7px; height: 4px; border-radius: 9px; background: rgba(120, 80, 150, .22); overflow: hidden; opacity: 0; }
.sd .voz.is-on .vz-medidor { opacity: 1; }
.sd .vz-medidor i { display: block; height: 100%; border-radius: inherit; background: var(--menta); transform-origin: left; transform: scaleX(var(--m, 0)); }

/* la pista, arriba de los controles */
.sd .pista { position: absolute; left: 50%; bottom: calc(172px + var(--safe-b)); transform: translateX(-50%); max-width: 88cqw; padding: 8px 16px; border-radius: 16px; background: rgba(255, 248, 238, .92); color: var(--ink); font: 700 15.5px/1.2 var(--f-body); text-align: center; white-space: nowrap; box-shadow: 0 2px 10px rgba(90, 50, 110, .16); opacity: 0; transition: opacity .25s; }
.sd .pista.is-on { opacity: 1; }
.sd .pista.is-oro { background: #FFF2C4; }
.sd .pista.is-discreta { opacity: .86; font-size: 14px; }
.sd .pista.is-corta { background: #E9FBEA; }
.sd .manita { position: absolute; left: 50%; bottom: calc(30px + var(--safe-b)); margin-left: -8px; width: 58px; height: 58px; opacity: 0; transition: opacity .2s; }
.sd .manita.is-on { opacity: 1; }
.sd .manita.is-on .manita-dedo { display: block; animation: sd-mano 1.5s ease-in-out infinite; transform-origin: 50% 20%; }
.sd .manita.is-on .manita-pulso { position: absolute; left: 4px; top: -2px; width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 248, 238, .5); animation: sd-pulso 1.5s ease-out infinite; }
@keyframes sd-mano { 0%, 100% { transform: translateY(8px) scale(1); } 40%, 75% { transform: translateY(0) scale(.92); } }
@keyframes sd-pulso { 0%, 35% { transform: scale(.3); opacity: 0; } 50% { opacity: .9; } 100% { transform: scale(1.5); opacity: 0; } }

/* aviso del micrófono */
.sd .nota-micro { position: absolute; left: 12px; right: 12px; top: calc(68px + var(--safe-t)); z-index: 12; display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px; border-radius: 20px; background: rgba(255, 248, 238, .97); color: var(--ink); box-shadow: 0 4px 18px rgba(90, 50, 110, .28); animation: sd-entra .3s ease; }
.sd .nota-micro.is-no { background: #FFF2C4; }
.sd .nota-micro strong { display: block; font: 700 16px/1.2 var(--f-body); }
.sd .nota-micro p { margin: 2px 0 0; font: 600 14.5px/1.3 var(--f-body); }
.sd .nm-ic { color: var(--rosa); flex: none; margin-top: 2px; }
.sd .nm-x { width: 44px; height: 44px; margin-left: auto; flex: none; }
@keyframes sd-entra { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ---------- tarjeta de deseo ---------- */
.sd .papel { border: 0 solid transparent; border-image: url("../assets/papel.webp") 72 fill / 42px stretch; }
.sd .tarjeta { position: absolute; left: 6px; right: 6px; bottom: calc(6px + var(--safe-b)); max-height: 66cqh; overflow: auto; padding: 22px 22px 16px; color: var(--ink); transform: translateY(24px) rotate(-.4deg); opacity: 0; transition: transform .38s cubic-bezier(.2, 1.2, .3, 1), opacity .3s; scrollbar-width: thin; }
.sd .tarjeta.is-in { transform: none; opacity: 1; }
.sd .tarjeta.is-out { transform: translateY(26px); opacity: 0; }
.sd .tarjeta > * { position: relative; }
.sd .tj-k { margin: 0 0 3px; font: 700 14px/1.2 var(--f-body); color: var(--ink-2); }
.sd .tj-t { margin: 0 0 8px; font: 700 28px/1.12 var(--f-display); color: var(--ink); outline: none; }
.sd .tj-cuerpo { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.sd .tj-seguir { position: relative; }
.sd .tj-avance { position: absolute; left: 0; bottom: 0; height: 5px; width: 100%; background: #FFE18A; transform-origin: left; transform: scaleX(0); }
.sd .tarjeta.is-auto .tj-avance { animation: sd-avanza var(--auto, 12s) linear forwards; }
@keyframes sd-avanza { to { transform: scaleX(1); } }
.sd .dato { text-align: center; }
.sd .dato-k { margin: 0; font: 700 16px var(--f-body); color: var(--ink-2); text-transform: capitalize; }
.sd .dato-v { margin: 2px 0; font: 700 38px/1.05 var(--f-display); color: var(--rosa); }
.sd .dato-s { margin: 0; font: 700 16px var(--f-body); color: var(--ink-2); }
.sd .gota { margin: 0 auto; padding: 5px 14px; border-radius: 99px; background: color-mix(in srgb, var(--flor, #FF55B8) 18%, #FFF8EE); font: 700 15px var(--f-body); color: var(--ink); }
.sd .acciones { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.sd .acciones .flor-btn { flex: 1 1 42%; }
.sd .programa { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.sd .programa li { display: flex; gap: 10px; align-items: baseline; padding: 4px 8px; border-radius: 12px; background: rgba(255, 255, 255, .55); }
.sd .pg-hora { flex: none; min-width: 66px; font: 700 15px var(--f-body); color: var(--rosa); }
.sd .pg-que { font: 600 15.5px/1.2 var(--f-body); }
.sd .mapita { border-radius: 14px; overflow: hidden; }
.sd .mapita svg { display: block; width: 100%; height: auto; }
.sd .lugar-nombre { margin: 0; font: 700 19px/1.2 var(--f-body); text-align: center; }
.sd .lugar-dir { margin: 0; font: 600 15px/1.3 var(--f-body); text-align: center; color: var(--ink-2); }
.sd .nota { margin: 0; text-align: center; }
.sd .nota p { margin: 0; font: 700 24px/1.25 var(--f-display); color: var(--ink); }
.sd .nota footer { margin-top: 6px; font: 700 16px var(--f-body); color: var(--ink-2); }
.sd .anfitriones { margin: 0; font: 700 34px/1.15 var(--f-display); text-align: center; color: var(--rosa); }
.sd .invita-nota { margin: 0; text-align: center; font: 600 16px/1.3 var(--f-body); }
.sd .con-tarjeta .pista, .sd .con-tarjeta .manita, .sd .con-tarjeta .controles { opacity: 0 !important; pointer-events: none !important; }
.sd .controles { transition: opacity .2s; }

/* ---------- ¡cumple! y final ---------- */
.sd .cumple { position: absolute; left: 0; right: 0; top: 40cqh; padding: 0 22px; text-align: center; animation: sd-entra .5s ease; }
.sd .cumple.is-arriba { top: calc(58px + var(--safe-t)); }
.sd .cumple-k { margin: 0; font: 700 15px/1.2 var(--f-body); color: var(--ink); text-shadow: 0 0 8px #fff; }
.sd .cumple-t { white-space: nowrap; margin: 2px 0 0; font: 700 min(10.8cqw, 44px)/1.05 var(--f-display); color: var(--ink); text-shadow: 0 0 14px rgba(255, 246, 230, .95), 0 0 2px #fff; }
.sd .cumple-s { margin: 4px 0 0; font: 700 16px/1.2 var(--f-body); color: var(--ink); text-shadow: 0 0 8px #fff; }
.sd .saltar { position: absolute; right: 14px; bottom: calc(14px + var(--safe-b)); }
.sd .fin { position: absolute; left: 6px; right: 6px; bottom: calc(6px + var(--safe-b)); padding: 18px 20px 8px; animation: sd-entra .5s ease; max-height: 38cqh; overflow: auto; }
.sd .fin-linea { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0 0 2px; font: 700 15px/1.15 var(--f-body); text-align: center; }
.sd .fin .pi { display: inline-flex; color: var(--rosa); }
.sd .fin .flor-btn .pi { color: #fff; }
.sd .fin-lugar { margin: 0 0 6px; }
.sd .fin-lugar summary { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; cursor: pointer; list-style: none; text-align: center; }
.sd .fin-lugar summary::-webkit-details-marker { display: none; }
.sd .fin-salon { font: 700 16px/1.2 var(--f-body); }
.sd .fin-vermapa { font: 700 14px var(--f-body); color: var(--rosa); text-decoration: underline; text-underline-offset: 3px; }
.sd .fin-enlaces { display: flex; flex-wrap: nowrap; justify-content: center; gap: 0; margin-top: 2px; }
.sd .fin-enlaces .enlace { padding: 6px 8px; font-size: 14px; }
.sd .fin-enlaces .enlace { background: none; }

/* ---------- vitrina ---------- */
.sd .is-vitrina .vineta { opacity: .6; }
.sd .vitrina-t { position: absolute; left: 0; right: 0; top: 6cqh; margin: 0; text-align: center; font: 700 min(9cqw, 64px)/1.05 var(--f-display); color: var(--ink); text-shadow: 0 0 18px rgba(255, 246, 230, .95); }
.sd .vitrina-t small { display: block; font: 700 min(4.5cqw, 26px) var(--f-body); }
.sd .dbg-fps { position: absolute; left: 8px; top: 72px; z-index: 40; margin: 0; padding: 3px 7px; border-radius: 6px; background: rgba(40, 20, 60, .8); color: #fff; font: 600 11px/1.3 monospace; }

@media (prefers-reduced-motion: reduce) {
  .sd .manita.is-on .manita-dedo, .sd .manita.is-on .manita-pulso, .sd .soplar.is-soplando .bt-rayo { animation: none; }
  .sd .tarjeta { transition: opacity .2s; transform: none; }
}
.sd.rm .manita.is-on .manita-dedo, .sd.rm .manita.is-on .manita-pulso, .sd.rm .soplar.is-soplando .bt-rayo { animation: none; }
