/* ---------- Tokens ---------- */
:root {
  --t-obvia: #8b9099;
  --t-comun: #2f6fe0;
  --t-poco: #1f9d55;
  --t-rara: #8b3fd9;
  --t-dificil: #e0a100;

  --display: "Arial Black", "Segoe UI Black", Impact, system-ui, sans-serif;
  --radius: 14px;
}

/* Nave: espacio profundo */
.theme-space {
  --bg: #060a1d;
  --surface: rgba(16, 23, 56, 0.92);
  --surface-2: #18214a;
  --text: #eef1ff;
  --text-soft: #a3acd8;
  --line: rgba(163, 172, 216, 0.2);
  --border: #2d3a78;
  --hard: #02040d;
  --accent: #ff6a3d;
  --accent-dark: #f0521f;
  --amber: #ffb020;
  --bad: #ff6b7a;
  --good: #3ddc84;
  --warn: #ffc857;
  --hi: rgba(255, 200, 87, 0.1);
  --hi-strong: rgba(255, 200, 87, 0.35);
  --soft-bg: rgba(255, 255, 255, 0.07);
  --focus: #5ad1ff;
  --input-off: #121a3d;
  --empty: #3a4680;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  --tt-obvia: #b7bcc6;
  --tt-comun: #6ea2ff;
  --tt-poco: #3ddc84;
  --tt-rara: #b58cff;
  --tt-dificil: #ffd24a;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  padding: 0 14px 48px;
}
.theme-space {
  background:
    radial-gradient(1px 1px at 12% 18%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 72% 8%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1.5px 1.5px at 88% 42%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 30% 66%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 55% 88%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(ellipse at 50% -10%, #1e2a6e 0%, transparent 60%),
    radial-gradient(ellipse at 100% 100%, rgba(120, 50, 160, 0.25), transparent 50%),
    var(--bg);
  background-size: 340px 340px, 340px 340px, 340px 340px, 340px 340px, 340px 340px, auto, auto, auto;
  background-attachment: fixed;
}

h1, h2, h3 { margin: 0 0 8px; line-height: 1.15; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1rem; margin-top: 18px; }
p { margin: 0 0 12px; line-height: 1.45; }
kbd {
  font: 700 0.75rem/1 ui-monospace, Consolas, monospace;
  border: 1.5px solid var(--text);
  border-bottom-width: 3px;
  border-radius: 5px;
  padding: 2px 5px;
  background: var(--surface-2);
}

/* ---------- Niveles de rareza ---------- */
.tier-obvia { --tc: var(--t-obvia); }
.tier-comun { --tc: var(--t-comun); }
.tier-poco { --tc: var(--t-poco); }
.tier-rara { --tc: var(--t-rara); }
.tier-dificil { --tc: var(--t-dificil); }

.chip, .sd.done { background-color: var(--tc); }

.chip.tier-dificil, .sd.tier-dificil {
  background-image: linear-gradient(115deg, #f7c948, #e0a100 30%, #fff2b3 45%, #e0a100 60%, #f0b429);
  background-size: 250% 100%;
  animation: holo 2.8s linear infinite;
  color: #221b14;
}

.tier-text-obvia { color: var(--tt-obvia) !important; }
.tier-text-comun { color: var(--tt-comun) !important; }
.tier-text-poco { color: var(--tt-poco) !important; }
.tier-text-rara { color: var(--tt-rara) !important; }
.tier-text-dificil { color: var(--tt-dificil) !important; }

/* ---------- Cabecera ---------- */
/* Logo al medio aunque a la derecha haya dos botones y a la izquierda uno. */
.top {
  max-width: 560px;
  margin: 0 auto;
  padding-top: 18px;
  display: grid;
  --side: 88px; /* lo que ocupan los dos botones de la derecha; la izquierda reserva lo mismo */
  grid-template-columns: minmax(var(--side), 1fr) auto minmax(var(--side), 1fr);
  align-items: center;
  gap: 8px;
}
.top > :first-child { justify-self: start; }
.top-actions { justify-self: end; display: flex; gap: 8px; }
.logo {
  font-family: var(--display);
  font-size: 2rem;
  letter-spacing: 0.04em;
  margin: 0;
  color: var(--surface);
  background: var(--accent);
  padding: 4px 16px 6px;
  border-radius: 10px;
  transform: rotate(-2deg);
  box-shadow: 3px 3px 0 var(--hard);
}
.logo span { color: var(--t-dificil); }
.theme-space .logo {
  color: #fff;
  background: linear-gradient(135deg, #ff7a3d, #ff3d7f);
  box-shadow: 0 8px 28px rgba(255, 80, 90, 0.4);
}
.theme-space .logo span { color: #ffd24a; }
.tagline {
  text-align: center;
  color: var(--text-soft);
  font-style: italic;
  margin: 10px 0 18px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  color: var(--text);
  box-shadow: 0 2px 0 var(--hard);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: translateY(2px); box-shadow: none; }
.theme-space .icon-btn { border-width: 1px; box-shadow: none; background: var(--surface-2); }
.theme-space .icon-btn:hover { background: #222c5c; }

/* ---------- Generales ---------- */
main { max-width: 560px; margin: 0 auto; }
.center { text-align: center; }
.kicker {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 6px;
}
.small { font-size: 0.85rem; color: var(--text-soft); }
.streak { margin: 12px 0 0; font-weight: 800; text-align: center; }

/* ---------- Botones ---------- */
.btn {
  font: inherit;
  font-weight: 800;
  border-radius: 999px;
  border: 2px solid var(--border);
  padding: 10px 18px;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s, background 0.15s, filter 0.15s;
}
.btn:active { transform: translateY(2px); box-shadow: none !important; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 3px 0 var(--hard); }
.btn.primary:hover { background: var(--accent-dark); }
.btn.ghost { background: transparent; color: var(--text); }
.btn.ghost:hover { background: var(--soft-bg); }
.btn.big { width: 100%; padding: 14px; font-size: 1.1rem; margin: 6px 0 10px; }
.btn:focus-visible, .sug:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.row .btn { flex: 1; margin: 0; }
.theme-space .btn.primary {
  border-color: transparent;
  background: linear-gradient(180deg, #ff8a4c, #ff5a2a);
  box-shadow: 0 8px 22px rgba(255, 106, 61, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.theme-space .btn.primary:hover { filter: brightness(1.08); }
.theme-space .btn.ghost { border-width: 1px; }

/* ---------- Leyenda ---------- */
.legend { list-style: none; padding: 0; margin: 8px 0; }
.legend li {
  display: grid;
  grid-template-columns: 7.5rem 4.6rem 1fr;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}
.legend li:last-child { border-bottom: 0; }
.legend-pts { font-weight: 800; font-variant-numeric: tabular-nums; }
.legend-blurb { font-size: 0.85rem; color: var(--text-soft); }

.chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
  text-align: center;
}
.theme-space .chip { border-color: rgba(0, 0, 0, 0.25); }
.chip.none { background: var(--soft-bg); color: var(--text-soft); border-color: var(--line); }

/* ---------- Reloj y respuesta ---------- */
.answer { display: flex; gap: 8px; }
.answer input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 16px; /* evita zoom en iOS */
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  outline: none;
}
.answer input::placeholder { color: var(--text-soft); }
.answer input:focus { box-shadow: 0 0 0 3px rgba(211, 63, 42, 0.25); }
.answer input:disabled { background: var(--input-off); }
.theme-space .answer input { border: 1px solid #3a4a94; }
.theme-space .answer input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 106, 61, 0.25); }
.shake { animation: shake 0.35s; }

.suggest {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--hi);
  animation: pop 0.18s ease-out;
}
.theme-space .suggest { border: 1px dashed var(--warn); }
.suggest[hidden] { display: none; }
.sug-q { font-weight: 800; }
.sug {
  font: inherit;
  font-weight: 800;
  border: 2px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--hard);
}
.theme-space .sug { border: 1px solid var(--warn); box-shadow: none; }
.sug:hover { background: var(--hi-strong); }
.sug:active { transform: translateY(2px); box-shadow: none; }
.sug-hint { flex-basis: 100%; text-align: center; font-size: 0.8rem; color: var(--text-soft); }

.feedback { min-height: 1.5em; margin: 10px 0 4px; text-align: center; font-weight: 800; }
.feedback.bad { color: var(--bad); }
.feedback.warn { color: var(--warn); }
.feedback.good { color: var(--good); }

.misses { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-bottom: 8px; }
.miss {
  font-size: 0.8rem;
  text-decoration: line-through;
  color: var(--text-soft);
  background: var(--soft-bg);
  border-radius: 999px;
  padding: 2px 10px;
}

.cat-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.cat-text { min-width: 0; }
.cat-text .kicker { margin-bottom: 2px; }
.cat-head h2 { margin-bottom: 2px; }
.cat-head p { margin: 0; }
.cat-emoji {
  font-size: 2.2rem;
  width: 56px;
  height: 56px;
  flex: none;
  display: grid;
  place-items: center;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: 2px 2px 0 var(--hard);
}
.theme-space .cat-emoji { border-width: 1px; box-shadow: none; border-radius: 14px; }
.cat-score {
  margin-left: auto;
  flex: none;
  text-align: right;
  font-family: var(--display);
  font-size: 1.6rem;
  color: var(--accent);
  line-height: 1;
}
.cat-score small { display: block; font-size: 0.65rem; color: var(--text-soft); letter-spacing: 0.08em; text-transform: uppercase; }

/* Festejo de La Difícil */
.stamp {
  position: absolute;
  top: 42%;
  left: 50%;
  z-index: 5;
  font: 2.1rem var(--display);
  color: #d33f2a;
  border: 4px solid #d33f2a;
  border-radius: 10px;
  padding: 4px 14px;
  background: rgba(255, 255, 255, 0.92);
  white-space: nowrap;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(-12deg);
  animation: stamp 1.4s forwards;
}
.confetti { position: fixed; width: 0; height: 0; z-index: 50; pointer-events: none; }
.confetti i {
  position: absolute;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  animation: burst 1.1s cubic-bezier(0.15, 0.7, 0.3, 1) forwards;
}

/* ---------- Revelación (compartido) ---------- */
.hard p { margin-bottom: 8px; }
.hard-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.chip-outline {
  border: 2px solid var(--t-dificil);
  background: var(--hi);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.85rem;
  font-weight: 700;
}
.all { border-top: 1px dashed var(--line); padding-top: 10px; }
.all summary { cursor: pointer; font-weight: 800; }
.all-tier { margin-top: 12px; }
.all-tier p { margin: 6px 0 0; font-size: 0.9rem; color: var(--text-soft); }
mark { background: var(--hi-strong); color: var(--text); padding: 0 3px; border-radius: 3px; font-weight: 700; }
s { color: var(--text-soft); }

.meter {
  height: 12px;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  margin: 0 auto 6px;
  max-width: 320px;
}
.theme-space .meter { border-width: 1px; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--t-comun), var(--t-rara), var(--t-dificil)); }
.countdown { margin: 14px 0 0; }

/* =========================================================
   Modo nave
   ========================================================= */
/* La escena ocupa toda la pantalla y la interfaz flota encima.
   --ship-top es la altura en pantalla de la base de la nave; cambia según la pantalla y la cámara se mueve sola. */
.top { position: relative; z-index: 3; }
main { position: relative; z-index: 2; }
.theme-space .tagline { display: none; }
.flight {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 0%, #1f2a55, transparent 70%), linear-gradient(#141b38, #070a18);
  isolation: isolate;
  --ship-top: 62%;
}
.flight.at-home { --ship-top: min(66%, calc(100% - 215px)); }
.flight.at-play { --ship-top: max(430px, 60%); }
.flight.at-results { --ship-top: 30%; }
/* En la portada el cielo es fondo: sin carteles detrás del título ni altímetro en 0 m. */
.lm-label { transition: opacity 0.4s; }
.at-home .lm-label, .flight.grounded .alt-tag { opacity: 0; }
.theme-space mark { background: #ffd24a; color: #1a1300; }
.sky, .world {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% - var(--ship-top) - 70px);
  will-change: transform;
  transition: bottom 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Capas lejanas: se mueven más lento que el paisaje y dan profundidad. Miden 400 px de más
   porque se desplazan en ciclos de 400 px. */
.par {
  position: absolute;
  left: 0;
  right: 0;
  top: -400px;
  bottom: 0;
  pointer-events: none;
  opacity: 0;
  will-change: transform;
}
.par-far {
  background-image:
    radial-gradient(1px 1px at 30px 40px, rgba(255, 255, 255, 0.75), transparent),
    radial-gradient(1px 1px at 140px 120px, rgba(200, 215, 255, 0.7), transparent),
    radial-gradient(1px 1px at 260px 60px, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1.5px 1.5px at 330px 250px, rgba(255, 240, 220, 0.8), transparent),
    radial-gradient(1px 1px at 90px 300px, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 210px 360px, rgba(190, 210, 255, 0.65), transparent);
  background-size: 400px 400px;
}
.par-glow {
  background-image:
    radial-gradient(ellipse 220px 140px at 20% 30%, rgba(120, 80, 220, 0.16), transparent 70%),
    radial-gradient(ellipse 260px 160px at 80% 80%, rgba(60, 120, 230, 0.13), transparent 70%);
  background-size: 100% 400px;
}

/* Altímetro en el borde izquierdo, dentro del paisaje */
.ruler { position: absolute; left: 0; top: 0; bottom: 0; width: 40px; pointer-events: none; }
.tick { position: absolute; left: 0; width: 7px; height: 1px; background: rgba(255, 255, 255, 0.35); }
.tick.major { width: 13px; background: rgba(255, 255, 255, 0.6); }
.tick small {
  position: absolute;
  left: 16px;
  top: -6px;
  font-size: 0.6rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.65);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Vida ambiente que cruza la pantalla */
.amb-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.amb { position: absolute; left: 0; top: 0; font-size: 18px; line-height: 1; will-change: transform; }
.amb-sat { font-size: 16px; opacity: 0.8; }
.amb-comet { font-size: 24px; }
.amb-star {
  width: 70px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.95));
  transform-origin: right center;
}

/* Partículas, viñeteado y destello */
.fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(ellipse 75% 65% at 50% 55%, transparent 45%, rgba(2, 3, 14, 0.85));
  opacity: 0.15;
}
.flash { position: absolute; inset: 0; pointer-events: none; z-index: 1; opacity: 0; }

