/* Misión Estrella — capa HTML sobre la escena: portada, HUD, progreso, tarjetas de capítulo, despegue, visor, avisos. */

/* ---------- Portada ---------- */
.ui > .cover { pointer-events: none; } /* deja tocar a Gloobi en la escena; sólo los controles reciben toques */
.cover button, .cover a { pointer-events: auto; }
.cover { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: calc(var(--sat) + 30px) 20px calc(var(--sab) + 26px); text-align: center; transition: opacity .5s var(--soft); }
.cover.is-out { opacity: 0; pointer-events: none; }
/* entrada de la portada: título → insignia → botón → enlace (fundido y subida de 10 px, 120 ms entre cada uno).
   Mientras la escena no está lista (is-pending) no se ve nada; con movimiento reducido, sólo fundidos. */
.cover.is-pending .ci { opacity: 0; animation: none; }
.cover.is-pending .hold, .cover.is-pending .hand { visibility: hidden; }
.cover.is-intro .ci { animation: ci-in .55s var(--soft) both; animation-delay: calc(var(--i, 0) * 120ms); }
@keyframes ci-in { from { opacity: 0; transform: translateY(10px); } }
.rm .cover.is-intro .ci { animation-name: ci-fade; }
@keyframes ci-fade { from { opacity: 0; } }
.cover-top { display: flex; flex-direction: column; align-items: center; gap: 12px; animation: jitter 90ms steps(2) infinite; }
@keyframes jitter { 0% { transform: translate(calc(var(--shake, 0) * 2px), calc(var(--shake, 0) * -1.5px)); } 100% { transform: translate(calc(var(--shake, 0) * -2px), calc(var(--shake, 0) * 1.5px)); } }
.welcome { margin: 0; padding: 6px 14px; border-radius: 999px; background: rgba(30, 27, 75, .6); font-weight: 600; font-size: 16px; }
.cover-title { margin: 0; font: 600 clamp(40px, 12.5vw, 56px)/1 var(--f-title); color: var(--cream); letter-spacing: .01em; text-shadow: 0 0 28px rgba(var(--theme-rgb), .55), 0 4px 18px rgba(20, 14, 60, .6); animation: title-in 1.1s var(--soft) both; }
@keyframes title-in { from { opacity: 0; transform: translateY(-14px) scale(.96); filter: blur(6px); } }
.badge { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 8px 16px 8px 12px; border-radius: 999px; background: var(--theme-gold); color: var(--ink); font: 600 18px var(--f-title); box-shadow: 0 6px 20px rgba(var(--theme-gold-rgb), .35); animation: title-in 1.1s .2s var(--soft) both; }
.cover-bottom { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.hold-wrap { position: relative; }
.hold { position: relative; width: 116px; height: 116px; padding: 0; border: 0; border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--theme-hi), var(--pink) 60%, var(--theme-lo)); color: var(--on-theme); cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  box-shadow: 0 0 0 8px rgba(var(--theme-rgb), calc(.12 + var(--p, 0) * .25)), 0 0 calc(24px + var(--p, 0) * 50px) rgba(var(--theme-rgb), calc(.35 + var(--p, 0) * .5)), 0 10px 26px rgba(10, 6, 40, .45);
  transform: scale(calc(1 + var(--p, 0) * .06)); transition: transform .12s; animation: breathe 2.6s ease-in-out infinite; }
