/* =====================================================================
   OPERACIÓN DESPACHO CRÍTICO 360° — Sistema visual Glassmorphism industrial
   ===================================================================== */
:root {
  --bg: #05080d;
  --glass: rgba(10, 18, 28, 0.62);
  --glass-strong: rgba(8, 14, 22, 0.82);
  --line: rgba(120, 200, 255, 0.22);
  --text: #e8f4ff;
  --muted: #8fa9bd;
  --cyan: #3de8ff;
  --amber: #ffb020;
  --green: #35f0a0;
  --red: #ff3b4e;
  --purple: #b06bff;
  --accent: var(--cyan);
  --f-display: 'Orbitron', 'Arial Black', sans-serif;
  --f-mono: 'JetBrains Mono', Consolas, monospace;
  --f-body: 'Inter', 'Segoe UI', Arial, sans-serif;
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--f-body); -webkit-font-smoothing: antialiased; }
button { font-family: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
[hidden] { display: none !important; }
.hidden { opacity: 0 !important; pointer-events: none !important; visibility: hidden; }
.t-amber { color: var(--amber); } .t-red { color: var(--red); } .t-green { color: var(--green); }

.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ---------- Escena ---------- */
#scene-container { position: fixed; inset: 0; }
#scene-container canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#scene-container canvas:active { cursor: grabbing; }
#hotspot-layer { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 4; background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%); }
#letterbox { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
#letterbox i { position: absolute; left: 0; right: 0; height: 0; background: #000; transition: height 0.9s cubic-bezier(.7, 0, .2, 1); }
#letterbox i:first-child { top: 0; } #letterbox i:last-child { bottom: 0; }
body.cinema #letterbox i { height: 9vh; }
body.cinema #hud, body.cinema #hint-bar { opacity: 0; pointer-events: none; }

/* ---------- Marcadores 3D → 2D ---------- */
.hotspot-marker {
  --c: var(--cyan);
  position: absolute; left: 0; top: 0; pointer-events: auto;
  display: grid; justify-items: center; gap: 8px; will-change: transform;
}
.hotspot-marker.stage-2 { --c: var(--amber); }
.hotspot-marker.solved { --c: var(--green); }
.hm-core {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  font: 800 15px var(--f-display); color: #04121a; background: var(--c);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.45), 0 0 26px var(--c); transition: transform 0.2s;
}
.hotspot-marker.solved .hm-core::after { content: '✓'; position: absolute; font-size: 12px; transform: translate(19px, -19px); background: #04121a; color: var(--green); width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; }
.hm-pulse { position: absolute; top: 0; width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--c); animation: hm-pulse 1.8s ease-out infinite; }
.hm-label {
  font: 700 11px var(--f-mono); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap;
  padding: 5px 10px; border-radius: 8px; background: rgba(4, 10, 16, 0.78); border: 1px solid var(--c); color: var(--c);
}
.hotspot-marker:hover .hm-core, .hotspot-marker:focus-visible .hm-core { transform: scale(1.14); }
@keyframes hm-pulse { 0% { transform: scale(1); opacity: 0.9; } 100% { transform: scale(2.3); opacity: 0; } }

/* ---------- Loader ---------- */
#loader { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, #0c1826, #03060a 70%); transition: opacity 0.7s; }
.loader-box { text-align: center; width: min(360px, 80vw); }
.loader-logo { font: 900 34px var(--f-display); letter-spacing: 0.12em; }
.loader-logo span { color: var(--cyan); }
.loader-bar { height: 4px; margin: 22px 0 14px; background: rgba(255, 255, 255, 0.08); border-radius: 4px; overflow: hidden; }
.loader-bar i { display: block; height: 100%; width: 40%; background: linear-gradient(90deg, transparent, var(--cyan), transparent); animation: load 1.1s linear infinite; }
#loader-text { font: 500 12px var(--f-mono); color: var(--muted); letter-spacing: 0.08em; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* ---------- HUD ---------- */
#hud {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 20;
  width: min(1180px, calc(100vw - 28px)); padding: 10px 18px; border-radius: var(--radius);
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 22px;
  transition: opacity 0.5s;
}
.hud-brand { display: grid; line-height: 1.15; }
.hud-logo { font: 900 17px var(--f-display); letter-spacing: 0.1em; }
.hud-logo b { color: var(--cyan); }
.hud-mission { font: 700 9.5px var(--f-mono); color: var(--muted); letter-spacing: 0.16em; }
.hud-stage { display: flex; align-items: center; gap: 12px; justify-self: center; }
#stage-label { font: 800 14px var(--f-display); letter-spacing: 0.08em; color: var(--accent); white-space: nowrap; }
.pips { display: flex; gap: 5px; }
.pips i { width: 22px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.14); transition: background 0.4s, box-shadow 0.4s; }
.pips i.on { background: var(--green); box-shadow: 0 0 10px var(--green); }
.hud-zone { font: 700 10px var(--f-mono); color: var(--muted); letter-spacing: 0.12em; }
.hud-timer { text-align: center; padding: 2px 16px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); position: relative; }
.hud-timer small { display: block; font: 700 8.5px var(--f-mono); letter-spacing: 0.18em; color: var(--muted); }
#timer { font: 900 30px var(--f-display); letter-spacing: 0.06em; font-variant-numeric: tabular-nums; }
.hud-timer.critical #timer { color: var(--red); animation: crit 0.9s steps(2, jump-none) infinite; text-shadow: 0 0 18px var(--red); }
.hud-timer.hit { animation: shake 0.4s; }
@keyframes crit { 50% { opacity: 0.35; } }
.hud-actions { display: flex; gap: 8px; }
.hud-btn {
  font: 700 11px var(--f-mono); letter-spacing: 0.04em; padding: 9px 12px; border-radius: 10px; white-space: nowrap;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); transition: background 0.2s, border-color 0.2s;
}
.hud-btn:hover, .hud-btn[aria-expanded="true"] { background: rgba(61, 232, 255, 0.14); border-color: var(--cyan); }
.hud-btn span { color: var(--cyan); }
body.stage-2 { --accent: var(--amber); }

