@font-face { font-family: "VT323"; src: url("fonts/VT323-Regular.ttf") format("truetype"); font-display: swap; }
[hidden] { display: none !important; }
:root {
  --bg: #0d111c; --panel: #151b2b; --panel2: #1d2539; --line: #33405e; --fg: #e8eef8; --dim: #9aa8c4;
  --amber: #ffc23d; --red: #ff4b4b; --cyan: #5ff6ff; --glow: none;
  --ok: #4fe08a; --warn: #ffc23d; --bad: #ff5a5a; /* estados: siempre van con ícono + marca de texto, nunca solo color */
  --font: "VT323", "DejaVu Sans Mono", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 20px; height: 100%; overflow: hidden; }
button { font: inherit; color: var(--fg); background: var(--panel2); border: 1px solid var(--line); padding: .15rem .6rem; cursor: pointer; text-shadow: var(--glow); border-radius: 3px; }
button:hover:not(:disabled) { background: #2a3550; border-color: var(--fg); }
button:disabled { opacity: .4; cursor: not-allowed; }
button:focus-visible, summary:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
h3 { margin: 0 0 .25rem; font-size: 1rem; font-weight: normal; color: var(--dim); letter-spacing: .08em; }
kbd { font-family: inherit; border: 1px solid var(--line); border-radius: 3px; padding: 0 .3em; color: var(--amber); font-size: .85em; }
.ic { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; flex: none; }
.ic.g { width: 1.6em; height: 1.6em; }
.mini { margin-left: auto; }

/* ---------- pantalla completa: el mapa ocupa toda la ventana y el HUD flota encima ---------- */
.juego { position: fixed; inset: 0; }
.pantalla { position: absolute; inset: 0; background: #000; }
canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
.hud { position: absolute; z-index: 2; pointer-events: none; font-size: clamp(13px, 0.75vw + 0.6vh, 19px); }
.hud .caja { background: rgba(13,17,28,.78); border: 1px solid rgba(90,110,155,.55); border-radius: 4px; padding: .3em .5em; }
.hud h3 { font-size: .82em; margin: 0 0 .2em; letter-spacing: .08em; display: flex; align-items: center; gap: .35em; }
.hud button { pointer-events: auto; }

/* barra de arriba */
.barra { left: 0; right: 0; top: 0; display: flex; gap: .9em; align-items: center; padding: .25em .6em; background: linear-gradient(rgba(10,14,24,.92), rgba(10,14,24,.6)); border-bottom: 1px solid rgba(90,110,155,.5); flex-wrap: nowrap; font-size: clamp(13px, 0.8vw + 0.6vh, 20px); }
.barra .logo { font-size: 1.25em; letter-spacing: .12em; } .logo b { color: var(--amber); font-weight: normal; }
.chip { display: inline-flex; align-items: center; gap: .35em; white-space: nowrap; color: var(--fg); }
.chip.reloj { color: var(--amber); font-size: 1.15em; }
.barra #bloque { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); }
.barra #bloque.tarde { color: var(--bad); }
.barra #bloque.tarde::before { content: "¡TARDE! "; }
.barra button { padding: .05em .55em; background: rgba(21,27,43,.9); display: inline-flex; align-items: center; gap: .4em; min-height: 1.9em; }
.barra .ib .ic { width: 1.25em; height: 1.25em; }
.barra .ib.off { color: var(--dim); text-decoration: line-through; }
.barra .ib.off .ic { opacity: .55; }
#rev { white-space: nowrap; padding: 0 .5em; border: 1px solid var(--line); border-radius: 3px; } #rev.pend { color: var(--amber); border-color: var(--amber); } #rev.ok { color: var(--ok); border-color: var(--ok); }
#coop-badge.ok { color: var(--ok); } #coop-badge.pend { color: var(--amber); }

/* barras de vitales: ícono + etiqueta + barra + número + marca (!, !!). El color sale de --est. */
.hud-izq { left: .5em; top: 2.7em; width: 17.2em; display: flex; flex-direction: column; gap: 4px; }
.filas { display: grid; gap: .14em; }
.vr { position: relative; display: grid; grid-template-columns: 1.3em 5.9em 1fr 3.1em; align-items: center; gap: .3em; font-size: .98em; line-height: 1.15; --est: var(--ok); }
.vr .ic { color: var(--est); }
.vr .nom { color: var(--fg); white-space: nowrap; overflow: hidden; letter-spacing: .03em; }
.vr .bv { height: .65em; background: #0a0e17; border: 1px solid rgba(110,130,175,.85); border-radius: 2px; overflow: hidden; }
.vr .bv i { display: block; height: 100%; width: 0; background-color: var(--est); transition: width .45s ease-out; }
.vr .val { text-align: right; white-space: nowrap; color: var(--est); }
.vr .val em { font-style: normal; }
.vr.est-ok { --est: var(--ok); } .vr.est-warn { --est: var(--warn); } .vr.est-bad { --est: var(--bad); }
.vr.est-warn .bv i { background-image: repeating-linear-gradient(135deg, rgba(0,0,0,.3) 0 3px, transparent 3px 6px); }
.vr.est-bad .bv i { background-image: repeating-linear-gradient(135deg, rgba(0,0,0,.45) 0 3px, transparent 3px 5px); }
.vr.est-bad .nom { color: var(--bad); }
.vr.neutro { --est: #8fb4ff; }
/* aviso de daño: la barra destella una vez, se mueve 2 px y aparece «−7» que sube y se apaga (nada de parpadeo: un destello por golpe, máx. ~1 por segundo) */
.vr .dmg { position: absolute; right: 0; top: -.95em; color: var(--bad); opacity: 0; pointer-events: none; text-shadow: 0 0 3px #000, 0 0 3px #000; font-size: 1.05em; }
.vr.golpe { animation: golpe .45s ease-out; }
.vr.golpe .bv { animation: flash-barra .7s ease-out; }
.vr.golpe .dmg { animation: sube-dmg 1.2s ease-out; }
.vr.golpe-est .dmg { opacity: 1; }
@keyframes golpe { 25% { transform: translateX(-2px); } 60% { transform: translateX(1.5px); } }
@keyframes flash-barra { 0% { box-shadow: 0 0 0 2px var(--bad), 0 0 8px var(--bad); } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes sube-dmg { 0% { opacity: 1; transform: translateY(.3em); } 65% { opacity: 1; } 100% { opacity: 0; transform: translateY(-.6em); } }
.sub-sis { color: var(--dim); font-size: .8em; margin: .05em 0 0; line-height: 1.05; }
.sub-sis:empty { display: none; }

/* tripulación y mochila */
.hud-crew { left: .5em; bottom: .5em; width: 17em; } .hud-crew .crew { font-size: .92em; }
.crew { list-style: none; margin: 0; padding: 0; }
.crew li { display: flex; align-items: center; gap: .3em; white-space: nowrap; overflow: hidden; }
.crew svg { width: 1.1em; height: 1.1em; }
.crew .pide { overflow: hidden; text-overflow: ellipsis; display: inline-flex; align-items: center; gap: .2em; min-width: 0; }
.hud-inv { left: 50%; bottom: .5em; transform: translateX(-50%); }
.hud-inv .inv { display: flex; gap: 3px; margin: 0; }
.hud-inv .slot { width: 2.4em; height: 2.4em; aspect-ratio: auto; flex: none; font-size: 1em; }
.hud-inv .slot svg { width: 1.7em; height: 1.7em; }
.hud-inv .cap { margin: .2em 0 0; justify-content: center; }
.hud-inv.llena .cap { color: var(--warn); }
.hud-inv.llena .cap::after { content: " · LLENA"; }
.slot { aspect-ratio: 1; border: 1px solid var(--line); display: grid; place-items: center; font-size: 1.3em; background: #0a0e17; position: relative; border-radius: 3px; }
.slot.tool { color: var(--amber); border-color: #7a6420; } .slot.plan { color: var(--cyan); border-color: var(--cyan); }
.slot.vacio { opacity: .35; }
.slot svg, .receta svg, .lista-it svg { image-rendering: pixelated; }

/* avisos y actividad (arriba al centro) */
.hud-centro { left: 50%; top: 2.7em; transform: translateX(-50%); width: min(30em, 46%); display: flex; flex-direction: column; gap: .35em; align-items: stretch; }
#actividad { background: rgba(13,17,28,.9); border-left: 4px solid var(--cyan); padding: .3em .6em; font-size: 1.1em; line-height: 1.1; display: flex; flex-wrap: wrap; gap: .2em .6em; align-items: baseline; }
#actividad small { color: var(--dim); font-size: .75em; letter-spacing: .06em; width: 100%; } #actividad b { font-weight: normal; color: var(--fg); }
#actividad .falta { margin-left: auto; color: var(--ok); white-space: nowrap; }
#actividad.va { border-left-color: var(--amber); } #actividad.va .falta { color: var(--amber); }
#emerg { border-color: var(--bad); background: rgba(42,13,18,.92); color: #ff9a9a; text-align: center; animation: pulso-emerg 1.8s ease-in-out infinite; } #emerg b { color: #fff; font-weight: normal; }
#emerg .cuenta { height: 8px; background: #0a0e17; border: 1px solid var(--bad); margin-top: .25em; } #emerg .cuenta i { display: block; height: 100%; background: var(--bad); }
@keyframes pulso-emerg { 50% { background: rgba(62,18,26,.95); box-shadow: 0 0 10px rgba(255,90,90,.35); } }
.avisos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3em; }
.avisos li { background: rgba(13,17,28,.88); border: 1px solid var(--line); border-left: 4px solid var(--dim); border-radius: 3px; padding: .22em .6em; text-align: left; font-size: 1.12em; line-height: 1.1; animation: entra .25s ease-out; display: flex; gap: .45em; align-items: flex-start; }
.avisos li .ic { margin-top: .12em; color: var(--dim); }
.avisos li.sale { opacity: 0; transform: translateY(-6px); transition: opacity .5s, transform .5s; }
.avisos li.ok { border-left-color: var(--ok); } .avisos li.ok .ic { color: var(--ok); }
.avisos li.warn { border-left-color: var(--amber); color: var(--amber); } .avisos li.warn .ic { color: var(--amber); }
.avisos li.bad, .avisos li.ia { border-left-color: var(--bad); color: #ff9a9a; } .avisos li.bad .ic, .avisos li.ia .ic { color: var(--bad); }
.avisos li.day { border-left-color: var(--amber); color: var(--amber); } .avisos li.day .ic { color: var(--amber); }
@keyframes entra { from { opacity: 0; transform: translateY(-8px); } }

/* paneles de teclas 1-4 (derecha) y atajos */
.hud-der { right: .5em; top: 0; bottom: 4.4em; display: flex; flex-direction: column; gap: 4px; width: 21em; padding-top: calc(2.7em + 76px); pointer-events: none; overflow: hidden; justify-content: flex-start; }
.hud-der .caja { font-size: .95em; }
.plan { list-style: none; margin: 0; padding: 0; } .plan li { padding: .05em 0; color: var(--dim); } .plan li.ok { color: var(--ok); }
.plan li::before { content: "[ ] "; } .plan li.ok::before { content: "[x] "; }
.plan li.enc::before { content: ""; } .plan li.enc { color: var(--amber); }
.plan li.ruta { color: var(--dim); } .plan li.ruta.ok { color: var(--cyan); }
.hud-der .plan li { font-size: .95em; } .hud-der .plan li small { font-size: .8em; }
.sistemas #sis-tareas { margin-top: .3em; font-size: .95em; } .sistemas #sis-tareas small { color: var(--dim); white-space: nowrap; }
.sistemas #sis-nota { display: block; margin-top: .3em; color: var(--dim); font-size: .72em; line-height: 1.02; }
.amenazas ul { list-style: none; margin: 0; padding: 0; font-size: .95em; }
.amenazas li { padding: .08em 0; color: #ff9a8a; } .amenazas li.ia { color: var(--amber); } .amenazas li.mision { color: #d08aff; }
.amenazas li small { display: block; color: var(--dim); font-size: .8em; line-height: 1.05; }
.evento { color: #ffb23d; font-weight: 700; list-style: none; }
.hud-der .nota, .ventana .nota { color: var(--dim); font-size: .8em; margin-top: .3em; list-style: none; } .ventana .nota::before { content: ""; }
.log { list-style: none; margin: 0; padding: 0; max-height: 210px; overflow: auto; font-size: .9em; line-height: 1.05; }
.hud-der .log { max-height: none; overflow: hidden; }
.log li { padding: .12em 0; border-bottom: 1px dashed rgba(80,100,140,.35); }
.log .ia, .log .bad { color: var(--bad); } .log .warn { color: var(--amber); } .log .ok { color: var(--ok); } .log .day { color: var(--amber); text-align: center; }
.hud-teclas { right: .5em; bottom: .5em; display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 26em; font-size: .88em; }
.hud-teclas button { padding: .05em .5em; background: rgba(21,27,43,.9); min-height: 1.8em; } .hud-teclas button.sel { background: #2a3550; border-color: var(--amber); color: var(--amber); }

/* ---------- ventanas (menús, pausa, final) ---------- */
.modal { position: fixed; inset: 0; background: rgba(4,7,14,.78); display: grid; place-items: center; z-index: 10; padding: 1rem; }
.ventana { background: var(--panel); border: 1px solid #55648a; border-radius: 8px; box-shadow: 0 0 40px rgba(0,0,0,.65); max-width: 720px; width: 100%; max-height: 94vh; overflow: auto; padding: 1rem 1.2rem; text-shadow: var(--glow); }
.ventana h2 { margin: 0 0 .5rem; font-weight: normal; font-size: 1.7rem; color: var(--amber); letter-spacing: .06em; display: flex; align-items: center; gap: .5rem; }
.ventana h3 { margin-top: .9rem; }
.ventana p { margin: .35rem 0; line-height: 1.15; }
.ventana .fila { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .7rem; }
.ventana button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .4em; }
.grande { font-size: 1.6rem; padding: .35em 1.6em; background: var(--amber); color: #1a1200; border: 0; border-radius: 8px; letter-spacing: .08em; box-shadow: 0 0 0 3px rgba(255,194,61,.22); min-height: 56px !important; }
.grande:hover:not(:disabled) { background: #ffd36e; color: #1a1200; }
.grande .ic { width: 1.1em; height: 1.1em; }
.grande kbd { color: #1a1200; border-color: rgba(26,18,0,.55); }
.sec { min-height: 44px; }
.puntos { color: var(--amber); }
.premio { color: var(--amber); font-size: 1.4rem; margin: .6rem 0; }
.fuente { font-size: .78em; opacity: .85; border-left: 3px solid var(--cyan); padding-left: .5rem; margin: .3rem 0; }
.nota { border-left: 2px solid var(--cyan); padding: .2rem .6rem; margin: .3rem 0; text-align: left; } .nota.no { color: var(--dim); border-color: var(--line); } .nota summary { cursor: pointer; }
.medallas { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .4rem; max-height: 60vh; overflow: auto; }
.medalla { border: 1px solid var(--line); background: var(--panel2); padding: .4rem .6rem; opacity: .6; text-align: left; border-radius: 4px; }
.medalla.si { opacity: 1; border-color: var(--amber); } .medalla.nueva { margin: .3rem auto; max-width: 340px; animation: brilla 1.6s ease-in-out 2; }
@keyframes brilla { 50% { box-shadow: 0 0 14px rgba(255,194,61,.7); } }
.medalla small { display: block; color: var(--dim); }
.recetas { display: grid; gap: .35rem; } .receta { display: grid; grid-template-columns: 1.6rem 1fr auto; gap: .5rem; align-items: center; border: 1px solid var(--line); padding: .25rem .5rem; border-radius: 4px; }
.receta.no { opacity: .5; } .receta small { color: var(--dim); display: block; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; } .lista-it { display: grid; gap: .25rem; } .lista-it button { text-align: left; display: flex; align-items: center; gap: .4rem; }
.estrellas { font-size: 2.4rem; color: var(--amber); letter-spacing: .3em; }
.mochila { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .4rem; margin: .4rem 0; }
.mochila .it { border: 1px solid var(--line); background: var(--panel2); padding: .35rem .5rem; display: flex; gap: .4rem; align-items: flex-start; border-radius: 4px; }
.mochila .it small { display: block; color: var(--dim); font-size: .8em; line-height: 1.05; }
.mochila .it .soltar { margin-top: .25rem; padding: .05rem .5rem; font-size: .85em; }
.mochila .it.tool { border-color: #7a6420; } .mochila .it.plan { border-color: var(--cyan); }

/* menú de título: fondo sobrio de estrellas fijas, un solo botón principal */
.modal.pant-titulo { align-items: start; overflow: auto; padding: 0; background:
  radial-gradient(1.3px 1.3px at 8% 14%, rgba(255,255,255,.75) 50%, transparent 52%), radial-gradient(1px 1px at 17% 62%, rgba(255,255,255,.55) 50%, transparent 52%),
  radial-gradient(1.4px 1.4px at 27% 31%, rgba(200,225,255,.8) 50%, transparent 52%), radial-gradient(1px 1px at 36% 83%, rgba(255,255,255,.5) 50%, transparent 52%),
  radial-gradient(1.2px 1.2px at 44% 9%, rgba(255,255,255,.7) 50%, transparent 52%), radial-gradient(1px 1px at 52% 47%, rgba(255,255,255,.4) 50%, transparent 52%),
  radial-gradient(1.5px 1.5px at 61% 22%, rgba(255,240,210,.8) 50%, transparent 52%), radial-gradient(1px 1px at 69% 71%, rgba(255,255,255,.55) 50%, transparent 52%),
  radial-gradient(1.2px 1.2px at 77% 38%, rgba(200,225,255,.7) 50%, transparent 52%), radial-gradient(1px 1px at 84% 90%, rgba(255,255,255,.5) 50%, transparent 52%),
  radial-gradient(1.4px 1.4px at 91% 16%, rgba(255,255,255,.75) 50%, transparent 52%), radial-gradient(1px 1px at 95% 57%, rgba(255,255,255,.45) 50%, transparent 52%),
  radial-gradient(1px 1px at 4% 78%, rgba(255,255,255,.5) 50%, transparent 52%), radial-gradient(1.2px 1.2px at 23% 52%, rgba(255,255,255,.4) 50%, transparent 52%),
  radial-gradient(1px 1px at 58% 93%, rgba(255,255,255,.45) 50%, transparent 52%), radial-gradient(1.2px 1.2px at 73% 5%, rgba(255,255,255,.6) 50%, transparent 52%),
  radial-gradient(ellipse 110% 45% at 50% 118%, rgba(40,90,170,.45), transparent 70%), linear-gradient(#04060d, #0a1121 70%, #0c1730); }
.pant-titulo .ventana { background: transparent; border: 0; box-shadow: none; max-width: 980px; max-height: none; overflow: visible; padding: .9rem 1rem 1.2rem; margin: 0 auto; }
.inicio { display: flex; flex-direction: column; align-items: center; gap: .6rem; text-align: center; }
.inicio .kicker { margin: 0; color: var(--cyan); letter-spacing: .22em; font-size: .85rem; }
.logo-grande { margin: 0; font-weight: normal; font-size: clamp(2.2rem, 6.5vw, 3.8rem); letter-spacing: .14em; line-height: 1; } .logo-grande b { color: var(--amber); font-weight: normal; }
.lema { margin: 0; max-width: 34em; color: #c7d3ea; font-size: 1.1rem; }
.inicio .paso { margin: .3rem 0 0; font-weight: normal; font-size: .95rem; color: var(--dim); letter-spacing: .18em; }
.tarjetas { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; width: 100%; }
.tarjeta { position: relative; display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .6rem .5rem .5rem; border: 2px solid var(--line); background: rgba(21,27,43,.88); border-radius: 10px; min-height: 44px; }
.tarjeta .arte { width: 54px; height: 54px; }
.tarjeta .nombre { font-size: 1.45rem; letter-spacing: .08em; line-height: 1.1; }
.tarjeta .tag { color: #c7d3ea; font-size: 1rem; }
.tarjeta .ia { color: var(--bad); font-size: .95rem; } .tarjeta .est { color: var(--amber); letter-spacing: .1em; font-size: 1rem; }
.tarjeta .marca { position: absolute; top: .45rem; right: .55rem; display: none; align-items: center; gap: .25em; color: var(--amber); font-size: .85rem; letter-spacing: .08em; }
.tarjeta.sel { border-color: var(--amber); background: rgba(48,40,16,.88); box-shadow: 0 0 0 2px rgba(255,194,61,.35); }
.tarjeta.sel .marca { display: inline-flex; }
.ajustes-rapidos { display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; justify-content: center; align-items: center; }
.ajustes-rapidos .grupo { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; justify-content: center; }
.lbl { color: var(--dim); font-size: .9rem; letter-spacing: .1em; }
.desc-nivel { margin: -.2rem 0 0; color: var(--dim); min-height: 1.2em; }
.accion { display: flex; gap: .7rem; flex-wrap: wrap; justify-content: center; align-items: center; margin-top: .2rem; }
.secundarios { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; }
.secundarios button { min-height: 44px; padding: .3rem 1rem; }
button.reto { border-color: var(--amber); color: var(--amber); }
.mas { width: 100%; max-width: 760px; border: 1px solid var(--line); border-radius: 8px; background: rgba(13,17,28,.7); text-align: left; padding: .3rem .8rem; }
.mas summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--dim); letter-spacing: .1em; }
.mas .bloque-op { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .5rem 0; }
.mas .bloque-op small { flex-basis: 100%; color: var(--dim); }
.pie { margin: 0; color: #6f7fa0; font-size: .85rem; }
.dificultad { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; align-items: center; margin-top: .6rem; }
.dificultad button { padding: .3rem .8rem; min-height: 44px; } .dificultad button.on { background: var(--fg); color: var(--bg); }
.dificultad .lbl { width: 6.5rem; text-align: right; }
.dificultad button.bloq { opacity: .65; border-style: dashed; }
.dificultad small { flex-basis: 100%; text-align: center; color: var(--dim); }
.seg { display: inline-flex; flex-wrap: wrap; gap: .3rem; justify-content: center; }
.seg button { min-height: 44px; padding: .2rem .9rem; border-radius: 6px; }
.seg button.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.seg button.on::before { content: "✓ "; }
.seg button.bloq { opacity: .65; border-style: dashed; }
/* interruptor: ícono + etiqueta + palanca + SÍ/NO (el estado se lee y se ve, no solo color) */
.sw { display: inline-flex; align-items: center; gap: .6rem; padding: .3rem .8rem; min-height: 44px; border: 1px solid var(--line); background: var(--panel2); border-radius: 999px; text-align: left; }
.sw .pista { width: 2.5em; height: 1.3em; border-radius: 999px; background: #0a0e17; border: 1px solid var(--line); position: relative; flex: none; }
.sw .pista::after { content: ""; position: absolute; top: 2px; left: 2px; width: calc(1.3em - 6px); height: calc(1.3em - 6px); border-radius: 50%; background: var(--dim); transition: transform .15s; }
.sw[aria-checked="true"] { border-color: var(--ok); } .sw[aria-checked="true"] .pista { background: #123a26; border-color: var(--ok); } .sw[aria-checked="true"] .pista::after { transform: translateX(1.2em); background: var(--ok); }
.sw .on-off { min-width: 1.6em; color: var(--dim); } .sw[aria-checked="true"] .on-off { color: var(--ok); }
.sw small { color: var(--dim); }

/* pausa */
.pausa-cab { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin: .4rem 0 .2rem; }
.ajustes { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: .5rem; margin: .4rem 0; }
.ajustes .vol { display: inline-flex; align-items: center; gap: .4rem; }
.ajustes .vol button { min-width: 44px; }
.ajustes .nota-aj { grid-column: 1 / -1; color: var(--dim); font-size: .85em; margin: 0; }
.pestanas { display: flex; gap: .4rem; margin: .8rem 0 .3rem; flex-wrap: wrap; } .pestanas button { min-height: 44px; } .pestanas button.sel { border-color: var(--amber); color: var(--amber); }
.pest { max-height: 34vh; overflow: auto; font-size: 1rem; }
.pest.plan li small { color: var(--dim); } .pest li small { display: block; color: var(--dim); }

/* fin de la partida: qué pasó + qué aprender */
.fin { text-align: left; }
.fin-cab { display: flex; gap: .8rem; align-items: center; padding: .6rem .8rem; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); }
.fin-cab .sello { width: 3.2rem; height: 3.2rem; border-radius: 50%; display: grid; place-items: center; border: 2px solid currentColor; flex: none; } .fin-cab .sello .ic { width: 1.9rem; height: 1.9rem; }
.fin-cab .etq { margin: 0; font-size: .95rem; letter-spacing: .18em; } .fin-cab h2 { margin: 0; font-size: 2rem; color: var(--fg); }
.fin.gana .fin-cab { color: var(--ok); border-color: var(--ok); background: #0f2a1d; } .fin.pierde .fin-cab { color: var(--bad); border-color: #a33; background: #2a1216; }
.fin .estrellas { text-align: center; margin: .3rem 0 0; }
.bloque { margin: .6rem 0; padding: .5rem .8rem; border-left: 4px solid var(--line); background: rgba(29,37,57,.7); border-radius: 0 6px 6px 0; }
.bloque h3 { margin: 0 0 .15rem; color: var(--dim); }
.bloque p { margin: .15rem 0; }
.bloque.aprende { border-left-color: var(--cyan); } .bloque.aprende h3 { color: var(--cyan); }
.bloque ul { margin: .2rem 0 0; padding-left: 1.2rem; color: #c7d3ea; }
.crit { list-style: none; padding: 0 !important; display: grid; gap: .1rem; } .crit li { display: flex; align-items: center; gap: .4rem; } .crit li.no { color: var(--dim); } .crit li.si { color: var(--amber); }
.datos { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0; }
.datos span { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .6rem; border: 1px solid var(--line); border-radius: 999px; background: var(--panel2); color: #c7d3ea; font-size: .95rem; }
.fin .fila, .fila-fija { justify-content: center; position: sticky; bottom: -1rem; margin: .5rem -1.2rem -1rem; padding: .8rem 1.2rem 1rem; background: linear-gradient(rgba(21,27,43,0), var(--panel) 30%); }

/* intro y ayuda */
.pasos3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: .6rem 0; }
.pasos3 > div { border: 1px solid var(--line); background: var(--panel2); border-radius: 8px; padding: .5rem .6rem; }
.pasos3 b { display: flex; align-items: center; gap: .4rem; color: var(--amber); font-weight: normal; } .pasos3 p { margin: .2rem 0 0; font-size: .95rem; color: #c7d3ea; }
.basico { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin: .5rem 0; padding: .5rem .7rem; border: 1px solid var(--cyan); border-radius: 8px; background: rgba(95,246,255,.06); }
.basico span { white-space: nowrap; }
.ventana details.mas-info { margin: .4rem 0; } .ventana details.mas-info summary { cursor: pointer; color: var(--dim); min-height: 36px; display: flex; align-items: center; }

/* minijuegos */
.pasos { display: grid; gap: .35rem; margin: .6rem 0; }
.pasos button { text-align: left; padding: .35rem .6rem; min-height: 44px; }
.pasos button.hecho { border-color: var(--cyan); color: var(--cyan); }
.tiempo { height: 10px; border: 1px solid var(--line); } .tiempo i { display: block; height: 100%; background: var(--amber); }
.sacudir { animation: sacudir .25s; }
@keyframes sacudir { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.respira { position: relative; height: 34px; border: 1px solid var(--line); background: #0a0e17; margin: .6rem 0; }
.respira .zona { position: absolute; top: 0; bottom: 0; background: rgba(95,182,255,.35); border-left: 1px solid #5fb6ff; border-right: 1px solid #5fb6ff; }
.respira .aguja { position: absolute; top: -4px; bottom: -4px; width: 4px; background: #fff; }
.respira-latido { font-size: 2rem; text-align: center; color: #ff4b4b; }
.teclado { display: grid; grid-template-columns: repeat(3, 64px); gap: 6px; justify-content: center; margin: .8rem 0; }
.teclado button { height: 64px; font-size: 1.8rem; } .teclado button.lit { background: var(--fg); color: #000; box-shadow: 0 0 18px var(--fg); }
.cables { display: flex; justify-content: space-between; margin: .8rem 2rem; } .cables > div { display: grid; gap: 10px; }
.cables button { width: 90px; height: 36px; border: 2px solid #000; color: #000; font-weight: bold; } .cables button.sel { outline: 3px solid #fff; } .cables button:disabled { opacity: .45; }

/* controles táctiles */
.tactil { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: flex-end; padding: .6rem; pointer-events: none; z-index: 5; }
.tactil button { pointer-events: auto; width: 56px; height: 56px; font-size: 1.5rem; background: rgba(29,37,57,.88); touch-action: manipulation; border-radius: 10px; padding: 0; }
.tactil button.sel { background: #2a3550; border-color: var(--amber); color: var(--amber); }
.tactil .principal { background: rgba(60,46,12,.92); border-color: var(--amber); color: var(--amber); }
.cruz { display: grid; grid-template-columns: repeat(3, 56px); grid-template-rows: repeat(3, 56px); gap: 2px; }
.cruz [data-d=u] { grid-area: 1/2; } .cruz [data-d=l] { grid-area: 2/1; } .cruz [data-d=r] { grid-area: 2/3; } .cruz [data-d=d] { grid-area: 3/2; }
.acciones { display: grid; grid-template-columns: repeat(3, 56px); gap: 6px; }

/* ---- cooperativo ---- */
.coop-roles { display: flex; gap: .8rem; flex-wrap: wrap; justify-content: center; margin: .6rem 0; }
.coop-roles button { flex: 1 1 14rem; padding: .8rem; text-align: center; } .coop-roles .ico { display: block; font-size: 2.4em; } .coop-roles small { display: block; margin-top: .4rem; opacity: .75; }
.coop-cuerpo { text-align: left; margin: .6rem 0; } .coop-cuerpo textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: .8em; background: #0b1018; color: #cfe; border: 1px solid #345; }
.coop-cuerpo code { background: #0b1018; padding: 0 .3em; } .sala { font-size: 1.6em; letter-spacing: .2em; color: var(--cyan); }
#c-estado.ok { color: #4dff88; }
#mcc { position: fixed; inset: 0; z-index: 50; background: #070b12; color: #dfe9f5; display: flex; flex-direction: column; font-family: inherit; }
.mcc-top { display: flex; gap: 1.2rem; align-items: center; padding: .4rem .8rem; background: #0e1522; border-bottom: 1px solid #234; }
.mcc-top #m-estado { margin-left: auto; } .mcc-top .ok, .ok { color: #4dff88; } .mcc-top .bad { color: #ff5d5d; }
.mcc-cuerpo { flex: 1; display: flex; gap: .6rem; padding: .5rem; min-height: 0; }
.mcc-mapa { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; overflow: auto; }
.mcc-mapa canvas { cursor: crosshair; border: 1px solid #234; max-width: 100%; }
.mcc-herr { display: flex; gap: .5rem; align-items: center; margin-bottom: .2rem; } .mcc-mapa canvas { flex: none; } .mcc-herr .on { border-color: var(--cyan); color: var(--cyan); }
.mcc-ack { min-height: 1.2em; color: #ffc23d; margin: .2rem 0; }
.mcc-lado { width: 22rem; display: flex; flex-direction: column; gap: .4rem; overflow-y: auto; }
.mcc-lado .caja { pointer-events: auto; border: 1px solid var(--line); background: var(--panel); padding: .45rem .6rem; } .m-fila { display: flex; flex-wrap: wrap; gap: .3rem; margin: .3rem 0; } .m-fila small { width: 100%; opacity: .75; } .m-fila button { font-size: .8em; padding: .2rem .4rem; }
.mcc-storm { color: #ffc23d; font-weight: 700; } .mcc-tarde { color: #ff9a5d; } .mcc-grande { width: 100%; margin-top: .4rem; min-height: 44px; font-size: 1.05rem; border: 2px solid #ffc23d; }
.mcc-emerg { color: #ff5d5d; font-weight: 700; animation: parp 1.8s ease-in-out infinite; } @keyframes parp { 50% { opacity: .55; } }
.mcc-fin { position: absolute; inset: 30% 20%; background: #000c; border: 2px solid var(--cyan); display: flex; align-items: center; justify-content: center; text-align: center; font-size: 2em; padding: 1rem; }
#m-mapa { position: static; inset: auto; width: auto; height: auto; image-rendering: auto; flex: none; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hud-der { width: 15em; } .hud-centro { width: 44%; }
  .hud-teclas .dup { display: none; }
}
@media (max-height: 640px) and (min-width: 601px) {
  .hud-izq { width: 15.5em; } .vr { font-size: .92em; }
  .hud-crew .crew li:nth-child(n+4) { display: none; }
  .inicio { gap: .55rem; } .tarjeta .arte { width: 44px; height: 44px; } .tarjeta { padding: .5rem; } .logo-grande { font-size: 2.6rem; }
}
/* teléfono en vertical: el HUD se vuelve fichas compactas (ícono + número), sin tapar al jugador en el centro */
@media (max-width: 600px), (max-height: 520px) {
  .barra { gap: .5em; padding: .25em .4em; font-size: 15px; }
  .barra .logo, .barra #bloque, .barra .ib .txt, .barra .mini, .chip#chip-dia #ic-dest { display: none; }
  #rev { font-size: .85em; }
  .barra button { min-width: 44px; min-height: 44px; justify-content: center; }
  .barra .ib.mini { display: none; }
  .barra { padding-right: .4em; } .barra .chip { flex: 1 1 auto; } .barra .chip.reloj { flex: none; }
  .hud-izq { left: .3em; right: 58px; top: 58px; width: auto; font-size: 13px; gap: 3px; }
  .hud-izq h3, .hud-izq .sub-sis { display: none; }
  .hud-izq .caja { padding: .2em .3em; }
  .filas { display: flex; flex-wrap: wrap; gap: 3px; }
  .vr { grid-template-columns: 1.2em auto; grid-template-areas: "ic val" "ba ba"; gap: 0 .25em; min-width: 3.9em; padding: .1em .25em; border: 1px solid rgba(110,130,175,.45); border-radius: 4px; font-size: 1em; }
  .vr .ic { grid-area: ic; } .vr .val { grid-area: val; text-align: left; } .vr .bv { grid-area: ba; margin-top: .1em; height: .5em; } .vr .nom { display: none; }
  .vr .dmg { top: -1em; }
  .hud-centro { left: .3em; right: 58px; top: calc(58px + 8.6em); transform: none; width: auto; }
  .hud-der { left: .3em; right: 58px; top: calc(58px + 8.6em); bottom: auto; width: auto; max-height: max(100px, calc(50vh - 196px)); padding-top: 0 !important; overflow: auto; z-index: 4; }
  .hud-crew { left: .3em; bottom: .4em; width: auto; } .hud-crew h3, .hud-crew .nom, .hud-crew .dos, .hud-crew .txt-pide, .hud-crew .pn { display: none; } .hud-crew .caja { padding: .15em .3em; } .hud-crew .crew li { gap: 3px; } .hud-crew .cor { font-size: .8em; }
  .hud-inv { bottom: 164px; left: .3em; transform: none; } .hud-inv .slot { width: 2.1em; height: 2.1em; } .hud-inv .caja { padding: .2em .3em; }
  .hud-teclas { display: flex; flex-direction: column; flex-wrap: nowrap; right: .3em; top: 150px; bottom: auto; max-width: none; align-items: stretch; gap: 4px; font-size: 14px; }
  .hud-teclas button { min-width: 48px; min-height: 44px; padding: 0 .3em; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .85em; line-height: 1; }
  .hud-teclas .dup { display: none; }
  .hud-teclas button kbd { font-size: 1.15em; border: 0; padding: 0; }
  .tactil { padding: .4rem; } .tactil button { width: 48px; height: 48px; }
  .cruz { grid-template-columns: repeat(3, 48px); grid-template-rows: repeat(3, 48px); } .acciones { grid-template-columns: repeat(3, 48px); gap: 4px; }
  .tarjetas { grid-template-columns: 1fr; gap: .5rem; } .tarjeta { flex-direction: row; text-align: left; gap: .8rem; padding: .5rem .8rem; } .tarjeta .arte { width: 48px; height: 48px; flex: none; }
  .tarjeta .txt { display: flex; flex-direction: column; } .tarjeta .marca { top: .3rem; }
  .dificultad .lbl { width: auto; } .pasos3 { grid-template-columns: 1fr; } .dos { grid-template-columns: 1fr; }
  .ventana { padding: .8rem; } .fin .fila, .fila-fija { bottom: -.8rem; margin: .5rem -.8rem -.8rem; padding: .7rem .8rem .8rem; } .ventana h2 { font-size: 1.4rem; } .fin-cab h2 { font-size: 1.5rem; } .grande { font-size: 1.4rem; padding: .3em 1.2em; }
  .ajustes { grid-template-columns: 1fr; }
}
@media (max-width: 400px) { .hud-izq { right: 54px; } }

/* ---------- modo suave y «reducir movimiento»: sin sacudidas, destellos ni animaciones; los números y las marcas siguen ---------- */
.suave *, .suave *::before, .suave *::after { animation: none !important; }
.suave .vr .bv i { transition: none; }
.suave .avisos li.sale { transition: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
  .vr .bv i { transition: none; }
}
.vr .sub { grid-column: 1 / -1; color: var(--dim); font-size: .8em; line-height: 1.05; }
.vr .sub:empty { display: none; }
.tarjeta .txt { display: flex; flex-direction: column; align-items: center; gap: .1rem; }
@media (max-width: 600px) { .vr .sub { display: none; } .tarjeta .txt { align-items: flex-start; } }

@media (max-height: 820px) and (min-width: 601px) { .tarjeta .arte { width: 44px; height: 44px; } .inicio { gap: .45rem; } .inicio .paso { display: none; } .lema { font-size: 1rem; } .fin-cab h2 { font-size: 1.7rem; } .bloque { margin: .4rem 0; } }
/* ajustes finos del teléfono en vertical */
.pant-titulo .ventana { min-width: 0; }
@media (max-width: 600px) {
  #rev { display: none; }
  .barra .chip#chip-dia { font-size: .95em; }
  .avisos li:not(:nth-last-child(-n+2)) { display: none; } /* en pantalla chica solo se ven los 2 avisos más nuevos; el resto queda en el historial */
  .avisos li { font-size: 1em; }
  body.panel-abierto .hud-centro { visibility: hidden; }
  .hud-der .caja { background: rgba(13,17,28,.97); }
  .sw small, .ajustes .nota-aj { display: none; } .sw { border-radius: 12px; padding: .2rem .6rem; }
  .inicio .kicker { display: none; } .logo-grande { font-size: 1.9rem; letter-spacing: .06em; } .lema { font-size: 1rem; } .puntos { font-size: .9rem; } .inicio .paso { display: none; }
  .tarjeta .txt { display: grid; grid-template-columns: auto auto; justify-content: start; column-gap: .8rem; row-gap: 0; align-items: baseline; } .tarjeta .nombre, .tarjeta .tag { grid-column: 1 / -1; }
  .tarjeta { padding: .4rem .7rem; } .tarjeta .tag { font-size: .95rem; }
  .ajustes-rapidos { gap: .4rem; } .secundarios button { flex: 1 1 45%; }
}
/* JUGAR siempre a la vista, aunque la pantalla sea baja: se queda pegado abajo */
@media (max-height: 700px), (max-width: 600px) { .pant-titulo .accion { position: sticky; bottom: 0; z-index: 2; width: 100%; padding: .5rem 0 .3rem; background: linear-gradient(rgba(10,17,33,0), #0a1121 40%); } }
@media (max-width: 600px) { .inicio .puntos, .desc-nivel { display: none; } .lema { font-size: .95rem; } }
@media (max-width: 600px) { .basico { display: none; } .pasos3 p { font-size: .9rem; } .pasos3 > div { padding: .4rem .6rem; } }
/* vista de Control de Misión (coopui.js): sus barras siguen usando estas clases */
.fila-sis { display: grid; grid-template-columns: 6.6rem 1fr 3.4rem; gap: .35rem; align-items: center; font-size: .95rem; margin: .12rem 0; }
.fila-sis .barrita { height: 8px; background: #0a0e17; border: 1px solid var(--line); } .fila-sis .barrita i { display: block; height: 100%; background: #5fb6ff; transition: width .3s; }
.fila-sis .barrita.bajo i { background: var(--red); } .fila-sis .barrita.rad i { background: #ffb23d; } .fila-sis .barrita.rad.bajo i { background: var(--red); }
.fila-sis span:last-child { text-align: right; color: var(--dim); }
.mcc-lado h3 { margin-top: 0; }
.ventana .coop-roles button { display: block; }
/* en el título y los menús previos no hay partida: se esconde el HUD vacío que quedaba detrás */
.sin-juego .hud, .sin-juego #tactil { visibility: hidden; }
.ventana details.mas-info { border: 1px solid var(--line); border-radius: 6px; padding: 0 .7rem; margin: .4rem 0; background: rgba(29,37,57,.5); } .ventana details.mas-info[open] { padding-bottom: .4rem; }
.ventana details.mas-info summary { color: var(--fg); letter-spacing: .08em; }
.basico .ic { color: var(--amber); }
.basico.esencial { flex-direction: column; gap: .3rem; display: flex !important; } .basico.esencial span { white-space: normal; }
.fin-cab > div { min-width: 0; } .fin-cab h2 { overflow-wrap: anywhere; }
@media (max-width: 600px) { .fin-cab h2 { font-size: 1.25rem; letter-spacing: .02em; } .fin-cab .sello { width: 2.6rem; height: 2.6rem; } .fin-cab .sello .ic { width: 1.5rem; height: 1.5rem; } .fin-cab .etq { font-size: .8rem; letter-spacing: .1em; } }

/* ---- Proyecto Hackaton 2.0: tormenta solar real ---- */
#emerg.tormenta { border-color: #ffc23d; background: rgba(46,34,6,.93); color: #ffe7a3; }
#emerg.tormenta .cuenta { border-color: #ffc23d; } #emerg.tormenta .cuenta i { background: #ffc23d; }
#emerg.tormenta.a-salvo { border-color: #4dff88; background: rgba(6,40,20,.93); color: #b6ffcf; animation: none; }
#emerg.tormenta.a-salvo .cuenta i { background: #4dff88; }
#emerg small { display: block; opacity: .8; font-size: .78em; margin-top: .2em; }
.tormenta-card .grande-txt { font-size: 1.12em; }
.tormenta-card .fuente { color: #ffc23d; }
.dosis-comp { display: grid; gap: .35em; margin: .6em 0; }
.dosis-comp div { display: grid; grid-template-columns: 7.5em 1fr 5em; align-items: center; gap: .5em; }
.dosis-comp div::before { content: ""; grid-column: 2; grid-row: 1; height: 12px; background: #0a0e17; border: 1px solid #334; }
.dosis-comp i { grid-column: 2; grid-row: 1; height: 12px; display: block; }
.dosis-comp i.ok { background: #4dff88; } .dosis-comp i.bad { background: #ff5d5d; }
.dosis-comp b { text-align: right; }

/* Cadete: pantalla más simple (salud, energía, alerta y los 4 sistemas) */
body.cadete:not(.ver-plan) .vr[data-f="fuerza"], body.cadete:not(.ver-plan) .vr[data-f="saber"], body.cadete .vr[data-f="integ"] { display: none; }

/* Pantalla DATOS NASA */
.datos-lista { list-style: none; padding-left: 0; margin: .3em 0 .8em; }
.datos-lista li { margin: .25em 0; padding-left: 1em; text-indent: -1em; }
.datos-lista li::before { content: "› "; color: #ffc23d; }
.pant-datos a, .tormenta-card a { color: #ffc23d; }
.pant-datos h3 { margin-top: .9em; }

.pant-datos .llave { display: flex; flex-wrap: wrap; gap: .4em; align-items: center; margin: .3em 0 .6em; }
.pant-datos .llave input { flex: 1 1 14em; min-width: 0; padding: .35em .5em; background: #0a0e17; color: #e6edf7; border: 1px solid #334; font: inherit; }
.pant-datos .llave small { flex-basis: 100%; }
/* selector de idioma (ES / EN) en el título */
.inicio .idioma { display: flex; justify-content: flex-end; gap: .25rem; margin: 0 0 .3rem; }
.inicio .idioma button { min-width: 44px; min-height: 36px; padding: .2rem .6rem; font-size: .95rem; letter-spacing: .08em; opacity: .75; }
.inicio .idioma button.on { opacity: 1; border-color: var(--cyan, #5ff6ff); color: var(--cyan, #5ff6ff); }

/* ---------- arranque dramático «CUSTODIA OS» ---------- */
#arranque { position: fixed; inset: 0; z-index: 9999; background: #02060b; color: #8ff7c4; font-family: 'VT323', monospace; font-size: clamp(1.05rem, 2.7vw, 1.6rem); display: flex; flex-direction: column; justify-content: center; padding: 6vh 8vw; cursor: pointer; transition: opacity .7s ease; }
#arranque.fuera { opacity: 0; pointer-events: none; }
#arranque::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0,0,0,.16) 0 1px, transparent 1px 3px); }
.suave #arranque::after { display: none; }
.boot-txt { margin: 0; white-space: pre-wrap; line-height: 1.4; min-height: 11em; }
.boot-txt .bl { min-height: 1.4em; }
.bl.ok { color: #6dff9b; } .bl.warn { color: #ffd23d; } .bl.bad { color: #ff6b6b; } .bl.ia { color: #ff9a9a; } .bl.big { color: #fff; font-size: 1.35em; letter-spacing: .08em; }
.boot-pie { margin: 2rem 0 0; color: #7aa9c9; }
.cursor { animation: parpadeo-lento 1s steps(2, jump-none) infinite; } @keyframes parpadeo-lento { 50% { opacity: 0; } }
#arranque.glitch .boot-txt { animation: sacudida-senal .42s steps(3) 1; text-shadow: 2px 0 #ff3d9a, -2px 0 #3dffff; }
@keyframes sacudida-senal { 0% { transform: translateX(0); } 34% { transform: translateX(-6px); } 67% { transform: translateX(5px); } 100% { transform: translateX(0); } }

/* ---------- consejos, entrada suave de las ventanas y final dramático ---------- */
.consejo { margin: .2rem auto .5rem; max-width: 46rem; font-size: .95rem; color: #9fd4ff; text-align: center; opacity: .92; }
.modal:not([hidden]) .ventana { animation: aparece-vent .3s ease-out both; }
@keyframes aparece-vent { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
#lienzo { transition: filter 1.4s ease; }
body.derrota #lienzo { filter: grayscale(1) brightness(.55); }
body.derrota .fin.pierde { border-color: #ff6b6b; }
.ficha { margin-bottom: .45rem; } .ficha small { color: #9fb3c8; } .nom { border-bottom: 1px dotted #6a7f96; cursor: help; }

/* ---------- terminal DATOS NASA ---------- */
.pant-datos .ventana { background: #03090d; border: 1px solid #1f6b57; box-shadow: 0 0 0 1px #07140f inset, 0 0 22px rgba(60,255,160,.08); position: relative; }
.pant-datos .ventana::after { content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; background: repeating-linear-gradient(0deg, rgba(0,0,0,.14) 0 1px, transparent 1px 3px); }
.suave .pant-datos .ventana::after { display: none; }
.term { font-family: 'VT323', monospace; color: #9ff7cf; }
.term-cab { display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; padding: .25rem .5rem; border: 1px solid #1f6b57; background: #04120e; font-size: .95rem; letter-spacing: .08em; }
.term-est { color: #ffc23d; } .term-est.vivo { color: #6dff9b; }
.term-cmds { display: flex; flex-wrap: wrap; gap: .3rem; margin: .5rem 0; }
.term-cmds button { background: transparent; border: 1px solid #1f6b57; color: #7ee9bd; font-family: inherit; font-size: 1rem; padding: .25rem .6rem; min-height: 40px; cursor: pointer; }
.term-cmds button[aria-pressed="true"] { background: #0c2a21; color: #fff; border-color: #6dff9b; }
.term-ps { margin: .2rem 0 .4rem; color: #6dff9b; min-height: 1.4em; }
.term-out { min-height: 9rem; }
.term-out h3 { color: #ffd23d; }
.term-out .datos-lista li, .term-out p { color: #cdeee0; }
.term-out.nueva .dt-sec:not([hidden]) > * { animation: dt-linea .35s ease-out both; }
.term-out.nueva .dt-sec:not([hidden]) > *:nth-child(2) { animation-delay: .08s; } .term-out.nueva .dt-sec:not([hidden]) > *:nth-child(3) { animation-delay: .16s; } .term-out.nueva .dt-sec:not([hidden]) > *:nth-child(4) { animation-delay: .24s; }
.term-out.nueva .dt-sec:not([hidden]) .datos-lista li { animation: dt-linea .3s ease-out both; }
.term-out.nueva .dt-sec:not([hidden]) .datos-lista li:nth-child(2) { animation-delay: .07s; } .term-out.nueva .dt-sec:not([hidden]) .datos-lista li:nth-child(3) { animation-delay: .14s; } .term-out.nueva .dt-sec:not([hidden]) .datos-lista li:nth-child(4) { animation-delay: .21s; } .term-out.nueva .dt-sec:not([hidden]) .datos-lista li:nth-child(5) { animation-delay: .28s; }
@keyframes dt-linea { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
.term-nota { color: #7aa9c9 !important; font-size: .95rem; }
.term-in { display: flex; gap: .4rem; align-items: center; margin-top: .6rem; border-top: 1px dashed #1f6b57; padding-top: .5rem; }
.term-in label { color: #6dff9b; white-space: nowrap; }
.term-in input { flex: 1; min-width: 0; background: transparent; border: none; border-bottom: 1px solid #1f6b57; color: #fff; font-family: inherit; font-size: 1.05rem; padding: .25rem .3rem; }
.term-in input:focus { outline: 2px solid #6dff9b; outline-offset: 2px; }
.term-msg { min-height: 1.3em; margin: .3rem 0 0; color: #ffd23d; font-size: .95rem; }
.pant-datos .llave input { background: #02070a; color: #fff; border: 1px solid #1f6b57; }

/* ---------- piel de terminal para Control de Misión ---------- */
#mcc { position: relative; font-family: 'VT323', monospace; }
#mcc::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 5; background: repeating-linear-gradient(0deg, rgba(0,0,0,.10) 0 1px, transparent 1px 3px); }
.suave #mcc::after { display: none; }
.mcc-top b { letter-spacing: .12em; text-shadow: 0 0 8px rgba(95,246,255,.35); }
#m-estado::before { content: '> '; opacity: .6; }
.pant-datos .term { padding-bottom: 3.6rem; }

/* ---------- pregunta de cierre ---------- */
.quiz { border-left-color: #5ff6ff; }
.quiz-op { display: grid; gap: .4rem; margin: .4rem 0; }
.quiz-op button { text-align: left; min-height: 44px; padding: .45rem .7rem; }
.quiz-op button kbd { margin-right: .4rem; }
.quiz-op button.ok { border-color: #4dff88; background: rgba(77,255,136,.12); }
.quiz-op button.mal { border-color: #ff6b6b; background: rgba(255,107,107,.12); }
.quiz-v.si { color: #6dff9b; } .quiz-v.no { color: #ffb23d; }

/* ---------- sin internet ---------- */
.offline { margin: .3rem auto; text-align: center; font-size: .95rem; color: #6dff9b; }
.offline .mini { margin-left: .4rem; }

/* ---------- leer en voz alta ---------- */
.btn-leer { float: right; margin: 0 0 .4rem .6rem; min-height: 40px; padding: .3rem .7rem; font-size: .95rem; position: relative; z-index: 2; }
.btn-leer[aria-pressed="true"] { border-color: #6dff9b; color: #6dff9b; }

/* Bitácora de la misión (informe causal del final y pestaña de la pausa): el estado va en número + marca, no solo en color */
.bloque.bitacora { border-left-color: var(--amber); } .bloque.bitacora h3 { color: var(--amber); }
.bitacora .causas { list-style: none; padding: 0; margin: .3rem 0 .5rem; }
.bitacora .causas li { margin: .28rem 0; line-height: 1.25; }
.bitacora .causas li.afuera, .bitacora .causas li.energia { color: #ffd9a8; }
.bitacora .causas li.refugio, .bitacora .causas li.perfecto { color: #c9f5d9; }
.bit-tabla { overflow-x: auto; margin: .3rem 0; }
.bit-tabla table { border-collapse: collapse; width: 100%; font-size: .9em; }
.bit-tabla th, .bit-tabla td { padding: .1rem .35rem; text-align: center; border: 1px solid var(--line); white-space: nowrap; }
.bit-tabla tbody th { text-align: left; color: var(--dim); font-weight: normal; }
.bit-tabla thead th { color: var(--dim); font-weight: normal; }
.bit-tabla td.ok { color: var(--ok); }
.bit-tabla td.warn { color: var(--warn); background: rgba(255,194,61,.12); }
.bit-tabla td.bad { color: var(--bad); background: rgba(255,90,90,.16); }
.bitacora small { color: var(--dim); }
.pest li.bit { list-style: none; padding: 0; border: 0; } .pest li.bit .bloque { margin: 0; }

/* Cartel del día nuevo: no recibe clics, queda por debajo de las ventanas y se va solo (en modo suave, sin animación) */
.dia-nuevo { position: fixed; left: 50%; top: 22%; transform: translateX(-50%); z-index: 9; pointer-events: none; width: min(92vw, 30rem); padding: .7rem 1.1rem .8rem; text-align: center;
  background: rgba(10,14,24,.9); border: 1px solid var(--line); border-top: 3px solid var(--cyan); border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.55); animation: dia-entra 6.5s ease both; }
.dia-nuevo[hidden] { display: none; }
@keyframes dia-entra { 0% { opacity: 0; transform: translate(-50%, -8px); } 6%, 90% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, 0); } }
.dia-nuevo p { margin: .15rem 0; }
.dn-dia { font-size: 2.2rem; letter-spacing: .14em; color: var(--fg); line-height: 1; }
.dn-dia small { font-size: .5em; color: var(--dim); letter-spacing: .08em; }
.dn-pista { display: flex; align-items: center; gap: .5rem; margin: .5rem 0 .25rem; }
.dn-ext { flex: none; font-size: 1.2rem; display: inline-flex; align-items: center; }
.dn-linea { position: relative; flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.dn-linea i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; background: var(--cyan); }
.dn-linea b { position: absolute; top: 50%; transform: translate(-50%, -52%); color: var(--cyan); font-size: 1.1rem; text-shadow: 0 0 8px rgba(95,246,255,.6); }
.dn-falta { color: var(--cyan); letter-spacing: .04em; }
.dn-msg { color: var(--dim); font-size: 1.02rem; line-height: 1.2; }
body.derrota .dia-nuevo { display: none; }
@media (max-width: 600px) { .dia-nuevo { top: 30%; } .dn-dia { font-size: 1.7rem; } }

/* Teléfono: todo un poco más chico (ventanas y botones en rem) */
@media (max-width: 600px) { html { font-size: 18px; } }
/* Teléfono acostado (alto ≤ 520 px): mismas fichas compactas, pero repartidas para que el mapa se vea */
@media (max-height: 520px) and (min-width: 601px) {
  html { font-size: 16px; }
  .hud-izq { left: .3em; right: auto; top: 54px; width: 17em; font-size: 12px; }
  .hud-centro { left: 50%; right: auto; transform: translateX(-50%); top: 54px; width: min(44%, 26em); }
  .hud-der { left: auto; right: 188px; top: 54px; width: 15em; max-height: calc(100vh - 54px - 120px); font-size: 12px; }
  .hud-inv { bottom: .4em; left: 50%; transform: translateX(-50%); } .hud-inv .slot { width: 1.9em; height: 1.9em; }
  .hud-teclas { right: .3em; top: 54px; bottom: auto; display: grid; grid-template-columns: repeat(3, 56px); flex-direction: unset; gap: 4px; font-size: 12px; }
  .tarjetas { grid-template-columns: repeat(3, 1fr); } .tarjeta { flex-direction: column; text-align: center; } .tarjeta .txt { align-items: center; }
  .dos, .ajustes { grid-template-columns: 1fr 1fr; } .pasos3 { grid-template-columns: repeat(3, 1fr); }
  .ventana { max-height: 96vh; } .grande { font-size: 1.2rem; }
}
/* tablet chica (alto 521–640 px): el título deja más aire para que JUGAR siempre quepa, aunque el consejo ocupe dos líneas */
@media (max-height: 640px) and (min-width: 601px) { .inicio { gap: .4rem; } .logo-grande { font-size: 2.3rem; } .inicio .puntos { display: none; } }

/* Joystick flotante (aparece donde pones el dedo) y botones de acción con su palabra */
.pantalla { touch-action: none; }
/* Joystick fijo: solo en pantallas táctiles, durante la partida y sin la cruz de flechas */
#joy { display: none; position: fixed; z-index: 6; left: 22px; bottom: 22px; width: 124px; height: 124px; border-radius: 50%; pointer-events: none;
  border: 2px solid rgba(95,246,255,.45); background: radial-gradient(circle, rgba(95,246,255,.10) 0 55%, rgba(95,246,255,.04) 56%); box-shadow: inset 0 0 18px rgba(0,0,0,.45); opacity: .7; transition: opacity .15s; }
body.tactil-on:not(.cruz-on):not(.sin-juego) #joy { display: block; }
body.mapa-on #joy { visibility: hidden; }
#joy.activo { opacity: 1; border-color: rgba(95,246,255,.8); }
#joy i { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(95,246,255,.35); border: 2px solid #5ff6ff; box-shadow: 0 4px 10px rgba(0,0,0,.4); transition: transform .08s ease-out; }
#joy.activo i { transition: none; background: rgba(95,246,255,.55); }
@media (max-height: 520px) { #joy { left: 14px; bottom: 14px; width: 112px; height: 112px; } }
/* el joystick ocupa la esquina: la tripulación (tablet) sube y la mochila se corre a la derecha del joystick */
body.tactil-on:not(.cruz-on) .hud-crew { bottom: 160px; }
.tactil .cruz { display: none; } body.cruz-on .tactil .cruz { display: grid; }
.tactil .acciones button { display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; gap: 2px; }
.tactil .acciones button b { font-weight: normal; font-size: 1.35rem; }
.tactil .acciones button small { font-size: .62rem; letter-spacing: .03em; color: var(--dim); }
.tactil .acciones button.principal small, .tactil .acciones button.sel small { color: var(--amber); }
/* Teléfono: las fichas del HUD dicen su nombre y vuelven los títulos de grupo (antes solo había ícono y número, y no se entendía qué era cada una) */
.tactil { justify-content: flex-end; } body.cruz-on .tactil { justify-content: space-between; }
@media (max-width: 600px), (max-height: 520px) {
  .hud-izq h3 { display: flex; font-size: .78em; margin: 0 0 .15em; }
  .hud-izq .sub-sis { display: none; }
  .vr { grid-template-areas: "ic val" "nom nom" "ba ba"; }
  .vr .nom { display: block; grid-area: nom; font-size: .68em; color: var(--dim); letter-spacing: .02em; line-height: 1.05; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .vr .bv { margin-top: .05em; }
}
@media (max-width: 600px) { .hud-centro, .hud-der { top: calc(58px + 13.6em); } .hud-der { max-height: max(100px, calc(50vh - 260px)); } }
@media (max-height: 520px) and (min-width: 601px) { .hud-izq { width: 19em; } }

/* Retratos de la tripulación (el dibujo del mapa, de frente y ampliado sin suavizar) */
.retrato, .retrato-mini { image-rendering: pixelated; image-rendering: crisp-edges; }
.ficha .retrato { float: left; width: 54px; height: 78px; margin: 0 .7rem .2rem 0; background: rgba(255,255,255,.04); border-radius: 6px; }
.ficha { overflow: hidden; }
.hud-crew .retrato-mini { width: 18px; height: 26px; vertical-align: middle; margin-right: 2px; }
.hud-crew .crew li { display: flex; align-items: center; gap: 2px; }
.ficha::before, .pest li.ficha::before { content: none !important; }
@media (max-height: 640px) and (min-width: 601px) { .desc-nivel { display: none; } }
@media (max-height: 700px) { .pant-titulo .accion { padding-bottom: .8rem; bottom: 10px; } } /* el borde de la ventana dejaba JUGAR unos px fuera de la pantalla */

/* Teléfono: la tripulación abajo a la izquierda (retrato, corazones y lo que pide); si usas la cruz de flechas, se esconde para no taparla */
body.cruz-on .hud-crew { display: none; }
.hud-crew .crew li { white-space: nowrap; }

/* Bitácora en el celular: la tabla se desliza de lado con la columna de nombres fija y más apretada; en compu no hace falta el aviso */
.bit-desliza { display: none; margin: .1rem 0 .2rem; color: var(--dim); font-size: .8em; text-align: center; }
.bit-tabla tbody th { position: sticky; left: 0; background: var(--panel2); z-index: 1; }
@media (max-width: 600px), (max-height: 520px) {
  .bit-desliza { display: block; }
  .bit-tabla table { font-size: .82em; } .bit-tabla th, .bit-tabla td { padding: .08rem .22rem; }
  .bit-tabla { -webkit-overflow-scrolling: touch; }
}

/* Evento del día (cartel del día nuevo y panel de mantenimiento): color según sea bueno, malo o un reto; siempre con ícono y texto */
.dn-evento { margin-top: .35rem; padding: .3rem .5rem; border-radius: 6px; border: 1px solid var(--line); text-align: left; font-size: 1.02rem; line-height: 1.2; }
.dn-evento.bueno { border-color: var(--ok); color: #c9f5d9; } .dn-evento.malo { border-color: var(--warn); color: #ffe0a3; } .dn-evento.reto { border-color: var(--cyan); color: #c8f7ff; }
.dia-nuevo { max-height: 70vh; overflow: hidden; }
.sistemas .evento.bueno { color: var(--ok); } .sistemas .evento.reto { color: var(--cyan); }
@media (max-width: 600px), (max-height: 520px) { .dia-nuevo { top: 16%; } .dn-evento { font-size: .95rem; } }

/* Cooperativo: tripulante invitado (compu y celular). Solo ve y usa lo que le sirve: moverse, USAR el panel, paneles de información. */
body.invitado #c-vit, body.invitado .hud-inv, body.invitado #btn-mochila, body.invitado #btn-fabricar, body.invitado #btn-usar,
body.invitado #t-f, body.invitado #t-t, body.invitado #t-sh, body.invitado #t-q, body.invitado #t-i { display: none !important; }
#inv-aviso { position: fixed; left: 50%; top: 56px; transform: translateX(-50%); z-index: 8; max-width: min(92vw, 34rem); padding: .35rem .8rem; background: rgba(13,17,28,.94); border: 1px solid var(--amber); border-radius: 6px; color: var(--amber); text-align: center; pointer-events: none; }
#inv-aviso[hidden] { display: none; }
.elige { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; margin: .6rem 0; }
.elige button { display: flex; flex-direction: column; align-items: center; gap: .2rem; min-width: 7.5rem; min-height: 44px; padding: .5rem .8rem; }
.elige button .retrato { width: 54px; height: 78px; float: none; margin: 0; image-rendering: pixelated; }
.elige button small { color: var(--dim); }
.elige button:disabled { opacity: .45; }
@media (max-width: 600px), (max-height: 520px) { #inv-aviso { top: 52px; font-size: .9rem; } .elige button { min-width: 6rem; } .elige button .retrato { width: 36px; height: 52px; } }

/* Tutorial guiado: una tarjeta arriba (en el lugar de los avisos); funciona igual en compu y en celular */
.tuto { background: rgba(13,17,28,.96) !important; border: 1px solid var(--amber) !important; border-left: 5px solid var(--amber) !important; pointer-events: auto; padding: .4em .7em !important; margin-bottom: 4px; }
.tuto small { display: block; color: var(--amber); letter-spacing: .08em; }
.tuto b { display: block; font-weight: normal; color: var(--fg); font-size: 1.25em; }
.tuto p { margin: .15em 0 .3em; color: #dbe5f7; line-height: 1.15; font-size: 1.05em; }
.tuto .tuto-bt { display: flex; gap: .5em; flex-wrap: wrap; align-items: center; }
.tuto .tuto-bt button { pointer-events: auto; min-height: 40px; padding: .1em .9em; }
.tuto .tuto-bt .grande { font-size: 1.15em; padding: .15em 1em; }
.tuto[hidden] { display: none; }
@media (max-width: 600px), (max-height: 520px) { .tuto p { font-size: .98em; } .tuto b { font-size: 1.1em; } .tuto .tuto-bt button { min-height: 44px; } }

body.tuto-on #actividad { display: none; }

/* Certificado de Cadete: ventana encima del final; la vista previa se achica para caber en cualquier pantalla */
#cert-modal { z-index: 12; overflow: auto; }
.cert-ventana { max-width: 760px; }
.cert-nombre { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: .3rem 0; }
.cert-nombre input { flex: 1 1 12rem; min-height: 44px; font: inherit; font-size: 1.2rem; padding: .2rem .6rem; background: #0b1018; color: var(--fg); border: 1px solid var(--line); border-radius: 6px; }
canvas.cert { position: static; inset: auto; display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; background: #0a1121; margin: .4rem 0; }
#cert-modal { background: rgba(4,7,14,.94); }

/* Panel docente / modo clase: tablas que se deslizan de lado en el celular, texto del resumen siempre con número */
#dc-texto { width: 100%; box-sizing: border-box; font: inherit; font-size: .95rem; background: #0b1018; color: var(--fg); border: 1px solid var(--line); border-radius: 6px; padding: .4rem; }
.doc-tabla { border-collapse: collapse; width: 100%; font-size: .95em; }
.doc-tabla th, .doc-tabla td { border: 1px solid var(--line); padding: .15rem .45rem; text-align: center; white-space: nowrap; }
.doc-tabla th { color: var(--dim); font-weight: normal; } .doc-tabla td:first-child { text-align: left; }
.doc-tabla td.ok { color: var(--ok); } .doc-tabla td.bad { color: var(--bad); background: rgba(255,90,90,.14); }

/* Fase 2: el compañero invitado sí ve su mochila y el botón DISTRAER (F) */
body.invitado .hud-inv { display: block !important; }
body.invitado #t-f { display: flex !important; }

/* ================= CUSTODIA · fusión 15/11/2026: marca, ayudas de lectura y pantallas de entrada ================= */
/* logo con el escudo (custodiar = proteger la base) */
.barra .logo { display: inline-flex; align-items: center; gap: .3em; white-space: nowrap; } .barra .logo .ic { width: 1.05em; height: 1.05em; color: var(--amber); }
.logo-grande { display: flex; align-items: center; justify-content: center; gap: .18em; } .logo-grande .ic { width: .82em; height: .82em; color: var(--amber); stroke-width: 2.2; flex: none; }
.sublema { margin: -.2rem 0 0; color: var(--amber); letter-spacing: .2em; font-size: 1rem; }
/* pasos numerados del inicio: 1 destino → 2 nivel → JUGAR (siempre a la vista) */
.inicio .paso, .inicio .lbl.paso { display: inline-flex !important; align-items: center; gap: .5em; margin: .15rem 0 0; color: #c7d3ea; font-size: .95rem; font-weight: normal; letter-spacing: .16em; white-space: nowrap; }
.paso .num { display: inline-grid; place-items: center; width: 1.5em; height: 1.5em; border-radius: 50%; background: var(--amber); color: #1a1405; letter-spacing: 0; font-size: .95em; }
.inicio .puntos[hidden] { display: none; }
/* grupos del HUD: cada caja dice de quién son las barras (tú / la IA / la base) */
.hud-izq .grupo h3 { color: #c7d3ea; }
#c-vit { border-left: 3px solid var(--cyan); } #c-ia { border-left: 3px solid var(--bad); } #ov-sis { border-left: 3px solid var(--amber); }
/* barras «al revés» (alerta, radiación): la raya roja de la derecha es el límite; llenarse es malo */
.vr.inv .bv { border-right: 3px solid var(--bad); }
@media (max-width: 600px) { .barra .logo { display: none; } .sublema { font-size: .82rem; letter-spacing: .1em; } }
@media (max-height: 760px) and (min-width: 601px) { .sublema { font-size: .9rem; } .inicio .kicker { display: none; } }

/* ---- título: entrada escalonada (una vez) y estrellas que respiran. Todo lento (≤1 Hz) y apagado en modo suave ---- */
.inicio.entra > * { animation: tit-sube .55s cubic-bezier(.2,.7,.2,1) both; }
.inicio.entra > :nth-child(1) { animation-delay: .05s; } .inicio.entra > :nth-child(2) { animation-delay: .12s; } .inicio.entra > :nth-child(3) { animation-delay: .2s; }
.inicio.entra > :nth-child(4) { animation-delay: .28s; } .inicio.entra > :nth-child(5) { animation-delay: .36s; } .inicio.entra > :nth-child(6) { animation-delay: .44s; }
.inicio.entra > :nth-child(7) { animation-delay: .52s; } .inicio.entra > :nth-child(8) { animation-delay: .6s; } .inicio.entra > :nth-child(9) { animation-delay: .68s; }
.inicio.entra > :nth-child(n+10) { animation-delay: .76s; }
.inicio.entra .logo-grande { animation: tit-logo .9s cubic-bezier(.2,.7,.2,1) both; animation-delay: .1s; }
.inicio.entra .tarjeta { animation: tit-carta .5s cubic-bezier(.2,.7,.2,1) both; } .inicio.entra .tarjeta:nth-child(1) { animation-delay: .5s; } .inicio.entra .tarjeta:nth-child(2) { animation-delay: .6s; } .inicio.entra .tarjeta:nth-child(3) { animation-delay: .7s; }
@keyframes tit-sube { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes tit-logo { 0% { opacity: 0; letter-spacing: .5em; filter: blur(6px); } 60% { opacity: 1; filter: none; } 100% { opacity: 1; letter-spacing: .14em; } }
@keyframes tit-carta { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: none; } }
.logo-grande .ic { animation: escudo-late 4s ease-in-out infinite; } @keyframes escudo-late { 50% { filter: drop-shadow(0 0 8px rgba(255,194,61,.75)); } }
.modal.pant-titulo::before { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; animation: estrellas-respiran 7s ease-in-out infinite;
  background: radial-gradient(1.6px 1.6px at 12% 22%, #fff 50%, transparent 52%), radial-gradient(1.2px 1.2px at 31% 9%, #bfe4ff 50%, transparent 52%), radial-gradient(1.8px 1.8px at 67% 15%, #fff 50%, transparent 52%), radial-gradient(1.2px 1.2px at 84% 34%, #ffe9b0 50%, transparent 52%), radial-gradient(1.4px 1.4px at 8% 61%, #fff 50%, transparent 52%), radial-gradient(1.2px 1.2px at 93% 72%, #bfe4ff 50%, transparent 52%), radial-gradient(1.5px 1.5px at 47% 4%, #fff 50%, transparent 52%), radial-gradient(1.2px 1.2px at 76% 88%, #fff 50%, transparent 52%); }
.pant-titulo .ventana { position: relative; z-index: 1; }
@keyframes estrellas-respiran { 0%, 100% { opacity: .15; } 50% { opacity: .85; } }
.suave .modal.pant-titulo::before { opacity: .5; }
.tarjeta { transition: transform .15s ease-out, border-color .15s, box-shadow .15s; } .tarjeta:hover { transform: translateY(-3px); border-color: #6f86b8; } .tarjeta.sel:hover { border-color: var(--amber); }
#t-jugar { animation: jugar-respira 2.6s ease-in-out infinite; } @keyframes jugar-respira { 50% { box-shadow: 0 0 0 6px rgba(255,194,61,.16), 0 0 22px rgba(255,194,61,.35); } }

/* ---- arranque «CUSTODIA OS»: monitor que enciende, cabecera con estado, ojo de la IA, barra de progreso y sello final ---- */
#arranque { align-items: center; overflow: hidden; background: radial-gradient(ellipse 90% 70% at 50% 45%, #06121d, #02060b 75%); }
.boot-marco { position: relative; width: min(100%, 60rem); display: flex; flex-direction: column; transition: opacity .45s ease, transform .45s ease; }
.boot-cab { display: flex; align-items: center; gap: .8em; padding-bottom: .5em; margin-bottom: .7em; border-bottom: 1px solid rgba(143,247,196,.28); opacity: .35; transition: opacity .5s ease; }
.boot-marca { display: inline-flex; align-items: center; gap: .35em; color: #fff; letter-spacing: .14em; } .boot-marca .ic { width: 1em; height: 1em; color: var(--amber); }
.boot-estado { margin-left: auto; padding: 0 .5em; border: 1px solid currentColor; border-radius: 3px; font-size: .8em; letter-spacing: .1em; color: #7aa9c9; } .boot-estado.mal { color: #ff6b6b; }
.boot-ojo { width: 1.1em; height: 1.1em; border-radius: 50%; border: 2px solid #5b7890; display: grid; place-items: center; transition: border-color .3s, box-shadow .3s; } .boot-ojo i { width: .4em; height: .4em; border-radius: 50%; background: #5b7890; transition: background .3s; }
#arranque.habla .boot-ojo { border-color: #ff6b6b; box-shadow: 0 0 14px rgba(255,90,90,.6); animation: ojo-habla 1.1s ease-in-out infinite; } #arranque.habla .boot-ojo i { background: #ff6b6b; }
@keyframes ojo-habla { 50% { transform: scale(1.22); box-shadow: 0 0 22px rgba(255,90,90,.85); } }
.boot-barra { height: 4px; margin-top: .9em; background: rgba(143,247,196,.14); border-radius: 2px; overflow: hidden; } .boot-barra i { display: block; height: 100%; width: 0; background: #8ff7c4; box-shadow: 0 0 8px #8ff7c4; transition: width .35s ease-out; }
.boot-pie { margin: 1.2rem 0 0; }
#arranque.encendido .boot-cab { opacity: 1; }
#arranque.encendido .boot-marco { animation: crt-enciende .42s cubic-bezier(.2,.8,.2,1) both; }
@keyframes crt-enciende { 0% { transform: scaleY(.02) scaleX(.6); filter: brightness(4); opacity: .9; } 55% { transform: scaleY(.02) scaleX(1); filter: brightness(3); } 100% { transform: none; filter: none; opacity: 1; } }
/* banda de luz que baja despacio por la pantalla (6 s por pasada) */
#arranque.encendido::before { content: ''; position: absolute; left: 0; right: 0; top: -20%; height: 18%; pointer-events: none; background: linear-gradient(transparent, rgba(143,247,196,.06), transparent); animation: crt-banda 6s linear infinite; }
@keyframes crt-banda { to { transform: translateY(700%); } }
.bl.ia { text-shadow: 0 0 10px rgba(255,90,90,.45); } .bl.big { text-shadow: 0 0 14px rgba(255,255,255,.5); }
.boot-sello { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4em; opacity: 0; pointer-events: none; color: #fff; }
.boot-sello .ic { width: 3.2em; height: 3.2em; color: var(--amber); stroke-width: 1.8; } .boot-sello b { font-weight: normal; font-size: clamp(2.4rem, 9vw, 4.6rem); letter-spacing: .16em; line-height: 1; } .boot-sello span { color: var(--amber); letter-spacing: .2em; font-size: .85em; text-align: center; }
#arranque.sello .boot-marco { opacity: 0; transform: scale(.97); }
#arranque.sello .boot-sello { animation: sello-entra .7s cubic-bezier(.2,.7,.2,1) .25s both; }
@keyframes sello-entra { from { opacity: 0; transform: scale(1.18); filter: blur(8px); } to { opacity: 1; transform: none; filter: none; } }
#arranque.sello.fuera { transition: opacity .7s ease, transform .7s ease; transform: scale(1.06); }
.suave #arranque::before { display: none; }
@media (max-width: 600px) { .boot-estado { font-size: .7em; } }

/* ---- hebreo (solo texto): las ventanas y los avisos se leen de derecha a izquierda; el HUD y el mapa no cambian de lugar ---- */
:lang(he) .ventana, :lang(he) .avisos, :lang(he) .hud-der, :lang(he) #actividad { direction: rtl; }
:lang(he) .ventana { letter-spacing: 0; } :lang(he) .logo-grande, :lang(he) .boot-txt, :lang(he) kbd { direction: ltr; }
:lang(he) .sublema, :lang(he) .inicio .paso, :lang(he) .inicio .kicker, :lang(he) .tarjeta .nombre { letter-spacing: 0; }
:lang(he) body { font-family: "VT323", "Noto Sans Hebrew", "Arial Hebrew", "DejaVu Sans Mono", monospace; }

/* ---- Feedback de prueba (15/11): botones más grandes, avisos fuera del centro, mapa ---- */
/* Botones táctiles grandes: USAR (E) ocupa dos filas en la esquina, donde descansa el pulgar */
.tactil { padding: .7rem; }
.tactil .acciones { grid-template-columns: repeat(3, 74px); grid-auto-rows: 74px; gap: 8px; }
.tactil .acciones button { width: 74px; height: 74px; border-radius: 14px; }
.tactil .acciones button b { font-size: 1.9rem; }
.tactil .acciones button small { font-size: .78rem; }
.tactil .acciones #t-e { grid-column: 3; grid-row: 2 / 4; height: auto; }
.tactil .acciones #t-e b { font-size: 2.6rem; } .tactil .acciones #t-e small { font-size: .95rem; }
.tactil .acciones #t-f { grid-column: 1; grid-row: 1; } .tactil .acciones #t-t { grid-column: 2; grid-row: 1; } .tactil .acciones #t-q { grid-column: 3; grid-row: 1; }
.tactil .acciones #t-sh { grid-column: 1; grid-row: 2; } .tactil .acciones #t-i { grid-column: 2; grid-row: 2; }
.tactil .acciones #t-m { grid-column: 1 / 3; grid-row: 3; width: auto; }
.tactil .cruz { grid-template-columns: repeat(3, 66px); grid-template-rows: repeat(3, 66px); }
.tactil .cruz button { width: 66px; height: 66px; font-size: 1.8rem; }
@media (max-width: 600px), (max-height: 520px) {
  .tactil { padding: .45rem; }
  .tactil .acciones { grid-template-columns: repeat(3, 64px); grid-auto-rows: 64px; gap: 6px; }
  .tactil .acciones button { width: 64px; height: 64px; }
  .tactil .acciones button b { font-size: 1.6rem; } .tactil .acciones button small { font-size: .7rem; }
  .tactil .cruz { grid-template-columns: repeat(3, 58px); grid-template-rows: repeat(3, 58px); } .tactil .cruz button { width: 58px; height: 58px; }
}
/* PC: los atajos de abajo a la derecha, más grandes y fáciles de leer */
@media (min-width: 601px) {
  .hud-teclas { font-size: .95em; gap: 5px; max-width: 30em; }
  .hud-teclas button { min-height: 2.1em; padding: .15em .6em; }
  .hud-teclas button kbd { font-size: 1.05em; }
}
/* Avisos: columna más angosta y con tope de alto, para que nunca bajen hasta el centro del mapa */
.hud-centro { width: min(26em, 40%); max-height: 34vh; overflow: hidden; }
.avisos li { font-size: 1em; padding: .18em .5em; }
/* Cartel del día: arriba, compacto y más corto (antes quedaba en medio de la pantalla) */
.dia-nuevo { top: 3.2em; width: min(92vw, 24rem); padding: .4rem .8rem .5rem; animation-duration: 4.5s; }
.dn-dia { font-size: 1.6rem; }
.dia-nuevo .dn-msg { display: none; }
@media (max-width: 600px), (max-height: 520px) { .dia-nuevo { top: 3.2em; } }
/* Con el mapa completo abierto se esconde el HUD (menos la barra y los botones) para que no tape las salas */
body.mapa-on .hud:not(.barra):not(.hud-teclas), body.mapa-on .hud-teclas button:not(#btn-mapa) { visibility: hidden; }
body.mapa-on.tactil-on #btn-mapa { visibility: hidden; }
/* Teléfono y tablet en vertical: se pide girar (el juego es SIEMPRE horizontal). En PC (mouse) nunca aparece. */
.girar { display: none; }
@media (pointer: coarse) and (orientation: portrait) {
  .girar { display: flex; position: fixed; inset: 0; z-index: 50; flex-direction: column; align-items: center; justify-content: center; gap: .6rem; padding: 2rem; text-align: center; background: #02060b; color: var(--fg); }
  .girar-tel { font-size: 4.5rem; animation: girar-tel 2.4s ease-in-out infinite; }
  .girar-tit { font-size: 1.8rem; letter-spacing: .12em; color: var(--cyan); margin: 0; }
  .girar-txt { color: var(--dim); font-size: 1.1rem; max-width: 20rem; margin: 0; }
}
@keyframes girar-tel { 0%, 25% { transform: rotate(0); } 55%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
.suave .girar-tel { animation: none; transform: rotate(-90deg); }
/* Teléfono acostado: botones en 2 filas (USAR alto a la derecha) y los atajos debajo del minimapa, sin taparlo */
@media (max-height: 520px) and (min-width: 601px) {
  .tactil .acciones { grid-template-columns: repeat(4, 58px); grid-auto-rows: 58px; gap: 6px; }
  .tactil .acciones button { width: 58px; height: 58px; }
  .tactil .acciones button b { font-size: 1.45rem; } .tactil .acciones button small { font-size: .66rem; }
  .tactil .acciones #t-f { grid-column: 1; grid-row: 1; } .tactil .acciones #t-t { grid-column: 2; grid-row: 1; } .tactil .acciones #t-q { grid-column: 3; grid-row: 1; }
  .tactil .acciones #t-sh { grid-column: 1; grid-row: 2; } .tactil .acciones #t-i { grid-column: 2; grid-row: 2; } .tactil .acciones #t-m { grid-column: 3; grid-row: 2; width: 58px; }
  .tactil .acciones #t-e { grid-column: 4; grid-row: 1 / 3; height: auto; } .tactil .acciones #t-e b { font-size: 2.2rem; }
  body.tactil-on .hud-teclas { top: 108px; }
}
body.tactil-on #btn-mapa { display: none; }
/* Ventana de inicio: ✕ para cerrar arriba a la derecha (junto a LEER), la misión destacada y los controles visibles también en táctil */
.btn-x { float: right; margin: 0 0 .4rem .5rem; min-width: 44px; min-height: 40px; padding: 0 .6rem; font-size: 1.2rem; line-height: 1; position: relative; z-index: 2; }
.ventana .mision { font-size: 1.12rem; padding: .45rem .7rem; border-left: 4px solid var(--amber); background: rgba(60,46,12,.25); border-radius: 4px; }
body.tactil-on .ventana .basico { display: flex; }
.ventana .basico kbd { white-space: nowrap; }
/* ---- Tablet (táctil sin rueda): los botones de acción ocupan la esquina inferior derecha; los atajos suben encima de ellos
   y los paneles 1-4 terminan antes, así nada queda tapado. ---- */
body.tactil-on:not(.rueda-on):not(.cruz-on) .hud-teclas { bottom: 272px; }
body.tactil-on:not(.rueda-on):not(.cruz-on) .hud-der { bottom: calc(272px + 5.2em); }
@media (max-height: 520px) { body.tactil-on:not(.rueda-on):not(.cruz-on) .hud-teclas { bottom: 150px; } body.tactil-on:not(.rueda-on):not(.cruz-on) .hud-der { bottom: calc(150px + 5.2em); } }
/* ---- Teléfono a pantalla completa: sin barra ni atajos; solo ⏸ + día + hora arriba a la izquierda, los indicadores en una tabla
   debajo, el minimapa en la esquina y USAR (la rueda trae todo lo demás). Más específico (html body…) para ganar a las reglas de abajo. ---- */
html body.telefono .barra { right: auto; top: 6px; left: 6px; padding: 0; gap: 4px; background: none; border: 0; font-size: 12px; pointer-events: none; }
html body.telefono .barra > * { display: none !important; }
html body.telefono .barra > #btn-menu, html body.telefono .barra > #chip-dia, html body.telefono .barra > .reloj { display: inline-flex !important; pointer-events: auto; }
html body.telefono .barra > #btn-menu { order: -1; padding: 2px 10px; min-height: 44px; min-width: 44px; justify-content: center; } html body.telefono #btn-menu .txt { display: none; }
html body.telefono .barra .chip { background: rgba(8,11,18,.72); border: 1px solid rgba(110,130,175,.35); border-radius: 6px; padding: 2px 6px; }
html body.telefono .barra #ic-dest { display: none; }
html body.telefono .hud-izq { top: 56px; left: 6px; width: 6.2em; max-width: none; flex-direction: column; flex-wrap: nowrap; gap: 0; padding: 3px 4px;
  background: rgba(8,11,18,.72); border: 1px solid rgba(110,130,175,.35); border-radius: 8px; font-size: 12px; }
html body.telefono .hud-izq .vr { border: 0; border-radius: 0; background: none; padding: 2px 2px; justify-content: space-between; border-bottom: 1px solid rgba(110,130,175,.18); }
html body.telefono .hud-izq .vr:last-child { border-bottom: 0; }
html body.telefono .hud-izq .vr .val { margin-left: auto; }
html body.telefono .hud-izq .vr:not(.est-ok) { background: rgba(255,90,90,.12); }
html body.telefono .hud-centro { top: 6px; }
html body.telefono .tactil .acciones #t-menu { display: none !important; }
/* ---- Teléfono con el mapa abierto: el mapa ocupa todo; nada fijo a la vista (USAR, joystick, ⏸, tabla, mochila);
   los avisos van en una columna a la izquierda, con el texto completo. Tocar en cualquier parte cierra el mapa. ---- */
html body.telefono.mapa-on .barra, html body.telefono.mapa-on #tactil, html body.telefono.mapa-on #joy, html body.telefono.mapa-on .hud-inv, html body.telefono.mapa-on .hud-izq { visibility: hidden !important; }
html body.telefono.mapa-on .hud-centro { visibility: visible !important; left: 6px; top: 8px; transform: none; width: min(224px, calc(28vw - 12px)); max-height: calc(100vh - 140px); font-size: 11px; }
html body.telefono.mapa-on .hud-centro .avisos li span { white-space: normal; }
html body.telefono.mapa-on #actividad { white-space: normal; flex-wrap: wrap; }
/* ---- Rueda de acciones (body.rueda-on = teléfono, o tablet con la opción RUEDA DE ACCIONES): queda USAR; ---- */
/* ---- Solo TELÉFONO (body.telefono): quedan USAR y ☰ ATAJOS; el resto va en ruedas (mantener USAR 2 s / tocar ☰). Tablet y PC no cambian ---- */
.tactil .acciones #t-menu { display: none; }
body.telefono .hud-teclas { display: none !important; }
body.rueda-on .tactil .acciones { display: flex !important; align-items: flex-end; gap: 10px; }
body.rueda-on .tactil .acciones button:not(#t-e):not(#t-menu) { display: none !important; }
body.rueda-on .tactil .acciones #t-e { width: 92px !important; height: 92px !important; border-radius: 50%; position: relative; }
body.rueda-on .tactil .acciones #t-e b { font-size: 2.6rem; }
body.telefono .tactil .acciones #t-menu { display: flex; width: 62px !important; height: 62px !important; border-radius: 50%; }
body.telefono .tactil .acciones #t-menu b { font-size: 1.6rem; }
@media (max-height: 520px) and (min-width: 601px) { body.rueda-on .tactil .acciones #t-e { width: 80px !important; height: 80px !important; } }
/* anillo que se llena mientras mantienes USAR */
#t-e::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; pointer-events: none; opacity: 0;
  background: conic-gradient(var(--amber) calc(var(--p, 0) * 1turn), transparent 0); -webkit-mask: radial-gradient(circle, transparent 62%, #000 64%); mask: radial-gradient(circle, transparent 62%, #000 64%); }
@property --p { syntax: '<number>'; inherits: false; initial-value: 0; }
#t-e.cargando::after { opacity: 1; animation: carga var(--carga, 2s) linear forwards; }
@keyframes carga { from { --p: 0; } to { --p: 1; } }
/* la rueda */
#rueda { position: fixed; inset: 0; z-index: 40; background: rgba(2,6,11,.45); touch-action: none; }
#rueda[hidden] { display: none; }
#rueda .r-centro { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; display: grid; place-items: center; background: rgba(13,17,28,.9); border: 1px solid var(--line); color: var(--dim); font-size: 1.2rem; }
#rueda .r-op { position: absolute; width: 72px; height: 72px; margin: -36px 0 0 -36px; border-radius: 50%; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; line-height: 1;
  background: rgba(21,27,43,.96); border: 2px solid var(--line); color: var(--fg); box-shadow: 0 6px 18px rgba(0,0,0,.5); animation: r-entra .14s ease-out both; }
#rueda .r-op b { font-weight: normal; font-size: 1.5rem; }
#rueda .r-op small { font-size: .62rem; letter-spacing: .03em; color: var(--dim); max-width: 68px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#rueda .r-op.sel { border-color: var(--amber); color: var(--amber); }
#rueda .r-op.apunta, #rueda .r-op:active { border-color: var(--cyan); background: #1d3a4a; transform: scale(1.12); }
@keyframes r-entra { from { opacity: 0; transform: scale(.6); } }
.suave #rueda .r-op { animation: none; }
.tactil button, #rueda { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
/* ---- Teléfono: HUD mínimo. Vitales como fichas chicas (ícono + número, color según estado), sin títulos ni barras;
   «AHORA» en una sola línea; tripulación oculta (está en la pausa). El mapa queda libre. ---- */
body.telefono .hud-izq { top: 50px; left: .3em; width: auto; max-width: 13.5em; flex-direction: row; flex-wrap: wrap; gap: 3px; font-size: 11px; }
body.telefono .hud-izq .grupo { display: contents; }
body.telefono .hud-izq h3, body.telefono .hud-izq .sub, body.telefono .hud-izq .nom, body.telefono .hud-izq .dmg, body.telefono .hud-izq .sub-sis { display: none !important; }
body.telefono .hud-izq .filas { display: contents; }
body.telefono .hud-izq .vr.neutro, body.telefono .hud-izq [data-f="integ"] { display: none; }
body.telefono .hud-izq .vr { display: flex; align-items: center; gap: 2px; min-width: 0; padding: 1px 4px; border: 1px solid var(--est); border-radius: 10px; background: rgba(8,11,18,.72); font-size: 1em; }
body.telefono .hud-izq .vr .bv { display: none; }
body.telefono .hud-izq .vr .val { color: var(--est); }
body.telefono .hud-izq .vr.est-ok { border-color: rgba(110,130,175,.35); }
body.telefono .hud-izq .vr.est-ok .val { color: var(--fg); }
body.telefono .hud-centro { top: 50px; width: min(36%, 18em); font-size: 11px; max-height: 26vh; }
body.telefono #actividad { padding: .15em .45em; font-size: 1em; flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }
body.telefono #actividad small { display: none; }
body.telefono #actividad b { overflow: hidden; text-overflow: ellipsis; }
body.telefono .avisos li { font-size: .95em; }
body.telefono .hud-crew { display: none; }
body.telefono .hud-inv { font-size: 11px; } body.telefono .hud-inv h3.cap { display: none; }
/* Teléfono: el aviso es UNA línea (el texto completo queda en el historial, ☰ → 4 Avisos) */
body.telefono .avisos li { align-items: center; padding: .12em .45em; }
body.telefono .avisos li span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
body.telefono #emerg { font-size: .95em; padding: .2em .4em; }
body.telefono .hud-izq .vr.neutro, body.telefono .hud-izq .vr[data-f="integ"] { display: none !important; }
body.telefono #emerg small, body.telefono #emerg .fuente, body.telefono #emerg p:not(:first-child) { display: none; }
/* Fin del entrenamiento: lista de finales (los secretos, atenuados con «???») */
.fines-tuto { list-style: none; margin: .3rem 0 .6rem; padding: 0; display: grid; gap: .35rem; }
.fin-tuto { display: flex; gap: .6rem; align-items: flex-start; padding: .35rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: rgba(21,27,43,.6); }
.fin-tuto .fi { font-size: 1.4rem; line-height: 1; flex: none; }
.fin-tuto small { color: var(--dim); font-size: .95em; }
.fin-tuto.secreto { border-style: dashed; border-color: #6a4f9a; } .fin-tuto.secreto b { color: #c9a8ff; letter-spacing: .2em; }
/* Academia de Cadetes: las 5 salas numeradas en la ventana de bienvenida */
.aca-salas { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: .5rem 0; list-style: none; counter-reset: sala; }
.aca-salas li { counter-increment: sala; padding: .25rem .6rem; border: 1px solid var(--line); border-radius: 6px; background: rgba(29,37,57,.6); }
.aca-salas li::before { content: counter(sala) " · "; color: var(--amber); }
/* En la Academia solo sirven mochila, fabricar, inhibir, nombres y mapa: lo de la base (paneles 1-4) y la tripulación vacía no se muestran */
body.en-academia #teclas [data-panel], body.en-academia .hud-crew { display: none !important; }

/* =====================================================================================================================
   TABLET (pantalla táctil de 600 px o más; siempre horizontal). Un solo bloque que manda sobre los de arriba:
   · los controles táctiles quedan a un margen seguro del borde (--mz): ahí llegan los pulgares sin salirse de la pantalla;
   · nada duplicado (Mochila e Inhibir ya están en los botones de acción) y nada encima del jugador, que va SIEMPRE en el centro;
   · todo botón mide al menos 44 px. Las alturas de abajo (joystick, botones, mochila, atajos) se suman en variables para que no se pisen.
   ===================================================================================================================== */
body.tablet {
  --mz: clamp(28px, 3.4vw, 44px);   /* margen de joystick y botones con el borde de la pantalla */
  --joy: clamp(132px, 19vh, 168px); /* diámetro del joystick */
  --bt: clamp(62px, 10vh, 76px);    /* lado de un botón de acción */
  --barra: 54px;                    /* alto de la barra de arriba (botones de 44 px) */
  --inv: 64px;                      /* alto de la mochila (abajo al centro) */
}
body.tablet .barra { padding: 5px var(--mz); min-height: var(--barra); }
body.tablet .barra button { min-width: 44px; min-height: 44px; justify-content: center; }
body.tablet .barra kbd, body.tablet .hud-teclas kbd { display: none; } /* en pantalla táctil la tecla no sirve */
body.tablet .barra .ib .ic { width: 1.4em; height: 1.4em; }
body.tablet .hud-izq, body.tablet .hud-centro { top: calc(var(--barra) + 8px); }
body.tablet .hud-izq { left: 12px; }
/* joystick: grande y lejos del borde */
body.tablet #joy { left: var(--mz); bottom: var(--mz); width: var(--joy); height: var(--joy); }
body.tablet #joy i { width: 42%; height: 42%; margin: -21% 0 0 -21%; }
/* botones de acción (abajo a la derecha) */
body.tablet .tactil { padding: 0 var(--mz) var(--mz); }
body.tablet .tactil .acciones { grid-template-columns: repeat(3, var(--bt)); grid-auto-rows: var(--bt); gap: 8px; }
body.tablet .tactil .acciones button { width: var(--bt); height: var(--bt); }
body.tablet .tactil .acciones #t-m { width: auto; }
body.tablet .tactil .cruz { grid-template-columns: repeat(3, var(--bt)); grid-template-rows: repeat(3, var(--bt)); }
body.tablet .tactil .cruz button { width: var(--bt); height: var(--bt); }
/* tripulación: sobre el joystick, no pegada a él */
body.tablet:not(.cruz-on) .hud-crew { left: var(--mz); bottom: calc(var(--mz) + var(--joy) + 14px) !important; } /* !important: las reglas de «tactil-on» de arriba tienen más peso */
/* mochila: abajo al centro, alineada con el joystick; los atajos van justo encima */
body.tablet .hud-inv { bottom: var(--mz) !important; }
body.tablet .hud-teclas { left: 50% !important; right: auto !important; top: auto !important; bottom: calc(var(--mz) + var(--inv) + 10px) !important; transform: translateX(-50%); display: grid; grid-template-columns: repeat(3, auto); gap: 6px; max-width: none; font-size: 15px; }
body.tablet .hud-teclas .dup, body.tablet #btn-mapa { display: none; }
body.tablet .hud-teclas button { min-width: 96px; min-height: 44px; padding: 0 .8em; }
/* paneles 1-4: a la derecha, debajo del minimapa y encima de los botones */
body.tablet .hud-der { right: var(--mz); bottom: calc(var(--mz) + 3 * var(--bt) + 24px) !important; width: min(21em, 36vw); }
/* con los controles «como en el celular» (rueda): ya no hay fila de atajos (están en ☰ y en la pausa) */
body.tablet.rueda-on .hud-teclas { display: none; }
body.tablet.rueda-on .tactil .acciones #t-menu { display: flex; width: 62px !important; height: 62px !important; border-radius: 50%; }
body.tablet.rueda-on .tactil .acciones { gap: 12px; }
/* botón para salir del mapa (solo existe con el mapa abierto) */
.cerrar-mapa { display: none; }
body.tablet.mapa-on .cerrar-mapa, body.telefono.mapa-on .cerrar-mapa { display: flex; position: fixed; right: var(--mz, 20px); top: 10px; z-index: 8; min-width: 44px; min-height: 44px; padding: 0 .9em; align-items: center; justify-content: center; gap: .4em; font-size: 1.1rem; letter-spacing: .06em; background: rgba(60,46,12,.95); border: 1px solid var(--amber); color: var(--amber); border-radius: 10px; pointer-events: auto; touch-action: manipulation; }
/* mapa abierto en tablet: el mapa ocupa casi todo; nada fijo a la vista salvo los avisos (columna izquierda) y ✕ CERRAR MAPA */
html body.tablet.mapa-on .barra, html body.tablet.mapa-on #tactil, html body.tablet.mapa-on #joy, html body.tablet.mapa-on .hud-inv, html body.tablet.mapa-on .hud-izq, html body.tablet.mapa-on .hud-crew, html body.tablet.mapa-on .hud-teclas, html body.tablet.mapa-on .hud-der { visibility: hidden !important; }
html body.tablet.mapa-on .hud-centro { visibility: visible !important; left: 12px; top: 12px; transform: none; width: min(300px, calc(27vw - 16px)); max-height: calc(100vh - 210px); overflow: hidden; font-size: 14px; }
html body.tablet.mapa-on .hud-centro .avisos li span { white-space: normal; }
html body.tablet.mapa-on #actividad { white-space: normal; flex-wrap: wrap; }
/* con un cartel de emergencia o de tormenta, «AHORA» se esconde en tablet: así la columna de avisos no llega al jugador (centro de la pantalla) */
body.tablet .hud-centro:has(#emerg:not([hidden])) #actividad { display: none; }
/* tope de seguridad: la columna de arriba nunca baja hasta el jugador (centro de la pantalla); si algo sobra, se recorta por abajo */
body.tablet:not(.mapa-on) .hud-centro { max-height: calc(50vh - var(--barra) - 48px); overflow: hidden; }

/* ======================================================================================================================
   TELÉFONO (body.telefono), jugable con los pulgares: botones lejos del borde, panel derecho fuera del jugador,
   botón de cierre siempre a la vista en las ventanas largas. Medido en 568×320 … 932×350 (con la barra del navegador).
   ====================================================================================================================== */
body.telefono { --mt: 26px; --mb: 24px; }
html body.telefono #joy { left: max(var(--mt), env(safe-area-inset-left)); bottom: max(var(--mb), env(safe-area-inset-bottom)); }
html body.telefono .tactil { padding: 0 max(var(--mt), env(safe-area-inset-right)) max(var(--mb), env(safe-area-inset-bottom)) max(var(--mt), env(safe-area-inset-left)); }
/* El panel derecho (Mantenimiento / Plan / Amenazas / Avisos) se pega a la derecha, debajo del minimapa y por encima de USAR:
   así nunca queda sobre el jugador, que está en el centro. */
html body.telefono .hud-der { left: auto !important; right: 8px !important; top: 74px !important; bottom: auto !important; width: min(16em, calc(50vw - 46px)) !important; max-height: calc(100vh - 74px - 128px) !important; padding-top: 0 !important; overflow: auto; font-size: 12px; }
/* Ventanas largas: el botón de abajo (CERRAR, SEGUIR…) se queda pegado, no hace falta bajar hasta el final */
html body.telefono .ventana > .fila:last-child { position: sticky; bottom: -.8rem; justify-content: center; margin: .5rem -.8rem -.8rem; padding: .7rem .8rem .8rem; background: linear-gradient(rgba(21,27,43,0), var(--panel) 30%); }
html body.telefono .ventana button { min-height: 44px; }
/* Teléfono angosto (≤660 px): los avisos del centro se corren a la derecha de la barra superior (⏸, día, reloj) para no taparla */
@media (max-width: 660px) { html body.telefono .hud-centro { left: 230px; right: 90px; width: auto; transform: none; } } /* 230: la barra (⏸ de 44 px + día + reloj) llega a ~222 px */
/* Teléfono angosto: la mochila va abajo al centro, entre la cruceta y USAR (en vez de pegada a la izquierda, encima de la cruceta) */
@media (max-width: 660px) { html body.telefono .hud-inv { left: 50% !important; right: auto !important; top: auto !important; bottom: 8px !important; transform: translateX(-50%) !important; } }
/* Pantalla muy baja (≤340 px, p. ej. iPhone SE de lado): joystick y cruceta un poco más chicos para no tapar el panel de estado */
@media (max-height: 340px) {
  html body.telefono #joy { width: 96px; height: 96px; }
  html body.telefono .tactil .cruz { grid-template-columns: repeat(3, 48px); grid-template-rows: repeat(3, 48px); }
  html body.telefono .tactil .cruz button { width: 48px; height: 48px; }
}
/* con cruceta: un poco más a la derecha, para que el botón ▲ no toque el panel de estado */
html body.telefono.cruz-on .tactil { padding-left: max(calc(var(--mt) + 8px), env(safe-area-inset-left)); }
/* Título en teléfono acostado: sin textos de relleno, para que se vean las tres misiones y JUGAR no las tape */
@media (max-height: 420px) {
  html body.telefono .inicio .sublema, html body.telefono .inicio .lema, html body.telefono .inicio .puntos { display: none; }
  html body.telefono .inicio .idioma { position: absolute; top: 6px; right: 8px; margin: 0; z-index: 3; }
  html body.telefono .inicio { gap: .35rem; }
  html body.telefono .inicio .logo-grande { font-size: 1.9rem; }
  html body.telefono .pant-titulo .ventana { padding-top: .5rem; }
  html body.telefono .tarjeta { padding: .35rem .5rem; gap: 0; } html body.telefono .tarjeta .arte { width: 34px; height: 34px; } html body.telefono .tarjeta .nombre { font-size: 1.2rem; }
  html body.telefono .inicio .paso { margin: 0; }
  html body.telefono .tarjetas { grid-template-columns: repeat(3, 1fr); gap: .4rem; }
  html body.telefono .tarjeta { flex-direction: column; text-align: center; padding: .3rem .4rem; }
  html body.telefono .tarjeta .txt { align-items: center; display: flex; flex-direction: column; }
  html body.telefono .tarjeta .tag { font-size: .8rem; line-height: 1.15; } html body.telefono .tarjeta .ia, html body.telefono .tarjeta .est { font-size: .8rem; }
  html body.telefono .tarjeta .marca { top: .2rem; right: .3rem; font-size: .7rem; }
}