/* Las nubes derivan despacio de un lado a otro */
.cloud { animation: cloud-drift 30s ease-in-out infinite alternate; }

.stars {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 20px 30px, #fff, transparent),
    radial-gradient(1px 1px at 90px 80px, #fff, transparent),
    radial-gradient(1px 1px at 150px 20px, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1.5px 1.5px at 60px 140px, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(1px 1px at 180px 120px, #fff, transparent),
    radial-gradient(2px 2px at 120px 170px, rgba(200, 220, 255, 0.9), transparent),
    radial-gradient(1px 1px at 40px 90px, rgba(255, 255, 255, 0.6), transparent);
  background-size: 200px 190px;
  -webkit-mask-image: linear-gradient(to top, transparent, #000 300px);
  mask-image: linear-gradient(to top, transparent, #000 300px);
  animation: twinkle 4s ease-in-out infinite alternate;
}

.cloud {
  position: absolute;
  height: 26px;
  margin-left: -45px;
  border-radius: 30px;
  background: #fff;
  transform: translateY(50%);
}
.cloud::before, .cloud::after {
  content: "";
  position: absolute;
  background: #fff;
  border-radius: 50%;
}
.cloud::before { width: 44%; height: 170%; left: 14%; bottom: 20%; }
.cloud::after { width: 34%; height: 130%; right: 14%; bottom: 25%; }

.city { position: absolute; left: 50%; transform: translateX(-50%); line-height: 0; }
.city-fill { position: absolute; left: 0; right: 0; height: 70px; background-repeat: repeat-x; background-position: bottom center; opacity: 0.9; }
.skyline { display: block; }
.ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(255, 215, 106, 0.35) 22px 24px, transparent 24px 61px),
    linear-gradient(#141b38 0 4px, #1c2647 4px, #0b1026);
  background-size: 100% 3px, auto;
  background-repeat: no-repeat;
  background-position: 0 10px, 0 0;
}
/* La tierra sigue hacia abajo con el mismo color: sin esto, el borde del piso con el fondo de la escena
   se veía como una raya que titilaba con la respiración de la cámara. */
.ground::after { content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 100vh; background: #0b1026; }

/* Lugares del camino: un ancla de 0 × 0 en su altura, con el dibujo centrado y el cartel debajo */
.lm { position: absolute; width: 0; height: 0; }
.lm.side-l { left: calc(50% - min(28vw, 240px)); }
.lm.side-r { left: calc(50% + min(28vw, 240px)); }
.art {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--sz);
  height: var(--sz);
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  line-height: 1;
}
.lm-label {
  position: absolute;
  top: calc(var(--sz, 0px) / 2 + 4px);
  white-space: nowrap;
  font-size: 0.68rem;
  font-weight: 800;
  color: #fff;
  background: rgba(6, 10, 29, 0.62);
  padding: 2px 8px;
  border-radius: 999px;
}
.lm-label small { font-weight: 600; opacity: 0.75; margin-left: 5px; font-size: inherit; }
.side-l .lm-label { left: calc(var(--sz) / -2); }
.side-r .lm-label { right: calc(var(--sz) / -2); }
.lm-obelisco { left: calc(50% - 80px); }
.lm-obelisco .lm-label { left: 0; top: -14px; transform: translate(-50%, -100%); }
.lm-karman, .lm-edge { left: 0; right: 0; width: auto; }
.lm-karman { border-top: 2px dashed rgba(255, 255, 255, 0.35); }
.lm-karman .lm-label, .lm-edge .lm-label { left: 10px; top: 6px; }
.lm-edge { height: 60px; transform: translateY(50%); background: linear-gradient(transparent, rgba(150, 110, 255, 0.35), transparent); }
.lm-edge .lm-label { top: 22px; }

.p-moon, .p-mars, .p-jupiter, .p-saturn, .p-uranus, .p-neptune, .p-pluto { border-radius: 50%; }
.p-moon {
  background:
    radial-gradient(circle at 30% 38%, rgba(0, 0, 0, 0.13) 0 8%, transparent 9%),
    radial-gradient(circle at 63% 60%, rgba(0, 0, 0, 0.15) 0 11%, transparent 12%),
    radial-gradient(circle at 56% 24%, rgba(0, 0, 0, 0.1) 0 6%, transparent 7%),
    radial-gradient(circle at 38% 72%, rgba(0, 0, 0, 0.1) 0 5%, transparent 6%),
    radial-gradient(circle at 35% 30%, #fbfbf6, #d6d6cf 55%, #9c9c95);
  box-shadow: inset -10px -8px 18px rgba(0, 0, 0, 0.35), 0 0 32px rgba(255, 255, 240, 0.3);
}
.p-mars {
  background:
    radial-gradient(ellipse at 50% 6%, rgba(255, 255, 255, 0.85) 0 12%, transparent 14%),
    radial-gradient(circle at 60% 58%, rgba(120, 30, 10, 0.35) 0 14%, transparent 16%),
    radial-gradient(circle at 35% 30%, #ffb08a, #e0603a 50%, #8a2e17);
  box-shadow: inset -8px -6px 14px rgba(0, 0, 0, 0.35), 0 0 24px rgba(255, 110, 60, 0.35);
}
.p-jupiter {
  background:
    radial-gradient(ellipse at 66% 64%, #c4563a 0 7%, transparent 8%),
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.28), transparent 55%),
    linear-gradient(180deg, #e9d6b8 0 14%, #c99a6b 14% 24%, #f0e2c8 24% 36%, #b97f55 36% 46%, #ead3b0 46% 60%, #c48e62 60% 70%, #e8d4b4 70% 84%, #b68560 84%);
  box-shadow: inset -16px -12px 26px rgba(0, 0, 0, 0.45), 0 0 30px rgba(233, 200, 150, 0.25);
}
/* Anillo: atrás se ve solo fuera del planeta (máscara circular); adelante, la mitad de abajo entera. */
.p-saturn::before, .p-saturn::after {
  content: "";
  position: absolute;
  left: -38%;
  right: -38%;
  top: 36%;
  height: 28%;
  border-radius: 50%;
  border: 6px solid rgba(236, 214, 160, 0.9);
  box-shadow: 0 0 0 3px rgba(200, 170, 110, 0.35);
  transform: rotate(-16deg);
}
.p-saturn::before {
  -webkit-mask-image: radial-gradient(circle at 50% 50%, transparent calc(var(--sz) / 2), #000 calc(var(--sz) / 2 + 1px));
  mask-image: radial-gradient(circle at 50% 50%, transparent calc(var(--sz) / 2), #000 calc(var(--sz) / 2 + 1px));
}
.p-saturn::after { clip-path: inset(50% 0 0 0); }
.p-saturn {
  background: radial-gradient(circle at 35% 30%, #fbe9b7, #d9b56c 55%, #9a7639);
  box-shadow: inset -10px -8px 18px rgba(0, 0, 0, 0.4), 0 0 26px rgba(250, 220, 150, 0.25);
}
.p-uranus {
  background: radial-gradient(circle at 35% 30%, #e0fcff, #8fdde6 55%, #4f9aa6);
  box-shadow: inset -8px -6px 14px rgba(0, 0, 0, 0.35), 0 0 22px rgba(140, 230, 240, 0.3);
}
.p-uranus::after {
  content: "";
  position: absolute;
  left: 40%;
  right: 40%;
  top: -22%;
  bottom: -22%;
  border-radius: 50%;
  border: 2px solid rgba(220, 250, 255, 0.55);
  transform: rotate(12deg);
}
.p-neptune {
  background:
    radial-gradient(ellipse at 40% 60%, rgba(10, 20, 80, 0.4) 0 10%, transparent 12%),
    radial-gradient(circle at 35% 30%, #9cc0ff, #3d6ff0 55%, #1b2f8a);
  box-shadow: inset -8px -6px 14px rgba(0, 0, 0, 0.35), 0 0 22px rgba(80, 130, 255, 0.35);
}
.p-pluto {
  background:
    radial-gradient(circle at 60% 62%, #f6eee2 0 18%, transparent 20%),
    radial-gradient(circle at 35% 30%, #e7d6bd, #b99a76 55%, #6f583e);
}
.p-belt::after, .p-oort::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  margin: -3px;
  border-radius: 50%;
}
.p-belt::after {
  background: #9a8f85;
  box-shadow:
    14px -8px 0 2px #7d736b, -18px 6px 0 1px #a59a90, 30px 10px 0 3px #8a8078, -30px -12px 0 0 #b0a69c,
    6px 18px 0 1px #6f665f, -6px -20px 0 2px #948a80, 40px -16px 0 0 #a0968c, -42px 14px 0 2px #857b73,
    22px 24px 0 0 #a59a90, -24px 26px 0 1px #7d736b, 2px -2px 0 1px #b0a69c;
}
.p-oort::after {
  width: 3px;
  height: 3px;
  margin: -1.5px;
  background: #dff3ff;
  box-shadow:
    18px -10px 0 0 #cfe9ff, -22px 8px 0 1px #eaf6ff, 36px 14px 0 0 #bfe0ff, -38px -16px 0 0 #dff3ff,
    8px 24px 0 1px #cfe9ff, -10px -28px 0 0 #eaf6ff, 44px -26px 0 1px #dff3ff, -46px 22px 0 0 #bfe0ff,
    28px 32px 0 0 #eaf6ff, -30px 34px 0 1px #cfe9ff, 0 -40px 0 0 #dff3ff, 52px 4px 0 0 #cfe9ff, -54px -4px 0 1px #eaf6ff;
}
.p-star {
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 14%, #ffd0b0 22%, rgba(255, 110, 70, 0.7) 40%, rgba(255, 60, 40, 0.15) 60%, transparent 70%);
  animation: glow 2.4s ease-in-out infinite alternate;
}
.p-nebula {
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 38% 50%, rgba(255, 90, 170, 0.55), transparent 58%),
    radial-gradient(ellipse at 66% 40%, rgba(90, 160, 255, 0.5), transparent 58%),
    radial-gradient(ellipse at 50% 72%, rgba(170, 90, 255, 0.45), transparent 62%);
  filter: blur(3px);
  transform: translate(-50%, -50%) scaleX(1.3);
}
.p-hole {
  border-radius: 50%;
  background: #000;
  box-shadow: 0 0 0 3px rgba(255, 180, 70, 0.95), 0 0 18px 8px rgba(255, 120, 40, 0.6), 0 0 44px 20px rgba(255, 80, 20, 0.22);
}
.p-hole::after {
  content: "";
  position: absolute;
  left: -45%;
  right: -45%;
  top: 42%;
  height: 16%;
  border-radius: 50%;
  background: linear-gradient(90deg, transparent, rgba(255, 200, 120, 0.9), #fff2c8, rgba(255, 200, 120, 0.9), transparent);
  transform: rotate(-10deg);
}
.p-galaxy {
  border-radius: 50%;
  background: radial-gradient(ellipse at center, #fff 0 5%, rgba(255, 236, 210, 0.85) 10%, rgba(190, 170, 255, 0.5) 30%, rgba(120, 100, 220, 0.2) 50%, transparent 68%);
  transform: translate(-50%, -50%) rotate(-25deg) scaleY(0.42);
}

/* La nave */
.ship {
  position: absolute;
  left: 50%;
  top: calc(var(--ship-top) - 64px); /* la tobera queda a 64 px del borde de arriba del dibujo */
  width: 46px;
  height: 92px;
  margin-left: -23px;
  z-index: 2;
  transition: top 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
.ship-in { width: 100%; height: 100%; }
.ship svg { display: block; width: 100%; height: 100%; overflow: visible; }
.ship .flame, .ship .flame-in { transform-box: fill-box; transform-origin: 50% 0; }
.ship .flame { transform: scaleY(0); transition: transform 0.35s ease; }
.ship .flame-in { animation: flicker 0.1s ease-in-out infinite alternate; }
.ship.idle .flame { transform: scaleY(0.45); }
.ship.idle .ship-in { animation: bob 2.4s ease-in-out infinite; }
.ship.thrust .flame { transform: scaleY(var(--flame, 1.2)); transition-duration: 0.12s; }
.ship.dead .ship-in { transform: rotate(10deg); filter: grayscale(0.7) brightness(0.8); transition: transform 0.6s, filter 0.6s; }

/* Altímetro pegado a la nave */
.alt-tag {
  position: absolute;
  left: calc(50% + 32px);
  top: calc(var(--ship-top) - 78px);
  z-index: 3;
  padding: 5px 11px 6px;
  border-radius: 12px;
  background: rgba(6, 10, 29, 0.62);
  backdrop-filter: blur(6px);
  color: #fff;
  white-space: nowrap;
  max-width: calc(50% - 40px);
  transition: top 0.7s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s;
}
.alt-now { display: block; font-weight: 800; }
.alt-now b { font: 1.45rem/1.05 var(--display); font-variant-numeric: tabular-nums; }
.alt-tag small { display: block; font-size: 0.68rem; opacity: 0.8; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; }
/* El cartel que revela el nivel cuando la nave frena en su barrera */
.verdict {
  position: absolute;
  left: 50%;
  top: calc(var(--ship-top) - 200px);
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  transform: translateX(-50%);
  animation: verdict 2.2s ease-out forwards;
}
.verdict .chip { font-size: 1rem; padding: 5px 14px; box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4); }
.verdict b { font: 2.1rem/1 var(--display); color: #fff; text-shadow: 0 3px 14px rgba(0, 0, 0, 0.65); }
.verdict.tier-dificil b { color: #ffd24a; }
/* Qué había más arriba: "Con «Durián» llegabas a La Difícil" */
.verdict.with-tip { top: calc(var(--ship-top) - 270px); }
.verdict-tip {
  margin-top: 4px;
  max-width: min(86vw, 360px);
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(6, 10, 29, 0.78);
  border: 1px solid rgba(255, 210, 74, 0.35);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  text-wrap: balance;
}
.verdict-tip b { font: inherit; font-weight: 800; color: #ffd24a; text-shadow: none; }
.sd.pending { border-color: #fff; background: rgba(255, 255, 255, 0.25); animation: pending-dot 0.6s ease-in-out infinite alternate; }
.feedback.climbing { color: var(--text-soft); }
.callout {
  position: absolute;
  left: 50%;
  top: calc(var(--ship-top) + 30px);
  z-index: 4;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: #0b1030;
  font-weight: 900;
  font-size: 0.9rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}
.callout.show { animation: callout 1.4s ease forwards; }
.flight .stamp { top: calc(var(--ship-top) - 150px); font-size: 1.8rem; }

/* Puntitos de etapas */
.dots { display: inline-flex; gap: 5px; }
.sd { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, 0.4); }
.sd.done { border-color: rgba(255, 255, 255, 0.85); }
.sd.none { background: transparent; border-style: dashed; }
.sd.cur { border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.22); }
.dots.big { display: flex; justify-content: center; gap: 8px; margin: 12px 0 4px; }
.dots.big .sd { width: 18px; height: 18px; }

/* Hojas de vidrio que flotan sobre la escena */
.sheet {
  position: relative;
  background: rgba(9, 13, 36, 0.74);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  padding: 16px 18px 14px;
  animation: enter 0.3s ease-out;
}
.link-btn {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  background: none;
  border: 0;
  padding: 4px 2px;
  color: var(--text-soft);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(163, 172, 216, 0.4);
}
.link-btn:hover { color: var(--text); }
.center-btn { display: block; margin: 8px auto 0; }

/* Portada */
.ui-home {
  min-height: calc(100vh - 76px);
  min-height: calc(100dvh - 76px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  padding: 18px 0 18px;
}
.home-hero { text-shadow: 0 2px 14px rgba(6, 12, 40, 0.55); animation: enter 0.4s ease-out; }
.home-hero .kicker { color: #fff; opacity: 0.85; }
.home-title { font: 2.3rem/1.05 var(--display); color: #fff; margin: 6px 0 10px; letter-spacing: -0.01em; }
.home-sub { color: rgba(255, 255, 255, 0.92); font-weight: 600; margin: 0; }
.home-bottom { animation: enter 0.4s ease-out; }
.home-status {
  display: inline-block;
  margin: 0 0 10px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(6, 10, 29, 0.6);
  backdrop-filter: blur(6px);
  font-size: 0.9rem;
}
.launch { font-size: 1.25rem !important; padding: 16px !important; letter-spacing: 0.02em; }
.home-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.pill-btn {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text);
  background: rgba(16, 23, 56, 0.75);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
}
.pill-btn:hover { background: rgba(30, 40, 90, 0.85); }
.pill-btn:focus-visible, .link-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ui-home .streak { text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6); }
/* Hueco de la nave: la nave se centra acá (lo calcula placeHomeShip) y se toca para cambiarla. */
.home-gap { flex: 1; min-height: 112px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.ship-tap {
  width: 64px;
  height: 100px;
  border: 0;
  border-radius: 22px;
  background: transparent;
  cursor: pointer;
  transition: box-shadow 0.2s, background 0.2s;
}
.ship-tap:hover { background: rgba(255, 255, 255, 0.06); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18); }
.ship-tap:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* En la portada la altura va centrada al costado de la nave: no sobresale por arriba del hueco. */
.flight.at-home .alt-tag { top: calc(var(--ship-top) - 58px); }
.ship-tap-hint { font-size: 0.72rem; font-weight: 700; color: rgba(255, 255, 255, 0.75); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6); }
/* La portada entra entera en la pantalla, sin scroll: cabecera arriba y el resto reparte el alto;
   el hueco de la nave se agranda o se achica con lo que quede. */
body.on-home { height: 100vh; height: 100dvh; min-height: 0; padding-bottom: 0; display: flex; flex-direction: column; overflow-x: hidden; overflow-y: auto; }
body.on-home .top { flex-shrink: 0; width: 100%; }
body.on-home main { flex: 1; min-height: 0; width: 100%; }
body.on-home .ui-home { height: 100%; min-height: 0; }
body.on-home .home-gap { min-height: 100px; }
/* Pantallas bajas (laptops con la ventana chica, celulares acostados): menos alto el título para que entre la nave. */
@media (max-height: 700px) {
  .ui-home { padding: 8px 0 10px; }
  .home-title { font-size: 1.8rem; margin: 2px 0 6px; }
  .home-sub { font-size: 0.92rem; }
  .home-status { margin-bottom: 6px; }
  .launch { padding: 12px !important; }
  .btn.big.launch { margin: 4px 0 8px; }
}
/* Muy bajas (celular acostado): título en una línea y sin la bajada. */
@media (max-height: 560px) {
  body.on-home .top { padding-top: 8px; }
  .home-sub { display: none; }
  .home-title { font-size: 1.45rem; margin: 0 0 2px; }
  .home-title br { display: none; }
  .home-hero .kicker { margin-bottom: 2px; }
  .home-status { font-size: 0.8rem; padding: 4px 12px; margin-bottom: 4px; }
  .launch { padding: 10px !important; font-size: 1.05rem !important; }
  .btn.big.launch { margin: 2px 0 6px; }
  .home-links { gap: 6px; }
  .pill-btn { padding: 5px 9px; font-size: 0.76rem; }
  .ui-home .streak { margin-top: 4px; font-size: 0.85rem; }
  .ship-tap-hint { display: none; }
  body.on-home .home-gap { min-height: 92px; }
}
/* Celulares chicos (320 × 568): sin la bajada y con el título más chico. */
@media (max-width: 360px) and (max-height: 600px) {
  .home-sub, .ship-tap-hint { display: none; }
  .home-title { font-size: 1.6rem; }
}
/* Celulares angostos: los botones de abajo ocupan menos filas. */
@media (max-width: 420px) {
  .home-links { gap: 6px; }
  .pill-btn { padding: 7px 11px; font-size: 0.8rem; }
}

/* En vuelo */
.ui-play { padding-top: 4px; }
.sheet-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sheet-top .kicker { margin: 0; }
.sheet-top .link-btn { margin-left: auto; }
.prompt { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.prompt h2 { font-size: 1.3rem; margin-bottom: 2px; }
.prompt p { margin: 0; }
.prompt.pop { animation: prompt-in 0.35s ease-out; }
.prompt .cat-emoji { width: 52px; height: 52px; font-size: 2rem; }
.answer input[readonly] { opacity: 0.7; }
.sheet-foot { text-align: center; margin-top: 2px; }
.play-sheet .feedback { margin: 8px 0 2px; }
.play-sheet .misses:empty { display: none; }

/* Barreras por rareza: una línea de energía por nivel arriba de la nave */
.barrier {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  transform: translateY(50%);
  background: linear-gradient(90deg, transparent, var(--tc) 10%, var(--tc) 90%, transparent);
  box-shadow: 0 0 14px var(--tc), 0 0 2px var(--tc);
  opacity: 0.9;
  animation: barrier-in 0.45s ease-out backwards;
}
.barrier::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -12px;
  height: 27px;
  background: linear-gradient(transparent, color-mix(in srgb, var(--tc) 26%, transparent), transparent);
  animation: barrier-hum 1.6s ease-in-out infinite;
}
.barrier-tag {
  position: absolute;
  left: 46px;
  bottom: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  color: #fff;
  background: var(--tc);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  transform-origin: left bottom;
  transition: transform 0.25s;
}
.barrier.tier-dificil .barrier-tag { color: #221b14; background: linear-gradient(115deg, #f7c948, #e0a100 30%, #fff2b3 45%, #e0a100 60%, #f0b429); }
/* La barrera resiste cuando la nave se acerca */
.barrier.strain { height: 5px; box-shadow: 0 0 26px var(--tc), 0 0 6px #fff; }
.barrier.strain::before { animation-duration: 0.25s; }
.barrier.broken { animation: barrier-break 0.55s ease-out forwards; }
.barrier.broken::before { animation: barrier-burst 0.5s ease-out forwards; }
.barrier.broken .barrier-tag { animation: tag-fly 0.6s ease-out forwards; }
.barrier.reached { height: 4px; box-shadow: 0 0 24px var(--tc), 0 0 5px #fff; }
.barrier.reached .barrier-tag { transform: scale(1.15); }
.barrier.ahead { opacity: 0.38; filter: saturate(0.6); }
.barrier.gone { transition: opacity 0.45s; opacity: 0 !important; }

/* Durante el ascenso el panel se pliega y la cámara baja el encuadre para ver lo que viene */
.play-sheet .prompt, .play-sheet .console, .play-sheet .console-meta, .play-sheet .sheet-foot, .play-sheet .misses {
  max-height: 220px;
  transition: max-height 0.45s ease, opacity 0.3s, margin 0.45s;
}
.play-sheet.collapsed .prompt, .play-sheet.collapsed .console, .play-sheet.collapsed .console-meta,
.play-sheet.collapsed .sheet-foot, .play-sheet.collapsed .misses, .play-sheet.collapsed .suggest {
  max-height: 0;
  opacity: 0;
  margin: 0;
  overflow: hidden;
  pointer-events: none;
}
.play-sheet.collapsed .feedback { font-size: 1.15rem; margin: 2px 0 0; }
.flight.at-play.climbing { --ship-top: 76%; }

/* Consola de la cabina: el reloj es un indicador de combustible y la respuesta se escribe en su pantalla */
.console {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(22, 30, 70, 0.92), rgba(9, 13, 34, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 -12px 22px rgba(0, 0, 0, 0.28);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.console.live { border-color: rgba(90, 209, 255, 0.4); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 0 0 3px rgba(90, 209, 255, 0.08); }
.console .answer { flex: 1; min-width: 0; }
.console .answer input {
  border-radius: 12px;
  background: rgba(3, 6, 20, 0.65);
  border: 1px solid rgba(90, 209, 255, 0.22);
  font-weight: 600;
  caret-color: var(--focus);
}
.console .answer input:focus { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(90, 209, 255, 0.18); }
.console.locked .answer input { color: var(--text-soft); }
.ignite { border-radius: 12px !important; padding: 10px 14px; white-space: nowrap; }
.fuel { position: relative; width: 52px; height: 52px; flex: none; display: grid; place-items: center; }
.fuel svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.fuel-bg { fill: rgba(0, 0, 0, 0.35); stroke: rgba(255, 255, 255, 0.12); stroke-width: 4; }
.fuel-arc { fill: none; stroke: #3ddc84; stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset 0.1s linear, stroke 0.3s; }
.fuel.mid .fuel-arc { stroke: var(--amber); }
.fuel.low .fuel-arc { stroke: var(--bad); }
.fuel.low { animation: fuel-pulse 0.55s ease-in-out infinite alternate; }
#fuel-num { position: relative; font: 0.95rem var(--display); font-variant-numeric: tabular-nums; }
.fuel.low #fuel-num { color: var(--bad); }
.console-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 7px 6px 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-soft);
}
.signal { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.signal i { width: 3px; height: 100%; border-radius: 1px; background: var(--focus); transform: scaleY(0.25); transform-origin: bottom; opacity: 0.55; }
.console.locked + .console-meta .signal i { background: var(--text-soft); }

/* Resultados al final del vuelo */
.ui-results { padding-top: 34vh; }
.results-sheet .kicker { margin-bottom: 0; }
.best { text-align: center; font-weight: 800; color: var(--tt-dificil); }
.alt-total { text-align: center; font-family: var(--display); line-height: 1.05; }
.alt-total b { display: inline-block; font-size: 3.6rem; font-weight: inherit; background: linear-gradient(180deg, #ffd24a, #ff6a3d); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
.alt-total small { font-size: 1.4rem; color: var(--text-soft); margin-left: 6px; }
.reached { text-align: center; font-weight: 800; font-size: 1.2rem; margin-bottom: 10px; }
.results-sheet h3 { margin-bottom: 2px; }
.log { border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: rgba(24, 33, 74, 0.6); margin-top: 10px; }
.res { border-bottom: 1px solid var(--line); }
.res:last-child { border-bottom: 0; }
.res summary {
  display: grid;
  grid-template-columns: 1.4rem 1fr auto 4.2rem;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  cursor: pointer;
  list-style: none;
}
.res summary::-webkit-details-marker { display: none; }
.res summary:hover { background: rgba(255, 255, 255, 0.04); }
.res[open] summary { background: rgba(255, 255, 255, 0.05); }
.res-no {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 800;
  background: var(--soft-bg);
  color: var(--text-soft);
}
.res-cat { font-weight: 800; font-size: 0.95rem; min-width: 0; }
.res-cat small {
  display: block;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.res-m { text-align: right; font-family: var(--display); font-variant-numeric: tabular-nums; }
.res-body { padding: 4px 14px 14px; }
.res-body .all-tier:first-of-type { margin-top: 4px; }
/* Buscador y filtro por nivel dentro de cada etapa */
.res-tools { margin: 14px 0 2px; }
.res-search {
  width: 100%;
  font: inherit;
  font-size: 16px; /* evita zoom en iOS */
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid #3a4a94;
  background: var(--surface-2);
  color: var(--text);
  outline: none;
}
.res-search:focus { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(90, 209, 255, 0.2); }
.res-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.res-tier {
  font: inherit;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
}
.res-tier:hover { color: var(--text); }
.res-tier.on { background: var(--tc, var(--text)); border-color: transparent; color: #fff; }
.res-tier[data-tier="all"].on { color: var(--bg); }
.res-tier.tier-dificil.on { color: #221b14; }
.res-tier:focus-visible, .res-search:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ans-list { display: flex; flex-wrap: wrap; gap: 3px 12px; }
.res-empty { margin: 12px 0 0; }
.res-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 2px 18px; margin-top: 10px; }

/* Archivo de días anteriores */
.flight.at-archive { --ship-top: 22%; }

/* Modo fiesta (beta) */
.beta-tag {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 210, 74, 0.18);
  color: #ffd24a;
  border: 1px solid rgba(255, 210, 74, 0.45);
  vertical-align: 2px;
}
.flight.at-party { --ship-top: 84%; }
/* Detrás de las hojas del modo fiesta no se ve la nave de un jugador: solo el cielo, que sube con el que va primero. */
.flight.at-party .ship, .flight.at-party .alt-tag, .at-party .lm-label { opacity: 0; transition: opacity 0.3s; }
.ui-party { padding-top: 4px; }
.party-sheet { display: grid; gap: 12px; }
.party-sheet .sheet-top { margin-bottom: 0; }
.party-title { font: 1.5rem/1.15 var(--display); margin: 0; text-wrap: balance; }
.party-sheet .btn.big { margin: 4px 0 0; }
.pt-players { display: grid; gap: 8px; }
.pt-player { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: center; }
.pt-player input {
  width: 100%;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid #3a4a94;
  border-radius: 12px;
  padding: 9px 12px;
  outline: none;
}
.pt-player input:focus { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(90, 209, 255, 0.2); }
.pt-del { text-decoration: none; font-size: 1rem; padding: 6px 8px; }
.pt-del:disabled { opacity: 0.3; cursor: default; }
.pt-dot { width: 18px; height: 18px; border-radius: 50%; display: inline-block; }
.pt-dot.small { width: 10px; height: 10px; margin-right: 6px; vertical-align: 1px; }
.pt-add { justify-self: start; padding: 8px 14px; font-size: 0.9rem; }
.pt-field { display: grid; gap: 6px; }
.pt-field > span { font-size: 0.78rem; font-weight: 800; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.08em; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { flex: 1; font: inherit; font-weight: 800; font-size: 0.9rem; color: var(--text-soft); background: transparent; border: 0; padding: 8px 6px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: #26306a; color: #fff; }
.seg button:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.pt-toggle { display: flex; gap: 10px; align-items: flex-start; font-size: 0.92rem; cursor: pointer; }
.pt-toggle input { width: 20px; height: 20px; accent-color: var(--accent); margin: 1px 0 0; flex-shrink: 0; }
.pt-handoff { justify-items: center; text-align: center; padding-top: 18px; padding-bottom: 18px; }
.pt-handoff .sheet-top { width: 100%; }
.pt-big-ship svg { width: 56px; height: 112px; display: block; }
/* Toda la pantalla de pase es un botón: se toca en cualquier lado para empezar el turno. */
.pt-ready {
  width: 100%;
  min-height: min(52vh, 420px);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  padding: 18px 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pt-ready:hover { background: rgba(255, 255, 255, 0.06); }
.pt-ready:active { transform: scale(0.99); }
.pt-ready:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.pt-ready .party-title { display: block; }
.pt-go {
  margin-top: 6px;
  padding: 12px 26px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
  background: linear-gradient(180deg, #ff8a4c, #ff5a2a);
  box-shadow: 0 8px 22px rgba(255, 106, 61, 0.35);
}
.pt-flash { margin: 0; padding: 7px 14px; border-radius: 999px; background: rgba(61, 220, 132, 0.14); color: #7dffb0; font-weight: 800; font-size: 0.88rem; animation: enter 0.3s ease-out; }
.pt-lanes {
  display: grid;
  grid-template-columns: repeat(var(--n), 1fr);
  gap: 6px;
  height: 210px;
  align-items: end;
  padding: 6px 4px 0;
  border-bottom: 2px solid rgba(163, 172, 216, 0.35);
  border-radius: 14px 14px 0 0;
  background: linear-gradient(to top, rgba(110, 162, 255, 0.12), transparent 75%);
}
.pt-lane { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; }
.pt-m { font: 0.72rem var(--display); margin-bottom: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pt-ship svg { width: 24px; height: 48px; display: block; margin-bottom: -4px; }
.pt-trail { width: 4px; height: 0; border-radius: 2px; transition: height 1.4s cubic-bezier(0.3, 0.7, 0.2, 1); }
.pt-cards, .pt-podium { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pt-card { display: grid; grid-template-columns: 8px 1fr auto 3.6rem; gap: 10px; align-items: center; background: rgba(24, 33, 74, 0.7); border-radius: 14px; padding: 9px 12px; }
.pt-bar { width: 8px; align-self: stretch; min-height: 32px; border-radius: 4px; }
.pt-who { min-width: 0; }
.pt-who b { display: block; font-size: 0.95rem; }
.pt-who small { display: block; color: var(--text-soft); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-pts { font-family: var(--display); font-weight: inherit; text-align: right; font-variant-numeric: tabular-nums; }
.pt-podium .pt-card { grid-template-columns: 2rem 1fr auto; }
.pt-pos { font: 1.2rem var(--display); color: var(--text-soft); text-align: center; }
.pt-podium .pt-card.first { background: linear-gradient(90deg, rgba(255, 210, 74, 0.22), rgba(24, 33, 74, 0.7)); }
.pt-podium .pt-card.first .pt-pos { color: #ffd24a; }
.pt-note { margin: 0; font-size: 0.86rem; color: #ffd24a; background: rgba(255, 210, 74, 0.1); border-radius: 12px; padding: 8px 12px; }
@media (prefers-reduced-motion: reduce) { .pt-trail { transition: none; } }
.ui-archive { padding-top: 24vh; }
.archive-sheet h2 { margin-bottom: 4px; }
.arch-list {
  list-style: none;
  margin: 12px 0 4px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(24, 33, 74, 0.6);
}
.arch-list li + li { border-top: 1px solid var(--line); }
.arch-day {
  width: 100%;
  display: grid;
  grid-template-columns: 2.8rem 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  font: inherit;
  color: var(--text);
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
}
.arch-day:hover { background: rgba(255, 255, 255, 0.05); }
.arch-day:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.arch-no { font-family: var(--display); color: var(--text-soft); font-variant-numeric: tabular-nums; }
.arch-date { font-weight: 800; }
.arch-date::first-letter { text-transform: uppercase; }
.arch-date small, .arch-res small { display: block; font-weight: 600; font-size: 0.78rem; color: var(--text-soft); }
.arch-res { text-align: right; font-weight: 800; }
.arch-res b { font-family: var(--display); font-weight: inherit; font-variant-numeric: tabular-nums; }
.arch-res small { letter-spacing: 1px; }
.arch-play { color: var(--accent); }
.arch-play small { letter-spacing: 0; }

/* ---------- Diálogos y toast ---------- */
dialog {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  width: min(520px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  background: var(--surface);
  color: var(--text);
  box-shadow: 6px 6px 0 var(--hard);
}
.theme-space dialog { background: #10173a; border-width: 1px; border-radius: 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6); }
dialog[open] { animation: pop 0.2s ease-out; }
.theme-space dialog::backdrop { background: rgba(2, 4, 13, 0.7); }
.dlg { padding: 22px; position: relative; }
.dlg .close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; }
.dlg > .btn { width: 100%; margin-top: 14px; }
.dlg h2 { padding-right: 36px; }
.rules { padding-left: 20px; margin: 8px 0; }
.rules li { margin-bottom: 6px; line-height: 1.45; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; margin: 10px 0; }
.stat-grid div { background: var(--surface-2); border: 2px solid var(--border); border-radius: 10px; padding: 8px 4px; }
.theme-space .stat-grid div { border-width: 1px; }
.stat-grid b { display: block; font-family: var(--display); font-size: 1.4rem; color: var(--accent); font-variant-numeric: tabular-nums; }
.stat-grid span { font-size: 0.72rem; color: var(--text-soft); }

/* Hangar: naves y logros (en el diálogo de estadísticas) */
.hangar h3 { display: flex; align-items: baseline; gap: 8px; margin: 20px 0 8px; }
.hangar h3 .small { font-weight: 600; }
.ships { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.ship-card {
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 6px 8px;
  display: grid;
  justify-items: center;
  gap: 2px;
  cursor: pointer;
  text-align: center;
}
.ship-card:hover:not(:disabled) { background: #222c5c; }
.ship-card:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ship-card.on { border-color: #ffd24a; box-shadow: 0 0 0 2px rgba(255, 210, 74, 0.35); }
.ship-card.locked { cursor: default; opacity: 0.55; }
.ship-card.locked .sc-art { filter: grayscale(1) brightness(0.55); }
.sc-art svg { width: 30px; height: 60px; display: block; }
.ship-card b { font-size: 0.82rem; }
.ship-card small { font-size: 0.68rem; color: var(--text-soft); line-height: 1.2; }
.ship-card.on small { color: #ffd24a; font-weight: 800; }
.achs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ach { display: grid; grid-template-columns: 2rem 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); }
.ach-icon { font-size: 1.3rem; text-align: center; }
.ach:not(.done) .ach-icon { filter: grayscale(1); opacity: 0.5; }
.ach-text b { display: block; font-size: 0.9rem; }
.ach-text small { display: block; font-size: 0.78rem; color: var(--text-soft); }
.ach-prog { display: block; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); margin-top: 5px; overflow: hidden; }
.ach-prog i { display: block; height: 100%; background: linear-gradient(90deg, #6ea2ff, #ffd24a); }
.ach-num { font-variant-numeric: tabular-nums; }
.ach-ok { font-weight: 800; color: #3ddc84; }
.ach.done { background: linear-gradient(90deg, rgba(61, 220, 132, 0.12), var(--surface-2)); }

/* Aviso de lo desbloqueado al terminar un vuelo */
.unlocks { margin: 14px 0 4px; padding: 12px 14px; border-radius: 16px; background: linear-gradient(135deg, rgba(255, 210, 74, 0.16), rgba(255, 106, 61, 0.12)); border: 1px solid rgba(255, 210, 74, 0.4); animation: enter 0.4s ease-out; }
.unlocks .kicker { color: #ffd24a; margin-bottom: 6px; }
.unlocks ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.unlocks li { display: grid; grid-template-columns: 2.2rem 1fr auto; gap: 10px; align-items: center; }
.unlocks b { display: block; }
.unlocks small { display: block; color: var(--text-soft); font-size: 0.8rem; }
.ul-icon { font-size: 1.5rem; text-align: center; }
.ul-ship svg { width: 22px; height: 44px; display: block; margin: 0 auto; }
.small-use { padding: 6px 12px !important; font-size: 0.82rem !important; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 60;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Animaciones ---------- */
@keyframes enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@keyframes pop {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: none; }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}
@keyframes holo {
  from { background-position: 0% 0; }
  to { background-position: 250% 0; }
}
@keyframes stamp {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(-12deg) scale(2.2); }
  14% { opacity: 1; transform: translate(-50%, -50%) rotate(-12deg) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(-12deg) scale(1); }
}
@keyframes burst {
  from { transform: translate(0, 0) rotate(0); opacity: 1; }
  to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; }
}
@keyframes flicker {
  from { transform: scale(0.94, 0.86); }
  to { transform: scale(1.04, 1.08); }
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes cloud-drift {
  from { transform: translate(-16px, 50%); }
  to { transform: translate(16px, 50%); }
}
@keyframes fuel-pulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}
@keyframes slam {
  0% { transform: scale(1); }
  35% { transform: scale(1.14); }
  100% { transform: scale(1); }
}
.alt-total b.slam { animation: slam 0.5s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes barrier-in {
  from { opacity: 0; transform: translateY(50%) scaleX(0.2); }
  to { opacity: 0.9; transform: translateY(50%) scaleX(1); }
}
/* Solo se desvanece con un destello: si se escalara la línea, se deformaría también su cartel. */
@keyframes barrier-break {
  0% { opacity: 1; filter: brightness(1); }
  25% { opacity: 1; filter: brightness(2.4); }
  100% { opacity: 0; filter: brightness(1); }
}
@keyframes barrier-burst {
  0% { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(5); opacity: 0; }
}
@keyframes tag-fly {
  to { opacity: 0; transform: translateY(-26px) scale(0.9); }
}
@keyframes barrier-hum {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
@keyframes twinkle {
  from { opacity: 0.75; }
  to { opacity: 1; }
}
@keyframes glow {
  from { transform: translate(-50%, -50%) scale(0.92); }
  to { transform: translate(-50%, -50%) scale(1.08); }
}
@keyframes verdict {
  0% { opacity: 0; transform: translateX(-50%) scale(0.5); }
  12% { opacity: 1; transform: translateX(-50%) scale(1.15); }
  22% { transform: translateX(-50%) scale(1); }
  80% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-24px); }
}
@keyframes pending-dot {
  from { opacity: 0.45; }
  to { opacity: 1; }
}
@keyframes prompt-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
@keyframes callout {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(0.9); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  75% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -10px) scale(1); }
}

@media (max-width: 520px) {
  .logo { font-size: 1.7rem; }
}

@media (max-width: 420px) {
  body { padding: 0 10px 40px; }
  .logo { font-size: 1.45rem; padding: 4px 12px 6px; }
  .top { gap: 6px; --side: 78px; }
  .top-actions { gap: 6px; }
  .top .icon-btn { width: 36px; height: 36px; font-size: 1rem; }
  .legend li { grid-template-columns: 7.5rem 4.6rem; }
  .legend-blurb { grid-column: 1 / -1; }
  .home-title { font-size: 2rem; }
  .sheet { padding: 14px 14px 12px; border-radius: 18px; }
  .prompt h2 { font-size: 1.12rem; }
  .prompt .cat-emoji { width: 44px; height: 44px; font-size: 1.7rem; }
  .stat-grid b { font-size: 1.1rem; }
  .res summary { grid-template-columns: 1.4rem 1fr auto 3.4rem; gap: 8px; padding: 10px; }
  .res .chip { padding: 3px 8px; font-size: 0.72rem; }
  .row .btn { padding: 10px 12px; white-space: nowrap; }
  .alt-total b { font-size: 3rem; }
}

/* En pantallas muy angostas no entra centrado: el logo ocupa el espacio que queda entre los botones. */
@media (max-width: 350px) {
  .top { grid-template-columns: auto 1fr auto; }
  .logo { justify-self: center; font-size: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