/* ---------- Bitácora ---------- */
#logbook { position: fixed; top: 86px; right: max(14px, calc((100vw - 1180px) / 2)); z-index: 21; width: 300px; padding: 16px; border-radius: var(--radius); background: var(--glass-strong); animation: drop 0.25s ease-out; }
#logbook h3 { font: 800 12px var(--f-display); letter-spacing: 0.14em; color: var(--cyan); margin-bottom: 12px; }
.log-stage h4 { font: 700 10px var(--f-mono); letter-spacing: 0.1em; color: var(--muted); margin-bottom: 6px; }
.log-stage + .log-stage { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.log-stage ul { list-style: none; display: grid; gap: 5px; }
.log-stage li { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; padding: 7px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.04); color: var(--muted); }
.log-stage li b { font: 700 14px var(--f-mono); letter-spacing: 0.1em; }
.log-stage li.found { color: var(--text); background: rgba(53, 240, 160, 0.1); }
.log-stage li.found b { color: var(--green); }
.log-stage.locked { opacity: 0.4; }
.log-code { margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.log-code b { font: 700 13px var(--f-mono); color: var(--amber); letter-spacing: 0.12em; }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } }

#hint-bar { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 10; padding: 9px 18px; border-radius: 999px; font: 500 12px var(--f-mono); color: var(--muted); white-space: nowrap; transition: opacity 0.6s; max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis; }
#toast { position: fixed; bottom: 66px; left: 50%; transform: translate(-50%, 20px); z-index: 60; padding: 11px 20px; border-radius: 12px; font: 600 13px var(--f-body); opacity: 0; pointer-events: none; transition: opacity 0.3s, transform 0.3s; border-color: var(--cyan); max-width: calc(100vw - 24px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#penalty-layer { position: fixed; inset: 0; pointer-events: none; z-index: 70; }
.penalty { position: absolute; top: 74px; left: 50%; font: 900 34px var(--f-display); color: var(--red); text-shadow: 0 0 22px var(--red); animation: pen 1.4s ease-out forwards; }
@keyframes pen { 0% { opacity: 0; transform: translate(-50%, -10px) scale(0.6); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.2); } 100% { opacity: 0; transform: translate(-50%, 70px) scale(1); } }
body.flash-red::after { content: ''; position: fixed; inset: 0; z-index: 65; pointer-events: none; box-shadow: inset 0 0 160px rgba(255, 59, 78, 0.55); animation: fade 0.6s forwards; }
@keyframes fade { to { opacity: 0; } }

