/* ===============================================================
   SELENE-7 · RETO 6 · REENTRADA · ASPECTO
   El mismo lenguaje que los retos 1 y 2: interfaz de película de
   ciencia ficción con líneas finas, esquinas de encuadre, rótulos
   muy espaciados y lecturas monoespaciadas. Añade la tarjeta de
   Tang, la mochila de «Tang asegurado», la gráfica del pasillo, el
   selector del ángulo, la vista del descenso y la pantalla de
   éxito. (La reentrada a pantalla completa y el final están en el
   Reto 7.)
   =============================================================== */
:root {
  --fondo: #010409;
  --panel: rgba(5, 12, 21, .84);
  --linea: rgba(126, 206, 255, .13);
  --linea-2: rgba(126, 206, 255, .28);
  --linea-3: rgba(126, 206, 255, .6);
  --texto: #d7ecff;
  --texto-2: #9bb6cc;
  --tenue: #5a768c;
  --cian: #62dcff;
  --cian-2: #b8f2ff;
  --verde: #4dffa0;
  --ambar: #ffb13d;
  --naranja: #ff9a3d;
  --rojo: #ff4d4d;
  --f-titulo: "Michroma", "Bahnschrift", "Segoe UI", sans-serif;
  --f-ui: "Barlow Semi Condensed", "Bahnschrift SemiCondensed", "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", Consolas, "Cascadia Mono", monospace;
  --f-seg: "DSEG7 Classic", "JetBrains Mono", monospace;
  --f-mano: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  --esq: 12px;
  --suave: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; color: var(--texto); font-family: var(--f-ui); font-variant-ligatures: none; overflow: hidden; -webkit-font-smoothing: antialiased; }
body {
  background:
    radial-gradient(1100px 620px at 12% -12%, rgba(38, 110, 185, .17), transparent 62%),
    radial-gradient(900px 520px at 108% 112%, rgba(26, 86, 150, .14), transparent 60%),
    radial-gradient(rgba(140, 205, 255, .075) 1px, transparent 1.3px) 0 0 / 24px 24px,
    var(--fondo);
}
.oculto { display: none !important; }
body.nave-master .solo-explorador, body:not(.nave-master) .solo-master { display: none !important; }
button { touch-action: manipulation; font: inherit; }
::selection { background: rgba(98, 220, 255, .3); }

#app { display: grid; grid-template-rows: 60px 1fr; height: 100vh; transition: filter .8s; }

/* ---------- Piezas comunes ---------- */
.marco {
  --c: var(--linea-3);
  background-image:
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c));
  background-size: var(--esq) 1px, 1px var(--esq);
  background-position: left top, left top, right top, right top, left bottom, left bottom, right bottom, right bottom;
  background-repeat: no-repeat;
  background-origin: border-box;
}
.mini { font: 500 9.5px/1 var(--f-ui); letter-spacing: .28em; color: var(--tenue); white-space: nowrap; }
.mini sub, .caja-cod sub { font-size: .8em; vertical-align: -.15em; letter-spacing: 0; }
.idx { display: inline-block; padding: 3px 5px 2px; border-radius: 1px; background: var(--cian); color: #021018; font: 600 9.5px/1 var(--f-mono); letter-spacing: .04em; }
.punto { display: inline-block; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--cian); box-shadow: 0 0 8px var(--cian); }
.punto.vivo { animation: vivo 2.4s ease-in-out infinite; }
.punto.rec { background: var(--rojo); box-shadow: 0 0 8px var(--rojo); animation: vivo 1.6s steps(1) infinite; }
.punto.ambar { background: var(--ambar); box-shadow: 0 0 8px var(--ambar); }
@keyframes vivo { 50% { opacity: .2; } }
@keyframes latido { 50% { opacity: .45; } }
@keyframes subir { from { opacity: 0; transform: translateY(10px); } }
@keyframes girar { to { transform: rotate(360deg); } }
@keyframes recorrer { from { background-position: -40% 0; } to { background-position: 140% 0; } }

.btn {
  font: 600 13px/1 var(--f-ui); letter-spacing: .16em; text-transform: uppercase; border-radius: 2px; padding: 11px 18px; cursor: pointer;
  border: 1px solid var(--linea-2); background: rgba(98, 220, 255, .05); color: var(--texto); user-select: none;
  transition: transform .08s, filter .15s, background .2s, border-color .2s, box-shadow .2s, opacity .2s;
}
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.btn:hover { filter: brightness(1.2); border-color: var(--linea-3); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: default; }
.btn:focus-visible { outline: 1px solid var(--cian); outline-offset: 2px; }

