/* ===============================================================
   SELENE-7 · RETO 4 · ASPECTO
   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.
   =============================================================== */
: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;
  --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);
  --col: 340px;          /* ancho de la columna derecha */
  --hueco: 14px;
}

* { 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; }
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; }
@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; } }
@keyframes sacudir { 0%, 100% { transform: none; } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }

.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;
}
.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, .obj:focus-visible, .herr:focus-visible, .chip-obj:focus-visible { outline: 1px solid var(--cian); outline-offset: 2px; }
.enlace { background: none; border: 0; padding: 4px 0; color: var(--texto-2); font: 500 12px/1 var(--f-mono); letter-spacing: .14em; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.enlace:hover { color: var(--cian); }

/* ---------- Barra superior ---------- */
#barra {
  position: relative; display: flex; align-items: center; gap: 30px; 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: 1 SOLTAR PESO · 2 DISYUNTOR · 3 ENCENDIDO */
#fases { display: flex; align-items: center; margin: 0; padding: 0; list-style: none; }
#fases li {
  position: relative; display: flex; align-items: center; gap: 9px; height: 30px; padding: 0 13px 0 7px; border: 1px solid var(--linea-2);
  font: 500 9.5px/1 var(--f-ui); letter-spacing: .24em; color: var(--tenue); white-space: nowrap; transition: color .4s, border-color .4s, background .4s, box-shadow .4s;
}
#fases li + li { margin-left: 18px; }
#fases li + li::before { content: ""; position: absolute; left: -19px; top: 50%; width: 18px; height: 1px; background: var(--linea-2); }
#fases li i { display: grid; place-items: center; width: 17px; height: 17px; border: 1px solid currentColor; font: 600 10px/1 var(--f-mono); font-style: normal; letter-spacing: 0; }
#fases li.activa { color: var(--cian-2); border-color: var(--cian); background: rgba(98, 220, 255, .08); box-shadow: 0 0 16px rgba(98, 220, 255, .15); }
#fases li.activa i { background: var(--cian); border-color: var(--cian); color: #021018; }
#fases li.hecha { color: var(--verde); border-color: rgba(77, 255, 160, .45); background: rgba(77, 255, 160, .05); }
#fases li.hecha i { border-color: var(--verde); font-size: 9px; }
#fases li.hecha + li::before { background: rgba(77, 255, 160, .5); }

.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.bien { 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(0, 1fr) var(--col); gap: var(--hueco); padding: var(--hueco); 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 {
  flex: none; display: flex; align-items: center; gap: 10px; height: 36px; 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); }

#escenario { position: relative; min-height: 0; min-width: 0; display: grid; }
.fase { min-height: 0; min-width: 0; }
.fase.entra { animation: encender-panel .8s var(--suave) both; }
#fase1, #fase2 { display: flex; flex-direction: column; overflow: hidden; }
.vista { position: relative; }

#columna { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: var(--hueco); min-height: 0; }

/* Modos (../comun/nave.js pone body.nave-explorador o body.nave-master) */
body.nave-master .solo-explorador, body.nave-explorador .solo-master { display: none !important; }

/* ---------- Qué hay que hacer (pasos de la fase) ----------
   Un botón ámbar en la cabecera del módulo de cada fase (en la 3, el de TRAYECTORIA)
   abre una ventana de ../comun/nave.js con tres pasos cortos y numerados */
.btn-pasos {
  flex: none; display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 10px 0 8px; cursor: pointer; user-select: none;
  border: 1px solid rgba(255, 177, 61, .55); border-radius: 2px; background: rgba(255, 177, 61, .08); color: #ffe0a8;
  font: 600 10.5px/1 var(--f-ui); letter-spacing: .16em; white-space: nowrap;
  transition: transform .08s, background .2s, border-color .2s, box-shadow .2s;
}
/* Icono de lista (con máscara: toma el color del texto) */
.btn-pasos::before {
  content: ""; flex: none; width: 13px; height: 13px; background: var(--ambar);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'><path d='M2 3.5h1.4M2 8h1.4M2 12.5h1.4M6 3.5h8M6 8h8M6 12.5h8'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'><path d='M2 3.5h1.4M2 8h1.4M2 12.5h1.4M6 3.5h8M6 8h8M6 12.5h8'/></svg>") center / contain no-repeat;
}
.btn-pasos:hover { border-color: var(--ambar); background: rgba(255, 177, 61, .17); box-shadow: 0 0 14px rgba(255, 177, 61, .22); }
.btn-pasos:active { transform: scale(.96); }
.btn-pasos:focus-visible { outline: 1px solid var(--ambar); outline-offset: 2px; }
/* Al empezar cada fase, el botón se ilumina unas veces */
.btn-pasos.nuevo { animation: pasos-nuevo 1.2s var(--suave) 3; }
@keyframes pasos-nuevo { 0%, 40% { background: rgba(255, 177, 61, .22); box-shadow: 0 0 0 1px var(--ambar), 0 0 22px rgba(255, 177, 61, .5); } }