/* ---------- Overlays (bienvenida, etapa 2, victoria) ---------- */
.overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 18px; overflow-y: auto; background: radial-gradient(ellipse at center, rgba(3, 8, 14, 0.35), rgba(3, 6, 10, 0.86)); transition: opacity 0.6s, visibility 0.6s; }
.welcome-card { width: min(720px, 100%); padding: clamp(22px, 4vw, 40px); border-radius: 22px; background: var(--glass-strong); position: relative; overflow: hidden; }
.welcome-card::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: repeating-linear-gradient(-45deg, var(--amber) 0 14px, #15171a 14px 28px); }
.welcome-card.narrow { width: min(600px, 100%); }
.eyebrow { font: 700 11px var(--f-mono); letter-spacing: 0.18em; color: var(--cyan); margin-bottom: 14px; }
h1, .welcome-card h2 { font-family: var(--f-display); font-weight: 900; line-height: 1.04; letter-spacing: 0.02em; }
h1 { font-size: clamp(30px, 6vw, 54px); }
.welcome-card h2 { font-size: clamp(26px, 5vw, 42px); }
h1 span, .welcome-card h2 span { color: var(--amber); }
h1 em { font-style: normal; color: var(--cyan); text-shadow: 0 0 26px rgba(61, 232, 255, 0.6); }
.edition { font: 700 11px var(--f-mono); letter-spacing: 0.3em; color: var(--muted); margin: 10px 0 18px; }
.briefing { display: grid; gap: 10px; font-size: 14.5px; line-height: 1.6; color: #c9dcea; border-left: 3px solid var(--amber); padding-left: 16px; margin: 18px 0; }
.briefing b { color: #fff; }
.brief-list { list-style: none; display: grid; gap: 6px; font-size: 13.5px; }
.brief-list b { font-family: var(--f-mono); color: var(--amber); margin-right: 8px; }
.stage-preview { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; margin-bottom: 20px; }
.stage-preview div { padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(61, 232, 255, 0.35); background: rgba(61, 232, 255, 0.06); display: grid; gap: 2px; }
.stage-preview div.s2 { border-color: rgba(255, 176, 32, 0.4); background: rgba(255, 176, 32, 0.06); }
.stage-preview b { font: 800 12px var(--f-display); letter-spacing: 0.1em; color: var(--cyan); }
.stage-preview .s2 b { color: var(--amber); }
.stage-preview span { font-weight: 600; font-size: 14px; }
.stage-preview small { font-size: 11px; color: var(--muted); }
.stage-preview > i { font-style: normal; color: var(--muted); font-size: 20px; }
#welcome-form { display: grid; grid-template-columns: 1.5fr 1fr; gap: 12px; }
#welcome-form label { display: grid; gap: 6px; font: 700 10.5px var(--f-mono); letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; }
input[type="text"], input[type="number"] {
  font: 600 15px var(--f-body); color: var(--text); padding: 12px 14px; border-radius: 10px; width: 100%;
  background: rgba(0, 0, 0, 0.4); border: 1px solid var(--line); outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(61, 232, 255, 0.18); }
#welcome-form .btn { grid-column: 1 / -1; }
.credits b { color: var(--cyan); font-weight: 700; }
.credits a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.credits a:hover { color: var(--cyan); }
.credits { line-height: 1.7; margin-top: 16px; font: 500 10.5px var(--f-mono); color: #5f7688; letter-spacing: 0.06em; text-align: center; }

.btn { font: 800 13px var(--f-display); letter-spacing: 0.08em; padding: 13px 20px; border-radius: 11px; transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s, background 0.2s; }
.btn.primary { color: #04121a; background: linear-gradient(135deg, var(--cyan), #25b8ff); box-shadow: 0 8px 26px rgba(61, 232, 255, 0.3); }
.btn.primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 34px rgba(61, 232, 255, 0.5); }
.btn.primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.ghost { border: 1px solid var(--line); color: var(--muted); background: rgba(255, 255, 255, 0.03); }
.btn.ghost:hover { color: var(--text); border-color: var(--text); }
.btn.big { padding: 17px 22px; font-size: 14.5px; width: 100%; }
.btn.go { background: linear-gradient(135deg, var(--green), #17c97c); box-shadow: 0 8px 26px rgba(53, 240, 160, 0.35); }

/* ---------- Modales de desafío ---------- */
.modal { --accent: var(--cyan); position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 84px 14px 14px; background: rgba(3, 6, 10, 0.5); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.3s, visibility 0.3s; }
.modal.stage2 { --accent: var(--amber); }
.modal.open { opacity: 1; visibility: visible; pointer-events: auto; }
.modal-card { width: min(940px, 100%); max-height: 100%; overflow-y: auto; border-radius: 20px; background: var(--glass-strong); border-color: color-mix(in srgb, var(--accent) 45%, transparent); transform: translateY(18px) scale(0.98); transition: transform 0.35s cubic-bezier(.2, .9, .3, 1.2); }
.modal.open .modal-card { transform: none; }
.modal-card.keypad-card { width: min(460px, 100%); }
.modal-card.shake { animation: shake 0.45s; }
@keyframes shake { 20% { transform: translateX(-9px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
.modal-head { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(8, 14, 22, 0.94); z-index: 2; }
.st-badge { font: 900 13px var(--f-display); color: #04121a; background: var(--accent); padding: 8px 11px; border-radius: 9px; letter-spacing: 0.06em; }
.modal-head h2 { font: 800 clamp(16px, 2.6vw, 21px) var(--f-display); letter-spacing: 0.03em; }
.modal-head p { font: 500 11.5px var(--f-mono); color: var(--muted); margin-top: 3px; }
.modal-close { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); font-size: 15px; }
.modal-close:hover { color: var(--red); border-color: var(--red); }
.modal-body { padding: 18px 20px 6px; display: grid; gap: 16px; }
.situation { font-size: 14.5px; line-height: 1.6; color: #c9dcea; }
.situation b { color: #fff; }
.modal-foot { display: flex; justify-content: space-between; gap: 10px; padding: 14px 20px 18px; flex-wrap: wrap; }
.feedback { margin: 10px 20px 0; padding: 0; border-radius: 12px; font-size: 13.5px; line-height: 1.55; display: none; }
.feedback.show { display: block; padding: 13px 16px; animation: drop 0.3s; }
.feedback.bad { background: rgba(255, 59, 78, 0.11); border: 1px solid rgba(255, 59, 78, 0.5); }
.feedback.ok { background: rgba(53, 240, 160, 0.1); border: 1px solid rgba(53, 240, 160, 0.5); }
.feedback h5 { font: 800 12px var(--f-display); letter-spacing: 0.08em; margin-bottom: 5px; }
.feedback.bad h5 { color: var(--red); } .feedback.ok h5 { color: var(--green); }
.key-chip { display: flex; width: fit-content; align-items: center; gap: 10px; margin-top: 10px; padding: 8px 14px; border-radius: 10px; background: rgba(0, 0, 0, 0.45); border: 1px dashed var(--green); font: 700 12px var(--f-mono); color: var(--muted); }
.key-chip b { font: 900 22px var(--f-display); color: var(--green); letter-spacing: 0.14em; text-shadow: 0 0 16px var(--green); }

/* Documentos estación 01 */
.doc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.doc { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: rgba(0, 0, 0, 0.3); }
.doc h4 { font: 700 11px var(--f-mono); letter-spacing: 0.08em; padding: 9px 12px; background: rgba(61, 232, 255, 0.1); color: var(--cyan); }
.doc-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.doc-table th { text-align: left; font: 700 10px var(--f-mono); color: var(--muted); padding: 7px 10px; letter-spacing: 0.06em; }
.doc-table td { padding: 9px 10px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.doc-table td:first-child, .doc-table td:last-child { font-family: var(--f-mono); font-weight: 700; }
.doc-table td:last-child, .doc-table th:last-child { text-align: right; }
.doc-table tbody tr { cursor: pointer; transition: background 0.15s; }
.doc-table tbody tr:hover { background: rgba(61, 232, 255, 0.08); }
.doc-table tbody tr.selected { background: rgba(255, 176, 32, 0.18); box-shadow: inset 3px 0 0 var(--amber); }
.inline-form { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); font-size: 13.5px; }
.inline-form b { font-family: var(--f-mono); color: var(--amber); font-size: 16px; }
.inline-form label { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.inline-form input { width: 110px; text-align: center; font-family: var(--f-mono); font-size: 18px; }

/* Tarjetas de selección */
.opt-group { display: grid; gap: 12px; }
.cards-3 { grid-template-columns: repeat(3, 1fr); }
.opt-card {
  display: grid; gap: 4px; justify-items: center; text-align: center; padding: 18px 12px; border-radius: 14px;
  border: 1.5px solid var(--line); background: rgba(255, 255, 255, 0.035); transition: transform 0.15s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.opt-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.opt-card.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent), 0 10px 30px rgba(0, 0, 0, 0.4); }
.opt-card.wrong { border-color: var(--red); opacity: 0.55; }
.opt-card.right { border-color: var(--green); background: rgba(53, 240, 160, 0.14); box-shadow: 0 0 0 3px rgba(53, 240, 160, 0.25); }

/* Feedback claro al presionar y al seleccionar una tarjeta */
.opt-card { position: relative; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.opt-card:active:not(.right) { transform: scale(0.97); background: color-mix(in srgb, var(--accent) 22%, transparent); }
.opt-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.opt-card.selected {
  border-color: var(--accent);
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 34%, transparent), color-mix(in srgb, var(--accent) 14%, transparent));
  box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 4px color-mix(in srgb, var(--accent) 28%, transparent), 0 0 28px color-mix(in srgb, var(--accent) 45%, transparent), 0 12px 30px rgba(0, 0, 0, 0.45);
  transform: translateY(-3px) scale(1.015);
}
.opt-card.selected b { color: #fff; text-shadow: 0 0 14px color-mix(in srgb, var(--accent) 80%, transparent); }
.opt-card.selected::after, .opt-card.right::after, .opt-card.wrong::after {
  position: absolute; top: 9px; right: 9px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font: 900 15px var(--f-display); color: #04121a; line-height: 1;
}
.opt-card.selected::after { content: '✓'; background: var(--accent); box-shadow: 0 0 14px var(--accent); animation: pop 0.25s cubic-bezier(.2, 1.6, .4, 1); }
.opt-card.right::after { content: '✓'; background: var(--green); }
.opt-card.wrong::after { content: '✕'; background: var(--red); color: #fff; }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
.scan-card.selected, .scan-card.right { box-shadow: 0 0 0 4px rgba(255, 176, 32, 0.28), 0 0 24px rgba(255, 176, 32, 0.4); }
.scan-card:active { transform: scale(0.97); }
.loc-cell:active { transform: scale(0.94); }
.doc-table tbody tr:active { background: rgba(255, 176, 32, 0.28); }
.oc-icon { font-size: 30px; line-height: 1; margin-bottom: 4px; }
.opt-card b { font: 800 14px var(--f-display); letter-spacing: 0.06em; }
.opt-card small { font: 500 10px var(--f-mono); color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }
.opt-card strong { font: 700 19px var(--f-mono); color: var(--accent); }
.opt-card em { font-style: normal; font-size: 12px; color: var(--muted); }
.protocols .opt-card { justify-items: start; text-align: left; align-content: start; padding: 16px; }
.protocols ul { list-style: none; display: grid; gap: 7px; margin-top: 8px; font-size: 12.5px; line-height: 1.4; color: #c9dcea; }
.protocols li { padding-left: 16px; position: relative; }
.protocols li::before { content: '▸'; position: absolute; left: 0; color: var(--accent); }
.order-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.order-strip div { padding: 12px; border-radius: 12px; background: rgba(255, 176, 32, 0.08); border: 1px solid rgba(255, 176, 32, 0.35); text-align: center; }
.order-strip small { display: block; font: 700 9.5px var(--f-mono); letter-spacing: 0.1em; color: var(--muted); }
.order-strip b { font: 800 clamp(15px, 2.4vw, 21px) var(--f-display); color: var(--amber); }
.thermo { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; font-size: 14.5px; line-height: 1.6; color: #c9dcea; }
.thermo b { color: #fff; }
.thermo-read { padding: 14px 20px; border-radius: 14px; text-align: center; background: rgba(255, 59, 78, 0.1); border: 1px solid var(--red); }
.thermo-read small { display: block; font: 700 9.5px var(--f-mono); letter-spacing: 0.1em; color: var(--muted); }
.thermo-read b { display: block; font: 900 34px var(--f-display); color: var(--red) !important; text-shadow: 0 0 18px var(--red); }
.thermo-read span { font: 700 11px var(--f-mono); color: var(--red); animation: crit 0.9s steps(2, jump-none) infinite; }
.abc-list .opt-card.row { grid-template-columns: 130px 1fr 1.4fr; justify-items: start; text-align: left; align-items: center; gap: 14px; padding: 14px 18px; }
.abc-list .opt-card span { font-size: 13.5px; }
.bars { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 5px 10px; align-items: center; }
.bars i { display: block; height: 9px; border-radius: 5px; background: rgba(255, 255, 255, 0.08); position: relative; overflow: hidden; }
.bars i::after { content: ''; position: absolute; inset: 0; width: var(--w); border-radius: 5px; }
.bars i.vol::after { background: #6f8aa5; }
.bars i.val::after { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.bars small { font-size: 10.5px; min-width: 128px; }

/* Teclado numérico industrial */
.key-slots { display: flex; justify-content: center; gap: 8px; }
.key-slots span { min-width: 74px; text-align: center; padding: 8px 10px; border-radius: 10px; border: 1px dashed var(--line); font: 700 18px var(--f-mono); color: #4f6577; letter-spacing: 0.12em; }
.key-slots span small { display: block; font-size: 8.5px; letter-spacing: 0.1em; color: var(--muted); }
.key-slots span.found { color: var(--green); border-color: var(--green); border-style: solid; background: rgba(53, 240, 160, 0.08); }
.keypad { display: grid; gap: 12px; justify-self: center; width: min(320px, 100%); padding: 16px; border-radius: 16px; background: linear-gradient(160deg, #262d36, #12161b); border: 1px solid rgba(255, 255, 255, 0.12); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.08), 0 14px 40px rgba(0, 0, 0, 0.5); }
.kp-display { height: 62px; border-radius: 10px; background: #02080c; border: 1px solid var(--accent); display: grid; place-items: center; font: 700 28px var(--f-mono); letter-spacing: 0.28em; color: var(--accent); text-shadow: 0 0 12px var(--accent); padding-left: 0.28em; }
.kp-display.err { color: var(--red); border-color: var(--red); text-shadow: 0 0 12px var(--red); }
.kp-display.ok { color: var(--green); border-color: var(--green); text-shadow: 0 0 12px var(--green); }
.kp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.kp-key { height: clamp(42px, 7.2vh, 58px); border-radius: 11px; font: 800 20px var(--f-display); background: linear-gradient(180deg, #3b434d, #20262d); border: 1px solid rgba(255, 255, 255, 0.13); box-shadow: 0 4px 0 #0b0e12; transition: transform 0.06s, box-shadow 0.06s; }
.kp-key:active, .kp-key.press { transform: translateY(3px); box-shadow: 0 1px 0 #0b0e12; }
.kp-key.c { color: var(--red); } .kp-key.ok { color: var(--green); font-size: 16px; }

/* ---------- Etapa 3: cierre de turno ---------- */
.hotspot-marker.stage-3 { --c: var(--purple); }
.hotspot-marker.stage-3.solved { --c: var(--green); }
body.stage-3 { --accent: var(--purple); }
.modal.stage3 { --accent: var(--purple); }
#fader { position: fixed; inset: 0; z-index: 38; background: #000; opacity: 0; pointer-events: none; transition: opacity 0.6s; }
#fader.on { opacity: 1; }
.mode-select { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#welcome-form label.mode-card { display: grid; gap: 2px; padding: 11px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: rgba(255, 255, 255, 0.03); cursor: pointer; text-transform: none; letter-spacing: 0; transition: border-color 0.2s, background 0.2s; }
.mode-card input { position: absolute; opacity: 0; pointer-events: none; }
.mode-card b { font: 800 12px var(--f-display); letter-spacing: 0.08em; color: var(--text); }
.mode-card span { font: 500 12.5px var(--f-body); color: #c9dcea; }
.mode-card small { font: 700 10.5px var(--f-mono); color: var(--amber); }
#welcome-form label.mode-card { position: relative; -webkit-tap-highlight-color: transparent; }
#welcome-form label.mode-card:hover { border-color: rgba(61, 232, 255, 0.6); transform: translateY(-2px); }
#welcome-form label.mode-card:active { transform: scale(0.98); background: rgba(61, 232, 255, 0.2); }
#welcome-form label.mode-card:has(input:checked) {
  border-color: var(--cyan);
  background: linear-gradient(160deg, rgba(61, 232, 255, 0.3), rgba(61, 232, 255, 0.1));
  box-shadow: inset 0 0 0 1.5px var(--cyan), 0 0 0 4px rgba(61, 232, 255, 0.22), 0 0 24px rgba(61, 232, 255, 0.35);
}
#welcome-form label.mode-card:has(input:checked) b { color: #fff; text-shadow: 0 0 14px rgba(61, 232, 255, 0.8); }
#welcome-form label.mode-card:has(input:checked)::after {
  content: '✓'; position: absolute; top: 9px; right: 9px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; font: 900 14px var(--f-display); line-height: 1; color: #04121a;
  background: var(--cyan); box-shadow: 0 0 14px var(--cyan); animation: pop 0.25s cubic-bezier(.2, 1.6, .4, 1);
}
.mode-card:has(input:focus-visible) { outline: 2px solid var(--cyan); outline-offset: 2px; }
.doc-table.static tbody tr { cursor: default; }
.doc-table.static tbody tr:hover { background: none; }
.doc-table tr.total td { border-top: 2px solid var(--accent); color: var(--accent); font-weight: 700; }
.modal.stage3 .doc h4 { background: rgba(176, 107, 255, 0.12); color: var(--purple); }
.report-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.report-form label, .assign-row { font-size: 13.5px; font-weight: 600; }
.report-form label { display: grid; gap: 6px; }
.report-form input, #cube-input { font-family: var(--f-mono); font-size: 18px; text-align: center; }
.cards-2 { grid-template-columns: 1fr 1fr; }
.loc-code { font-family: var(--f-mono); color: var(--purple) !important; font-size: 17px; letter-spacing: 0.08em; }
.aisle-tabs { display: flex; gap: 8px; }
.aisle-tab { font: 800 12px var(--f-display); letter-spacing: 0.08em; padding: 9px 16px; border-radius: 10px; border: 1.5px solid var(--line); color: var(--muted); }
.aisle-tab.selected { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.loc-grid { display: grid; grid-template-columns: auto repeat(4, 1fr); gap: 7px; align-items: stretch; padding: 14px; border-radius: 14px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); }
.loc-grid .lg-h { font: 700 10.5px var(--f-mono); color: var(--muted); display: grid; place-items: center; padding: 2px 8px; letter-spacing: 0.06em; }
.loc-cell { height: clamp(38px, 6.4vh, 54px); border-radius: 8px; border: 1.5px solid rgba(255, 255, 255, 0.14); background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.03) 0 8px, transparent 8px 16px); transition: border-color 0.15s, background 0.15s, transform 0.1s; }
.loc-cell:hover { border-color: var(--accent); transform: scale(1.03); }
.loc-cell.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 30%, transparent); box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 50%, transparent); }
.loc-cell.right { border-color: var(--green); background: rgba(53, 240, 160, 0.3); }
.loc-picked { font-size: 13px; color: var(--muted); }
.loc-picked b { font-family: var(--f-mono); color: var(--accent); font-size: 15px; }
.assign-list { display: grid; gap: 9px; }
.assign-row { display: grid; grid-template-columns: 1fr minmax(170px, 230px); gap: 12px; align-items: center; padding: 11px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.assign-row small { display: block; font: 500 11.5px var(--f-mono); color: var(--muted); margin-top: 2px; }
.assign-row select { font: 600 13.5px var(--f-body); color: var(--text); padding: 10px 12px; border-radius: 10px; background: #0a121b; border: 1px solid var(--line); outline: none; width: 100%; }
.assign-row select:focus { border-color: var(--accent); }
.assign-row.bad { border-color: var(--red); }
.assign-row.good { border-color: var(--green); }

/* ---------- Etapa 4: centro de control RF ---------- */
:root { --pink: #ff5fa2; }
.hotspot-marker.stage-4 { --c: var(--pink); }
.hotspot-marker.stage-4.solved { --c: var(--green); }
body.stage-4 { --accent: var(--pink); }
.modal.stage4 { --accent: var(--pink); }
.modal.stage4 .doc h4 { background: rgba(255, 95, 162, 0.12); color: var(--pink); }
.mode-select { grid-template-columns: repeat(3, 1fr); }
.report-form.three { grid-template-columns: repeat(3, 1fr); }
.scan-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; }
.scan-card { display: grid; gap: 3px; justify-items: center; text-align: center; padding: 12px 6px; border-radius: 12px; border: 1.5px dashed var(--line); background: rgba(255, 255, 255, 0.03); min-height: 122px; align-content: center; transition: border-color 0.2s, background 0.2s, transform 0.15s; }
.scan-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.scan-card b { font: 800 13px var(--f-display); letter-spacing: 0.05em; }
.scan-card .bars-ico { font: 700 18px var(--f-mono); letter-spacing: -2px; color: var(--muted); }
.scan-card small { font: 700 10.5px var(--f-mono); color: var(--muted); line-height: 1.45; }
.scan-card.read { border-style: solid; background: rgba(255, 95, 162, 0.06); }
.scan-card.read small { color: #dbe9f4; }
.scan-card.read .bars-ico { display: none; }
.scan-card.selected { border-color: var(--amber); background: rgba(255, 176, 32, 0.16); box-shadow: 0 0 0 3px rgba(255, 176, 32, 0.22); }
.scan-card.wrong { border-color: var(--red); opacity: 0.55; }
.scan-card.right { border-color: var(--green); background: rgba(53, 240, 160, 0.14); }
.order-list { list-style: none; display: grid; gap: 8px; counter-reset: step; }
.order-item { counter-increment: step; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: rgba(255, 255, 255, 0.04); font-size: 13.5px; font-weight: 500; transition: border-color 0.2s, background 0.2s; }
.order-item::before { content: counter(step); width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font: 800 13px var(--f-display); color: #04121a; background: var(--accent); }
.order-item.good { border-color: var(--green); background: rgba(53, 240, 160, 0.09); }
.order-item .mv { display: flex; gap: 5px; }
.order-item .mv button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.order-item .mv button:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.order-item .mv button:disabled { opacity: 0.25; cursor: default; }

/* ---------- Victoria ---------- */
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.victory { text-align: center; }
.victory .eyebrow { margin-bottom: 10px; }
.v-name { margin-top: 12px; font-size: 16px; color: #c9dcea; }
.v-name b { color: #fff; font-size: 19px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0 12px; }
.stats div, .rank { padding: 14px 10px; border-radius: 14px; background: rgba(255, 255, 255, 0.045); border: 1px solid var(--line); }
.stats small, .rank small { display: block; font: 700 9.5px var(--f-mono); letter-spacing: 0.12em; color: var(--muted); margin-bottom: 4px; }
.stats b { font: 900 clamp(20px, 4vw, 30px) var(--f-display); color: var(--cyan); }
.rank { border-color: rgba(255, 176, 32, 0.55); background: rgba(255, 176, 32, 0.08); }
.rank b { font: 800 clamp(14px, 2.6vw, 19px) var(--f-display); color: var(--amber); letter-spacing: 0.04em; }
.v-actions { display: grid; gap: 10px; margin-top: 18px; }
#cert-preview { width: 100%; margin-top: 16px; border-radius: 10px; border: 1px solid var(--line); }

/* ---------- Responsivo ---------- */
@media (max-width: 1120px) {
  #hud { gap: 14px; }
  .hud-zone { display: none; }
  .hud-btn { padding: 9px 11px; font-size: 0; }
  .hud-btn span { font-size: 15px; }
}
@media (max-width: 900px) {
  #hud { grid-template-columns: 1fr auto auto; gap: 10px; padding: 8px 12px; }
  .hud-brand { display: none; }
  .hud-stage { justify-self: start; flex-wrap: wrap; gap: 6px 10px; }
  #timer { font-size: 24px; }
  .doc-grid, .thermo { grid-template-columns: 1fr; }
  .abc-list .opt-card.row { grid-template-columns: 1fr; gap: 6px; }
  #logbook { right: 14px; top: 78px; }
}
@media (max-width: 640px) {
  #hud { grid-template-columns: 1fr auto; row-gap: 8px; }
  .hud-timer { border-right: 0; padding-right: 4px; }
  .hud-actions { grid-column: 1 / -1; justify-content: flex-end; }
  #logbook { top: 128px; width: auto; left: 14px; }
  .cards-3 { grid-template-columns: 1fr; }
  .opt-card { grid-template-columns: auto 1fr; justify-items: start; text-align: left; column-gap: 12px; padding: 12px 14px; }
  .opt-card .oc-icon { grid-row: span 4; align-self: center; }
  .protocols .opt-card { grid-template-columns: 1fr; }
  #welcome-form, .stage-preview, .mode-select, .assign-row, .report-form.three { grid-template-columns: 1fr; }
  .scan-list { grid-template-columns: repeat(2, 1fr); }
  .stage-preview > i { display: none; }
  .stats { grid-template-columns: 1fr; }
  .modal { padding-top: 74px; }
  .hm-label { display: none; }
  .order-strip { grid-template-columns: 1fr 1fr; }
  .order-strip div:last-child { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .hm-pulse, .loader-bar i { animation: none; }
}
