/* Tema "terminal de fósforo verde": pantalla CRT retro monocromática.
   Se carga después de console.css y solo recolorea; no cambia la estructura. */
@font-face { font-family: "VT323"; src: url("../fonts/VT323-Regular.ttf") format("truetype"); font-display: swap; }

:root {
  --bg: #020a04; --panel: #04140a; --panel2: #072112; --line: #1c6b34; --fg: #4dff88; --dim: #2fb35c;
  --green: #4dff88; --amber: #ffc23d; --red: #ff4b4b; --blue: #4dff88; --violet: #4dff88;
  --glow: 0 0 6px rgba(77, 255, 136, .55);
  --font: "VT323", "DejaVu Sans Mono", monospace;
  --mono: "VT323", "DejaVu Sans Mono", monospace;
  --tint: grayscale(1) sepia(1) hue-rotate(75deg) saturate(4) brightness(.95);
}

html, body { font: 21px/1.25 var(--font); color: var(--fg); text-shadow: var(--glow); }
body { background: radial-gradient(ellipse at center, #062a12 0%, #031208 60%, #000 100%) fixed !important; }
/* líneas de barrido + viñeta + parpadeo leve */
body::before { content: ""; pointer-events: none; position: fixed; inset: 0; z-index: 98;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .28) 0 1px, transparent 1px 3px);
  animation: crt-parpadeo 6s infinite; }
body::after { content: ""; pointer-events: none; position: fixed; inset: 0; z-index: 99;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, .65) 100%); }
@keyframes crt-parpadeo { 0%, 100% { opacity: 1; } 48% { opacity: .92; } 50% { opacity: 1; } 51% { opacity: .85; } }

#barra { background: rgba(2, 14, 6, .95); border-bottom: 2px solid var(--line); backdrop-filter: none; }
#barra .logo { color: var(--fg); letter-spacing: .2em; }

h1 { background: none; -webkit-background-clip: border-box; background-clip: border-box; color: var(--fg);
  font-weight: normal; font-size: 3rem; letter-spacing: .15em; text-shadow: 0 0 10px var(--fg), 0 0 22px rgba(77, 255, 136, .5); }
h2 { color: var(--fg) !important; font-weight: normal; letter-spacing: .1em; text-transform: uppercase;
  border-bottom: 1px dashed var(--line); padding-bottom: .15rem; }
h3 { color: var(--dim); font-weight: normal; text-transform: uppercase; }
b, strong, .name, .estado, .res-name, .res-val { font-weight: normal !important; }

button, select, input { color: var(--fg); background: var(--panel); border: 2px solid var(--dim); border-radius: 3px;
  text-shadow: var(--glow); text-transform: uppercase; letter-spacing: .04em; }