.hold.is-down { animation: none; }
.hold.nudge { animation: nudge .45s var(--spring); }
@keyframes breathe { 50% { transform: scale(1.04); } }
@keyframes nudge { 30% { transform: scale(.92); } 70% { transform: scale(1.06); } }
.hold-ring { position: absolute; inset: -9px; pointer-events: none; }
.hold-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.hold-track { fill: none; stroke: rgba(255, 247, 236, .22); stroke-width: 5; }
.hold-fill { fill: none; stroke: var(--gold); stroke-width: 6; stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(255, 210, 122, .8)); }
.hold-core { position: relative; display: grid; place-items: center; width: 100%; height: 100%; }
.hold-label { max-width: 250px; margin: 6px 0 0; font: 600 18px/1.25 var(--f-title); text-shadow: 0 2px 10px rgba(20, 14, 60, .7); }
.hand { position: absolute; left: 62%; top: 55%; width: 56px; height: 56px; pointer-events: none; opacity: 0; transition: opacity .4s; }
.hand.is-on { opacity: 1; animation: press 1.6s ease-in-out infinite; }
@keyframes press { 0%, 100% { transform: translate(0, 0); } 30%, 70% { transform: translate(-8px, -10px) scale(.92); } }
@media (max-height: 720px) {
  .cover { padding-top: calc(var(--sat) + 20px); padding-bottom: calc(var(--sab) + 14px); }
  .cover-top { gap: 8px; }
  .cover-title { font-size: clamp(34px, 10.5vw, 46px); }
  .cover-bottom { gap: 6px; }
  .hold { width: 92px; height: 92px; }
  .hold-label { font-size: 16px; margin-top: 2px; }
  .welcome { font-size: 15px; padding: 4px 12px; }
}
.showcase-title { position: absolute; left: 0; right: 0; top: 8%; margin: 0; text-align: center; font: 600 clamp(40px, 8vw, 88px)/1 var(--f-title); color: var(--cream); text-shadow: 0 0 30px rgba(var(--theme-rgb), .55); pointer-events: none; }
.is-showcase .ui > :not(.showcase-title) { display: none; }
.is-showcase .stage { top: 0; left: 0; width: 100vw; height: 100vh; height: 100dvh; transform: none; border-radius: 0; box-shadow: none; cursor: default; } /* vitrina: a todo el iframe */

/* ---------- HUD ---------- */
.hud { position: absolute; top: calc(var(--sat) + 12px); right: 12px; display: flex; gap: 8px; opacity: 0; transform: translateY(-10px); pointer-events: none; transition: opacity .4s, transform .4s var(--soft); }
.hud.is-on { opacity: 1; transform: none; pointer-events: auto; }
.me:not(.q-low) .icon-btn { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }

/* ---------- Progreso: mini constelación ---------- */
/* (los puntos no cambian de aspecto: sólo su separación —la columna ocupa ~62 % del alto, o menos si hay una tarjeta
   a la vista (--progress-max, progress.js fit)— y su área táctil de 44×44) */
.progress { position: absolute; right: 2px; top: calc(var(--sat) + 78px); z-index: 2; height: min(62vh, 62dvh, var(--progress-max, 999px)); min-height: 396px; display: flex; flex-direction: column; justify-content: space-between; opacity: 0; pointer-events: none; transition: opacity .4s, height .4s var(--soft); }
.progress.is-on { opacity: 1; pointer-events: auto; }
.progress-line { position: absolute; left: 50%; top: 22px; bottom: 22px; width: 1px; background: linear-gradient(180deg, rgba(255, 247, 236, 0), rgba(255, 247, 236, .35), rgba(255, 247, 236, 0)); }
.dot { position: relative; width: 44px; height: 44px; padding: 0; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.dot span { position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: rgba(255, 247, 236, .45); transition: transform .3s var(--spring), background .3s, box-shadow .3s; }
.dot.is-past span { background: rgba(255, 210, 122, .7); }
.dot.is-on span { background: var(--theme-hi); transform: scale(1.8); box-shadow: 0 0 10px 3px rgba(var(--theme-rgb), .8); }

/* ---------- Tarjetas de capítulo ---------- */
.cards { position: absolute; left: 12px; right: 12px; bottom: calc(var(--sab) + 12px); height: 0; }
.card { position: absolute; left: 0; right: 0; bottom: 0; max-height: min(56vh, 460px, var(--card-max, 9999px)); overflow-y: auto; scrollbar-width: none; padding: 18px 18px 20px; border-radius: 24px; background: var(--card-bg); border: 1.5px solid var(--card-line); box-shadow: 0 18px 50px rgba(10, 6, 40, .45); color: var(--cream);
  opacity: 0; transform: translateY(18px) scale(.98); pointer-events: none; transition: opacity .45s var(--soft), transform .55s var(--soft); display: flex; flex-direction: column; gap: 12px; }
.card::-webkit-scrollbar { display: none; }
.me:not(.q-low) .card { -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2); }
.q-low .card { background: rgba(30, 27, 75, .9); }
.card.is-on { opacity: 1; transform: none; pointer-events: auto; }
/* --card-max (main.js fitCard): la tarjeta no tapa al astronauta; si su contenido no cabe, se desplaza por dentro y
   el borde inferior se desvanece mientras quede algo por ver */