/* La ventana (Nave.ventana, ../comun/nave.js) */
.nave-caja.nave-caja-pasos { max-width: 560px; border-color: rgba(255, 177, 61, .45); }
.nave-caja-pasos .nave-cab { color: var(--ambar); }
.nave-caja-pasos .nave-cab span:last-child { color: #c9a063; }
.nave-pasos h2 { margin: 0 0 16px; font: 400 22px/1.2 var(--f-titulo); letter-spacing: .12em; color: #ffe0a8; }
.pasos-lista { margin: 0 0 20px; padding: 0; list-style: none; counter-reset: paso; display: flex; flex-direction: column; gap: 12px; }
.pasos-lista li { counter-increment: paso; position: relative; padding-left: 40px; min-height: 28px; font: 500 18px/1.4 var(--f-ui); color: var(--texto); }
.pasos-lista li::before {
  content: counter(paso); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 27px; height: 27px; border-radius: 50%;
  background: var(--ambar); color: #1c1000; font: 700 13px/1 var(--f-mono);
}
.pasos-lista b { color: #ffe0a8; font-weight: 700; }
.pasos-lista b.verde { color: var(--verde); }

/* ---------- Masa de la nave ---------- */
.masa-cuerpo { display: flex; flex-direction: column; gap: 11px; padding: 13px 14px 14px; }
.masa-fila { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.masa-fila.sec b { font: 500 13px/1 var(--f-mono); color: var(--ambar); }
.masa-valor { font: 500 32px/1 var(--f-mono); letter-spacing: -.01em; color: var(--texto); transition: color .3s; }
.masa-valor small { margin-left: 6px; font-size: 12px; color: var(--cian); letter-spacing: .06em; }
#masa.fijada .masa-valor { color: #c9ffe3; text-shadow: 0 0 16px rgba(77, 255, 160, .35); }
.masa-barra { position: relative; height: 12px; margin: 4px 0 2px; background: repeating-linear-gradient(90deg, rgba(126, 206, 255, .16) 0 3px, transparent 3px 6px); }
.masa-zona { position: absolute; top: 0; bottom: 0; right: 0; background: repeating-linear-gradient(-45deg, rgba(255, 77, 77, .45) 0 4px, transparent 4px 8px); }
.masa-limite { position: absolute; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; background: var(--ambar); box-shadow: 0 0 8px var(--ambar); }
.masa-aguja { position: absolute; top: -7px; bottom: -7px; width: 0; border-left: 2px solid var(--cian-2); box-shadow: 0 0 10px var(--cian); transition: left .6s var(--suave); }
.masa-aguja::before { content: ""; position: absolute; top: -2px; left: -6px; border: 5px solid transparent; border-top-color: var(--cian-2); }
.masa-estado { padding: 8px 10px 7px; border: 1px solid; text-align: center; font: 600 10.5px/1.2 var(--f-ui); letter-spacing: .22em; transition: color .3s, border-color .3s, background .3s; }
.masa-estado.mal { color: #ffb3b3; border-color: rgba(255, 77, 77, .55); background: rgba(255, 77, 77, .08); }
.masa-estado.ok { color: var(--verde); border-color: rgba(77, 255, 160, .5); background: rgba(77, 255, 160, .07); }
.masa-estado.aviso { color: var(--ambar); border-color: rgba(255, 177, 61, .55); background: rgba(255, 177, 61, .07); }
#masa.prueba .masa-estado { background: #e4e8ea; color: #151a1e; border-color: #fff; }

/* ---------- Terminal de GUIDO ---------- */
#terminal { display: flex; flex-direction: column; }
#log {
  flex: 1; min-height: 0; overflow-y: auto; padding: 9px 14px; font: 400 12px/1.55 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; }


/* ---------- Carteles sobre la vista ---------- */
.banner {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 20; min-width: 62%; max-width: 92%;
  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: repeating-linear-gradient(-45deg, rgba(255, 177, 61, .7) 0 6px, transparent 6px 12px) top / 100% 4px no-repeat, rgba(34, 22, 3, .9);
  border-color: rgba(255, 177, 61, .65); color: #ffe7bd; 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); text-shadow: 0 0 14px rgba(255, 177, 61, .5); }
.banner.bien .b-titulo { color: var(--verde); text-shadow: 0 0 14px rgba(77, 255, 160, .5); }
.b-sub { margin-top: 7px; font: 400 14.5px/1.4 var(--f-ui); }
@keyframes aparece { from { transform: translateX(-50%) scale(.94); opacity: 0; } }
.f1-vista .banner { bottom: auto; top: 34%; }
.tray-vista .banner { bottom: 34px; min-width: 0; width: max-content; max-width: 88%; padding: 9px 16px 11px; }
.tray-vista .b-titulo { font-size: 14.5px; }
.tray-vista .b-sub { font-size: 13px; }

/* ===============================================================
   FASE 1 · SOLTAR PESO
   =============================================================== */
.f1-vista { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 12px 14px 14px; }
/* 15 objetos y el pósit: 4 × 4. «dense» rellena los huecos que deja el pósit al ir en la última columna */
#objetos { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 8px; }
.obj {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto auto; align-content: center; column-gap: 10px;
  min-height: 0; padding: 10px 12px 10px 10px; text-align: left; overflow: hidden; cursor: pointer; color: var(--texto);
  border: 1px solid var(--linea-2); border-radius: 2px;
  background: linear-gradient(155deg, rgba(98, 220, 255, .07), rgba(98, 220, 255, .015) 60%), rgba(4, 11, 19, .6);
  transition: border-color .2s, background .2s, box-shadow .2s, opacity .3s, transform .15s;
}
.obj::before { content: ""; position: absolute; left: 0; top: 0; width: 10px; height: 1px; background: var(--linea-3); box-shadow: 0 0 0 0 transparent; }
.obj:hover { border-color: var(--linea-3); background: linear-gradient(155deg, rgba(98, 220, 255, .13), rgba(98, 220, 255, .03) 60%), rgba(4, 11, 19, .6); box-shadow: 0 0 18px rgba(98, 220, 255, .12); }
.obj:active { transform: scale(.98); }
.obj-icono { grid-row: 1; width: 46px; height: 46px; color: var(--cian-2); }
.obj-icono svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.obj-icono img { display: block; width: 100%; height: 100%; object-fit: contain; }
.obj-masa { justify-self: end; align-self: start; margin-top: 4px; font: 500 19px/1 var(--f-mono); color: var(--texto); }
.obj-masa small { margin-left: 3px; font-size: 10.5px; color: var(--tenue); }
.obj-nombre { grid-column: 1 / -1; margin-top: 8px; font: 600 14.5px/1.15 var(--f-ui); letter-spacing: .01em; color: var(--texto); }
.obj-detalle { grid-column: 1 / -1; margin-top: 3px; font: 400 12.5px/1.25 var(--f-ui); color: var(--texto-2); }
.obj-sello { position: absolute; right: 8px; bottom: 7px; font: 600 9.5px/1 var(--f-mono); letter-spacing: .14em; color: var(--ambar); }
/* Acentos de color de los iconos */
svg .tenue { opacity: .45; }
svg .pelo { stroke: #ff9b4a; }
svg .rojo { stroke: #ff6b6b; }
svg .rojo.gordo { stroke-width: 3; }
svg .naranja { fill: rgba(255, 155, 61, .55); stroke: #ffb46e; }
svg .papel { stroke: #c9d2da; stroke-dasharray: 2 1.6; }
svg .agua { stroke: #6cc4ff; }
svg .azul { fill: rgba(56, 110, 220, .35); }
svg .orejas { display: none; }
.obj.con-tang svg .orejas { display: inline; }
svg .naranja-t { stroke: #ffab5c; fill: rgba(255, 155, 61, .5); }
svg .marron { fill: rgba(150, 92, 48, .75); stroke: #d49a66; }
svg .ojo { fill: #f6f1e8; stroke: none; }
svg .pupila { fill: #22130a; stroke: none; }
svg .boca { stroke: #22130a; }
/* En la esclusa: la tarjeta queda como un hueco */
.obj.dentro { border-style: dashed; border-color: rgba(255, 177, 61, .55); background: rgba(255, 177, 61, .04); }
.obj.dentro > :not(.obj-sello) { opacity: .28; }
.obj.expulsado { cursor: default; border-style: dashed; border-color: var(--linea); background: none; }
.obj.expulsado > :not(.obj-sello) { opacity: .18; }
.obj.expulsado .obj-sello { color: var(--tenue); }
.obj.expulsado:hover { box-shadow: none; }
/* Tang: no es una opción */
.obj.bloqueado { cursor: default; border-color: rgba(126, 206, 255, .16); background: repeating-linear-gradient(-45deg, rgba(126, 206, 255, .04) 0 6px, transparent 6px 12px), rgba(4, 10, 16, .6); }
.obj.bloqueado .obj-icono img { filter: grayscale(1) brightness(.75); }
.obj.bloqueado .obj-nombre, .obj.bloqueado .obj-masa { color: var(--texto-2); }
.obj.bloqueado .obj-sello { right: 10px; bottom: 9px; transform: rotate(-7deg); transform-origin: right bottom; padding: 5px 8px 4px; border: 2px solid rgba(255, 77, 77, .75); color: #ff8a8a; font-size: 11px; letter-spacing: .16em; white-space: nowrap; background: rgba(30, 4, 4, .6); }
.obj.bloqueado.encontrado .obj-icono img { filter: none; }
.obj.bloqueado.ronrona .obj-icono { animation: ronroneo .5s ease-in-out 2; }
@keyframes ronroneo { 25% { transform: translateX(-1.5px) rotate(-2deg); } 75% { transform: translateX(1.5px) rotate(2deg); } }
/* EXPLORADOR: lo que no se puede soltar viene marcado */
.obj.se-queda { cursor: default; border-color: rgba(126, 206, 255, .16); background: rgba(4, 10, 16, .55); }
.obj.se-queda > :not(.obj-sello) { opacity: .5; }
.obj.se-queda:hover { box-shadow: none; border-color: rgba(126, 206, 255, .22); background: rgba(4, 10, 16, .55); }
.obj.se-queda .obj-sello { right: 10px; bottom: 9px; padding: 5px 8px 4px; border: 2px solid rgba(98, 220, 255, .6); color: var(--cian-2); font-size: 11px; letter-spacing: .16em; background: rgba(2, 16, 26, .7); transform: rotate(-5deg); transform-origin: right bottom; }
/* Alguien ha dicho que no: la tarjeta intenta irse y vuelve */
.obj.rechazo { animation: rechazo .55s var(--suave); border-color: var(--rojo); }
@keyframes rechazo { 0% { transform: none; } 30% { transform: translateY(10px) scale(.97); } 55% { transform: translateX(-5px); } 75% { transform: translateX(4px); } 100% { transform: none; } }
.obj.con-tang { border-color: rgba(255, 177, 61, .6); }
.obj.con-tang .obj-sello { color: var(--ambar); }
.obj.miau .obj-icono { animation: saltito .5s var(--suave) 2; }
@keyframes saltito { 40% { transform: translateY(-6px) rotate(-6deg); } }
.miau-globo {
  position: absolute; right: 10px; top: 8px; padding: 5px 10px 4px; background: var(--ambar); color: #221300; font: 400 16px/1 var(--f-titulo); letter-spacing: .08em;
  clip-path: polygon(0 0, 100% 0, 100% 78%, 30% 78%, 16% 100%, 18% 78%, 0 78%); padding-bottom: 12px; animation: globo 2.6s var(--suave) forwards; pointer-events: none;
}
@keyframes globo { 0% { transform: scale(.4); opacity: 0; } 12% { transform: scale(1.08); opacity: 1; } 20% { transform: none; } 85% { opacity: 1; } 100% { opacity: 0; } }
.obj.arrastrando { opacity: .5; }

/* Pósit de Irene junto a los bidones: en la última columna, justo debajo del tercero */
.posit-agua {
  grid-column: -2;
  position: relative; align-self: center; justify-self: center; width: min(100%, 170px); aspect-ratio: 1.15; max-height: 100%; padding: 20px 12px 10px; border: 0; cursor: pointer; text-align: left;
  border-radius: 1px 1px 3px 3px / 1px 1px 12px 12px; transform: rotate(-3.5deg);
  font: 400 13px/1.45 var(--f-mano); color: #1d2a6a;
  background: linear-gradient(rgba(0, 0, 0, .06), rgba(0, 0, 0, .015) 14px, transparent 15px), linear-gradient(170deg, #fee873 62%, #eccf50);
  box-shadow: 0 2px 2px rgba(0, 0, 0, .35), 0 12px 22px rgba(0, 0, 0, .5); transition: transform .25s var(--suave);
}
.posit-agua:hover { transform: rotate(0) scale(1.06); }
.pa-celo { position: absolute; left: 50%; top: -7px; width: 52px; height: 15px; margin-left: -26px; background: rgba(240, 240, 228, .55); transform: rotate(-4deg); }
.pa-hora { position: absolute; right: 10px; top: 5px; font-weight: 700; font-size: 12px; color: #c23b2b; transform: rotate(3deg); }
.pa-texto { display: block; }
.pa-texto b { font-weight: 700; }
.pa-texto .subr, .ng-texto .subr { text-decoration: underline; text-decoration-thickness: 2px; }
.pa-firma { position: absolute; right: 12px; bottom: 6px; font-size: 12px; color: #4a5a78; }

/* Esclusa de carga */
#esclusa {
  flex: none; position: relative; display: grid; grid-template-columns: 196px minmax(0, 1fr) 120px; grid-template-rows: 1fr auto; grid-template-areas: "info camara espacio" "mando camara espacio";
  height: 164px; border: 1px solid var(--linea-2); background: linear-gradient(rgba(8, 17, 28, .95), rgba(4, 9, 15, .95)); overflow: hidden; transition: border-color .3s, box-shadow .3s;
}
#esclusa.sobre { border-color: var(--ambar); box-shadow: 0 0 24px rgba(255, 177, 61, .25); }
.esc-info { grid-area: info; display: flex; flex-direction: column; gap: 7px; padding: 12px 14px 0; border-right: 1px solid var(--linea); }
.esc-info b { margin-bottom: 2px; font: 400 10px/1.1 var(--f-titulo); letter-spacing: .1em; color: var(--cian-2); white-space: nowrap; }
.esc-info span { font: 500 9.5px/1 var(--f-ui); letter-spacing: .2em; color: var(--tenue); }
.esc-info em { font: 500 10.5px/1 var(--f-mono); font-style: normal; letter-spacing: .02em; color: var(--texto-2); }
.esc-mando { grid-area: mando; display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 6px 10px; padding: 0 14px 12px; border-right: 1px solid var(--linea); }
#esc-kg { justify-self: end; font: 500 19px/1 var(--f-mono); color: #ffe0a8; }
.btn.btn-expulsar {
  grid-column: 1 / -1; position: relative; overflow: hidden; padding: 12px 10px; font: 400 13px/1 var(--f-titulo); letter-spacing: .2em; color: #fff0f0;
  border: 1px solid rgba(255, 100, 100, .9);
  background:
    repeating-linear-gradient(-45deg, rgba(255, 77, 77, .7) 0 5px, transparent 5px 10px) top / 100% 4px no-repeat,
    repeating-linear-gradient(-45deg, rgba(255, 77, 77, .7) 0 5px, transparent 5px 10px) bottom / 100% 4px no-repeat,
    radial-gradient(120% 120% at 50% 35%, rgba(255, 70, 70, .5), rgba(110, 12, 12, .6) 60%, rgba(40, 4, 4, .9));
  box-shadow: 0 0 20px rgba(255, 77, 77, .25), inset 0 0 20px rgba(255, 90, 90, .25);
}
.btn-expulsar span { text-shadow: 0 0 12px rgba(255, 120, 120, .7); }
.btn.btn-expulsar:disabled { opacity: .3; }
.esc-camara {
  grid-area: camara; position: relative; display: grid; grid-template-columns: 18px minmax(0, 1fr) 18px; min-width: 0;
  background: repeating-linear-gradient(90deg, rgba(126, 206, 255, .05) 0 1px, transparent 1px 28px), radial-gradient(ellipse at center, #0b1622, #050a10);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, .8);
}
.esc-puerta { position: relative; z-index: 2; display: flex; align-items: center; justify-content: center; background: repeating-linear-gradient(-45deg, #e0a526 0 6px, #1a1204 6px 12px); opacity: .85; transition: transform .6s var(--suave), opacity .3s; }
.esc-puerta span { writing-mode: vertical-rl; transform: rotate(180deg); padding: 4px 1px; background: rgba(10, 8, 2, .85); font: 600 8px/1 var(--f-mono); letter-spacing: .2em; color: var(--ambar); }
.esc-puerta.exterior { transform-origin: top; }
#esc-dentro { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 6px; min-width: 0; padding: 8px 10px; }
.esc-vacia { font: 400 13px/1.3 var(--f-ui); color: var(--tenue); text-align: center; }
.chip-obj {
  display: flex; align-items: center; gap: 7px; max-width: 100%; padding: 4px 10px 4px 4px; cursor: pointer; white-space: nowrap;
  border: 1px solid rgba(255, 177, 61, .55); border-radius: 2px; background: rgba(255, 177, 61, .09); color: #ffe7bd; font: 600 12.5px/1 var(--f-ui);
  transition: background .2s, border-color .2s;
}
.chip-obj:hover { background: rgba(255, 177, 61, .18); border-color: var(--ambar); }
.chip-obj .ci { flex: none; width: 26px; height: 26px; color: #ffe0a8; }
.chip-obj .ci svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chip-obj .cn { overflow: hidden; text-overflow: ellipsis; }
.chip-obj b { font: 500 11.5px/1 var(--f-mono); color: var(--ambar); }
.chip-obj.entra { animation: chip-entra .35s var(--suave); }
@keyframes chip-entra { from { transform: translateY(-14px) scale(.9); opacity: 0; } }
.esc-espacio { grid-area: espacio; position: relative; overflow: hidden; background: radial-gradient(circle at 130% 120%, rgba(160, 170, 185, .5) 0 34%, rgba(90, 100, 115, .35) 35%, transparent 36%), #000; border-left: 1px solid var(--linea); }
.esc-estrellas { position: absolute; inset: 0; opacity: .8; background:
  radial-gradient(1px 1px at 20% 30%, #fff, transparent), radial-gradient(1px 1px at 70% 15%, #cfe8ff, transparent), radial-gradient(1.2px 1.2px at 45% 65%, #fff, transparent),
  radial-gradient(1px 1px at 85% 55%, #fff, transparent), radial-gradient(1px 1px at 12% 80%, #bfe0ff, transparent), radial-gradient(1px 1px at 60% 88%, #fff, transparent),
  radial-gradient(1px 1px at 32% 8%, #fff, transparent), radial-gradient(1px 1px at 92% 90%, #fff, transparent); }
/* Ciclo de la esclusa */
#esclusa.ciclo { border-color: rgba(255, 177, 61, .7); box-shadow: 0 0 30px rgba(255, 177, 61, .2); }
#esclusa.ciclo #esc-presion { color: var(--ambar); }
.esc-camara.sellada .esc-puerta.interior { opacity: 1; box-shadow: 0 0 16px rgba(255, 177, 61, .6); }
.esc-camara.sellada::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(255, 90, 60, .12), transparent 40%); animation: latido .6s infinite; }
.esc-camara.abierta .esc-puerta.exterior { transform: scaleY(0); opacity: 0; }
.esc-camara.abierta #esc-dentro { overflow: visible; }
#esclusa.ciclo { overflow: hidden; }
#esclusa.ciclo .esc-camara, #esclusa.ciclo #esc-dentro { overflow: visible; }
.chip-obj.sale { animation: al-espacio 1.7s cubic-bezier(.4, 0, .7, 1) forwards; }
@keyframes al-espacio { 0% { transform: none; opacity: 1; } 100% { transform: translate(560px, var(--dy)) rotate(var(--giro)) scale(.35); opacity: 0; } }
#esclusa.hecha { border-color: rgba(77, 255, 160, .4); }

/* ===============================================================
   FASE 2 · EL DISYUNTOR
   =============================================================== */
#fase2 .panel-estado .punto.rec + * { color: var(--rojo); }
#fase2.resuelta .panel-estado { color: var(--verde); }
#fase2.resuelta .panel-estado .punto { background: var(--verde); box-shadow: 0 0 8px var(--verde); }
.f2-vista { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(230px, 29%); gap: 12px; padding: 12px 14px; }
#panel16 { position: relative; min-height: 0; min-width: 0; display: flex; align-items: center; justify-content: center; border: 1px solid var(--linea); background: radial-gradient(ellipse at 40% 40%, rgba(40, 70, 100, .15), transparent 70%), #03080d; }
#panel16 > svg { display: block; width: 100%; height: 100%; }
#panel16.sacudida > svg { animation: sacudir .45s; }
.p16-titulo { font: 700 13px var(--f-ui); letter-spacing: .34em; fill: #cfd8e0; }
.p16-grupo { fill: none; stroke: #9fb0bf; stroke-width: 1; opacity: .55; }
.p16-grupo-txt { font: 600 9.5px var(--f-ui); letter-spacing: .28em; fill: #9fb0bf; paint-order: stroke; stroke: #131b24; stroke-width: 6px; }
.p16-etq { font: 600 8.6px var(--f-ui); letter-spacing: .06em; fill: #c9d4de; }
.p16-etq.roto { fill: var(--ambar); }
.p16-etq.cerrado { fill: var(--verde); }
.tornillo circle { fill: #2a3542; stroke: #0b1016; }
.tornillo path { stroke: #0b1016; stroke-width: 1.4; }
.dis-base { fill: #0a0e13; stroke: #2e3a46; stroke-width: 1; }
.dis-banda { fill: none; stroke: #eef3f7; stroke-width: 2.6; display: none; }
.dis.abierto .dis-banda { display: inline; }
.dis, #dis-roto { cursor: pointer; }
.dis:hover .dis-base { stroke: var(--cian); }
.dis.recien .dis-base { stroke: var(--verde); stroke-width: 1.6; filter: drop-shadow(0 0 4px var(--verde)); }
.dis-pomo { stroke: #000; stroke-width: .6; }
.dis-brillo { fill: rgba(255, 255, 255, .16); }
#dis-roto .grieta { fill: none; stroke: #55616d; stroke-width: .9; }
#dis-roto .trozo { fill: #10151b; stroke: #3b4652; stroke-width: .8; }
#dis-roto .contacto { filter: drop-shadow(0 0 3px rgba(255, 200, 100, .6)); }
.dis-luz { fill: #2a1414; stroke: #0b0f14; }
#dis-roto.cerrado .dis-luz { fill: var(--verde); filter: drop-shadow(0 0 5px var(--verde)); }
#dis-roto.cerrado .contacto { filter: drop-shadow(0 0 6px var(--verde)); }
.huella { fill: rgba(222, 205, 176, .34); }
.pelos { fill: none; stroke: #ff9b4a; stroke-width: 1; opacity: .75; }
.dis-marca { position: absolute; pointer-events: none; border: 1px solid rgba(255, 177, 61, .8); box-shadow: 0 0 18px rgba(255, 177, 61, .3), inset 0 0 12px rgba(255, 177, 61, .15); animation: marca 1.6s ease-in-out infinite; }
.dis-marca::before, .dis-marca::after { content: ""; position: absolute; left: 50%; width: 1px; height: 8px; background: var(--ambar); }
.dis-marca::before { top: -9px; } .dis-marca::after { bottom: -9px; height: 11px; }
.dis-marca span { position: absolute; left: 50%; top: calc(100% + 12px); transform: translateX(-50%); padding: 4px 7px 3px; background: rgba(30, 18, 2, .9); border: 1px solid rgba(255, 177, 61, .6); font: 600 9.5px/1 var(--f-mono); letter-spacing: .18em; color: var(--ambar); white-space: nowrap; }
.dis-marca.ok { border-color: rgba(77, 255, 160, .8); box-shadow: 0 0 22px rgba(77, 255, 160, .35); animation: none; }
.dis-marca.ok::before, .dis-marca.ok::after { background: var(--verde); }
.dis-marca.ok span { color: var(--verde); border-color: rgba(77, 255, 160, .6); background: rgba(2, 26, 14, .9); }
@keyframes marca { 50% { transform: scale(1.08); opacity: .7; } }
.dis-efecto { position: absolute; width: 0; height: 0; pointer-events: none; z-index: 5; }
.dis-efecto i { position: absolute; left: 0; top: 0; width: var(--l); height: 2px; transform-origin: 0 50%; transform: rotate(var(--a)); background: linear-gradient(90deg, #fff, #ffe08a 40%, transparent); opacity: 0; }
.dis-efecto.chispas i { animation: chispa .5s ease-out forwards; }
.dis-efecto.chispas::after { content: ""; position: absolute; left: -30px; top: -30px; width: 60px; height: 60px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .95), rgba(255, 210, 120, .6) 30%, transparent 70%); animation: destello .45s forwards; }
@keyframes chispa { 0% { opacity: 1; transform: rotate(var(--a)) scaleX(.2); } 60% { opacity: 1; } 100% { opacity: 0; transform: rotate(var(--a)) translateX(14px) scaleX(1); } }
.dis-efecto.anillo::after { content: ""; position: absolute; left: -12px; top: -12px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--verde); animation: anillo .8s ease-out forwards; }
@keyframes anillo { to { transform: scale(4.5); opacity: 0; } }

/* Cámara del asiento de Irene */
#irene { position: relative; min-height: 0; overflow: hidden; border: 1px solid var(--linea-2); background: #000; }
#irene > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 56% 50%; filter: saturate(.75) brightness(.92) contrast(1.05); transition: filter 1s; }
#irene.despierta > img { filter: saturate(1) brightness(1.1); }
#irene .scanlines { position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(transparent 0 2px, rgba(0, 0, 0, .18) 2px 3px); box-shadow: inset 0 0 60px rgba(0, 0, 0, .85); }
#irene .esquinas {
  position: absolute; inset: 8px; 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: 18px 1px, 1px 18px, 18px 1px, 1px 18px, 18px 1px, 1px 18px, 18px 1px, 1px 18px;
  background-position: left top, left top, right top, right top, left bottom, left bottom, right bottom, right bottom; background-repeat: no-repeat;
}
.irene-cab { position: absolute; left: 16px; top: 14px; display: flex; flex-direction: column; gap: 5px; pointer-events: none; }
.irene-cab span { font: 500 9px/1 var(--f-mono); letter-spacing: .2em; color: rgba(185, 225, 250, .65); }
.irene-cab b { font: 600 11px/1 var(--f-ui); letter-spacing: .2em; color: var(--texto); text-shadow: 0 1px 6px #000; }
/* Encima de la mano de Irene y del rotulador de assets/historia/irene-asiento.webp (foto del 04-10: el rotulador va de u 0,53 a 0,59
   y de v 0,78 a 0,90; el biomonitor tapa por debajo de ~0,86). La foto se ve con object-position 56 %, así que vale en cualquier pantalla */
.irene-mano {
  position: absolute; left: 57.5%; top: 81%; transform: translate(-50%, calc(-100% + 26px)); display: flex; flex-direction: column-reverse; align-items: center; gap: 7px;
  padding: 0; border: 0; background: none; cursor: pointer; color: var(--ambar);
}
.irene-mano .retic {
  position: relative; width: 70px; height: 46px; border: 1px solid rgba(255, 177, 61, .85); background: radial-gradient(ellipse at center, rgba(255, 190, 90, .28), transparent 70%);
  box-shadow: 0 0 20px rgba(255, 177, 61, .35); animation: marca 1.6s ease-in-out infinite;
}
/* el rotulador ya se ve en la imagen: el recuadro solo lo enmarca */
.irene-mano .retic::before { display: none; content: ""; position: absolute; left: 18px; top: 17px; width: 34px; height: 9px; border-radius: 3px; background: linear-gradient(#2a3140, #0d1016); box-shadow: 0 0 10px rgba(255, 200, 120, .6); transform: rotate(-14deg); }
.irene-mano .retic::after { content: ""; position: absolute; inset: -5px; border: 1px dashed rgba(255, 177, 61, .45); }
.irene-mano-txt { padding: 5px 9px 4px; background: rgba(30, 18, 2, .88); border: 1px solid rgba(255, 177, 61, .55); font: 600 9.5px/1 var(--f-mono); letter-spacing: .14em; white-space: nowrap; }
.irene-mano:hover .retic { background: radial-gradient(ellipse at center, rgba(255, 190, 90, .45), transparent 70%); }
.irene-mano.llama-atencion .retic { animation: marca .7s ease-in-out infinite; }
.irene-mano.cogido { pointer-events: none; opacity: 0; transition: opacity .6s; }
.bio { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; gap: 5px; padding: 9px 14px 10px; background: rgba(2, 10, 16, .88); border-top: 1px solid var(--linea-2); }
.bio-cab { display: flex; justify-content: space-between; font: 500 9px/1 var(--f-mono); letter-spacing: .2em; color: var(--tenue); }
.bio-cab b { color: var(--ambar); font-weight: 600; }
#irene.despierta .bio-cab b { color: var(--verde); }
.ecg { display: block; width: 100%; height: 30px; overflow: hidden; }
.ecg path { fill: none; stroke: var(--verde); stroke-width: 1.4; filter: drop-shadow(0 0 3px rgba(77, 255, 160, .8)); animation: ecg 3.8s linear infinite; }
#irene.despierta .ecg path { animation-duration: 2.4s; }
@keyframes ecg { from { transform: translateX(0); } to { transform: translateX(-200px); } }
.bio-datos { display: flex; justify-content: space-between; font: 500 10px/1 var(--f-mono); color: var(--texto-2); }
.bio-datos b { color: var(--verde); font-weight: 600; }

/* Bandeja de la caja de herramientas */
#bandeja { flex: none; display: flex; align-items: center; gap: 16px; padding: 10px 14px 14px; border-top: 1px solid var(--linea); background: linear-gradient(rgba(7, 16, 27, .92), rgba(3, 8, 14, .96)); }
.bandeja-etq { flex: none; display: flex; flex-direction: column; gap: 6px; }
.bandeja-etq b { font: 400 10.5px/1.2 var(--f-titulo); letter-spacing: .12em; color: var(--texto-2); }
#bandeja-huecos { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.herr {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-width: 0; padding: 9px 8px 8px; cursor: pointer;
  border: 1px solid var(--linea-2); border-radius: 3px; color: var(--texto);
  background: radial-gradient(ellipse at 50% 40%, #121a22, #080c11 75%); box-shadow: inset 0 2px 10px rgba(0, 0, 0, .8);
  transition: border-color .2s, box-shadow .2s, opacity .3s;
}
.herr:hover:not(:disabled) { border-color: var(--linea-3); box-shadow: inset 0 2px 10px rgba(0, 0, 0, .8), 0 0 16px rgba(98, 220, 255, .15); }
.herr-svg { display: block; width: 100%; max-width: 150px; aspect-ratio: 140 / 44; }
.herr-svg svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .7)); }
.herr-nombre { font: 600 12px/1.1 var(--f-ui); letter-spacing: .04em; color: var(--texto-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.herr.en-uso .herr-svg { opacity: 0; }
.herr.tiznado .herr-nombre::after { content: " · tiznado"; color: var(--tenue); }
.herr.roto { cursor: default; opacity: .45; }
.herr.roto .herr-svg { opacity: .3; clip-path: polygon(0 0, 48% 0, 52% 50%, 48% 100%, 0 100%); }
.herr.vacio { cursor: default; border-style: dashed; background: #05080c; }
.herr.vacio .herr-svg { opacity: .9; filter: brightness(0); }
.herr.vacio .herr-svg svg { filter: drop-shadow(0 0 0 transparent); opacity: .5; }
.herr.vacio .herr-nombre { color: var(--tenue); font-family: var(--f-mono); }
.herr.vacio:disabled { opacity: 1; }
.herr.llega { animation: llega .6s var(--suave); border-color: rgba(255, 177, 61, .7); }
@keyframes llega { 0% { box-shadow: 0 0 0 0 rgba(255, 177, 61, .8); } 100% { box-shadow: 0 0 0 14px rgba(255, 177, 61, 0); } }
.herr.usado { opacity: .5; cursor: default; }
/* EXPLORADOR: de qué es cada herramienta */
.herr-mat { padding: 3px 6px 2px; border: 1px solid; border-radius: 2px; font: 600 9px/1 var(--f-mono); letter-spacing: .14em; }
.herr-mat.metal, .herr-mat.grafito { color: #ff9a9a; border-color: rgba(255, 77, 77, .5); background: rgba(255, 77, 77, .08); }
.herr-mat.madera { color: #e8c898; border-color: rgba(217, 178, 122, .5); }
.herr-mat.plastico { color: var(--verde); border-color: rgba(77, 255, 160, .5); background: rgba(77, 255, 160, .07); }
.herr.usado .herr-svg { opacity: .2; }
.herr:disabled { cursor: default; }
.herr-vuelo { position: fixed; z-index: 60; pointer-events: none; transition: transform .6s cubic-bezier(.5, 0, .3, 1); }
.herr-vuelo svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .7)); }
.herr-vuelo.partido svg { animation: partir .9s ease-in forwards; clip-path: polygon(0 0, 55% 0, 55% 100%, 0 100%); }
@keyframes partir { 30% { transform: rotate(-8deg); } 100% { transform: translate(-30px, 90px) rotate(-60deg); opacity: 0; } }

/* ===============================================================
   FASE 3 · EL ENCENDIDO
   =============================================================== */
/* Los bloques, anchos; la columna de TRAYECTORIA y PAD, más estrecha. El PAD se lleva como mínimo
   la mitad del alto (o lo que ocupe su papel, si es más) y la trayectoria, el resto */
#fase3 { display: grid; grid-template-columns: minmax(400px, 1.6fr) minmax(340px, 1fr); gap: var(--hueco); }
#f3-col { display: grid; grid-template-rows: minmax(0, 1fr) minmax(min-content, 1fr); gap: var(--hueco); min-height: 0; min-width: 0; }
/* Con la columna estrecha, las cabeceras de TRAYECTORIA y PAD dejan fuera su rótulo de estado */
#vista-tray, #pad { container-type: inline-size; }
@container (max-width: 480px) {
  .panel-titulo .panel-estado { display: none; }
  .tray-actitud { bottom: 42px; }   /* la leyenda de abajo ocupa dos líneas */
}

#panel-programa { display: flex; flex-direction: column; overflow: hidden; }
#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 { display: flex; }
.acciones { 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)); }
.btn.btn-ejecutar {
  display: inline-flex; align-items: center; gap: 11px; padding: 13px 22px; font-size: 14px; letter-spacing: .28em;
  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); }
body.ejecutando .btn-ejecutar { opacity: .4; pointer-events: none; }
#contador-bloques { margin-left: auto; font: 500 10.5px/1 var(--f-mono); letter-spacing: .14em; color: var(--tenue); white-space: nowrap; }
#contador-bloques b { color: var(--texto); font-weight: 600; }
/* Blockly con la misma estética */
.blocklyMainBackground { stroke: none !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; }

/* Trayectoria */
#vista-tray { display: flex; flex-direction: column; overflow: hidden; }
.tray-vista { flex: 1; min-height: 0; overflow: hidden; background: radial-gradient(ellipse at 30% 60%, rgba(30, 80, 140, .12), transparent 60%), #01050a; }
#vista-tray.temblor .tray-vista > svg { animation: temblor-imp .28s linear; }
@keyframes temblor-imp { 20% { transform: translate(-2px, 1px); } 40% { transform: translate(2px, -1px); } 60% { transform: translate(-1px, -2px); } 80% { transform: translate(1px, 2px); } }
#tray { position: absolute; inset: 0; width: 100%; height: 100%; }
.tr-estrellas circle { fill: #cfe6ff; }
.tr-recorrido { fill: none; stroke: var(--cian); stroke-width: 1.4; opacity: .45; }
.tr-noche { fill: rgba(0, 6, 20, .55); }
.tr-pasillo { fill: none; stroke: rgba(77, 255, 160, .55); stroke-width: 1.2; stroke-dasharray: 2 2.5; transition: stroke .4s, stroke-width .4s; }
.tr-pasillo.cerca { stroke: rgba(77, 255, 160, .9); }
.tr-pasillo.ok { stroke: var(--verde); stroke-width: 2.4; stroke-dasharray: none; filter: drop-shadow(0 0 5px var(--verde)); animation: latido 1s infinite; }
.tr-guia { fill: none; stroke: rgba(77, 255, 160, .45); stroke-width: .8; }
.tr-etq { font: 600 8.5px var(--f-ui); letter-spacing: .24em; fill: var(--texto-2); }
.tr-etq.pasillo { fill: rgba(77, 255, 160, .85); font-size: 7.5px; }
.tr-etq.tenue { fill: var(--tenue); font-size: 7px; }
.tr-etq.nave { fill: var(--cian-2); font-size: 7.5px; }
.tr-prevista { fill: none; stroke: var(--ambar); stroke-width: 1.6; stroke-dasharray: 5 4; stroke-linecap: round; filter: drop-shadow(0 0 3px rgba(255, 177, 61, .6)); animation: hormigas 1.2s linear infinite; }
@keyframes hormigas { to { stroke-dashoffset: -18; } }
.tr-prevista.clavada, .tr-prevista.mal { stroke: var(--rojo); filter: drop-shadow(0 0 3px rgba(255, 77, 77, .7)); }
.tr-prevista.ok { stroke: var(--verde); stroke-width: 2; stroke-dasharray: none; filter: drop-shadow(0 0 4px var(--verde)); animation: none; }
.tr-viaje { fill: #fff; filter: drop-shadow(0 0 4px var(--verde)); }
.nave-cuerpo { fill: #dfe8f0; stroke: #0b1520; stroke-width: .5; }
.nave-linea { stroke: #7a8a98; stroke-width: .6; }
.nave-tobera { fill: #6b7885; }
.llama { fill: #ffb13d; opacity: 0; transition: opacity .08s; }
.llama.nucleo { fill: #fff3c4; }
.llama.on { opacity: 1; filter: drop-shadow(0 0 3px #ff8a2a); }
.tray-hud { position: absolute; left: 12px; top: 10px; display: flex; gap: 16px; pointer-events: none; }
.tray-hud > div { display: flex; flex-direction: column; gap: 6px; padding: 7px 10px 8px; background: rgba(2, 8, 14, .72); border: 1px solid var(--linea); }
.tray-hud b { font: 500 20px/1 var(--f-mono); color: var(--texto); }
.tray-hud b small { font-size: 11px; color: var(--cian); }
#hud-impulsos.pulso { animation: pulso-imp .35s ease-out; }
@keyframes pulso-imp { from { color: var(--ambar); text-shadow: 0 0 12px var(--ambar); } }
.tray-actitud { position: absolute; right: 10px; bottom: 28px; display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 6px; background: rgba(2, 8, 14, .72); border: 1px solid var(--linea); pointer-events: none; }
.tray-actitud svg { width: 74px; height: 44px; overflow: visible; }
.tray-actitud > div { display: flex; flex-direction: column; gap: 6px; }
.tray-actitud b { font: 500 11px/1 var(--f-mono); color: var(--texto); white-space: nowrap; }
.act-mov { fill: none; stroke: var(--tenue); stroke-width: 1; }
.act-mov-txt { font: 600 5px var(--f-ui); letter-spacing: .2em; fill: var(--tenue); }
.tray-leyenda { position: absolute; left: 12px; right: 12px; bottom: 8px; display: flex; flex-wrap: wrap; gap: 6px 16px; pointer-events: none; font: 500 8.5px/1 var(--f-ui); letter-spacing: .2em; color: var(--tenue); }
.tray-leyenda span { display: flex; align-items: center; gap: 7px; }
.tray-leyenda span::before { content: ""; width: 16px; height: 0; border-top: 1.5px solid; }
.ley-rec::before { border-color: rgba(98, 220, 255, .6) !important; }
.ley-prev::before { border-top-style: dashed !important; border-color: var(--ambar) !important; }
.ley-pas::before { border-top-style: dotted !important; border-color: var(--verde) !important; }
#tray.exito .tr-etq.pasillo { fill: var(--verde); }

/* PAD en papel de teletipo (papel pijama con agujeros de arrastre). El papel ocupa todo el alto del módulo */
#pad { display: flex; flex-direction: column; }
.pad-cuerpo { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 9px; padding: 10px 12px 12px; }
.pad-papel {
  flex: 1 0 auto; position: relative; min-height: 146px; padding: 6px 26px 8px; color: #1b2530; overflow: hidden;
  background:
    radial-gradient(circle at 9px 9px, #02070c 0 3px, transparent 3.5px) left top / 18px 18px repeat-y,
    radial-gradient(circle at 9px 9px, #02070c 0 3px, transparent 3.5px) right top / 18px 18px repeat-y,
    repeating-linear-gradient(#dfe9d7 0 18px, #eef1e5 18px 36px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .5); filter: brightness(.93);
}
.pad-papel::after { content: ""; position: absolute; left: 18px; right: 18px; top: 0; bottom: 0; pointer-events: none; border-left: 1px dashed rgba(40, 60, 50, .25); border-right: 1px dashed rgba(40, 60, 50, .25); }
.pad-papel.imprimiendo { animation: teletipo .09s steps(2) infinite; }
@keyframes teletipo { 50% { transform: translateY(.5px); } }
.pad-texto { font: 500 11.5px/18px var(--f-mono); letter-spacing: .01em; }
.pad-l { white-space: nowrap; overflow: hidden; text-overflow: clip; }
.pad-l.cab { font-weight: 700; letter-spacing: .08em; }
.pad-l.fin { font-weight: 700; }
.pad-k { display: inline-block; min-width: 7.2em; font-weight: 700; }
.pad-l b { font-weight: 700; }
.pad-tabla { padding-left: 1.2em; }
.pad-fila { display: flex; align-items: baseline; gap: 6px; height: 18px; }
.pad-fila i { flex: 1; border-bottom: 1px dotted rgba(27, 37, 48, .55); transform: translateY(-4px); }
.pad-fila b { min-width: 2ch; text-align: right; font-weight: 700; }
/* Pasos numerados, como en una hoja de maniobra: el número en tinta, y debajo sus datos, alineados con la palabra clave */
.pad-n {
  display: inline-block; width: 3ch; margin-right: 1ch; padding: 1px 0; border-radius: 1px; text-align: center; line-height: 1.15;
  background: #1b2530; color: #eef1e5; font-weight: 700;
}
.pad-paso .pad-tabla { padding-left: 4ch; }
.pad-l.fin { padding-left: 4ch; }
.entra { animation: imprime .25s steps(4); }
@keyframes imprime { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.tapa { display: inline-block; color: #6b7a86; animation: estatica-txt .18s steps(2) infinite; }
@keyframes estatica-txt { 50% { opacity: .35; transform: translateY(-1px); } }
.limpia { background: rgba(255, 190, 60, .55); box-shadow: 0 0 0 2px rgba(255, 190, 60, .55); }
.pad-pie { display: flex; align-items: center; gap: 10px; }
#pad-aviso { flex: 1; min-width: 0; font: 500 10px/1.3 var(--f-mono); letter-spacing: .1em; color: var(--ambar); }
.pad-pie .btn { margin: 0; padding: 10px 14px; font-size: 12px; white-space: nowrap; border-color: rgba(255, 177, 61, .55); color: #ffe0a8; background: rgba(255, 177, 61, .08); }
.senal { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.senal i { width: 3px; background: var(--verde); box-shadow: 0 0 4px var(--verde); }
.senal i:nth-child(1) { height: 4px; } .senal i:nth-child(2) { height: 7px; } .senal i:nth-child(3) { height: 10px; } .senal i:nth-child(4) { height: 14px; }
.senal.debil i { background: var(--ambar); box-shadow: 0 0 4px var(--ambar); }
.senal.debil i:nth-child(n+3) { background: rgba(255, 177, 61, .2); box-shadow: none; animation: latido .4s steps(2) infinite; }

body.sobrecarga #app { animation: sobrecarga .12s steps(2) 8; }
@keyframes sobrecarga { 50% { filter: hue-rotate(-30deg) brightness(1.3); transform: translateX(2px); } }

/* ===============================================================
   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-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); }
.objetivo { display: flex; align-items: baseline; gap: 12px; padding: 10px 12px; border-left: 2px solid var(--cian); background: rgba(98, 220, 255, .05); color: var(--texto) !important; }
.objetivo span { flex: none; font: 600 10.5px/1 var(--f-mono); letter-spacing: .2em; color: var(--cian); }
.aviso-o2 { display: flex; align-items: center; gap: 12px; margin-top: 16px !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%); }
.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; }

/* Intro con ilustración y código de reanudación */
.caja-historia { max-width: 1060px; }
.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: 3 / 2; 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; margin-bottom: 14px; }
.intro-texto p { font-size: 17.5px; }
.reanudar { margin-top: 16px; padding: 12px 14px; border: 1px dashed var(--linea-2); background: rgba(98, 220, 255, .03); }
.reanudar label { display: block; margin-bottom: 10px; white-space: normal; line-height: 1.4; }
.reanudar-fila { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.codigo-input {
  width: 9.6em; padding: 8px 0 8px 12px; border: 1px solid var(--linea-3); border-radius: 2px; outline: none; background: #020911; color: #fff3da;
  font: 700 26px/1 var(--f-seg); letter-spacing: .38em; caret-color: var(--ambar);
  text-shadow: 0 0 12px rgba(255, 177, 61, .7);
}
.codigo-input::placeholder { color: rgba(255, 177, 61, .16); text-shadow: none; }
.codigo-input:focus { border-color: var(--ambar); box-shadow: 0 0 18px rgba(255, 177, 61, .25); }
.codigo-input.sacude { animation: sacudir .45s; border-color: var(--rojo); }
.codigo-msg { font: 500 13px/1.3 var(--f-ui); color: var(--texto-2); }
.codigo-msg.mal { color: #ff8a8a; }
.codigo-msg.aviso { color: var(--ambar); }
.codigo-msg.ok { color: var(--verde); font-family: var(--f-mono); font-size: 12px; }
.llegada { margin-top: 14px; font: 500 13px/1.4 var(--f-mono); color: var(--texto-2); }
.llegada b { color: var(--texto); }
.intro-botones { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; margin-top: 16px; }
.intro-botones .btn-ejecutar.grande { margin-top: 0; }

/* Radio de Houston */
#radio { align-items: flex-end; padding-bottom: 56px; background: linear-gradient(transparent 40%, rgba(1, 4, 8, .75)); backdrop-filter: none; z-index: 110; }
.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; }
.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; } }
.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); }
/* Irene habla en persona, sin radio: tonos fríos y letra más lenta */
.caja-radio.en-persona { --c: rgba(184, 242, 255, .7); border-color: rgba(184, 242, 255, .35); box-shadow: 0 0 50px rgba(98, 220, 255, .12), 0 30px 90px rgba(0, 0, 0, .65); }
.caja-radio.en-persona .caja-cab { color: var(--cian-2); border-color: var(--linea); }
.caja-radio.en-persona .onda i { background: var(--cian); animation-duration: 2.2s; }
.caja-radio.en-persona #radio-avatar { border-color: rgba(184, 242, 255, .5); filter: saturate(.8); }
.caja-radio.en-persona .radio-quien b { color: var(--cian-2); }
.caja-radio.en-persona #radio-texto { color: #dff6ff; font-style: italic; }

/* Radio corta: no interrumpe */
#radio-corta {
  position: fixed; top: 72px; left: calc(var(--hueco) + (100vw - var(--col) - 3 * var(--hueco)) / 2); transform: translateX(-50%); z-index: 96;
  display: flex; align-items: center; gap: 12px; width: max-content; max-width: min(640px, 70vw); padding: 8px 16px 8px 8px; cursor: pointer;
  border: 1px solid rgba(255, 177, 61, .6); background: rgba(24, 15, 3, .94); box-shadow: 0 0 30px rgba(255, 177, 61, .18), 0 16px 40px rgba(0, 0, 0, .6);
}
#radio-corta.entra { animation: rc-entra .35s var(--suave); }
@keyframes rc-entra { from { opacity: 0; transform: translate(-50%, -10px); } }
#radio-corta img { flex: none; width: 48px; height: 48px; object-fit: cover; border: 1px solid rgba(255, 177, 61, .55); }
#rc-nombre { display: block; margin-bottom: 5px; font: 400 10.5px/1.2 var(--f-titulo); letter-spacing: .14em; color: #ffd08a; }
#rc-texto { display: block; font: 400 16px/1.35 var(--f-ui); color: #ffe7bd; }

/* Tang encontrado */
#aviso-tang {
  position: fixed; top: 150px; left: calc(var(--hueco) + (100vw - var(--col) - 3 * var(--hueco)) / 2); transform: translateX(-50%); z-index: 96;
  display: flex; align-items: center; gap: 12px; max-width: min(600px, 70vw); padding: 8px 16px 8px 8px; pointer-events: none;
  border: 1px solid rgba(255, 201, 77, .6); background: rgba(30, 20, 4, .92); box-shadow: 0 0 30px rgba(255, 177, 61, .25); color: #ffe7bd; animation: rc-entra .35s var(--suave);
}
#aviso-tang img { width: 50px; height: 50px; object-fit: contain; flex: none; }
#aviso-tang b { display: block; font: 400 13px/1.3 var(--f-titulo); letter-spacing: .12em; color: var(--ambar); }
#aviso-tang b em { margin-left: 8px; font: 600 14px/1 var(--f-mono); font-style: normal; letter-spacing: 0; color: var(--verde); text-shadow: 0 0 10px rgba(77, 255, 160, .6); }
#aviso-tang span { font: 400 15px/1.35 var(--f-ui); }

/* Éxito (falso final) */
.caja-exito { --c: rgba(77, 255, 160, .75); border-color: rgba(77, 255, 160, .35); max-width: 760px; }
.caja-exito .caja-cab { border-color: rgba(77, 255, 160, .18); }
.caja-exito .caja-sub { color: var(--verde); }
.caja-exito h1 { color: #c9ffe3; text-shadow: 0 0 26px rgba(77, 255, 160, .4); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.stats > div { padding: 12px 14px; border: 1px solid var(--linea); background: rgba(98, 220, 255, .03); }
.stats span { display: block; font: 500 9.5px/1 var(--f-ui); letter-spacing: .24em; color: var(--tenue); white-space: nowrap; }
.stats b { display: block; margin-top: 10px; font: 500 26px/1 var(--f-mono); color: var(--texto); }
.ex-tang { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding: 8px 14px; border: 1px dashed rgba(255, 201, 77, .45); font: 500 14px/1.3 var(--f-ui); letter-spacing: .04em; color: #ffe7bd; }
.ex-tang img { width: 36px; height: 36px; object-fit: contain; flex: none; }
.ex-tang.no { color: var(--texto-2); border-color: var(--linea-2); }
.ex-tang.no img { filter: grayscale(1) brightness(.7); }
.modulo { display: flex; align-items: baseline; gap: 14px; padding: 10px 14px; border: 1px dashed var(--linea-2); }
.modulo span { flex: none; font: 500 9.5px/1 var(--f-ui); letter-spacing: .26em; color: var(--cian); }
.modulo code { font: 500 12.5px/1.5 var(--f-mono); color: var(--texto); }
.exito-botones { display: flex; align-items: stretch; gap: 12px; margin-top: 20px; }
.btn.btn-finalizar { display: block; flex: 1; margin-top: 0; padding: 20px; font-size: 16px; letter-spacing: .4em; }
.exito-botones .nave-btn-master { flex: none; }

/* Alarma 1202 */
#alarma { position: fixed; inset: 0; z-index: 140; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(90, 10, 10, .45), rgba(10, 0, 0, .85)); animation: alarma-fondo .5s steps(2) infinite; }
@keyframes alarma-fondo { 50% { background-color: rgba(120, 0, 0, .15); } }
.dsky-alarma { --c: rgba(255, 90, 90, .8); --esq: 18px; width: min(460px, 90vw); padding: 18px 20px 20px; background-color: #06090c; border: 1px solid rgba(255, 90, 90, .5); box-shadow: 0 0 80px rgba(255, 60, 60, .35); animation: caja-entra .35s var(--suave) both; }
.dsky-cab { display: flex; justify-content: space-between; margin-bottom: 14px; font: 500 10px/1 var(--f-mono); letter-spacing: .2em; color: var(--tenue); }
.dsky-cab span { color: var(--texto); }
.dsky-luces { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-bottom: 12px; }
.luz { display: flex; align-items: center; justify-content: center; min-height: 32px; padding: 3px; text-align: center; border-radius: 2px; font: 600 9px/1.1 var(--f-ui); letter-spacing: .1em; background: #0c1117; color: #3b4a58; border: 1px solid #1a242e; }
.luz.on { background: #e4e8ea; color: #151a1e; border-color: #fff; box-shadow: 0 0 14px rgba(230, 240, 245, .35); }
.luz.ambar.on { background: var(--ambar); color: #2a1700; border-color: #ffd28a; box-shadow: 0 0 16px rgba(255, 177, 61, .6); }
.parpadeo { animation: parpadeo .5s steps(2) infinite; }
@keyframes parpadeo { 50% { opacity: .15; } }
.dsky-reg { display: flex; justify-content: space-between; align-items: center; padding: 10px 18px; background: #020704; border: 1px solid #13261a; }
.dsky-reg span { font: 600 11px/1 var(--f-ui); letter-spacing: .24em; color: #3a8a5a; }
.dsky-reg .seg { font: 700 56px/1 var(--f-seg); letter-spacing: 4px; color: var(--verde); text-shadow: 0 0 14px rgba(77, 255, 160, .8); }
.dsky-msg { margin-top: 10px; padding: 9px 12px; background: #0b0303; border: 1px solid #4a1a1a; font: 500 12px/1.4 var(--f-mono); letter-spacing: .12em; color: #ff8585; text-align: center; }
body.temblor #app { animation: temblor .11s linear infinite; }
@keyframes temblor { 0% { transform: translate(0, 0); } 25% { transform: translate(-5px, 3px); } 50% { transform: translate(4px, -3px); } 75% { transform: translate(-3px, -4px); } 100% { transform: translate(0, 0); } }

/* Sin oxígeno: por encima de la radio y del resto de ventanas del reto */
#sin-o2 { z-index: 130; }
.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: 200; 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: 8px; margin-bottom: 12px; }
.gm-botones.tres { grid-template-columns: repeat(3, 1fr); }
.gm-botones .btn { margin: 0; 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: 140px; overflow: auto; margin: 0; padding-left: 18px; }

/* Lectura del pósit 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; }
.lectura-fondo { position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(3, 11, 20, .55), rgba(1, 3, 7, .82)); backdrop-filter: blur(3px); opacity: 0; transition: opacity .35s; }
#lectura.visible .lectura-fondo { opacity: 1; }
#lectura-hoja { position: relative; transform: scale(.6) rotate(-4deg); opacity: 0; transition: transform .4s var(--suave), opacity .3s; }
#lectura.visible #lectura-hoja { transform: none; opacity: 1; }
#lectura-pie { position: relative; font: 500 10px/1 var(--f-mono); letter-spacing: .24em; color: var(--texto-2); opacity: 0; transition: opacity .3s .25s; }
#lectura.visible #lectura-pie { opacity: 1; }
.nota-grande {
  position: relative; width: min(410px, 88vw); min-height: 300px; padding: 40px 32px 30px; border-radius: 1px 1px 3px 3px / 1px 1px 14px 14px;
  font: 400 21px/1.6 var(--f-mano); color: #1d2a6a;
  background: linear-gradient(rgba(0, 0, 0, .05), rgba(0, 0, 0, .015) 26px, transparent 27px), linear-gradient(100deg, rgba(0, 0, 0, .04), transparent 30%, transparent 70%, rgba(0, 0, 0, .06)), linear-gradient(170deg, #fee873 60%, #eccf50);
  box-shadow: 0 2px 2px rgba(0, 0, 0, .3), 0 30px 60px rgba(0, 0, 0, .65);
}
.ng-celo { position: absolute; left: 50%; top: -13px; width: 118px; height: 30px; margin-left: -59px; background: rgba(240, 240, 228, .55); box-shadow: 0 0 1px rgba(0, 0, 0, .25); transform: rotate(-3deg); }
.ng-hora { position: absolute; top: 12px; right: 20px; font-weight: 700; font-size: 18px; color: #c23b2b; transform: rotate(3deg); }
.ng-texto b { font-weight: 700; }
.ng-texto small { font-size: 14px; line-height: 1.5; }
.ng-firma { margin-top: 8px; text-align: right; font-size: 15px; color: #4a5a78; }

/* Confeti de estrellas (discreto) */
#confeti { position: fixed; inset: 0; z-index: 89; pointer-events: none; overflow: hidden; }
#confeti i {
  position: absolute; top: -20px; width: var(--t); height: var(--t); opacity: 0;
  background: radial-gradient(circle, #fff 0 25%, rgba(184, 242, 255, .9) 40%, rgba(77, 255, 160, .5) 60%, transparent 72%);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
}
#confeti.activo i { animation-name: estrella; animation-timing-function: linear; animation-fill-mode: forwards; }
@keyframes estrella { 0% { opacity: 0; transform: translate(0, 0) rotate(0); } 12% { opacity: .95; } 80% { opacity: .7; } 100% { opacity: 0; transform: translate(var(--x), 80vh) rotate(200deg); } }

/* 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; } }

/* ===============================================================
   «ANTERIORMENTE EN SELENE-7»
   =============================================================== */
#resumen { position: fixed; inset: 0; z-index: 160; overflow: hidden; background: #000; color: var(--texto); transition: opacity .5s; }
#resumen.saliendo { opacity: 0; }
.res-plano { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .8s ease; }
.res-plano.visible { opacity: 1; animation: kenburns 5.2s linear forwards; }
@keyframes kenburns { from { transform: scale(1.02); } to { transform: scale(1.1); } }
.res-velo { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, .55) 100%), linear-gradient(0deg, rgba(0, 0, 0, .75) 0%, transparent 34%); }
.res-franja { position: absolute; left: 0; right: 0; height: 6vh; background: #000; z-index: 2; }
.res-franja.arriba { top: 0; } .res-franja.abajo { bottom: 0; }
.res-cab { position: absolute; z-index: 3; left: clamp(16px, 4vw, 56px); top: calc(6vh + 20px); display: flex; align-items: center; gap: 12px; font: 400 clamp(11px, 1vw, 14px)/1 var(--f-titulo); letter-spacing: .3em; color: var(--texto-2); text-shadow: 0 1px 8px #000; }
.res-cab b { font-weight: 400; color: var(--cian-2); }
.res-progreso { position: absolute; z-index: 3; left: clamp(16px, 4vw, 56px); right: clamp(16px, 4vw, 56px); top: calc(6vh + 6px); display: flex; gap: 6px; }
.res-progreso i { flex: 1; height: 2px; background: rgba(255, 255, 255, .18); overflow: hidden; }
.res-progreso i b { display: block; height: 100%; width: 0; background: var(--cian); box-shadow: 0 0 6px var(--cian); }
.res-progreso i.hecha b { width: 100%; }
.res-progreso i.activa b { animation: progreso var(--dur, 4s) linear forwards; }
@keyframes progreso { to { width: 100%; } }
.res-texto {
  position: absolute; z-index: 3; left: 50%; bottom: calc(6vh + 5vh); transform: translateX(-50%); width: min(88vw, 1000px); text-align: center;
  font: 500 clamp(19px, 2.2vw, 30px)/1.35 var(--f-ui); letter-spacing: .02em; color: #f2f8ff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .95), 0 0 2px rgba(0, 0, 0, .9); opacity: 0; transition: opacity .5s ease;
}
.res-texto.visible { opacity: 1; }
.res-remate { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 0 20px; text-align: center; opacity: 0; pointer-events: none; transition: opacity .6s; }
#resumen.remate .res-remate { opacity: 1; }
.res-voz { display: flex; align-items: center; gap: 14px; text-align: left; opacity: 0; }
.res-voz img { width: 58px; height: 58px; object-fit: cover; border: 1px solid rgba(255, 177, 61, .55); }
.res-voz span { font: 500 10px/1.2 var(--f-mono); letter-spacing: .2em; color: var(--tenue); }
.res-voz b { display: block; margin-bottom: 5px; font: 400 13px/1.2 var(--f-titulo); letter-spacing: .12em; color: #ffd08a; }
.res-frase { margin: 0; font: 400 clamp(28px, 4.4vw, 58px)/1.15 var(--f-titulo); letter-spacing: .06em; color: #fff3da; text-shadow: 0 0 30px rgba(255, 177, 61, .45); opacity: 0; }
.res-guido { margin: 0; font: 500 clamp(14px, 1.4vw, 19px)/1.4 var(--f-mono); color: var(--verde); text-shadow: 0 0 10px rgba(77, 255, 160, .6); opacity: 0; }
#resumen.remate .res-voz { animation: remate .6s .1s var(--suave) forwards; }
#resumen.remate .res-frase { animation: remate .7s .45s var(--suave) forwards; }
#resumen.remate .res-guido { animation: remate .6s 2.1s var(--suave) forwards; }
@keyframes remate { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
#res-saltar { position: absolute; z-index: 4; right: clamp(16px, 3vw, 40px); bottom: calc(6vh + 14px); margin: 0; background: rgba(0, 0, 0, .5); border-color: rgba(255, 255, 255, .28); color: rgba(255, 255, 255, .8); font: 500 12px/1 var(--f-mono); letter-spacing: .18em; }

/* ---------- Encendido de la cabina ---------- */
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 #masa { animation-delay: .12s; }
body.encendiendo #terminal { animation-delay: .24s; }
@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 grandes, bajas y estrechas ---------- */
@media (min-width: 1700px) {
  :root { --col: 400px; }
  .obj-icono { width: 64px; height: 64px; }
  .obj-nombre { margin-top: 12px; font-size: 17px; }
  .obj-detalle { font-size: 14px; }
  .obj-masa { font-size: 24px; }
  #esclusa { height: 210px; grid-template-columns: 240px minmax(0, 1fr) 190px; }
  .esc-info { padding: 18px 18px 0; gap: 10px; }
  .esc-info b { font-size: 12px; }
  .esc-info span { font-size: 10.5px; }
  .esc-info em { font-size: 12px; }
  .esc-mando { padding: 0 18px 18px; }
  #esc-kg { font-size: 24px; }
  .btn.btn-expulsar { padding: 15px 10px; font-size: 15px; }
  .esc-camara { grid-template-columns: 24px minmax(0, 1fr) 24px; }
  .esc-vacia { font-size: 15px; }
  #objetos { gap: 10px; }
  .obj { padding: 16px 18px 16px 16px; column-gap: 14px; }
  .obj-sello { font-size: 10.5px; right: 12px; bottom: 10px; }
  .chip-obj { font-size: 14px; padding: 6px 12px 6px 6px; }
  .chip-obj .ci { width: 30px; height: 30px; }
  .masa-valor { font-size: 38px; }
  .pad-texto { font-size: 13px; line-height: 20px; }
  .pad-papel { background:
    radial-gradient(circle at 9px 10px, #02070c 0 3px, transparent 3.5px) left top / 18px 20px repeat-y,
    radial-gradient(circle at 9px 10px, #02070c 0 3px, transparent 3.5px) right top / 18px 20px repeat-y,
    repeating-linear-gradient(#dfe9d7 0 20px, #eef1e5 20px 40px); }
  .pad-fila { height: 20px; }
  #log { font-size: 13px; }
  .p16-etq { font-size: 9.4px; }
  .posit-agua { width: min(100%, 200px); font-size: 15px; }
}
/* Pantallas grandes y altas (1920 × 1080): el PAD, más alto, se lee con letra más grande */
@media (min-width: 1700px) and (min-height: 960px) {
  .pad-texto { font-size: 14px; line-height: 22px; }
  .pad-papel { background:
    radial-gradient(circle at 9px 11px, #02070c 0 3px, transparent 3.5px) left top / 18px 22px repeat-y,
    radial-gradient(circle at 9px 11px, #02070c 0 3px, transparent 3.5px) right top / 18px 22px repeat-y,
    repeating-linear-gradient(#dfe9d7 0 22px, #eef1e5 22px 44px); }
  .pad-fila { height: 22px; }
}
@media (max-height: 820px) {
  :root { --hueco: 10px; }
  .masa-cuerpo { gap: 8px; padding: 10px 14px 12px; }
  .masa-valor { font-size: 28px; }
  .masa-estado { padding: 6px 8px 5px; }
  .f1-vista { padding: 10px 12px 12px; gap: 10px; }
  #esclusa { height: 150px; }
  .esc-info { gap: 6px; padding-top: 10px; }
  .esc-mando { padding-bottom: 10px; }
  .btn.btn-expulsar { padding: 11px 10px; }
  .obj { padding: 8px 10px 8px 8px; }
  .obj-icono { width: 40px; height: 40px; }
  .obj-nombre { margin-top: 6px; font-size: 14px; }
  .obj-detalle { font-size: 12px; }
  .pad-cuerpo { gap: 7px; padding: 8px 10px 10px; }
  .pad-papel { min-height: 0; }
  #bandeja { padding: 8px 12px 10px; }
  .herr { padding: 7px 6px 6px; }
  .f2-vista { padding: 10px 12px; }
  .intro-texto p { font-size: 16.5px; margin-bottom: 9px; }
  .caja h1 { margin-bottom: 12px; }
}
@media (max-width: 1400px) {
  .panel-titulo .sub { display: none; }
  #fases li { padding: 0 10px 0 6px; letter-spacing: .18em; }
  #fases li + li { margin-left: 14px; }
  #fases li + li::before { left: -15px; width: 14px; }
  #barra { gap: 24px; }
  .o2 { width: 220px; }
}
@media (max-width: 1100px) {
  html, body { overflow: auto; }
  #app { height: auto; }
  main { grid-template-columns: 1fr; }
  #escenario { min-height: 88vh; }
  #fase3 { grid-template-columns: 1fr; }
  #panel-programa { height: 70vh; }
  #columna { grid-template-rows: auto 260px; }
  .marca-txt span, .o2-sv, #fases span { display: none; }
  .o2 { width: 150px; }
}
@media (max-width: 980px) {
  .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; }
  body.temblor #app { animation: none; }
}