/* ---------- Barra superior ---------- */
#barra {
  position: relative; display: flex; align-items: center; gap: 28px; padding: 0 20px;
  background: linear-gradient(rgba(8, 18, 30, .92), rgba(4, 10, 18, .7));
  border-bottom: 1px solid var(--linea);
}
#barra::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; opacity: .7;
  background: linear-gradient(90deg, transparent, var(--cian), transparent) no-repeat;
  background-size: 28% 100%; animation: recorrer 8s linear infinite;
}
.marca { display: flex; align-items: center; gap: 13px; flex: 1; min-width: 0; user-select: none; }
.emblema { flex: none; width: 36px; height: 36px; overflow: visible; }
.em-aro { fill: none; stroke: var(--linea-3); stroke-width: .8; stroke-dasharray: 1.5 3.2; transform-box: fill-box; transform-origin: center; animation: girar 40s linear infinite; }
.em-luna { fill: rgba(98, 220, 255, .12); stroke: var(--cian); stroke-width: 1; }
.em-orbita { fill: none; stroke: var(--cian); stroke-width: .7; opacity: .5; }
.em-nave { fill: var(--cian-2); filter: drop-shadow(0 0 2px var(--cian)); }
.marca-txt { min-width: 0; }
.marca-txt b { display: block; font: 400 15px/1 var(--f-titulo); letter-spacing: .22em; color: var(--texto); }
.marca-txt span { display: block; margin-top: 7px; font: 500 10px/1 var(--f-ui); letter-spacing: .26em; color: var(--tenue); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Fases del reto: pendiente · en curso (ámbar) · hecha (verde) */
.fases { display: flex; margin: 0; padding: 0; list-style: none; border: 1px solid var(--linea-2); }
.fases li {
  position: relative; display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 13px 0 10px;
  font: 500 9.5px/1 var(--f-ui); letter-spacing: .24em; color: var(--tenue); white-space: nowrap; transition: color .3s, background .3s;
}
.fases li + li { border-left: 1px solid var(--linea); }
.fases li i { display: grid; place-items: center; width: 16px; height: 16px; border: 1px solid currentColor; border-radius: 50%; font: 600 9px/1 var(--f-mono); font-style: normal; letter-spacing: 0; }
.fases li.activa { color: var(--ambar); background: rgba(255, 177, 61, .07); }
.fases li.activa i { background: var(--ambar); color: #1c1000; border-color: var(--ambar); box-shadow: 0 0 8px rgba(255, 177, 61, .6); }
.fases li.hecha { color: var(--verde); }
.fases li.hecha i { font-size: 0; background: var(--verde) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path d='M2.5 6.2 5 8.6 9.6 3.6' fill='none' stroke='%2302200f' stroke-width='1.8'/></svg>") center / 10px no-repeat; border-color: var(--verde); }

.reloj { display: flex; flex-direction: column; gap: 6px; }
.reloj-val { font: 500 21px/1 var(--f-mono); letter-spacing: .03em; color: var(--texto); }
.reloj-val small { margin-right: 7px; font-size: 11px; letter-spacing: .1em; color: var(--cian); }

.o2 { position: relative; display: flex; flex-direction: column; gap: 7px; width: 250px; }
.o2-cab { display: flex; justify-content: space-between; align-items: flex-end; }
#o2-valor { font: 600 18px/1 var(--f-mono); color: var(--texto); }
.o2-barra { position: relative; height: 9px; background: repeating-linear-gradient(90deg, rgba(126, 206, 255, .13) 0 5px, transparent 5px 7px); }
#o2-relleno {
  height: 100%; width: 100%; background: var(--verde); filter: drop-shadow(0 0 4px rgba(77, 255, 160, .9));
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 5px, transparent 5px 7px); mask: repeating-linear-gradient(90deg, #000 0 5px, transparent 5px 7px);
  transition: width .6s var(--suave), background .6s;
}
#o2-relleno.medio { background: var(--ambar); filter: drop-shadow(0 0 4px rgba(255, 177, 61, .9)); }
#o2-relleno.bajo { background: var(--rojo); filter: drop-shadow(0 0 4px rgba(255, 77, 77, .9)); }
body.o2-critico .o2 { animation: latido 1s infinite; }
body.o2-critico #o2-valor { color: var(--rojo); }
.flotante { position: absolute; right: 0; top: 34px; font: 600 14px var(--f-mono); color: var(--rojo); text-shadow: 0 0 10px rgba(255, 77, 77, .6); animation: sube 1.8s forwards; pointer-events: none; }
.flotante.mas { color: var(--verde); text-shadow: 0 0 10px rgba(77, 255, 160, .6); }
@keyframes sube { to { transform: translateY(14px); opacity: 0; } }

/* ---------- Distribución y paneles ---------- */
main { display: grid; grid-template-columns: minmax(460px, 1.08fr) 1fr; gap: 14px; padding: 14px; min-height: 0; }
.panel { position: relative; min-height: 0; background-color: var(--panel); border: 1px solid var(--linea); box-shadow: 0 24px 60px rgba(0, 0, 0, .4); }
.panel-titulo {
  display: flex; align-items: center; gap: 10px; height: 36px; flex: none; padding: 0 14px; border-bottom: 1px solid var(--linea);
  font: 500 11.5px/1 var(--f-ui); letter-spacing: .24em; color: #c3dcef; white-space: nowrap; overflow: hidden;
}
.panel-titulo .sep { color: var(--tenue); letter-spacing: 0; }
.panel-titulo .sub { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font: 400 11.5px/1 var(--f-ui); letter-spacing: .04em; color: var(--tenue); }
.regla {
  flex: 1 1 20px; min-width: 20px; height: 7px; opacity: .8;
  background:
    repeating-linear-gradient(90deg, var(--linea-2) 0 1px, transparent 1px 6px) left bottom / 100% 3px no-repeat,
    repeating-linear-gradient(90deg, var(--linea-3) 0 1px, transparent 1px 30px) left bottom / 100% 7px no-repeat;
}
.panel-estado { flex: none; display: flex; align-items: center; gap: 7px; font: 500 10px/1 var(--f-mono); letter-spacing: .14em; color: var(--tenue); }

#principal { display: flex; flex-direction: column; overflow: hidden; }
.etapa { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.etapa.entra > :not(.panel-titulo) { animation: subir .6s var(--suave) both; }
.etapa.entra > :nth-child(3) { animation-delay: .08s; }
.etapa.entra > :nth-child(4) { animation-delay: .16s; }
.etapa.entra > :nth-child(5) { animation-delay: .24s; }

/* ---------- Fase 1 · ¿Dónde va Tang? ---------- */
.g-explica { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 22px; align-items: center; padding: 14px 18px 12px; border-bottom: 1px solid var(--linea); background: linear-gradient(rgba(98, 220, 255, .035), transparent); }
.g-texto b { display: block; margin-bottom: 7px; font: 500 10px/1 var(--f-ui); letter-spacing: .3em; color: var(--cian); }
.g-texto p { margin: 0; font: 400 15.5px/1.4 var(--f-ui); color: var(--texto-2); }
.g-texto p b { display: inline; margin: 0; font: 600 15.5px/1.4 var(--f-ui); letter-spacing: 0; color: var(--texto); }
.g-escala { position: relative; height: 62px; }
.g-pista { position: absolute; left: 0; right: 0; top: 29px; height: 4px; background: linear-gradient(90deg, rgba(98, 220, 255, .5), rgba(255, 177, 61, .7) 55%, rgba(255, 77, 77, .8)); }
.g-pista::before { content: ""; position: absolute; left: 0; right: 0; top: 6px; height: 5px; background: repeating-linear-gradient(90deg, var(--linea-3) 0 1px, transparent 1px 12.5%); }
.g-marca { position: absolute; top: 0; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; white-space: nowrap; }
.g-marca b { font: 600 12px/1 var(--f-mono); color: var(--texto); }
.g-marca i { width: 1px; height: 10px; margin-top: 2px; background: currentColor; }
.g-marca span { position: absolute; top: 40px; font: 400 11px/1.15 var(--f-ui); color: var(--texto-2); }
.g-marca:first-child { transform: none; align-items: flex-start; }
.g-marca:first-child span { left: 0; }
.g-marca.apolo b { color: var(--ambar); }

.pregunta { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px 0; font: 400 14px/1.2 var(--f-titulo); letter-spacing: .12em; color: var(--cian-2); }
.pregunta small { font: 500 10px/1 var(--f-mono); letter-spacing: .14em; color: var(--tenue); }
#opciones { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 12px; padding: 12px 18px 18px; }
.opcion {
  position: relative; display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; cursor: pointer; text-align: left;
  border: 1px solid var(--linea-2); border-radius: 2px; background: linear-gradient(rgba(10, 24, 40, .9), rgba(5, 12, 21, .9)); color: var(--texto);
  transition: border-color .2s, box-shadow .2s, transform .12s, background .2s;
}
.opcion:hover { border-color: var(--linea-3); box-shadow: 0 0 22px rgba(98, 220, 255, .12); }
.opcion:active { transform: scale(.985); }
.opcion:focus-visible { outline: 1px solid var(--cian); outline-offset: 2px; }
.op-dibujo { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px 10px 0;
  background: radial-gradient(rgba(140, 205, 255, .07) 1px, transparent 1.3px) 0 0 / 14px 14px; }
.op-dibujo svg { width: 100%; height: 100%; max-height: 270px; overflow: visible; }
.picto-txt { font: 700 22px var(--f-mono); fill: #9fdcf5; opacity: .6; }
.op-pie { display: flex; align-items: center; gap: 12px; padding: 10px 14px 12px; border-top: 1px solid var(--linea); }
.op-letra { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--linea-3); font: 600 12px/1 var(--f-mono); color: var(--cian); }
.op-txt { font: 600 16px/1.2 var(--f-ui); letter-spacing: .02em; color: var(--texto); }
.op-motivo { position: absolute; inset: auto 0 0 0; padding: 10px 14px 12px; font: 500 14.5px/1.35 var(--f-ui); color: #ffd6d6; background: rgba(40, 4, 4, .94); border-top: 1px solid rgba(255, 77, 77, .6); transform: translateY(100%); transition: transform .35s var(--suave); }
.opcion.mal { border-color: rgba(255, 77, 77, .55); }
.opcion.mal .op-motivo { transform: none; }
.opcion.mal .op-dibujo { opacity: .45; filter: grayscale(.6); }
.opcion.mal .op-letra { border-color: var(--rojo); color: var(--rojo); }
.opcion.mal .op-dibujo::after { content: "✖"; position: absolute; right: 14px; top: 8px; font: 700 26px/1 var(--f-ui); color: var(--rojo); text-shadow: 0 0 12px rgba(255, 77, 77, .6); }
.opcion.bien { border-color: rgba(77, 255, 160, .7); box-shadow: 0 0 30px rgba(77, 255, 160, .18), inset 0 0 30px rgba(77, 255, 160, .06); }
.opcion.bien .op-letra { border-color: var(--verde); background: var(--verde); color: #02200f; }
.opcion.bien .op-txt { color: #c9ffe3; }
#opciones.resuelto .opcion:not(.bien) { opacity: .35; pointer-events: none; }
/* Tang asoma de la bolsa, ofendido */
#picto-bolsa .tang-asoma { transform: translateY(26px); transition: transform .8s cubic-bezier(.3, 1.5, .5, 1); clip-path: inset(-40px -40px 12px -40px); }
.opcion.bien #picto-bolsa .tang-asoma { transform: none; }
/* Desde el 06-10, fotos de la cabina (assets/tang/); el pictograma SVG solo se ve si la foto no carga */
.op-foto { position: absolute; inset: 0; overflow: hidden; }
.op-foto img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%; user-select: none; transition: transform .5s var(--suave), opacity .7s var(--suave); }
.op-foto:not(.sin-foto) + svg { display: none; }
.op-foto.sin-foto { display: none; }
.op-foto .asoma { opacity: 0; }
.opcion.bien .op-foto .asoma { opacity: 1; }
.opcion:hover .op-foto img { transform: scale(1.03); }

/* ---------- Fase 1 · Tang asegurado (la mochila, en orden) ---------- */
.panel-estado.ok { color: var(--verde); }
.panel-estado.ok .punto { background: var(--verde); box-shadow: 0 0 8px var(--verde); animation: none; }
#mochila { position: relative; flex: 1; min-height: 0; background: radial-gradient(rgba(140, 205, 255, .07) 1px, transparent 1.3px) 0 0 / 14px 14px; }
#mochila .mo { position: absolute; inset: 0; display: block; width: 100%; height: 100%; padding: 10px 12px 6px; overflow: visible; user-select: none; touch-action: none; -webkit-tap-highlight-color: transparent; }
#banner-mochila { bottom: 88px; }
#etapa-mochila.entra > #banner-mochila { animation: aparece .3s var(--suave); }   /* su aparición, no la de la etapa (que lo descentraría) */
.mo-toque { cursor: pointer; outline: none; }
.mo-toque.hecho { pointer-events: none; cursor: default; }
.mo-toque.arrastrando { cursor: grabbing; }
/* EXPLORADOR: aro ámbar en lo que toca; con el teclado, aro cian en lo que tiene el foco */
.mo-anillo { fill: none; stroke: var(--ambar); stroke-width: 2.2; stroke-dasharray: 6 5; opacity: 0; pointer-events: none; transform-box: fill-box; transform-origin: center; }
.mo-toque.toca .mo-anillo { animation: anillo 1.6s ease-in-out infinite; }
.mo-toque:focus-visible .mo-anillo { opacity: 1; stroke: var(--cian); animation: none; }
.mo-toque.hecho .mo-anillo, .mo-toque.arrastrando .mo-anillo, .mo-toque.comiendo .mo-anillo { display: none; }
@keyframes anillo { 0%, 100% { opacity: .95; transform: scale(1); } 50% { opacity: .35; transform: scale(1.14); } }
.mo-etq { font: 600 10.5px var(--f-mono); letter-spacing: .12em; fill: var(--texto-2); }
/* La galleta flota (hay 0 g) hasta que la cogen */
.mo-galleta-flota { transform-box: fill-box; transform-origin: center; animation: flotar-galleta 3.4s ease-in-out infinite; }
.mo-toque.arrastrando .mo-galleta-flota, .mo-toque.comiendo .mo-galleta-flota { animation: none; }
@keyframes flotar-galleta { 50% { transform: translateY(-7px) rotate(7deg); } }
#mo-migas circle { fill: #e2a95a; animation: miga .9s ease-out forwards; }
@keyframes miga { to { transform: translate(var(--dx), var(--dy)); opacity: 0; } }
/* Tang: nervioso, se revuelve; si lo intentan encerrar así, bufa. Con la galleta, ronronea y se duerme */
.mo-tang { transform-box: fill-box; transform-origin: 45% 60%; }
.mo.nervioso .mo-tang { animation: revolverse 2.2s ease-in-out infinite; }
.mo .mo-tang.bufa { animation: bufar .6s linear; }
@keyframes revolverse { 0%, 52%, 100% { transform: none; } 60% { transform: rotate(-3deg) translateX(-3px); } 68% { transform: rotate(3deg) translateX(3px); } 76% { transform: rotate(-2deg); } 84% { transform: rotate(1.5deg); } }
@keyframes bufar { 15% { transform: translateY(-7px) scale(1.05); } 30% { transform: translate(-5px, -6px) rotate(-4deg) scale(1.05); } 45% { transform: translate(5px, -6px) rotate(4deg) scale(1.05); } 60% { transform: translate(-4px, -3px) rotate(-3deg); } 80% { transform: translate(2px, 0) rotate(1deg); } }
.mo-nervios { display: none; }
.mo.nervioso .mo-nervios { display: inline; animation: vivo .8s steps(1) infinite; }
.mo-ronroneo { opacity: 0; pointer-events: none; }
.mo.tranquilo:not(.cerrando) .mo-ronroneo { animation: ronronear 1s ease-in-out 5; }
@keyframes ronronear { 50% { opacity: .9; } }
.mo-z text { font: 400 16px var(--f-titulo); fill: var(--cian-2); opacity: 0; pointer-events: none; }
.mo-z text:nth-child(2) { font-size: 20px; }
.mo.tranquilo .mo-z text { animation: dormir 3.6s ease-in-out infinite; }
.mo.tranquilo .mo-z text:nth-child(2) { animation-delay: 1.2s; }
.mo.tranquilo .mo-z text:nth-child(3) { animation-delay: 2.4s; }
@keyframes dormir { 0% { opacity: 0; transform: translate(0, 8px); } 30% { opacity: .85; } 100% { opacity: 0; transform: translate(10px, -14px); } }
.mo-bocadillo { opacity: 0; pointer-events: none; transform-box: fill-box; transform-origin: 90% 100%; }
.mo-bocadillo.visible { animation: bocadillo 1.5s var(--suave) forwards; }
.mo-bocadillo text { font: 400 16px var(--f-titulo); letter-spacing: .06em; fill: var(--ambar); }
@keyframes bocadillo { 0% { opacity: 0; transform: scale(.5); } 14% { opacity: 1; transform: scale(1.08); } 24% { transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }
/* La mochila tiembla si se hace algo fuera de orden */
.mo-bolsa { transform-box: fill-box; transform-origin: 50% 100%; }
.mo-bolsa.tiembla { animation: tiembla-mochila .5s linear; }
@keyframes tiembla-mochila { 15% { transform: translateX(-6px) rotate(-1.2deg); } 30% { transform: translateX(6px) rotate(1.2deg); } 45% { transform: translateX(-5px) rotate(-.8deg); } 60% { transform: translateX(4px) rotate(.6deg); } 80% { transform: translateX(-2px); } }
/* Broches: piloto ámbar hasta que encajan; entonces, verde y «¡CLIC!» */
.mo-led { fill: var(--ambar); filter: drop-shadow(0 0 3px var(--ambar)); animation: vivo 1.2s steps(1) infinite; }
.mo-broche.cerrado .mo-led { fill: var(--verde); filter: drop-shadow(0 0 4px var(--verde)); animation: none; }
.mo-clic { font: 700 14px var(--f-mono); letter-spacing: .06em; fill: var(--verde); opacity: 0; pointer-events: none; }
.mo-broche.cerrado .mo-clic { animation: clic 1s ease-out; }
@keyframes clic { 0% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-16px); } }
/* Al terminar: sello verde y la mochila, con brillo */
.mo-sello { opacity: 0; pointer-events: none; transform-box: fill-box; transform-origin: center; filter: drop-shadow(0 0 10px rgba(77, 255, 160, .45)); }
.mo.listo .mo-sello { animation: sellar .5s cubic-bezier(.2, 1.4, .4, 1) .2s both; }
@keyframes sellar { from { opacity: 0; transform: scale(1.8); } to { opacity: 1; transform: none; } }
.mo-sello-txt { font: 400 25px var(--f-titulo); letter-spacing: .12em; fill: var(--verde); }
.mo-sello-sub { font: 600 11px var(--f-mono); letter-spacing: .45em; fill: #9ff0c2; }
.mo.listo .mo-bolsa { filter: drop-shadow(0 0 16px rgba(77, 255, 160, .28)); }

/* Abajo: la tarjeta con el orden (EXPLORADOR) o la sujeción (MASTER); al terminar, SEGUIR */
.mochila-pie { flex: none; display: flex; align-items: center; gap: 12px; min-height: 66px; padding: 10px 14px; border-top: 1px solid var(--linea); background: linear-gradient(rgba(7, 16, 27, .92), rgba(3, 8, 14, .96)); }
.pasos-mochila { flex: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.pasos-mochila li { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 7px 10px; border: 1px solid var(--linea); font: 500 14px/1.15 var(--f-ui); color: var(--tenue); transition: color .3s, border-color .3s, background .3s; }
.pasos-mochila li i { flex: none; display: grid; place-items: center; width: 20px; height: 20px; border: 1px solid currentColor; border-radius: 50%; font: 600 10px/1 var(--f-mono); font-style: normal; }
.pasos-mochila li.toca { color: var(--ambar); border-color: rgba(255, 177, 61, .55); background: rgba(255, 177, 61, .07); }
.pasos-mochila li.toca i { background: var(--ambar); border-color: var(--ambar); color: #1c1000; box-shadow: 0 0 8px rgba(255, 177, 61, .6); }
.pasos-mochila li.hecho { color: var(--verde); border-color: rgba(77, 255, 160, .3); }
.pasos-mochila li.hecho span { text-decoration: line-through; text-decoration-color: rgba(77, 255, 160, .75); text-decoration-thickness: 2px; }
.pasos-mochila li.hecho i { font-size: 0; background: var(--verde) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path d='M2.5 6.2 5 8.6 9.6 3.6' fill='none' stroke='%2302200f' stroke-width='1.8'/></svg>") center / 11px no-repeat; border-color: var(--verde); }
.sujecion { flex: 1; display: flex; align-items: center; gap: 14px; }
.sujecion-seg { display: flex; gap: 4px; }
.sujecion-seg i { width: 28px; height: 10px; background: rgba(126, 206, 255, .13); transition: background .3s, box-shadow .3s; }
.sujecion-seg i.on { background: var(--ambar); box-shadow: 0 0 6px rgba(255, 177, 61, .7); }
#sujecion-txt { font: 600 11px/1 var(--f-mono); letter-spacing: .16em; color: var(--ambar); }
.mochila-listo { display: none; flex: 1; flex-direction: column; gap: 6px; min-width: 0; }
.mochila-listo span { font: 400 16px/1.1 var(--f-titulo); letter-spacing: .14em; color: var(--verde); text-shadow: 0 0 14px rgba(77, 255, 160, .45); }
.mochila-listo small { font: 400 14px/1.2 var(--f-ui); color: var(--texto-2); }
#btn-seguir-mochila { display: none; flex-direction: column; align-items: flex-start; gap: 6px; }
.mochila-pie.listo .pasos-mochila, .mochila-pie.listo .sujecion { display: none; }
.mochila-pie.listo .mochila-listo { display: flex; animation: subir .5s var(--suave) both; }
.mochila-pie.listo #btn-seguir-mochila { display: inline-flex; animation: subir .5s var(--suave) .15s both; }

/* Carteles de fallo y de éxito */
.banner {
  position: absolute; left: 50%; bottom: 22px; z-index: 5; transform: translateX(-50%); min-width: 62%; max-width: 90%;
  padding: 12px 20px 14px; text-align: center; border: 1px solid; backdrop-filter: blur(3px); animation: aparece .3s var(--suave); pointer-events: none;
}
.banner.mal {
  background: repeating-linear-gradient(-45deg, rgba(255, 77, 77, .75) 0 6px, transparent 6px 12px) top / 100% 4px no-repeat, rgba(40, 4, 4, .88);
  border-color: rgba(255, 77, 77, .7); color: #ffd6d6; box-shadow: 0 0 30px rgba(255, 77, 77, .25);
}
.banner.aviso { background: rgba(34, 22, 2, .9); border-color: rgba(255, 177, 61, .6); color: #ffe2b0; box-shadow: 0 0 30px rgba(255, 177, 61, .2); }
.banner.bien { background: rgba(2, 30, 16, .88); border-color: rgba(77, 255, 160, .6); color: #d4ffe6; box-shadow: 0 0 30px rgba(77, 255, 160, .2); }
.b-cab { font: 500 9.5px/1 var(--f-mono); letter-spacing: .24em; opacity: .75; }
.b-titulo { margin-top: 8px; font: 400 18px/1.25 var(--f-titulo); letter-spacing: .1em; }
.banner.mal .b-titulo { color: var(--rojo); text-shadow: 0 0 14px rgba(255, 77, 77, .6); }
.banner.aviso .b-titulo { color: var(--ambar); }
.banner.bien .b-titulo { color: var(--verde); text-shadow: 0 0 14px rgba(77, 255, 160, .5); }
.b-sub { margin-top: 7px; font: 400 15px/1.4 var(--f-ui); }
@keyframes aparece { from { transform: translateX(-50%) scale(.94); opacity: 0; } }

/* ---------- Fase 2 · El ángulo de entrada ---------- */
.consigna { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--linea); font: 400 14.5px/1.35 var(--f-ui); color: var(--texto-2); }
.consigna b { font-weight: 600; color: var(--texto); }
.consigna::before { content: "i"; flex: none; display: grid; place-items: center; width: 18px; height: 18px; border: 1px solid var(--cian); border-radius: 50%; font: 600 11px/1 var(--f-mono); color: var(--cian); }
#grafica { position: relative; flex: 1; min-height: 0; margin: 6px 8px 0; cursor: crosshair; }
#grafica.bloqueada { cursor: default; }
.grafica-svg { display: block; width: 100%; height: 100%; user-select: none; touch-action: none; }
.gr-fondo { fill: rgba(98, 220, 255, .025); }
.gr-rej { stroke: rgba(126, 206, 255, .16); stroke-width: 1; }
.gr-rej-fina { stroke: rgba(126, 206, 255, .06); stroke-width: 1; }
.gr-eje { stroke: rgba(126, 206, 255, .5); stroke-width: 1; }
.gr-borde-rebote { stroke: rgba(185, 160, 255, .6); stroke-width: 1; stroke-dasharray: 3 3; }
.gr-num { font: 500 11px var(--f-mono); fill: var(--texto-2); }
.gr-titulo text { font: 500 11px var(--f-ui); letter-spacing: .2em; fill: #c3dcef; }
.gr-titulo .gr-unidad, .gr-unidad { font: 400 12px var(--f-ui); letter-spacing: .02em; fill: var(--tenue); }
.gr-eje-y { font: 600 12px var(--f-mono); fill: var(--texto-2); }
.gr-eje-x { font: 500 10.5px var(--f-ui); letter-spacing: .2em; fill: var(--texto-2); }
.gr-extremo { font: 500 10px var(--f-mono); letter-spacing: .1em; fill: var(--tenue); }
.gr-rebote { font: 400 13px var(--f-titulo); letter-spacing: .16em; fill: #cdbfff; }
.gr-rebote-sub { font: 400 11.5px var(--f-ui); fill: #b3a6e6; }
.gr-pasillo { fill: rgba(77, 255, 160, .1); stroke: rgba(77, 255, 160, .5); stroke-width: 1; }
.gr-pasillo-txt { font: 500 10px var(--f-mono); letter-spacing: .16em; fill: var(--verde); }
.gr-cursor line { stroke: rgba(255, 255, 255, .85); stroke-width: 1.2; }
.gr-cursor circle { stroke: #fff; stroke-width: 2; }
#gr-cur-mango { fill: #fff; filter: drop-shadow(0 0 5px rgba(255, 255, 255, .8)); }
#grafica.bloqueada .gr-cursor line { stroke: var(--verde); }
.gr-prohibido { fill: rgba(255, 77, 77, .07); }
.gr-limite { stroke: var(--rojo); stroke-width: 2; stroke-dasharray: 7 4; filter: drop-shadow(0 0 3px rgba(255, 77, 77, .6)); }
.gr-limite-txt { font: 600 11px var(--f-mono); letter-spacing: .08em; fill: #ff8a8a; paint-order: stroke; stroke: #06101b; stroke-width: 3px; }

.mandos-angulo { flex: none; display: grid; grid-template-columns: 172px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--linea); background: linear-gradient(rgba(7, 16, 27, .92), rgba(3, 8, 14, .96)); }
.selector { display: flex; align-items: stretch; justify-content: center; gap: 8px; }
.btn.ang-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; width: 92px; padding: 8px 6px; font: 600 17px/1 var(--f-mono); letter-spacing: 0; text-transform: none; }
.ang-btn small { font: 500 9.5px/1 var(--f-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--tenue); }
.ang-lectura { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; min-width: 176px; padding: 8px 14px 9px; background: #020704; border: 1px solid #13261a; position: relative; overflow: hidden; }
.ang-lectura::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .28) 0 1px, transparent 1px 3px); }
.ang-lectura .mini { color: #3a8a5a; letter-spacing: .24em; }
.seg-grande { display: flex; align-items: flex-end; font: 700 40px/1 var(--f-seg); color: var(--verde); text-shadow: 0 0 12px rgba(77, 255, 160, .65); }
.seg-grande .d { position: relative; z-index: 0; }
.seg-grande .d::before { content: attr(data-f); position: absolute; right: 0; z-index: -1; color: rgba(77, 255, 160, .07); text-shadow: none; }
.seg-grande .coma { display: inline-block; width: 6px; height: 11px; margin: 0 3px -2px 2px; background: var(--verde); box-shadow: 0 0 8px rgba(77, 255, 160, .8); transform: skewX(-12deg); clip-path: polygon(0 0, 100% 0, 100% 55%, 30% 100%, 0 100%); }
.seg-grande .grado { margin-left: 4px; font: 700 20px/1 var(--f-seg); align-self: flex-start; }
.btn.btn-ejecutar {
  display: inline-flex; align-items: center; gap: 11px; padding: 13px 22px; font-size: 14px; letter-spacing: .24em;
  background: rgba(77, 255, 160, .1); border-color: rgba(77, 255, 160, .65); color: #e3fff0;
  box-shadow: 0 0 22px rgba(77, 255, 160, .14), inset 0 0 16px rgba(77, 255, 160, .08);
}
.btn-ejecutar svg { width: 11px; height: 11px; fill: var(--verde); filter: drop-shadow(0 0 4px var(--verde)); }
.btn-ejecutar small { margin-left: 2px; font: 500 9px/1 var(--f-mono); letter-spacing: .08em; color: rgba(200, 255, 225, .55); }
#btn-confirmar { flex-direction: column; gap: 6px; padding: 14px 20px; line-height: 1.1; text-align: center; }

/* Pegatinas del panel (pequeñas, se pulsan para leerlas en grande) */
.pegatina-mini {
  display: block; width: 100%; padding: 8px 8px 7px; cursor: pointer; text-align: center; border: 4px solid #111; border-radius: 1px;
  background: #f2c200; color: #111; font-family: Consolas, "JetBrains Mono", monospace; box-shadow: 0 6px 16px rgba(0, 0, 0, .55); transform: rotate(-1.5deg);
  transition: transform .2s var(--suave), box-shadow .2s;
}
.pegatina-mini:hover { transform: rotate(0) scale(1.04); box-shadow: 0 10px 22px rgba(0, 0, 0, .6); }
.pegatina-mini .t { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; }
.pegatina-mini .v { display: block; margin: 5px 0 4px; font-size: 16px; white-space: nowrap; font-weight: 700; letter-spacing: .04em; line-height: 1; }
.pegatina-mini .p { display: block; font-size: 8.5px; font-weight: 700; letter-spacing: .08em; }

/* ---------- Fase 3 · Programa (Blockly) ---------- */
#zona-blockly { position: relative; flex: 1; min-height: 0; }
#blockly { position: absolute; inset: 0; }
#bloqueo { position: absolute; inset: 0; z-index: 50; display: none; align-items: flex-start; justify-content: flex-end; padding: 14px 16px; cursor: not-allowed; background: rgba(3, 8, 14, .28); }
#bloqueo::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--ambar), transparent) no-repeat; background-size: 40% 100%; animation: recorrer 1.6s linear infinite; }
#bloqueo span { display: flex; align-items: center; gap: 9px; padding: 7px 11px; border: 1px solid rgba(255, 177, 61, .5); background: rgba(20, 12, 2, .85); font: 600 10px/1 var(--f-mono); letter-spacing: .24em; color: var(--ambar); }
#bloqueo .punto { background: var(--ambar); box-shadow: 0 0 8px var(--ambar); }
body.ejecutando #bloqueo, body.cargado #bloqueo { display: flex; }
body.cargado #bloqueo { background: rgba(2, 16, 8, .3); }
body.cargado #bloqueo::before { background-image: linear-gradient(90deg, transparent, var(--verde), transparent); }
body.cargado #bloqueo span { border-color: rgba(77, 255, 160, .5); background: rgba(2, 20, 10, .85); color: var(--verde); }
body.cargado #bloqueo .punto { background: var(--verde); box-shadow: 0 0 8px var(--verde); }

.acciones { flex: none; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--linea); background: linear-gradient(rgba(7, 16, 27, .92), rgba(3, 8, 14, .96)); }
body.ejecutando .acciones .btn, body.ejecutando .mandos-angulo .btn, body.ejecutando .opcion { opacity: .4; pointer-events: none; }
body.cargado .acciones .btn { opacity: .4; pointer-events: none; }
#contador-bloques { margin-left: auto; font: 500 10.5px/1 var(--f-mono); letter-spacing: .14em; color: var(--tenue); }
#contador-bloques b { color: var(--texto); font-weight: 600; }

.blocklyMainBackground { stroke: none !important; }
.blocklyText.bloque-angulo { font-family: var(--f-mono) !important; font-weight: 700 !important; fill: #fff !important; }
.blocklyFlyoutLabelText { font-family: var(--f-ui) !important; font-size: 10px !important; font-weight: 600 !important; fill: #5f7d93 !important; }
.blocklyTooltipDiv { background: #0a1826 !important; color: var(--texto) !important; border: 1px solid var(--linea-2) !important; border-radius: 2px !important; font: 400 13px/1.4 var(--f-ui) !important; box-shadow: 0 8px 24px rgba(0, 0, 0, .5) !important; }
.blocklyWidgetDiv .blocklyHtmlInput { font-family: var(--f-mono) !important; }
.blocklyZoom > image, .blocklyTrash > image { opacity: .35; }
.blocklyZoom > image:hover, .blocklyTrash > image:hover { opacity: .7; }

/* ---------- Columna derecha ---------- */
#columna { display: grid; grid-template-rows: minmax(200px, 1fr) 150px auto; gap: 14px; min-height: 0; }

#vista { display: flex; flex-direction: column; overflow: hidden; }
#vista-lienzos { position: relative; flex: 1; min-height: 0; background: #01040a; overflow: hidden; }
#vista-lienzos canvas { position: absolute; left: 0; top: 0; display: block; }
.scanlines { position: absolute; inset: 36px 0 0 0; pointer-events: none; background: repeating-linear-gradient(transparent 0 2px, rgba(0, 0, 0, .14) 2px 3px); box-shadow: inset 0 0 70px rgba(0, 0, 0, .75); }
.esquinas {
  position: absolute; inset: 46px 10px 10px 10px; pointer-events: none; --c: rgba(160, 225, 255, .5);
  background-image:
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c));
  background-size: 22px 1px, 1px 22px, 22px 1px, 1px 22px, 22px 1px, 1px 22px, 22px 1px, 1px 22px;
  background-position: left top, left top, right top, right top, left bottom, left bottom, right bottom, right bottom;
  background-repeat: no-repeat;
}
#vista.cambio #vista-lienzos { animation: salto-senal .42s steps(3); }
@keyframes salto-senal { 0% { transform: translateX(-5px); filter: brightness(1.7); } 50% { transform: translateX(4px); } 100% { transform: none; filter: none; } }

/* Lecturas sobre la vista */
.hud { position: absolute; left: 20px; top: 54px; z-index: 3; display: flex; gap: 6px; pointer-events: none; }
.hud-lec { min-width: 88px; padding: 6px 10px 7px; border: 1px solid rgba(160, 225, 255, .28); background: rgba(2, 8, 16, .62); backdrop-filter: blur(2px); }
.hud-lec span { display: block; font: 500 8.5px/1 var(--f-ui); letter-spacing: .26em; color: rgba(185, 225, 250, .7); white-space: nowrap; }
.hud-lec b { display: block; margin-top: 6px; font: 600 16px/1 var(--f-mono); color: var(--texto); white-space: nowrap; }
.hud-lec b small { margin-left: 3px; font-size: 10px; color: var(--cian); }
.hud-lec.mal { border-color: rgba(255, 77, 77, .7); background: rgba(40, 4, 4, .7); }
.hud-lec.mal b { color: #ff9a9a; }
.hud-lec.bien b { color: var(--verde); }
.hud-lec .luces { display: flex; gap: 4px; margin-top: 6px; }
.hud-lec .luces i { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(185, 225, 250, .45); }
.hud-lec .luces i.on { background: var(--ambar); border-color: var(--ambar); box-shadow: 0 0 8px var(--ambar); }
.hud-lec .luces i.roto { background: var(--rojo); border-color: var(--rojo); box-shadow: 0 0 8px var(--rojo); }
.hud-nota { position: absolute; left: 50%; bottom: 16px; z-index: 2; transform: translateX(-50%); padding: 6px 12px 5px; background: rgba(2, 8, 14, .62); white-space: nowrap; font: 500 9.5px/1 var(--f-mono); letter-spacing: .16em; color: rgba(215, 236, 255, .72); pointer-events: none; }

/* Terminal de fósforo verde */
#terminal { display: flex; flex-direction: column; }
#log {
  flex: 1; overflow-y: auto; padding: 8px 14px; font: 400 12px/1.5 var(--f-mono); color: #9ff0c2;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .25) 0 1px, transparent 1px 3px), #020704;
}
#log::-webkit-scrollbar { width: 6px; }
#log::-webkit-scrollbar-thumb { background: #1d3a2a; }
.linea { white-space: pre-wrap; min-height: 1.2em; }
.linea.ok { color: var(--verde); }
.linea.error { color: #ff7b7b; }
.linea.aviso { color: var(--ambar); }
.linea.titulo { color: var(--cian); font-weight: 600; }
.linea.radio { color: #ffd08a; }
.linea.vuelta { color: #7fd6ff; }

/* Abajo: datos de la tripulación o, en la fase 3, la pegatina de los paracaídas (a todo lo ancho) */
#datos { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 8px 14px; }
.tripu { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.tripu-fila { display: flex; align-items: center; gap: 9px; font: 500 10.5px/1 var(--f-mono); letter-spacing: .1em; color: var(--texto-2); white-space: nowrap; overflow: hidden; }
.tripu-fila b { font-weight: 600; color: var(--texto); }
.tripu-fila .est { margin-left: auto; letter-spacing: .14em; }
.tripu-fila.aviso .est { color: var(--ambar); }
.tripu-fila.ok .est { color: var(--verde); }
.tripu-fila .punto { width: 5px; height: 5px; }
.tripu-fila.aviso .punto { background: var(--ambar); box-shadow: 0 0 6px var(--ambar); }
.tripu-fila.ok .punto { background: var(--verde); box-shadow: 0 0 6px var(--verde); }

/* Pegatina del panel de paracaídas, en pequeño */
.placa-mini {
  flex: 1; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 12px; min-width: 0; padding: 6px 12px 6px 8px; cursor: pointer; text-align: left;
  border: 3px solid #111; background: #e9ecef; color: #111; font-family: Consolas, "JetBrains Mono", monospace; box-shadow: 0 5px 14px rgba(0, 0, 0, .5);
  transform: rotate(-.6deg); transition: transform .2s var(--suave);
}
.placa-mini:hover { transform: rotate(0) scale(1.02); }
.placa-mini { grid-template-columns: auto 1fr auto; }
.placa-mini .ico { grid-row: span 2; width: 34px; height: 34px; }
.placa-mini .fila { grid-column: 2; font-size: 12.5px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.placa-mini .fila em { font-style: normal; color: #b3261e; }
.placa-mini .lupa { grid-column: 3; grid-row: 1 / span 2; padding: 5px 7px; border: 2px solid #111; font-size: 9px; font-weight: 700; letter-spacing: .1em; }

/* ---------- Ventanas superpuestas ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(ellipse at center, rgba(3, 11, 20, .7), rgba(1, 3, 7, .92)); backdrop-filter: blur(5px);
}
.caja { position: relative; width: 100%; max-width: 680px; padding: 24px 32px 28px; background-color: rgba(4, 12, 21, .94); border: 1px solid var(--linea-2); box-shadow: 0 30px 90px rgba(0, 0, 0, .65); }
.caja.marco { --esq: 18px; }
.overlay:not(.oculto) .caja { animation: caja-entra .55s var(--suave) both; }
.overlay:not(.oculto) .caja > * { animation: subir .6s var(--suave) both; }
.caja > :nth-child(2) { animation-delay: .12s !important; }
.caja > :nth-child(3) { animation-delay: .2s !important; }
.caja > :nth-child(4) { animation-delay: .28s !important; }
.caja > :nth-child(5) { animation-delay: .36s !important; }
.caja > :nth-child(6) { animation-delay: .44s !important; }
.caja > :nth-child(7) { animation-delay: .52s !important; }
.caja > :nth-child(8) { animation-delay: .6s !important; }
@keyframes caja-entra { from { opacity: 0; transform: scale(.975); clip-path: inset(0 0 100% 0); } to { opacity: 1; transform: none; clip-path: inset(0 0 0 0); } }
.caja-cab { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 13px; margin-bottom: 18px; border-bottom: 1px solid var(--linea); font: 500 10.5px/1 var(--f-mono); letter-spacing: .16em; color: var(--cian); }
.caja-cab > span:first-child { display: flex; align-items: center; gap: 10px; }
.caja-cod { color: var(--tenue); white-space: nowrap; }
.caja-cab.ok { color: var(--verde); }
.caja-cab.ok .punto { background: var(--verde); box-shadow: 0 0 8px var(--verde); }
.caja-cab.mal { color: var(--rojo); }
.caja-cab.mal .punto { background: var(--rojo); box-shadow: 0 0 8px var(--rojo); }
.caja-cab.aviso { color: var(--ambar); }
.caja-cab.aviso .punto { background: var(--ambar); box-shadow: 0 0 8px var(--ambar); }
.caja-sub { font: 500 11px/1 var(--f-ui); letter-spacing: .34em; color: var(--tenue); }
.caja h1 { margin: 12px 0 18px; font: 400 30px/1.2 var(--f-titulo); letter-spacing: .12em; color: var(--cian-2); text-shadow: 0 0 26px rgba(98, 220, 255, .35); }
.caja p { margin: 0 0 12px; font: 400 18px/1.55 var(--f-ui); color: var(--texto-2); }
.caja p b { font-weight: 600; color: var(--texto); }
.aviso-o2 { display: flex; align-items: center; gap: 12px; margin-top: 18px !important; font: 600 12px/1 var(--f-ui) !important; letter-spacing: .24em; text-transform: uppercase; color: var(--ambar) !important; }
.aviso-o2::before { content: "!"; display: grid; place-items: center; width: 20px; height: 18px; padding-top: 5px; background: var(--ambar); color: #1c1000; font: 700 10px/1 var(--f-mono); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.caja p.objetivo { display: flex; align-items: baseline; gap: 12px; margin-top: 16px; padding: 10px 14px; border-left: 3px solid var(--cian); background: rgba(98, 220, 255, .07); color: var(--texto); font-weight: 500; }
.objetivo span { flex: none; font: 600 10px/1 var(--f-mono); letter-spacing: .2em; color: var(--cian); }
.btn-ejecutar.grande { position: relative; overflow: hidden; margin-top: 20px; padding: 16px 38px; font-size: 14px; letter-spacing: .34em; }
.btn-ejecutar.grande::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%; background: linear-gradient(100deg, transparent, rgba(180, 255, 215, .22), transparent); animation: brillo 3.2s ease-in-out infinite; }
@keyframes brillo { 0%, 55% { left: -60%; } 100% { left: 130%; } }
@keyframes rayas { to { background-position: -45px 0; } }
.caja .btn-sec { display: block; margin: 20px 0 0 auto; }

.caja-historia { max-width: 1040px; }
.historia-cuerpo { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 26px; align-items: center; }
.intro-img { margin: 0; }
.intro-img img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border: 1px solid var(--linea-2); }
.intro-img figcaption { margin-top: 8px; font: 400 12.5px/1.45 var(--f-mono); color: var(--tenue); }
.intro-texto h1 { margin-top: 10px; }
.intro-texto .btn-ejecutar.grande { margin-top: 12px; }

/* Radio de Houston, con la cara de quien habla */
#radio { align-items: flex-end; padding-bottom: 56px; background: linear-gradient(transparent 40%, rgba(1, 4, 8, .75)); backdrop-filter: none; }
.caja-radio { max-width: 780px; --c: rgba(255, 177, 61, .75); border-color: rgba(255, 177, 61, .4); box-shadow: 0 0 50px rgba(255, 177, 61, .1), 0 30px 90px rgba(0, 0, 0, .65); }
.caja-radio .caja-cab { color: var(--ambar); border-color: rgba(255, 177, 61, .2); }
#radio-texto { min-height: 3em; margin: 0; font: 400 17px/1.6 var(--f-mono); color: #ffe7bd; }
.radio-cuerpo { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 18px; align-items: start; }
#radio-avatar { width: 76px; height: 76px; object-fit: cover; border: 1px solid rgba(255, 177, 61, .55); box-shadow: 0 0 18px rgba(255, 177, 61, .18); }
.radio-quien { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 6px; }
.radio-quien b { font: 400 13px/1.2 var(--f-titulo); letter-spacing: .12em; color: #ffd08a; }
.radio-quien span { font: 500 10px/1 var(--f-mono); letter-spacing: .2em; color: var(--tenue); }
.onda { display: inline-flex; gap: 2px; align-items: center; height: 16px; }
.onda i { width: 2px; height: 3px; background: var(--ambar); animation: onda .9s infinite ease-in-out; }
.onda i:nth-child(3n) { animation-delay: .15s; } .onda i:nth-child(3n+1) { animation-delay: .3s; }
.onda i:nth-child(4n) { animation-duration: .7s; } .onda i:nth-child(5n) { animation-duration: 1.1s; }
@keyframes onda { 0%, 100% { height: 3px; } 50% { height: 16px; } }

/* Aviso de Tang encontrado */
#aviso-tang {
  position: absolute; left: 50%; top: 90px; z-index: 6; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; max-width: 90%;
  padding: 8px 16px 8px 8px; border: 1px solid rgba(255, 201, 77, .6); background: rgba(30, 20, 4, .9); box-shadow: 0 0 30px rgba(255, 177, 61, .25);
  color: #ffe7bd; pointer-events: none; animation: aparece .35s var(--suave);
}
#aviso-tang img { width: 46px; height: 46px; object-fit: contain; flex: none; }
#aviso-tang img.cara { object-fit: cover; border-radius: 50%; border: 1px solid rgba(255, 190, 90, .55); }
#aviso-tang b { display: block; font: 400 13px/1.3 var(--f-titulo); letter-spacing: .12em; color: var(--ambar); }
#aviso-tang span { font: 400 14.5px/1.35 var(--f-ui); }

/* Listos para la reentrada */
.caja-listo { max-width: 620px; --c: rgba(255, 177, 61, .8); border-color: rgba(255, 177, 61, .45); text-align: center; }
.caja-listo .caja-cab { color: var(--ambar); border-color: rgba(255, 177, 61, .2); text-align: left; }
.caja-listo h1 { color: #ffe2a8; text-shadow: 0 0 26px rgba(255, 177, 61, .35); }
.lista-go { list-style: none; margin: 0 auto 8px; padding: 0; display: grid; gap: 8px; max-width: 460px; text-align: left; }
.lista-go li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid rgba(77, 255, 160, .3); background: linear-gradient(90deg, rgba(77, 255, 160, .1), rgba(77, 255, 160, .02)); font: 500 15px/1.2 var(--f-ui); color: #d4ffe6; }
.lista-go li b { margin-left: auto; font: 600 12px/1 var(--f-mono); letter-spacing: .1em; color: var(--verde); }
.lista-go li::before { content: ""; flex: none; width: 16px; height: 16px; border-radius: 50%; background: var(--verde) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path d='M2.5 6.2 5 8.6 9.6 3.6' fill='none' stroke='%2302200f' stroke-width='1.8'/></svg>") center / 11px no-repeat; box-shadow: 0 0 8px rgba(77, 255, 160, .6); }
.btn.btn-reentrada {
  position: relative; overflow: hidden; margin-top: 22px; padding: 20px 44px; font: 400 16px/1 var(--f-titulo); letter-spacing: .22em; color: #fff4e0;
  border: 1px solid rgba(255, 150, 70, .9);
  background:
    repeating-linear-gradient(-45deg, rgba(255, 120, 50, .7) 0 6px, transparent 6px 12px) top / 100% 5px no-repeat,
    repeating-linear-gradient(-45deg, rgba(255, 120, 50, .7) 0 6px, transparent 6px 12px) bottom / 100% 5px no-repeat,
    radial-gradient(120% 120% at 50% 40%, rgba(255, 130, 60, .5), rgba(120, 30, 8, .6) 60%, rgba(40, 8, 2, .9));
  box-shadow: 0 0 40px rgba(255, 120, 50, .35), inset 0 0 30px rgba(255, 150, 80, .3);
  animation: latido-suave 2.2s ease-in-out infinite;
}
@keyframes latido-suave { 50% { box-shadow: 0 0 60px rgba(255, 120, 50, .55), inset 0 0 30px rgba(255, 150, 80, .45); } }

/* Reto superado */
#exito .caja-listo { max-width: 760px; --c: rgba(77, 255, 160, .75); border-color: rgba(77, 255, 160, .4); }
#exito .caja-listo .caja-cab { color: var(--verde); border-color: rgba(77, 255, 160, .2); }
#exito .caja-listo h1 { margin: 6px 0 14px; color: #d4ffe6; text-shadow: 0 0 26px rgba(77, 255, 160, .35); }
.exito-datos { display: flex; justify-content: center; gap: 22px; margin: 12px 0 0; font: 500 10px/1 var(--f-mono); letter-spacing: .18em; color: var(--tenue); }
.exito-datos b { margin-left: 6px; font: 600 14px/1 var(--f-mono); letter-spacing: .04em; color: var(--texto); }
.caja p.exito-txt { margin: 16px 0 0; font-size: 17px; }
.exito-botones { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.exito-botones .btn.btn-reentrada { margin: 0; padding: 14px 24px; display: inline-flex; flex-direction: column; align-items: center; gap: 7px; font-size: 14px; letter-spacing: .16em; text-decoration: none; }
.btn-reentrada small { font: 500 10px/1 var(--f-mono); letter-spacing: .2em; color: #ffd9b0; }
.exito-botones .nave-btn-master { align-self: stretch; }

.caja-mal { --c: rgba(255, 77, 77, .8); border-color: rgba(255, 77, 77, .5); text-align: center; overflow: hidden; }
.caja-mal::before, .caja-mal::after { content: ""; position: absolute; left: 0; right: 0; height: 8px; background: repeating-linear-gradient(-45deg, var(--rojo) 0 8px, transparent 8px 16px); background-size: 200% 100%; animation: rayas 1s linear infinite; opacity: .8; }
.caja-mal::before { top: 0; } .caja-mal::after { bottom: 0; }
.caja-mal .caja-cab { border-color: rgba(255, 77, 77, .25); }
.caja-mal h1 { color: var(--rojo); text-shadow: 0 0 26px rgba(255, 77, 77, .6); animation: latido 1s infinite; }

/* ---------- Panel del director de juego ---------- */
#gm { position: fixed; top: 70px; right: 16px; z-index: 300; width: 400px; max-height: calc(100vh - 86px); overflow: auto; padding: 16px; background: rgba(18, 9, 28, .97); border: 1px solid rgba(190, 140, 255, .6); box-shadow: 0 20px 60px rgba(0, 0, 0, .6); font: 400 12px/1.4 var(--f-mono); color: var(--texto); }
.gm-cab { margin-bottom: 12px; font: 600 11px/1 var(--f-ui); letter-spacing: .26em; color: #d2a8ff; }
.gm-botones { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 12px; }
.gm-botones .btn { padding: 9px 8px; font-size: 11px; letter-spacing: .08em; border-color: rgba(190, 140, 255, .35); background: rgba(190, 140, 255, .06); }
.gm-sub { margin-bottom: 6px; color: var(--tenue); }
#gm-resultados { max-height: 150px; overflow: auto; margin: 0 0 12px; padding-left: 18px; }
#gm .btn-sec { margin: 0; border-color: rgba(190, 140, 255, .35); }

/* ---------- Destello ---------- */
#flash { position: fixed; inset: 0; z-index: 90; pointer-events: none; opacity: 0; }
#flash.activo { animation: destello .7s; }
#flash.rojo { background: radial-gradient(transparent 30%, rgba(255, 30, 30, .5)); }
#flash.ambar { background: radial-gradient(transparent 30%, rgba(255, 170, 30, .45)); }
#flash.verde { background: radial-gradient(transparent 30%, rgba(61, 255, 138, .35)); }
@keyframes destello { 0% { opacity: 1; } 100% { opacity: 0; } }
body.temblor #app { animation: temblor .09s linear 8; }
@keyframes temblor { 25% { transform: translate(-3px, 2px); } 50% { transform: translate(2px, -2px); } 75% { transform: translate(-1px, -3px); } }

/* ---------- Lectura de una pegatina en grande ---------- */
#lectura { position: fixed; inset: 0; z-index: 150; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 16px; cursor: pointer;
  background: radial-gradient(ellipse at center, rgba(3, 11, 20, .6), rgba(1, 3, 7, .86)); backdrop-filter: blur(3px); animation: aparecer .3s; }
#lectura-hoja { animation: crecer .4s var(--suave); }
@keyframes crecer { from { transform: scale(.6) rotate(-4deg); opacity: 0; } to { transform: rotate(-1.5deg); } }
@keyframes aparecer { from { opacity: 0; } }
#lectura-hoja { transform: rotate(-1.5deg); }
#lectura-pie { font: 500 10px/1 var(--f-mono); letter-spacing: .24em; color: var(--texto-2); }
.peg-grande {
  width: min(470px, 88vw); padding: 24px 20px 20px; text-align: center; border: 6px solid #111; background: #f2c200; color: #111;
  font-family: Consolas, "JetBrains Mono", monospace; box-shadow: 0 30px 60px rgba(0, 0, 0, .65);
}
.peg-grande .t { font-size: 18px; font-weight: 700; letter-spacing: .14em; }
.peg-grande .v { margin: 12px 0 10px; font-size: 60px; font-weight: 700; letter-spacing: .04em; line-height: 1; }
.peg-grande .p { font-size: 13px; font-weight: 700; letter-spacing: .06em; }
.placa-grande {
  width: min(640px, 92vw); padding: 22px 26px 20px; border: 6px solid #111; background: #e9ecef; color: #111; font-family: Consolas, "JetBrains Mono", monospace;
  box-shadow: 0 30px 60px rgba(0, 0, 0, .65);
}
.placa-grande .cab { padding-bottom: 12px; margin-bottom: 14px; border-bottom: 3px solid #111; font-size: 16px; font-weight: 700; letter-spacing: .18em; text-align: center; }
.placa-grande .sec { display: grid; grid-template-columns: 70px 1fr; gap: 16px; align-items: center; padding: 10px 0; }
.placa-grande .sec + .sec { border-top: 2px dashed #777; }
.placa-grande .sec svg { width: 70px; height: 64px; }
.placa-grande h3 { margin: 0 0 6px; font-size: 18px; letter-spacing: .06em; }
.placa-grande p { margin: 0; font-size: 16px; line-height: 1.45; font-weight: 600; }
.placa-grande em { font-style: normal; background: #111; color: #f2c200; padding: 0 5px; }

/* ---------- Encendido ---------- */
body.apagado #app { filter: saturate(.2) brightness(.45); }
body.encendiendo #barra { animation: encender-barra .7s var(--suave) both; }
body.encendiendo .panel { animation: encender-panel .9s var(--suave) both; }
body.encendiendo #vista { animation-delay: .12s; }
body.encendiendo #terminal { animation-delay: .24s; }
body.encendiendo #datos { animation-delay: .34s; }
@keyframes encender-barra { from { opacity: 0; transform: translateY(-100%); } }
@keyframes encender-panel {
  0% { opacity: 0; clip-path: inset(49.5% 0 49.5% 0); }
  35% { opacity: 1; clip-path: inset(49.5% 0 49.5% 0); }
  40% { opacity: .4; }
  45% { opacity: 1; }
  100% { opacity: 1; clip-path: inset(0 0 0 0); }
}

/* ---------- Pantallas bajas, medianas y estrechas ---------- */
@media (max-height: 820px) {
  main { gap: 10px; padding: 10px; }
  #columna { grid-template-rows: minmax(170px, 1fr) 128px auto; gap: 10px; }
  .g-explica { padding: 10px 16px 8px; }
  .g-texto p { font-size: 14.5px; }
  #opciones { gap: 10px; padding: 10px 16px 14px; }
  .op-pie { padding: 8px 12px 9px; }
  .op-txt { font-size: 15px; }
  .mandos-angulo { padding: 9px 14px; }
  .seg-grande { font-size: 34px; }
  .consigna { padding: 8px 16px; font-size: 13.5px; }
  .mochila-pie { min-height: 58px; padding: 8px 14px; }
  .pasos-mochila li { padding: 6px 9px; font-size: 13.5px; }
  .caja-historia p { font-size: 17px; }
}
@media (max-width: 1400px) {
  .panel-titulo .sub { display: none; }
  #barra { gap: 20px; }
  .fases li { padding: 0 10px 0 8px; letter-spacing: .18em; }
  .mandos-angulo { grid-template-columns: 150px minmax(0, 1fr) auto; gap: 12px; }
  .btn.ang-btn { width: 80px; }
}
@media (max-width: 1100px) {
  html, body { overflow: auto; }
  #app { height: auto; }
  main { grid-template-columns: 1fr; }
  #principal { height: 88vh; }
  #columna { grid-template-rows: 50vh 180px auto; }
  .marca-txt span, .fases, .o2-sv { display: none; }
  .o2 { width: 150px; }
  .historia-cuerpo { grid-template-columns: 1fr; }
  .intro-img { display: none; }
}

/* ---------- Menos movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  /* la mochila: el aro de lo que toca y el bufido de Tang se ven quietos */
  .mo-toque.toca .mo-anillo { animation: none !important; opacity: .9; }
  .mo-bocadillo.visible { animation: none !important; opacity: 1; }
}