.card.is-more { -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 34px), transparent); mask-image: linear-gradient(180deg, #000 calc(100% - 34px), transparent); }
@media (max-height: 700px) { .card { padding: 14px 16px 16px; gap: 9px; } .card .btn-lg { min-height: 52px; } }
.kicker { margin: 0; font: 800 12px var(--f-body); letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.big { margin: 0; font: 600 26px/1.18 var(--f-title); }
.big-sm { font-size: 22px; }
.muted { margin: 0; font-size: 16px; line-height: 1.4; color: rgba(255, 247, 236, .78); }
.hint { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; font-size: 16px; color: var(--teal); }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* Fecha y cuenta regresiva */
.date { display: flex; align-items: center; gap: 14px; }
.date-tile { flex: none; width: 70px; overflow: hidden; border-radius: 16px; background: var(--cream); color: var(--ink); text-align: center; box-shadow: 0 6px 16px rgba(10, 6, 40, .3); }
.date-m { display: block; padding: 3px 0; background: var(--pink); font: 600 14px var(--f-title); letter-spacing: .08em; }
.date-d { display: block; padding: 2px 0 4px; font: 600 34px/1.1 var(--f-title); }
.date-day { margin: 0; font: 600 21px/1.15 var(--f-title); }
.date-time { display: flex; align-items: center; gap: 6px; margin: 4px 0 0; font-weight: 800; font-size: 17px; }
.cd { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cd-u { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 6px; border-radius: 14px; background: rgba(255, 247, 236, .1); box-shadow: inset 0 0 0 1px rgba(255, 247, 236, .15); }
.cd-n { font: 600 26px/1 var(--f-title); font-variant-numeric: tabular-nums; color: var(--gold); }
.cd-l { font: 800 11px var(--f-body); letter-spacing: .1em; text-transform: uppercase; opacity: .8; }
.cd-wrap.is-compact .cd-u { padding: 5px 2px 4px; }
.cd-wrap.is-compact .cd-n { font-size: 22px; }
.cd-big { margin: 0 0 8px; padding: 10px; border-radius: 14px; background: var(--gold); color: var(--ink); font: 600 22px var(--f-title); text-align: center; }
.cal-add { display: flex; flex-direction: column; gap: 8px; }
/* capítulo 4: una sola línea con fecha y horario (la cuenta regresiva está en los satélites y la fecha en la Luna) */
.date-line { display: flex; align-items: center; gap: 7px; margin: 0; font: 600 19px/1.3 var(--f-title); white-space: nowrap; }
.date-line svg { flex: none; color: var(--gold); }
.card-4 { gap: 10px; }
/* punto de encuentro: Maps y Waze siempre en un renglón, mitad y mitad */
.card-5 .btn-row { flex-wrap: nowrap; gap: 8px; }
.card-5 .btn-row > .btn { flex: 1 1 0; min-width: 0; padding: 10px 8px; font-size: 16px; }

/* Bloques con ícono */
.info { display: flex; gap: 12px; align-items: flex-start; }
.info-ic { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: rgba(255, 247, 236, .12); color: var(--gold); }
.info-k { margin: 0; font-weight: 800; font-size: 18px; line-height: 1.25; }
.info-v { margin: 2px 0 0; font-size: 16px; line-height: 1.45; }
.info-sm .info-v { opacity: .85; }

/* Plan de vuelo */
.plan { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; position: relative; }
.plan li { display: flex; align-items: center; gap: 12px; padding: 7px 10px; border-radius: 14px; transition: background .3s; }
.plan li.is-on { background: rgba(255, 210, 122, .16); }
.plan-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; background: rgba(255, 247, 236, .3); box-shadow: 0 0 0 4px rgba(255, 247, 236, .08); transition: background .3s, box-shadow .3s; }
.plan li.is-on .plan-dot { background: var(--gold); box-shadow: 0 0 12px 3px rgba(255, 210, 122, .7); }
.plan-time { margin: 0; font: 600 17px var(--f-title); color: var(--teal); }
.plan-title { margin: 0; font-weight: 600; font-size: 17px; }

/* Regalos */
.gifts { display: flex; flex-direction: column; gap: 10px; }
.gift { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 18px; background: rgba(255, 247, 236, .08); }
.gift .grow { flex: 1; min-width: 0; }
.gift-ic { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: rgba(255, 247, 236, .12); color: var(--cream); }
.gift-name { margin: 0; font-weight: 800; font-size: 17px; }
.gift-note { margin: 2px 0 0; font-size: 16px; opacity: .8; }
.gift.is-top { position: relative; overflow: hidden; background: linear-gradient(135deg, #FFE3A3, var(--gold)); color: var(--ink); box-shadow: 0 0 24px rgba(255, 210, 122, .45); }
.gift.is-top .gift-ic { background: #fff; color: #E86A83; }
.gift.is-top .gift-note { opacity: .8; }
.gift.is-tap { cursor: pointer; transition: transform .2s var(--soft), box-shadow .2s var(--soft); }
.gift.is-tap:active { transform: scale(.98); }
.gift.is-hl { animation: gift-hl 1.6s var(--soft); }
@keyframes gift-hl { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 210, 122, 0); } 18% { box-shadow: 0 0 0 3px rgba(255, 210, 122, .95), 0 0 26px rgba(var(--theme-rgb), .6); transform: scale(1.02); } }
.gift.is-top::after { content: ""; position: absolute; top: -40%; left: -60%; width: 40%; height: 180%; transform: rotate(20deg); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .7), transparent); animation: shine 3s ease-in-out infinite; pointer-events: none; }
@keyframes shine { 60%, 100% { left: 130%; } }
.check { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.check li { display: flex; gap: 10px; align-items: flex-start; font-size: 16px; line-height: 1.4; }
.check-ic { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--mint); color: var(--ink); }

/* Tripulación */
.crew-t { margin: 0; font: 600 24px/1.1 var(--f-title); letter-spacing: .02em; }
.crew-done { display: flex; align-items: center; gap: 8px; color: var(--mint); font-size: 21px; }
.deadline { display: inline-flex; align-self: flex-start; align-items: center; gap: 6px; margin: 0; padding: 5px 12px; border-radius: 999px; background: rgba(255, 210, 122, .18); color: var(--gold); font-weight: 800; font-size: 15px; }
.crew-n { margin: 0; font-size: 16px; }
.crew-n b { font: 600 20px var(--f-title); color: var(--gold); }
.card-8 .link, .card-9 .btn-ghost { align-self: center; }

/* Pistas y despegue */
.swipe-hint { position: absolute; left: 50%; bottom: calc(var(--sab) + 26px); white-space: nowrap; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 16px; border-radius: 999px; background: rgba(30, 27, 75, .55); font: 600 17px var(--f-title); transform: translateX(-50%); opacity: 0; pointer-events: none; transition: opacity .5s; }
.swipe-hint.is-on { opacity: 1; }
.swipe-arrow { animation: bob 1.2s ease-in-out infinite; color: var(--gold); }
@keyframes bob { 50% { transform: translateY(5px); } }
.launch-count { position: absolute; left: 0; right: 0; top: 30%; text-align: center; font: 600 120px/1 var(--f-title); color: var(--cream); text-shadow: 0 0 40px rgba(var(--theme-rgb), .9), 0 6px 20px rgba(30, 27, 75, .6); pointer-events: none; opacity: 0; }
.launch-count.is-on { opacity: 1; animation: count-pop .8s var(--spring) both; }
.launch-count.is-go { font-size: clamp(40px, 13vw, 58px); color: var(--gold); }
@keyframes count-pop { from { transform: scale(.4); opacity: 0; } 30% { opacity: 1; } }
.skip { position: absolute; right: 14px; bottom: calc(var(--sab) + 18px); }

/* ---------- Visor de fotos ---------- */
.viewer { position: absolute; inset: 0; z-index: 95; background: rgba(20, 16, 56, calc(.94 - var(--pull, 0) * .5)); animation: fade .25s both; touch-action: pan-x; }
.viewer.is-out { opacity: 0; transition: opacity .22s; }
@keyframes fade { from { opacity: 0; } }
.viewer-track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior: contain; }
.viewer-track::-webkit-scrollbar { display: none; }
.viewer-item { flex: 0 0 100%; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; margin: 0; padding: calc(var(--sat) + 76px) 18px calc(var(--sab) + 34px); }
.viewer-item img { max-width: 100%; max-height: calc(100% - 60px); object-fit: contain; border: 10px solid #FFFDF8; border-bottom-width: 26px; border-radius: 6px; box-shadow: 0 20px 50px rgba(0, 0, 0, .45); }
.viewer-item figcaption { color: var(--cream); font: 600 19px var(--f-title); text-align: center; }
.viewer-count { position: absolute; top: calc(var(--sat) + 26px); left: 0; right: 0; margin: 0; text-align: center; font: 600 19px var(--f-title); pointer-events: none; }
.viewer-close { position: absolute; top: calc(var(--sat) + 14px); right: 14px; z-index: 2; }

/* ---------- Avisos ---------- */
.toast { position: absolute; left: 50%; top: calc(var(--sat) + 70px); z-index: 90; max-width: calc(100% - 32px); padding: 12px 20px; border-radius: 999px; background: var(--cream); color: var(--ink); font: 600 18px var(--f-title); text-align: center; box-shadow: 0 10px 30px rgba(10, 6, 40, .4); transform: translateX(-50%); animation: toast-in .5s var(--spring) both; pointer-events: none; }
.toast.is-out { opacity: 0; transition: opacity .3s; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -14px) scale(.9); } }
.modal { position: absolute; inset: 0; z-index: 98; display: grid; place-items: center; padding: 20px; background: rgba(20, 16, 56, .6); animation: fade .2s both; }
.modal-card { width: 100%; max-width: 340px; padding: 22px 18px 18px; border-radius: 24px; background: var(--cream); color: var(--ink); text-align: center; box-shadow: 0 20px 60px rgba(10, 6, 40, .5); }
.modal-card p { margin: 0 0 16px; font-size: 17px; font-weight: 600; line-height: 1.4; }
.modal-card .demo-ic { font-size: 38px; margin: -4px 0 6px; }

/* ---------- Debug ---------- */
.debug { position: fixed; left: 8px; bottom: 8px; z-index: 1000; width: 270px; max-height: 70vh; overflow: auto; padding: 10px; border-radius: 12px; background: rgba(255, 247, 236, .96); color: var(--ink); font: 600 12px var(--f-body); }
.debug.is-min > :not(.debug-head) { display: none; }
.debug-head { display: flex; justify-content: space-between; align-items: center; font-weight: 800; }
.debug h4 { margin: 8px 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink2); }
.debug-row { display: flex; flex-wrap: wrap; gap: 4px; }
.debug button { min-height: 28px; padding: 3px 8px; border: 1.5px solid var(--ink); border-radius: 8px; background: #fff; color: var(--ink); font: 700 11px var(--f-body); cursor: pointer; }
.debug button.is-on { background: var(--gold); }
.debug-perf { margin-top: 6px; font-family: ui-monospace, Consolas, monospace; font-size: 11px; white-space: pre-line; }