button:hover:not(:disabled) { transform: none; background: var(--fg); color: #021006; text-shadow: none; box-shadow: 0 0 12px var(--fg); border-color: var(--fg); }
button.sel, .sel { background: var(--fg) !important; color: #021006 !important; border-color: var(--fg) !important; text-shadow: none; }
button.warn { border-color: var(--amber); color: var(--amber); background: #1a1203; }
button.danger { border-color: var(--red); color: var(--red); background: #1a0505; }
input[type=range], input[type=checkbox], input[type=radio] { accent-color: var(--fg); }
select option { background: #021006; color: var(--fg); }

/* todos los paneles en verde: cada sección se distingue por el título, no por el color */
.panel, .panel.c-blue, .panel.c-pink, .panel.c-green, .panel.c-amber, .panel.c-violet, .panel.c-cyan {
  border: 2px solid var(--line); border-radius: 4px; background: rgba(3, 20, 9, .88);
  box-shadow: inset 0 0 18px rgba(77, 255, 136, .08), 0 0 10px rgba(0, 0, 0, .6); }
.panel.c-amber { border-color: #7a5a14; }
.panel.c-blue h2, .panel.c-pink h2, .panel.c-green h2, .panel.c-amber h2, .panel.c-violet h2, .panel.c-cyan h2 { color: var(--fg); }

.dim, .help, th, .res-name, .tag { color: var(--dim); }
.tag { border-color: var(--line); border-radius: 2px; }
.green, .log .bueno { color: var(--fg); }
.amber, .log .aviso { color: var(--amber); text-shadow: 0 0 6px rgba(255, 194, 61, .5); }
.red, .log .evento, .log .fin { color: var(--red); text-shadow: 0 0 6px rgba(255, 75, 75, .5); }

/* barras por bloques, como medidores de terminal */
.bar { border-radius: 0; background: #010803; border: 2px solid var(--line); box-shadow: none; }
.bar > i { border-radius: 0; box-shadow: 0 0 8px rgba(77, 255, 136, .6);
  background: repeating-linear-gradient(90deg, var(--fg) 0 9px, transparent 9px 12px); }
.bar.amber > i { background: repeating-linear-gradient(90deg, var(--amber) 0 9px, transparent 9px 12px); box-shadow: 0 0 8px rgba(255, 194, 61, .6); }
.bar.red > i { background: repeating-linear-gradient(90deg, var(--red) 0 9px, transparent 9px 12px); box-shadow: 0 0 10px rgba(255, 75, 75, .8); }
.bar .mark { background: var(--amber); box-shadow: none; }

.cell { border-radius: 2px; background: rgba(1, 10, 4, .8); border-color: var(--line); }
.cell.full { background: rgba(14, 60, 28, .7); border-color: var(--fg); }
.cell.quitar { border-color: var(--red); border-style: dashed; cursor: not-allowed; }
.cell.quitar:hover { background: rgba(80, 10, 10, .6); }
td, th { border-bottom-color: var(--line); }

.res-card, .alert-card, .mini-card, .option, .vote-card { border-radius: 3px; background: rgba(0, 0, 0, .35); border: 2px solid var(--line); }
.option.sel { background: rgba(14, 60, 28, .6) !important; color: var(--fg) !important; }
.mini-card button[data-accept] { background: var(--panel); border-color: var(--fg); }
.crew-card, .crew-card.mal { border-radius: 4px; background: rgba(3, 20, 9, .9); border: 2px solid var(--line); }
.crew-card.mal { border-color: var(--red); box-shadow: 0 0 12px rgba(255, 75, 75, .35); }
.pill, .pill.violet, .pill.amber, .pill.blue, .pill.role { background: transparent; color: var(--fg); border: 1px solid var(--fg); border-radius: 2px; font-weight: normal; }
label.pick { background: rgba(77, 255, 136, .08); border-radius: 2px; }

.banner { border-radius: 3px; background: rgba(26, 18, 3, .7); }
.banner.red { color: var(--red); background: rgba(26, 5, 5, .7); }
.lesson { border-left-color: var(--fg); background: rgba(14, 60, 28, .3); border-radius: 0; }
.modal { border-radius: 4px; background: #031208; border-color: var(--fg); box-shadow: 0 0 30px rgba(77, 255, 136, .35); }
.modal.grave { border-color: var(--red); box-shadow: 0 0 34px rgba(255, 75, 75, .45); }
.clock { color: var(--fg); text-shadow: 0 0 14px var(--fg); }

/* pestañas: la activa se ve "invertida" */
.tabs { border-radius: 3px; background: rgba(0, 0, 0, .4); border: 2px solid var(--line); }
.tab { border-radius: 2px; background: transparent; border-color: var(--line); }
.tab.on, .tab.on.c-blue, .tab.on.c-pink, .tab.on.c-violet, .tab.on.c-amber, .tab.on.c-cyan, .tab.on.c-green {
  background: var(--fg); color: #021006; text-shadow: none; border-color: var(--fg); box-shadow: 0 0 14px rgba(77, 255, 136, .5); }
.badge { background: var(--red); border-radius: 2px; font-family: var(--font); }
.badge.info { background: var(--amber); color: #021006; box-shadow: none; }

.day-head { border-radius: 3px; background: rgba(3, 20, 9, .9); border: 2px solid var(--line); }
.trip { border-radius: 0; background: #010803; border-color: var(--line); }
.trip-fill { border-radius: 0; background: repeating-linear-gradient(90deg, var(--fg) 0 9px, transparent 9px 12px); }

/* dibujos y emojis en monocromo verde */
.avatar-wrap svg, #guia .guide-svg, .ico, .res-ico, .big-ico, .sky .rocket, .sky .station, .trip-ship, .trip-end, #flecha, .tab .t-ico {
  filter: var(--tint) drop-shadow(0 0 4px rgba(77, 255, 136, .6)); }
.avatar-wrap.mood-muerto svg { filter: grayscale(1) brightness(.5); }

/* Nova: globo de terminal */
#guia .g-bubble { background: #031208; color: var(--fg); border: 2px solid var(--fg); border-radius: 3px; box-shadow: 0 0 20px rgba(77, 255, 136, .35); font-size: 1.1rem; }
#guia .g-bubble::before { border-left-color: var(--fg) !important; }
#guia.mood-alerta .g-bubble { background: #1a1203; color: var(--amber); border-color: var(--amber); }
#guia.mood-alerta .g-bubble::before { border-left-color: var(--amber) !important; }
#guia .g-name { color: var(--dim); font-weight: normal; }
#guia .g-text::after { content: "█"; animation: cursor 1s steps(1) infinite; margin-left: .15em; }
@keyframes cursor { 50% { opacity: 0; } }
#guia .g-btns button { background: var(--panel); border-color: var(--fg); color: var(--fg); }
.senalado { outline-color: var(--fg) !important; border-radius: 2px; }
@keyframes brilla { 50% { outline-color: rgba(77, 255, 136, .25); box-shadow: 0 0 22px rgba(77, 255, 136, .55); } }

/* cielo del despegue en verde */
.sky { border-radius: 3px; border: 2px solid var(--line); background: linear-gradient(180deg, #010803 0%, #04200d 60%, #0b4a20 100%); }
.sky.space { background: #010803; }
.sky .ground { background: #0e5a26; }
.sky .tower { background: repeating-linear-gradient(0deg, #2fb35c 0 6px, #0e5a26 6px 12px); }
.sky .planet { background: radial-gradient(circle at 50% 20%, #4dff88, #157a36 60%, #032010); box-shadow: 0 0 40px rgba(77, 255, 136, .6); }
button.big { background: var(--panel) !important; border: 2px solid var(--fg) !important; color: var(--fg) !important; border-radius: 3px !important;
  box-shadow: 0 0 16px rgba(77, 255, 136, .45) !important; letter-spacing: .15em; }
button.big:hover:not(:disabled) { background: var(--fg) !important; color: #021006 !important; }
::selection { background: var(--fg); color: #021006; text-shadow: none; }
.job, .turno-chip, .token { border-radius: 2px; }
.job.over { background: rgba(77, 255, 136, .12); }
.cand, .hire { border-radius: 3px; background: rgba(0, 0, 0, .3); }

/* ===== Consola: menos "tarjetas", más instrumentos ===== */
.panel, .panel.c-blue, .panel.c-pink, .panel.c-green, .panel.c-amber, .panel.c-violet, .panel.c-cyan {
  border: 1px solid var(--dim); border-radius: 0; box-shadow: none; background: rgba(2, 14, 6, .9); padding: 0 .8rem .7rem; }
.panel > h2:first-child, .panel > .row:first-child > h2 {
  margin: 0 -.8rem .6rem; padding: .1rem .6rem; background: var(--fg); color: #021006 !important; text-shadow: none; border: none; font-size: 1.05rem; }
.panel > .row:first-child { margin: 0 -.8rem .6rem; padding-right: .6rem; background: var(--fg); }
.panel > .row:first-child > h2 { margin: 0; }
.panel > .row:first-child button { background: #021006; }
.panel.c-amber > h2:first-child { background: var(--amber); }

.code { display: inline-block; padding: 0 .3em; border: 1px solid currentColor; font-size: .85em; letter-spacing: .06em; line-height: 1.15; }
.cell .ico.code { font-size: .95rem; margin-bottom: .1rem; filter: none; }
.big-ico.code { float: left; margin: 0 .7rem .3rem 0; padding: .1rem .5rem; font-size: 1.2rem; animation: none; background: var(--fg); color: #021006; text-shadow: none; border: none; }
.big-ico.code.alerta { background: var(--amber); }
.modal.grave .big-ico.code { background: var(--red); }

/* etiquetas entre corchetes en vez de pastillas */
.chip, .pill, .pill.role, .pill.amber, .pill.violet, .pill.blue, .tag { background: none !important; border: none !important; border-radius: 0 !important; padding: 0 !important; box-shadow: none !important; }
.chip::before, .pill::before, .tag::before { content: "["; opacity: .7; }
.chip::after, .pill::after, .tag::after { content: "]"; opacity: .7; }
.chip.ok { color: var(--fg); } .chip.bad { color: var(--red); }

/* pestañas como teclas de función */
.tabs { counter-reset: fkey; border: none; background: none; padding: 0; gap: .3rem; }
.tab { counter-increment: fkey; border: 1px solid var(--dim); }
.tab::before { content: "F" counter(fkey) " "; opacity: .65; }
.badge { position: static; display: inline-block; margin-left: .35rem; min-width: 0; height: auto; line-height: 1.2; padding: 0 .3rem; border-radius: 0; box-shadow: none; animation: none; }

button.big::before { content: "[ "; } button.big::after { content: " ]"; }

/* recursos como lecturas de instrumento */
.res-grid { grid-template-columns: 1fr; gap: .15rem; }
.res-card, .res-card.low { display: grid; grid-template-columns: 4.2rem 1fr; gap: .6rem; padding: .15rem 0; background: none; border: none; border-bottom: 1px dotted var(--line); border-radius: 0; animation: none; }
.res-card.low { color: var(--red); }
.res-card > div:last-child { display: grid; grid-template-columns: 8rem 7rem 1fr; align-items: center; gap: .5rem; }
.res-ico.code { font-size: .9rem; text-align: center; align-self: center; filter: none; }
.res-name { font-size: 1rem; color: var(--dim); }
.res-val { font-size: 1.05rem; margin: 0; }

.crew-card, .cand, .hire, .job, .alert-card, .mini-card, .option, .vote-card, .day-head, .tabs .tab, .cell, .res-card, .turno-chip {
  border-radius: 0 !important; box-shadow: none; }
.crew-card, .cand, .hire, .alert-card, .mini-card { border: 1px solid var(--line); background: rgba(0, 0, 0, .25); }
.day-head { border: 1px solid var(--dim); background: rgba(2, 14, 6, .95); }
.trip-ship { font-size: 1rem; top: -1.1rem; animation: none; }
.trip-end { top: -1.2rem; right: -1.5rem; }
.avatar-wrap { animation-duration: 5s; }

/* dibujos de línea */
.art { width: 100%; height: 100%; display: block; }
.art-wrap { display: inline-block; width: 1em; height: 1em; }
.sky .rocket { transform: translateX(-50%) !important; font-size: 1rem; width: 44px; height: 44px; color: var(--fg); }
.sky .rocket .art-wrap, .sky .station .art-wrap { width: 100%; height: 100%; }
.sky .rocket.go::after { content: ""; position: absolute; left: 50%; top: 100%; width: 10px; height: 18px; margin-left: -5px; transform: none;
  background: linear-gradient(var(--amber), transparent); clip-path: polygon(0 0, 100% 0, 50% 100%); }
.sky .station { width: 56px; height: 56px; font-size: 1rem; color: var(--fg); }
#flecha { font-size: 1.6rem; color: var(--fg); text-shadow: 0 0 8px var(--fg); filter: none; }
.mapa .nodo text { fill: var(--fg); font-family: var(--font); font-size: 6px; }
.medal { font-size: 1.6rem; letter-spacing: .15em; border: 1px solid var(--fg); display: inline-block; padding: .1rem .8rem; margin: .4rem 0; }
.job-head .ico:empty { display: none; }
#tablero .tab::before { content: none; }

/* ===== Monitor de la base ===== */
.monitor { width: 100%; max-height: 260px; display: block; margin: .3rem 0; font-family: var(--font); }
.monitor .mod rect:first-child { fill: rgba(77, 255, 136, .06); stroke: var(--dim); stroke-width: .5; }
.monitor .mod text { fill: var(--fg); font-size: 3.6px; }
.monitor .mod.apagado { opacity: .35; }
.monitor .mod.roto rect:first-child { stroke: var(--red); animation: latido 1s infinite; }
.monitor .seg { fill: var(--fg); } .monitor .seg.vacio { fill: rgba(77, 255, 136, .15); }
.monitor .zona { fill: var(--dim); font-size: 3.2px; }
.monitor .marca { transition: transform 1.1s ease-in-out; cursor: pointer; }
.monitor .marca circle { fill: #021006; stroke: var(--fg); stroke-width: .5; }
.monitor .marca text { fill: var(--fg); font-size: 3.4px; }
.monitor .marca.mal circle { stroke: var(--amber); animation: latido 1s infinite; }
#turno-monitor { color: var(--dim); letter-spacing: .08em; }
#turno-monitor::after { content: "█"; animation: cursor 1s steps(1) infinite; margin-left: .3em; }
.mini-crew { gap: .2rem 1rem; }
.mini-crew .who { padding: 0; text-align: left; }

/* ===== Velocidad del tiempo ===== */
.velocidad { display: flex; align-items: center; gap: .25rem; border: 1px solid var(--line); padding: .15rem .3rem; }
.velocidad button { padding: .1rem .45rem; min-width: 2.4rem; }

/* ===== Panel de escotillas ===== */
.escotillas { border: 1px solid var(--amber); padding: .4rem .6rem; margin: .4rem 0; }
.hatch-grid { display: grid; gap: 3px; margin: .4rem 0; }
.hatch { padding: .25rem 0; font-size: .9rem; }
.hatch.mal { color: var(--red); border-color: var(--red); text-decoration: line-through; }
#escotillas-log { max-height: 5.5em; overflow: auto; }

/* ===== Base, energía y diario: dos columnas ===== */
.grid-base { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1rem; align-items: start; }
.orden { margin: .2rem 0 0 1.2rem; padding: 0; }
@media (max-width: 1100px) { .grid-base { grid-template-columns: 1fr; } }

/* ===== Tablero de trabajos más compacto ===== */
.job-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .35rem; }
.job { min-height: 74px; padding: .3rem .45rem; }
.job .job-desc { display: none; }
.job.off .job-desc { display: block; }
.job .checklist { font-size: .8rem; }
.job-crew { min-height: 46px; }
.cell .ico.code { margin-right: .35rem; }

/* ---------- teléfono (≤ 600 px) ---------- */
@media (max-width: 600px) {
  #barra { flex-wrap: wrap; gap: .35rem .5rem; padding: .35rem .6rem; }
  #barra .logo { font-size: .85rem; letter-spacing: .08em; }
  #barra-info { order: 5; flex-basis: 100%; font-size: .7rem; line-height: 1.2; }
  #barra button { padding: .2rem .45rem; font-size: .75rem; }
  #app { padding-left: .5rem; padding-right: .5rem; }
  .panel { padding: .6rem .6rem; }
  .tabs { gap: .25rem; }
  .tab { padding: .35rem .55rem; font-size: .85rem; white-space: normal; max-width: 100%; }
  .res-card > div:last-child { grid-template-columns: 1fr auto; }
  .res-card > div:last-child .bar { grid-column: 1 / -1; min-width: 0; }
  .ship, .hatch-grid { grid-auto-columns: minmax(0, 1fr); }
  .cell { min-width: 0; padding: 3px; font-size: .68rem; overflow: hidden; }
  .cell b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cell input[type=number] { width: 2.6rem !important; }
  .bar { min-width: 0; }
  h1 { font-size: 1.5rem !important; }
  button.big { font-size: 1rem; padding: .55rem .9rem; }
  .plantas { grid-template-columns: repeat(3, 1fr); }
  .consola-tarea .lectura { font-size: 1.5rem; }
  .terreno { min-width: calc(36 * 22px); }
  .bloque { font-size: .8rem; }
  .tramo { flex-basis: 64px; }
  #barra { position: static; }
  #barra-info { display: none; }
  #guia { left: 6px; bottom: 6px; max-width: calc(100vw - 12px); }
  #guia .g-avatar, #guia .guide-svg { width: 62px !important; height: 74px !important; }
  #guia .g-bubble { font-size: .85rem; max-height: 34vh; overflow-y: auto; margin-bottom: 30px !important; padding: .5rem .6rem; }
  #guia.closed.nuevo .g-avatar { animation: pulso 1s steps(2) 4; }
  #app { padding-bottom: 7rem; }
  #app table { display: block; max-width: 100%; overflow-x: auto; font-size: .8rem; }
  .res { grid-template-columns: 6.5rem minmax(0, 1fr) auto; gap: .35rem; font-size: .85rem; }
  .res > :last-child { white-space: nowrap; }
  .design-layout, .grid2, .grid3, .grid-base { grid-template-columns: minmax(0, 1fr) !important; }
  .design-layout > *, .grid2 > *, .grid-base > * { min-width: 0; }
  h2 { white-space: normal !important; overflow-wrap: anywhere; letter-spacing: .04em; font-size: 1.05rem; }
}

/* Colores para daltonismo (rojo/verde): peligro en magenta y aviso en amarillo claro; barras con rayas. */
body.daltonico { --red: #ff5cf0; --amber: #fff06a; }
body.daltonico .bar > i { background-image: repeating-linear-gradient(45deg, rgba(0,0,0,.35) 0 4px, transparent 4px 8px) !important; }
body.daltonico .bar.red > i { background-color: var(--red); }
.glosario .lesson { margin: .4rem 0; }
.reservas { display: flex; flex-wrap: wrap; gap: .4rem; margin: .3rem 0; }
.reservas .chip-res { border: 1px solid var(--line); padding: .1rem .5rem; }
.reservas .chip-res.ok { color: var(--green); }
.reservas .chip-res.warn { color: var(--amber); border-color: var(--amber); }
.reservas .chip-res.bad { color: var(--red); border-color: var(--red); animation: latido 1s infinite; }
.chat-bar { position: fixed; left: .5rem; bottom: .5rem; z-index: 50; display: flex; flex-wrap: wrap; gap: .25rem; max-width: 60vw; }
.chat-bar button { font-size: .8rem; padding: .1rem .4rem; }
.chat-toast { position: fixed; left: .5rem; bottom: 3rem; z-index: 60; background: var(--panel); border: 1px solid var(--amber); color: var(--amber); padding: .3rem .6rem; }
.quiz-q { margin: .5rem 0; }
.quiz-q button.ok { border-color: var(--green); color: var(--green); }
.quiz-q button.mal { border-color: var(--red); color: var(--red); }
.logro { display: inline-block; margin: .2rem; padding: .2rem .5rem; border: 1px solid var(--amber); }
.logro.no { opacity: .35; border-color: var(--line); }
/* Nova se achica cuando el consejo es tranquilo: no tapa el monitor. Al pasar el mouse vuelve. */
#guia .g-bubble { transition: opacity .4s, transform .4s; }
#guia.resting .g-bubble { opacity: 0; transform: translateY(12px) scale(.96); pointer-events: none; }
#guia.resting:hover .g-bubble { opacity: 1; transform: none; pointer-events: auto; }
#guia.resting .g-avatar { opacity: .6; }
#guia.resting:hover .g-avatar { opacity: 1; }
#guia .g-bubble { cursor: pointer; }
@media (max-width: 600px) { .chat-bar { max-width: calc(100vw - 5.5rem); bottom: .3rem; } .chat-bar button { font-size: .7rem; } .reservas .chip-res { font-size: .85rem; } }
.chat-bar { flex-direction: column-reverse; align-items: flex-start; }
.chat-bar .chat-list { display: none; flex-wrap: wrap; gap: .25rem; background: var(--panel); border: 1px solid var(--line); padding: .3rem; max-width: 18rem; }
.chat-bar.open .chat-list { display: flex; }
.chat-bar .chat-toggle { font-size: 1.1rem; padding: .2rem .5rem; }

/* Evento relámpago: cerrar escotillas contra reloj */
#relampago h2 { clear: both; }
.modal:has(#relampago) { animation: none; } /* sin animación: cada segundo cuenta */
.flash-tiempo { position: relative; height: 1.6rem; border: 2px solid var(--red); margin: .5rem 0; background: #120404; }
.flash-barra { height: 100%; width: 100%; background: var(--amber); transition: width .2s linear; }
.flash-barra.roja { background: var(--red); animation: latido .4s infinite; }
.flash-tiempo b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; text-shadow: 0 0 4px #000; }
.flash-grid { display: grid; justify-content: center; align-items: stretch; margin: .6rem auto; gap: 0; max-width: 100%; overflow-x: auto; }
.flash-mod { border: 1px solid var(--fg-dim, #2a7a45); display: flex; align-items: center; justify-content: center; font-size: .8rem; opacity: .55; }
.flash-mod.vecino { opacity: 1; border-color: var(--fg); }
.flash-mod.golpe { opacity: 1; border: 2px solid var(--red); color: var(--red); background: rgba(255, 75, 75, .15); animation: latido .5s infinite; }
.flash-door { min-width: 0; min-height: 0; padding: 0; margin: .15rem; font-size: .85rem; font-weight: bold; border: 2px solid var(--amber); color: var(--amber); background: #1a1200; }
.flash-door:not(:disabled) { animation: latido .7s infinite; cursor: pointer; }
.flash-door.cerrada { border-color: var(--fg); color: var(--fg); background: #06301a; animation: none; }
@media (max-width: 600px) { .flash-grid { transform-origin: top center; } .flash-mod { font-size: .65rem; } }

/* Minijuegos del evento relámpago */
.modal:has(#relampago) { max-height: 94vh; overflow-y: auto; }
.flash-paso { border: 1px solid var(--red); padding: .4rem .6rem; margin: .5rem 0; background: rgba(255, 75, 75, .05); }
.flash-paso.hecho { border-color: var(--fg); background: rgba(77, 255, 136, .06); }
.flash-paso h3 { margin: .1rem 0 .3rem; font-size: 1rem; }
.flash-casco { display: grid; gap: .25rem; max-width: 22rem; margin: .3rem auto; }
.flash-panel { min-width: 0; min-height: 2.4rem; padding: 0; margin: 0; font-weight: bold; background: #10140f; border: 1px solid var(--fg-dim, #2a7a45); color: var(--fg); }
.flash-panel.medido { background: color-mix(in srgb, var(--red) calc(var(--calor, 0) * 100%), #06200f); color: #fff; opacity: 1; }
.flash-panel.agujero { background: var(--fg); color: #000; }
.flash-valvulas { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .1rem; margin: .3rem 0; }
.flash-valvula { display: flex; flex-direction: column; align-items: center; min-width: 3.4rem; padding: .3rem; margin: 0; border: 2px solid var(--amber); border-radius: 50%; aspect-ratio: 1; justify-content: center; background: #1a1200; color: var(--amber); }
.flash-valvula .flecha { font-size: 1.5rem; line-height: 1; transition: transform .15s; display: inline-block; }
.flash-valvula small { font-size: .65rem; }
.flash-valvula.ok { border-color: var(--fg); color: var(--fg); background: #06301a; }
.flash-eslabon { width: 1.2rem; text-align: center; color: var(--amber); }
.flash-cables { display: grid; grid-template-columns: 1fr 3.5rem 1fr; gap: 0 .2rem; margin: .3rem 0; }
.flash-cables .col { display: contents; }
.flash-cables .col:first-child > * { grid-column: 1; }
.flash-cables .col:last-child > * { grid-column: 3; }
.flash-lineas { grid-column: 2; grid-row: 1 / -1; width: 100%; height: 100%; }
.flash-cable, .flash-borne { margin: .15rem 0; padding: .2rem .4rem; min-height: 0; font-size: .8rem; border: 2px solid var(--cable, var(--fg)); color: var(--cable, var(--fg)); background: #0a0d0a; }
.flash-cable.elegido { background: var(--cable); color: #000; animation: latido .5s infinite; }
.flash-cable.listo, .flash-borne.listo { opacity: .6; border-style: dashed; }
.flash-esquema .chip { margin: .1rem; }
.flash-lista { margin: .2rem 0 .4rem 1.2rem; }
.flash-lista li.hecho { text-decoration: line-through; opacity: .55; }
.flash-lista li.ahora { color: var(--amber); }
.flash-botones { display: flex; flex-wrap: wrap; gap: .3rem; }
.flash-paso-btn { flex: 1 1 45%; margin: 0; font-size: .8rem; padding: .35rem; }
.flash-paso-btn.hecho { opacity: .35; }
/* Efectos: sacudón al empezar, borde rojo que late y destello rojo al equivocarse */
@keyframes sacudon { 0%, 100% { transform: none; } 20% { transform: translate(-8px, 3px); } 40% { transform: translate(7px, -4px); } 60% { transform: translate(-5px, 2px); } 80% { transform: translate(3px, -1px); } }
body.sacudon #app, body.sacudon .modal-bg { animation: sacudon .5s; }
body.alarma-roja::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 49; box-shadow: inset 0 0 90px rgba(255, 40, 40, .55); animation: latido 1s infinite; }
@keyframes chispa { 0% { box-shadow: 0 0 60px #ff3b3b, inset 0 0 40px rgba(255, 60, 60, .6); transform: translateX(-4px); } 50% { transform: translateX(4px); } 100% { transform: none; } }
.modal.chispa { animation: chispa .3s; }
@media (prefers-reduced-motion: reduce) { body.sacudon #app, body.sacudon .modal-bg, .modal.chispa { animation: none; } }
@media (max-width: 600px) { .flash-valvula { min-width: 2.8rem; } .flash-cables { grid-template-columns: 1fr 2rem 1fr; } }
body:has(#relampago) #guia, body:has(#relampago) #flecha { display: none; }
/* Minijuegos nuevos: código, energía, momento justo, escotilla atascada */
.flash-door.atascada { border-color: var(--red); color: var(--red); }
.flash-codigo { font-size: 1.8rem; letter-spacing: .35rem; text-align: center; margin: .3rem 0; color: var(--fg-dim, #2a7a45); font-weight: bold; }
.flash-codigo.visible { color: var(--amber); text-shadow: 0 0 10px var(--amber); }
.flash-teclado { display: grid; grid-template-columns: repeat(5, 1fr); gap: .25rem; max-width: 18rem; margin: .3rem auto; }
.flash-tecla { margin: 0; padding: .35rem 0; min-height: 0; font-size: 1.1rem; font-weight: bold; }
.flash-energia { display: grid; grid-template-columns: 1fr 2rem auto 2rem 5.5rem; align-items: center; gap: .3rem; margin: .2rem 0; font-size: .85rem; }
.flash-energia button { margin: 0; padding: .1rem; min-height: 0; font-weight: bold; }
.flash-energia .barras { color: var(--amber); letter-spacing: .05rem; font-size: 1rem; }
.flash-energia.ok .barras, .flash-energia.ok .pide { color: var(--fg); }
.flash-energia .pide { text-align: right; color: var(--amber); }
.flash-pista { position: relative; height: 2.2rem; border: 2px solid var(--fg); margin: .4rem 0; background: #06120a; overflow: hidden; }
.flash-pista .zona { position: absolute; top: 0; bottom: 0; background: rgba(77, 255, 136, .35); border-left: 2px solid var(--fg); border-right: 2px solid var(--fg); }
.flash-pista .marca { position: absolute; top: -2px; bottom: -2px; width: 6px; margin-left: -3px; background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.flash-ahora { margin: 0 .5rem 0 0; }
@media (max-width: 600px) { .flash-energia { grid-template-columns: 1fr 1.8rem auto 1.8rem; } .flash-energia .pide { grid-column: 1 / -1; text-align: left; } .flash-codigo { font-size: 1.4rem; } }

/* ---------- teléfono: arreglos 8/11 ---------- */
@media (max-width: 600px) {
  /* barra en una sola fila deslizable (antes ocupaba 3 filas) */
  #barra { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
  #barra::-webkit-scrollbar { display: none; }
  #barra > * { flex: none; }
  #barra .logo { font-size: .75rem; }
  /* títulos sin letras tan separadas */
  h1 { letter-spacing: .04em; line-height: 1.25; }
  h1 .small, h1 .dim { letter-spacing: 0; font-size: .7rem; display: block; }
  /* con una ventana abierta, Nova no tapa las opciones (queda solo la carita) */
  body:has(.modal-bg) #guia .g-bubble { display: none; }
  /* mapa de escotillas: cabe en la pantalla */
  .flash-grid { justify-content: safe center; }
  .flash-grid > * { min-width: 0; }
  .flash-mod { font-size: .55rem; overflow: hidden; }
  .flash-door { font-size: .75rem; margin: .1rem; padding: 0 !important; letter-spacing: 0 !important; min-width: 0 !important; overflow: hidden; }
}

/* Mapa del viaje (monitor) */
.trip-wrap { width: min(620px, 100%); min-width: min(420px, 100%); margin: .4rem 0 .2rem; border: 1px solid var(--line); background: #010803; padding: 2px 4px; }
.trip-map { width: 100%; display: block; font-family: var(--font); }
.trip-map .tm-ruta { stroke: var(--dim); stroke-width: .8; stroke-dasharray: 3 2; }
.trip-map .tm-hecho { stroke: var(--fg); stroke-width: 1.6; }
.trip-map .tm-nave { fill: var(--fg); filter: drop-shadow(0 0 2px var(--fg)); }
.trip-map .tm-txt { fill: var(--dim); font-size: 6px; letter-spacing: .02em; }
.trip-map line.tm-hito { stroke: var(--fg); stroke-width: .8; } .trip-map text.tm-hito { fill: var(--fg); }
.trip-map line.tm-carga { stroke: var(--fg); stroke-width: .8; stroke-dasharray: 1 1; } .trip-map text.tm-carga { fill: var(--fg); }
.trip-map line.tm-aviso { stroke: var(--amber); stroke-width: .8; } .trip-map text.tm-aviso { fill: var(--amber); }
.trip-map line.tm-peligro { stroke: var(--red); stroke-width: 1.2; animation: latido 1s infinite; } .trip-map text.tm-peligro { fill: var(--red); }
.trip-map .tm-conj { fill: rgba(255, 190, 60, .18); }
