/* ═══════════════ EXTREME DARK QUANT ═══════════════ */
:root {
  --bg: #050505;
  --panel: #0a0a0b;
  --panel-2: #0f0f11;
  --line: #1a1a1e;
  --line-2: #26262c;
  --text: #d6d6dc;
  --muted: #6b6b76;
  --green: #10f0a0;
  --green-dim: #0a7a54;
  --red: #ff2a4d;
  --red-dim: #7a1022;
  --amber: #ffb020;
  --cyan: #22d3ee;
  --violet: #a78bfa;
  --jelly: cubic-bezier(.68, -0.55, .27, 1.55);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text); font: 12px/1.35 var(--mono); overflow: hidden; }
a { color: var(--cyan); }
code { color: var(--green); }
::selection { background: var(--green-dim); }

/* ---------- botones ---------- */
.btn { font: 600 12px var(--mono); color: var(--bg); background: var(--green); border: 0; border-radius: 6px; padding: 8px 14px; cursor: pointer; letter-spacing: .04em; transition: transform .35s var(--jelly), filter .2s; }
.btn:hover { transform: scale(1.05, .95); filter: brightness(1.15); }
.btn:active { transform: scale(.94, 1.06); }
.btn.sm { padding: 6px 10px; font-size: 11px; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line-2); }
.btn.danger { background: var(--red); color: #fff; }
.btn.god { width: 100%; background: linear-gradient(90deg, #3b2f00, #6b5300); color: #ffe27a; border: 1px solid #8a6d00; margin-top: auto; }
.btn.phantom { width: 100%; background: #ab9ff2; color: #1c1630; font-size: 14px; padding: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.82); backdrop-filter: blur(6px); display: none; align-items: center; justify-content: center; z-index: 50; }
.overlay.show { display: flex; }
.login-card { width: 380px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; padding: 28px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 0 60px rgba(16,240,160,.08); animation: pop .6s var(--jelly); }
.login-logo { font-size: 22px; font-weight: 800; color: var(--green); text-shadow: 0 0 18px rgba(16,240,160,.6); }
.login-sub, .fine { color: var(--muted); }
.fine { font-size: 10px; }
.or { text-align: center; color: var(--muted); }
#simpleForm input { flex: 1; }
input, select { font: 12px var(--mono); background: var(--bg); color: var(--text); border: 1px solid var(--line-2); border-radius: 6px; padding: 7px 9px; outline: none; width: 100%; }
input:focus, select:focus { border-color: var(--green-dim); box-shadow: 0 0 0 2px rgba(16,240,160,.12); }
.err { color: var(--red); min-height: 14px; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0 } 60% { transform: scale(1.05, .95) } 80% { transform: scale(.98, 1.02) } 100% { transform: scale(1); opacity: 1 } }

/* ---------- layout de una sola pantalla ---------- */
#app { height: 100vh; display: grid; grid-template-rows: 46px minmax(0, 1fr) auto 28px; grid-template-columns: minmax(0, 1fr); filter: blur(0); transition: filter .4s; }
header > * { min-width: 0; }
body.locked #app { filter: blur(8px); pointer-events: none; }
header { display: flex; align-items: center; gap: 14px; padding: 0 14px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #0b0b0d, var(--bg)); }
.brand { font-weight: 800; color: var(--green); letter-spacing: .08em; text-shadow: 0 0 12px rgba(16,240,160,.45); white-space: nowrap; }
.tag { font-size: 9px; padding: 2px 6px; border-radius: 4px; margin-left: 6px; vertical-align: middle; }
.tag.sim { background: #1b1300; color: var(--amber); border: 1px solid #4a3600; }
.badges { display: flex; gap: 6px; overflow: hidden; flex: 1; }
.badge { font-size: 10px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 4px; padding: 3px 7px; white-space: nowrap; }
.badge.on { color: var(--green); border-color: var(--green-dim); }
.badge.warn { color: var(--amber); border-color: #4a3600; }
.hright { display: flex; align-items: center; gap: 12px; }
.user { color: var(--muted); white-space: nowrap; }
.gear { font-size: 22px; background: none; border: 0; cursor: pointer; transition: transform .6s var(--jelly); filter: drop-shadow(0 0 6px rgba(255,255,255,.15)); }
.gear:hover { transform: rotate(120deg) scale(1.15); }

.switch { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.slider { width: 38px; height: 20px; background: var(--line-2); border-radius: 20px; position: relative; transition: background .3s; }
.slider::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; background: var(--cyan); border-radius: 50%; transition: transform .45s var(--jelly), background .3s; }
.switch input:checked + .slider { background: #3a0d16; }
.switch input:checked + .slider::after { transform: translateX(18px); background: var(--red); }
.switch-label { font-size: 10px; font-weight: 600; color: var(--cyan); white-space: nowrap; }
.switch input:checked ~ .switch-label { color: var(--red); text-shadow: 0 0 8px rgba(255,42,77,.6); }

/* ── FUEGO REAL — interruptor maestro (Mainnet) ── */
.badge.fire { font-weight: 700; }
.badge.fire-on   { color: var(--green); border-color: var(--green-dim); background: rgba(16,240,160,.08); box-shadow: 0 0 10px rgba(16,240,160,.35); }
.badge.fire-bad  { color: var(--red); border-color: #6b1626; background: rgba(255,42,77,.08); }
.badge.fire-warn { color: var(--amber); border-color: #4a3600; background: rgba(255,210,63,.06); }
.badge.fire-off  { color: var(--muted); border-color: var(--line-2); }
/* el id gana en especificidad a las reglas .switch:check* genéricas */
#fireSwitch .slider { background: var(--line-2); }
#fireSwitch .slider::after { background: var(--muted); }
#fireSwitch .switch-label { font-weight: 700; color: var(--muted); }
#fireSwitch.fire-on .slider { background: #06281c; box-shadow: 0 0 10px rgba(16,240,160,.45); }
#fireSwitch.fire-on .slider::after { background: var(--green); transform: translateX(18px); }
#fireSwitch.fire-on .switch-label { color: var(--green); text-shadow: 0 0 8px rgba(16,240,160,.6); }
#fireSwitch.fire-bad .slider { background: #3a0d16; }
#fireSwitch.fire-bad .slider::after { background: var(--red); }
#fireSwitch.fire-bad .switch-label { color: var(--red); text-shadow: 0 0 8px rgba(255,42,77,.6); }
#fireSwitch.fire-warn .slider { background: #2a1e00; }
#fireSwitch.fire-warn .slider::after { background: var(--amber); }
#fireSwitch.fire-warn .switch-label { color: var(--amber); text-shadow: 0 0 6px rgba(255,210,63,.4); }
#fireSwitch.fire-off .slider { background: var(--line-2); }
#fireSwitch.fire-off .slider::after { background: var(--muted); }
#fireSwitch.fire-off .switch-label { color: var(--muted); }

main { display: grid; grid-template-columns: 330px minmax(0, 1fr) 350px; gap: 10px; padding: 10px; min-height: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; min-height: 0; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.lbl { font-size: 10px; color: var(--muted); letter-spacing: .12em; }

/* ---------- izquierda ---------- */
.eq-head { display: flex; justify-content: space-between; align-items: flex-end; }
.eq { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.pnl { font-weight: 600; }
.up { color: var(--green); text-shadow: 0 0 10px rgba(16,240,160,.45); }
.down { color: var(--red); text-shadow: 0 0 10px rgba(255,42,77,.45); }
.chart-wrap { flex: 1; min-height: 120px; position: relative; border: 1px solid var(--line); border-radius: 8px; background: radial-gradient(ellipse at 50% 120%, #0d1512 0%, var(--bg) 70%); }
#curve { position: absolute; inset: 0; width: 100%; height: 100%; }
.health { border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.health-top, .health-bot { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); }
.health-top span:last-child { color: var(--text); font-weight: 700; }
.hbar { height: 12px; margin: 6px 0; background: #111; border-radius: 6px; position: relative; overflow: hidden; }
.hfill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--green-dim), var(--green)); box-shadow: 0 0 14px rgba(16,240,160,.6); transition: width .8s var(--spring), background .4s; }
.hfill.danger { background: linear-gradient(90deg, var(--red-dim), var(--red)); box-shadow: 0 0 14px rgba(255,42,77,.7); animation: throb .8s infinite; }
.vital, .panic { position: absolute; top: 0; bottom: 0; width: 2px; }
.vital { background: var(--red); box-shadow: 0 0 6px var(--red); }
.panic { background: var(--amber); opacity: .7; }
@keyframes throb { 50% { filter: brightness(1.6) } }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.stats div { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 2px 0; }
.stats span { color: var(--muted); font-size: 10px; }

/* ---------- centro: dormitorio ---------- */
.center { gap: 6px; }
.dorm-head { display: flex; justify-content: space-between; align-items: center; }
.counts { display: flex; gap: 10px; font-size: 11px; }
.dorm { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 6px; }

.agent { position: relative; border: 1px solid #1e293b; border-radius: 8px; background: repeating-linear-gradient(0deg, #070b14 0px, #070b14 8px, #0a101d 8px, #0a101d 16px), repeating-linear-gradient(90deg, rgba(34,211,238,0.04) 0px, rgba(34,211,238,0.04) 8px, transparent 8px, transparent 16px); overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 4px 4px 3px; cursor: default; transition: border-color .3s, box-shadow .3s, background .3s; min-height: 0; image-rendering: pixelated; box-shadow: inset 0 0 14px rgba(0,0,0,0.85); }
.agent .room { position: relative; flex: 1; width: 100%; min-height: 0; container-type: size; border-bottom: 2px solid rgba(34,211,238,0.18); }
/* la "escena" tiene proporción fija y se ancla abajo: cápsula pixel-art y avatar nunca se separan */
.scene { position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%); width: min(100cqw, 125cqh); aspect-ratio: 1.25; }
.agent .nm { font-size: 10px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; color: var(--c); text-shadow: 0 1px 2px #000; }
.agent .st { font-size: 9px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; height: 12px; }

/* Cápsula / Cama Cyberpunk Pixel-Art (reemplaza los cuadros cafés viejos) */
.bed { position: absolute; left: 4%; right: 4%; bottom: 0; height: 38%; filter: drop-shadow(0 3px 4px rgba(0,0,0,0.8)); }
.bed .head { position: absolute; left: 0; bottom: 0; width: 11%; height: 132%; background: linear-gradient(180deg, var(--c) 0%, #0f172a 35%, #1e293b 100%); border: 2px solid #38bdf8; border-radius: 3px 3px 0 0; box-shadow: 0 0 8px var(--c); }
.bed .frame { position: absolute; left: 0; right: 0; bottom: 0; height: 38%; background: repeating-linear-gradient(90deg, #0f172a 0px, #0f172a 6px, #1e293b 6px, #1e293b 12px); border: 2px solid #334155; border-top-color: var(--c); border-radius: 2px; }
.bed .mattress { position: absolute; left: 9%; right: 2%; bottom: 34%; height: 38%; background: linear-gradient(90deg, #1e293b, #334155); border: 1.5px solid #64748b; border-radius: 3px; }
.bed .pillow { position: absolute; left: 12%; bottom: 64%; width: 22%; height: 30%; background: linear-gradient(180deg, #e0f2fe, #7dd3fc); border: 1.5px solid #0284c7; border-radius: 3px; }
.quilt { position: absolute; left: 36%; right: 4%; bottom: 12%; height: 26%; background: repeating-linear-gradient(90deg, var(--c) 0px, var(--c) 8px, color-mix(in srgb, var(--c) 70%, #000) 8px, color-mix(in srgb, var(--c) 70%, #000) 16px); border: 1.5px solid #fff; border-radius: 4px 4px 2px 2px; transform-origin: right bottom; transition: transform .7s var(--jelly), opacity .4s; box-shadow: 0 0 10px color-mix(in srgb, var(--c) 50%, transparent); z-index: 3; }


/* el avatar (jelly) */
.avatar { position: absolute; left: 50%; bottom: 30%; height: 58%; aspect-ratio: 1; translate: -50% 0; transform-origin: 50% 100%; will-change: scale; z-index: 2; transition: bottom .6s var(--jelly), left .6s var(--jelly), height .6s var(--jelly), rotate .7s var(--jelly), filter .5s; }
.avatar .body { width: 100%; height: 100%; transform-origin: 50% 100%; }
.avatar img, .avatar svg.bot { width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 4px 6px rgba(0,0,0,.6)); }
.avatar svg.bot { display: none; }
.avatar.noimg img { display: none; }
.avatar.noimg svg.bot { display: block; }
.action { position: absolute; right: -14%; top: -10%; font-size: max(14px, min(26cqh, 20cqw)); line-height: 1; opacity: 0; transform: scale(0); transition: transform .45s var(--jelly), opacity .2s; }
.zzz { position: absolute; left: 26%; top: 18%; font-weight: 800; color: #9db4ff; opacity: 0; pointer-events: none; font-size: max(10px, 10cqh); z-index: 4; }
.zzz i { position: absolute; font-style: normal; animation: zfloat 2.4s infinite ease-out; opacity: 0; }
.zzz i:nth-child(2) { animation-delay: .8s; font-size: 1.25em; }
.zzz i:nth-child(3) { animation-delay: 1.6s; font-size: 1.5em; }
@keyframes zfloat { 0% { transform: translate(0, 0) scale(.6); opacity: 0 } 25% { opacity: 1 } 100% { transform: translate(18px, -30px) scale(1.1) rotate(12deg); opacity: 0 } }
.ring { position: absolute; left: 4px; top: 4px; width: 24px; height: 24px; border-radius: 50%; display: none; place-items: center; font-size: 8px; color: var(--amber); background: conic-gradient(var(--amber) calc(var(--p, 1) * 360deg), #222 0); z-index: 5; }
.ring::before { content: ''; position: absolute; inset: 3px; background: var(--panel-2); border-radius: 50%; }
.ring span { position: relative; }

/* 💤 durmiendo: acostado en la cama, cabeza en la almohada, tapado */
.agent.sleeping { background: #08080a; }
.agent.sleeping .avatar { left: 36%; bottom: 13%; height: 46%; rotate: -90deg; transform-origin: 50% 50%; filter: saturate(.7) brightness(.9); }
.agent.sleeping .avatar .body { animation: breathe 3.2s ease-in-out infinite; }
.agent.sleeping .zzz { opacity: 1; }
@keyframes breathe { 50% { transform: scale(1.05, .95) } }

/* ⏳ despierto: sentado en la orilla, esperando 60 s */
.agent.awake .avatar { left: 62%; bottom: 26%; height: 56%; }
.agent.awake .avatar .body { animation: idle 2.2s ease-in-out infinite; }
.agent.awake .ring { display: grid; }
.agent.awake .quilt { transform: scaleX(.3); }
@keyframes idle { 0%, 100% { transform: scale(1, 1) } 30% { transform: scale(1.04, .96) } 60% { transform: scale(.98, 1.02) } }

/* ⚡ trabajando: brincando con su avatar de acción */
.agent.working { border-color: var(--c); box-shadow: 0 0 18px -4px var(--c), inset 0 0 22px -12px var(--c); background: radial-gradient(ellipse at 50% 100%, color-mix(in srgb, var(--c) 16%, transparent), var(--panel-2) 70%); }
.agent.working .avatar { left: 50%; bottom: 34%; height: 60%; }
.agent.working .avatar .body { animation: hop .7s var(--jelly) infinite; }
.agent.working .action { opacity: 1; transform: scale(1); animation: wobble .9s ease-in-out infinite; }
.agent.working .quilt { transform: scaleX(.12); opacity: .7; }
@keyframes hop {
  0%   { transform: translateY(0)    scale(1.18, .82) }
  35%  { transform: translateY(-16%) scale(.88, 1.14) }
  55%  { transform: translateY(-20%) scale(.95, 1.05) }
  80%  { transform: translateY(0)    scale(1.12, .88) }
  100% { transform: translateY(0)    scale(1.18, .82) }
}
@keyframes wobble { 50% { transform: scale(1.25) rotate(-12deg) } }
.agent.wake .avatar .body { animation: wakejelly .8s var(--jelly) !important; }
@keyframes wakejelly {
  0% { transform: scale(1, 1) } 20% { transform: scale(1.35, .6) } 38% { transform: scale(.7, 1.35) } 52% { transform: scale(1.18, .85) }
  66% { transform: scale(.92, 1.08) } 80% { transform: scale(1.04, .96) } 100% { transform: scale(1, 1) }
}

/* academia */
.academy { display: flex; gap: 10px; align-items: stretch; border: 1px solid #2a2350; background: linear-gradient(90deg, #0e0b1f, var(--panel)); border-radius: 8px; padding: 7px 10px; min-height: 58px; transition: transform .5s var(--jelly); }
.academy.flash { animation: pop .6s var(--jelly); }
.ac-tag { color: var(--violet); font-weight: 800; font-size: 10px; writing-mode: horizontal-tb; white-space: nowrap; align-self: center; }
.ac-body { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.ac-body b { color: #d9d0ff; }
.ac-body span { color: var(--text); font-size: 11px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ac-body i { color: var(--muted); font-size: 9.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- derecha ---------- */
.positions, .trades { display: flex; flex-direction: column; gap: 3px; }
.positions { min-height: 22px; }
.prow, .trow { display: grid; grid-template-columns: 1.4fr 1fr 1fr .8fr; gap: 6px; padding: 4px 6px; border-radius: 5px; background: var(--panel-2); font-size: 11px; animation: slidein .5s var(--jelly); }
.trow { grid-template-columns: 1.4fr 1fr 2fr; font-size: 10.5px; }
.prow .sym, .trow .sym { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow span, .trow span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.empty { color: var(--muted); font-size: 11px; padding: 4px 6px; }
@keyframes slidein { from { transform: translateX(30px) scale(.9, 1.1); opacity: 0 } }
.feed { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 2px; mask-image: linear-gradient(180deg, #000 70%, transparent); }
.fi { font-size: 10.5px; padding: 3px 6px; border-left: 2px solid var(--line-2); animation: slidein .4s var(--spring); }
.fi .who { font-weight: 700; margin-right: 4px; }
.fi .ts { color: #444; margin-right: 4px; }
.fi.trade { border-color: var(--cyan); background: rgba(34,211,238,.05); }
.fi.win { border-color: var(--green); background: rgba(16,240,160,.06); }
.fi.loss { border-color: var(--red); background: rgba(255,42,77,.06); }
.fi.warn { border-color: var(--amber); }
.fi.alert { border-color: var(--red); background: rgba(255,42,77,.14); color: #ffd0d8; }
.fi.llm { border-color: var(--violet); background: rgba(167,139,250,.08); color: #e2dcff; }

/* ---------- footer / ticker ---------- */
footer { display: flex; align-items: center; border-top: 1px solid var(--line); font-size: 10.5px; }
.ticker { flex: 1; overflow: hidden; white-space: nowrap; }
.ticker-inner { display: inline-block; padding-left: 100%; animation: marquee 60s linear infinite; }
.ticker-inner span { margin-right: 26px; }
.ticker-inner .r { color: var(--violet); font-size: 9px; }
@keyframes marquee { to { transform: translateX(-100%) } }
.credit { color: #444; padding: 0 12px; white-space: nowrap; }
.credit a { color: #555; }

/* ---------- DEATH_IMMINENT ---------- */
.death { position: fixed; inset: 0; z-index: 40; display: none; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(80,0,10,.55), rgba(0,0,0,.9)); box-shadow: inset 0 0 160px 40px rgba(255,0,40,.55); animation: deathpulse 1.1s ease-in-out infinite; }
.death.show { display: flex; }
.death.min { pointer-events: none; background: transparent; }
.death.min .death-box { display: none; }
@keyframes deathpulse { 50% { box-shadow: inset 0 0 220px 70px rgba(255,0,40,.75); } }
.death-box { text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; animation: pop .7s var(--jelly); }
.skull { font-size: 70px; animation: shake .25s infinite; }
@keyframes shake { 25% { transform: translate(2px, -1px) rotate(-3deg) } 75% { transform: translate(-2px, 1px) rotate(3deg) } }
.death-title { font-size: 42px; font-weight: 800; color: var(--red); letter-spacing: .15em; text-shadow: 0 0 30px var(--red); }
.death-sub { color: #ffc2cc; max-width: 520px; }

/* ---------- Engranaje Maestro ---------- */
.modal { width: min(1180px, 96vw); max-height: 92vh; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; display: flex; flex-direction: column; animation: pop .55s var(--jelly); box-shadow: 0 0 80px rgba(0,0,0,.8); }
.modal-head, .modal-foot { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 700; }
.modal-foot { border-top: 1px solid var(--line); border-bottom: 0; }
.x { background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; }
.modal-body { padding: 14px 16px; overflow: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
fieldset { border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
legend { padding: 0 6px; color: var(--green); font-weight: 700; }
fieldset label { display: grid; grid-template-columns: 1fr 1.25fr; gap: 8px; align-items: center; font-size: 11px; color: var(--muted); }
.note { font-size: 10.5px; color: var(--muted); }
.note.ok { color: var(--green); } .note.bad { color: var(--red); }
.progress { height: 6px; background: #111; border-radius: 3px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--green); box-shadow: 0 0 8px var(--green); transition: width .4s var(--spring); }

/* ---------- interruptor del cerebro ---------- */
.engine-switch { display: flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.engine-switch button { font: 700 10px var(--mono); padding: 6px 9px; background: transparent; color: var(--muted); border: 0; cursor: pointer; white-space: nowrap; transition: background .3s, color .3s, transform .4s var(--jelly); }
.engine-switch button:hover { transform: scale(1.04, .96); }
.engine-switch button.on[data-engine="local"] { background: #062b1f; color: var(--green); box-shadow: inset 0 0 12px rgba(16,240,160,.35); }
.engine-switch button.on[data-engine="openrouter"] { background: #2b1a00; color: var(--amber); box-shadow: inset 0 0 12px rgba(255,176,32,.35); }
.span2 { grid-column: span 2; }
.engine-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.engine-pick .engine { display: flex !important; gap: 10px; align-items: center; padding: 12px; border: 2px solid var(--line-2); border-radius: 10px; cursor: pointer; color: var(--text) !important; transition: border-color .3s, background .3s; }
.engine-pick .engine input { width: auto; accent-color: var(--green); transform: scale(1.4); }
.engine-pick .engine b { display: block; font-size: 13px; letter-spacing: .04em; }
.engine-pick .engine small { color: var(--muted); font-size: 10px; }
.engine-pick .engine.local:has(input:checked) { border-color: var(--green); background: #04180f; }
.engine-pick .engine.paid:has(input:checked) { border-color: var(--amber); background: #1b1300; }
.engine-pick .engine.paid b { color: var(--amber); }
.engine-pick .engine.local b { color: var(--green); }
.stats div { padding: 1px 0; }

/* ---------- KILL EVERYTHING ---------- */
.row-btns { display: flex; gap: 6px; margin-top: auto; }
.row-btns .god { flex: 1; margin: 0; padding: 7px 8px; }
.kill { position: relative; overflow: hidden; width: 100%; min-height: 54px; border: 2px solid #ff2a4d; border-radius: 10px; background: #2a0009; color: #fff; cursor: pointer; font: 800 15px var(--mono); letter-spacing: .12em; display: flex; flex-direction: column; align-items: center; justify-content: center; user-select: none; box-shadow: 0 0 22px rgba(255,42,77,.35), inset 0 0 18px rgba(255,42,77,.25); transition: transform .35s var(--jelly); touch-action: none; }
.kill:hover { transform: scale(1.02, .98); box-shadow: 0 0 34px rgba(255,42,77,.6), inset 0 0 22px rgba(255,42,77,.35); }
.kill-fill { position: absolute; inset: 0; width: 0; background: linear-gradient(90deg, #ff2a4d, #ff7a8f); }
.kill.holding .kill-fill { width: 100%; transition: width 2s linear; }
.kill-label, .kill-sub { position: relative; text-shadow: 0 0 8px #000; }
.kill-sub { font-size: 9px; font-weight: 600; letter-spacing: .06em; opacity: .75; }
.kill.done { background: #400010; animation: throb .8s infinite; }
.kill-banner { position: fixed; left: 50%; top: 54px; transform: translateX(-50%) translateY(-200%); z-index: 45; display: flex; gap: 14px; align-items: center; background: #2a0009; border: 2px solid var(--red); color: #ffd0d8; padding: 10px 16px; border-radius: 10px; font-weight: 700; box-shadow: 0 0 40px rgba(255,42,77,.5); transition: transform .6s var(--jelly); }
.acc-box { border: 1px solid var(--line-2); border-radius: 10px; padding: 10px; margin: 10px 0; text-align: left; }
.acc-title { font-size: 11px; letter-spacing: .08em; margin-bottom: 8px; }
.acc-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.acc-item { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; background: #000; }
.acc-item.cur { border-color: #22d3ee; }
.acc-item .info { flex: 1; min-width: 0; font-size: 11px; }
.acc-item .info b { font-size: 12.5px; }
.acc-item .info .m { color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-item button { white-space: nowrap; }
.acc-new summary { cursor: pointer; font-size: 11.5px; margin-top: 8px; color: #a78bfa; }
.acc-form { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.kill-banner.show { transform: translateX(-50%) translateY(0); visibility: visible; opacity: 1; }
.kill-banner:not(.show) { visibility: hidden; opacity: 0; transform: translateX(-50%) translateY(-400%); transition: transform .6s var(--jelly), opacity .3s, visibility 0s .6s; }

/* ---------- Devnet / gear extras ---------- */
.badge.devnet { color: #c4b5fd; border-color: #3b2f6b; }
.badge.devnet.on { color: #a78bfa; border-color: #6d5bd0; }
label.chk, label.force { display: flex !important; gap: 8px; align-items: center; color: var(--text) !important; }
label.chk input, label.force input { width: auto; accent-color: var(--green); }
label.force { padding: 8px; border: 1px solid #6b5300; border-radius: 8px; background: #1b1300; color: #ffe27a !important; }
label.force b { font-size: 12px; letter-spacing: .04em; }
.warn-note { color: var(--amber); }
.sources { display: flex; flex-direction: column; gap: 3px; font-size: 10.5px; }
.sources div { display: grid; grid-template-columns: 14px 1fr; gap: 6px; padding: 3px 0; border-bottom: 1px dashed var(--line); }
.sources small { color: var(--muted); display: block; }
.fi a { color: #a78bfa; margin-left: 6px; text-decoration: none; }
.fi.chain { border-color: #a78bfa; background: rgba(167,139,250,.07); }
.agent.clone { border-style: dashed; }
.agent.clone .nm::before { content: '🧬 '; }
.agent.spawned { animation: pop .9s var(--jelly); }
.lv { color: var(--cyan); font-size: 9px; margin-left: 4px; }

@media (max-width: 1200px) {
  main { grid-template-columns: 280px minmax(0, 1fr) 290px; }
  .modal-body { grid-template-columns: 1fr 1fr; }
  .badges .badge:nth-child(n+4) { display: none; }
}
@media (max-width: 900px) {
  html, body { overflow: auto; }
  #app { height: auto; }
  main { grid-template-columns: 1fr; }
  .dorm { height: 70vh; }
  .chart-wrap { height: 200px; flex: none; }
  .feed { height: 240px; flex: none; }
  .modal-body { grid-template-columns: 1fr; }
}

/* Learning team: same cards and controls. */
.agent.learning { outline: 1px dashed var(--c); outline-offset: -2px; }
.study-badge { font-size: .85em; }
.agent.learning .avatar::after { content: "📖"; position: absolute; bottom: 0; right: 0; font-size: 17px; pointer-events: none; }

/* ---------- ¿qué está pasando? (barra explicativa) ---------- */
.explain { border-top: 1px solid var(--line); padding: 6px 12px; display: flex; flex-direction: column; gap: 5px; background: #000; position: relative; z-index: 2; }
.ex-head { display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.ex-tag { font-size: 9.5px; letter-spacing: .12em; color: #22d3ee; white-space: nowrap; font-weight: 700; }
.ex-main { font-size: 12.5px; color: var(--text, #e5e7eb); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ex-chips span { font-size: 10.5px; padding: 2px 8px; border: 1px solid var(--line-2, #333); border-radius: 999px; color: var(--muted, #9ca3af); white-space: nowrap; cursor: help; }
.ex-chips span.good { color: #4ade80; border-color: rgba(74,222,128,.4); }
.ex-chips span.warn { color: #fbbf24; border-color: rgba(251,191,36,.4); }
/* ---------- réplicas ---------- */
.clones-body { display: block !important; }
.clones-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-top: 10px; }
.clone-card { border: 1px solid var(--line-2, #333); border-radius: 10px; padding: 10px; font-size: 11.5px; display: flex; flex-direction: column; gap: 4px; }
.clone-card .t { display: flex; justify-content: space-between; font-weight: 700; font-size: 12.5px; }
.clone-card .up { color: #4ade80; } .clone-card .down { color: #f87171; }
.clone-card .g { color: var(--muted, #9ca3af); font-size: 10.5px; }
.clones-tree { font-size: 11px; color: var(--muted, #9ca3af); display: flex; flex-direction: column; gap: 2px; margin-top: 6px; max-height: 180px; overflow: auto; }

/* scroll dentro de los paneles (se pueden ver todas las estadísticas y botones en pantallas chicas) */
.panel.left, .panel.right { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: auto; scrollbar-color: #4b5563 #000; }
.panel.left::-webkit-scrollbar, .panel.right::-webkit-scrollbar { width: 10px; background: #000; }
.panel.left::-webkit-scrollbar-thumb, .panel.right::-webkit-scrollbar-thumb { background: #6b7280; border-radius: 5px; border: 2px solid #000; }
.panel.left::-webkit-scrollbar-thumb:hover, .panel.right::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
.panel.right .feed { min-height: 160px; }
@media (max-height: 820px) { .chart-wrap { min-height: 120px; } }
footer { background: #000; position: relative; z-index: 2; }
.ex-chips span { background: #000; }

/* ═══════════════ CONTROL DE DINERO + CURVA DE DOLOR ($5 vs $100) ═══════════════ */
.cap-box {
  border: 1px solid #1e3a2f;
  background: linear-gradient(180deg, rgba(16, 240, 160, 0.06), rgba(10, 10, 12, 0.95));
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cap-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--green);
}
.cap-pain-badge {
  font-size: 9.5px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 176, 32, 0.14);
  border: 1px solid rgba(255, 176, 32, 0.45);
  color: #ffd166;
  max-width: 195px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cap-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.cap-chip {
  font: 700 10.5px var(--mono);
  background: #0c0d10;
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 4px 2px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
  transition: border-color .2s, background .2s, transform .2s;
}
.cap-chip small {
  font-size: 8.5px;
  font-weight: 400;
  color: var(--muted);
}
.cap-chip:hover, .cap-chip.active {
  border-color: var(--green);
  background: rgba(16, 240, 160, 0.12);
  color: #fff;
  transform: translateY(-1px);
}
.cap-chip.active small { color: var(--green); }
.cap-custom {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 4px;
}
.cap-custom input {
  padding: 4px 6px;
  font-size: 10.5px;
}

/* ═══════════════ MUNDO VIDEOJUEGO 2D (CIUDAD + EDIFICIO 1 + LUFFY VOZ) ═══════════════ */
.view-tabs {
  display: flex;
  gap: 4px;
  background: #070709;
  padding: 2px;
  border-radius: 7px;
  border: 1px solid var(--line-2);
}
.vtab {
  font: 700 10.5px var(--mono);
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 5px;
  padding: 4px 9px;
  cursor: pointer;
  transition: background .2s, color .2s;
  white-space: nowrap;
}
.vtab:hover { color: var(--text); }
.vtab.active {
  background: linear-gradient(90deg, #063022, #0b3b2d);
  color: var(--green);
  box-shadow: 0 0 10px rgba(16, 240, 160, 0.25);
}

.game-world-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
#gameCanvas {
  flex: 1;
  width: 100%;
  min-height: 260px;
  border-radius: 10px;
  border: 1px solid #1f2937;
  background: #07090e;
  cursor: pointer;
  display: block;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.85);
}

/* 🏴‍☠️ Barra de Voz de Luffy */
.luffy-voice-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid #4a2c11;
  background: linear-gradient(90deg, #1a0f07 0%, #121016 55%, #0c141d 100%);
  box-shadow: 0 0 18px rgba(255, 176, 32, 0.12);
}
.luffy-avatar-mini {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  border: 2px solid #ffb020;
  background: radial-gradient(circle at 50% 50%, #3b2006, #09090b);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  overflow: hidden;
  transition: transform .25s var(--jelly);
}
.luffy-avatar-mini:hover { transform: scale(1.08); }
.luffy-avatar-mini img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  image-rendering: pixelated;
}
.luffy-live-dot {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}
.luffy-controls {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.luffy-top-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.luffy-mic-btn {
  background: linear-gradient(90deg, #ff2a4d, #ff6b2b) !important;
  color: #fff !important;
  font-weight: 800 !important;
  box-shadow: 0 0 12px rgba(255, 42, 77, 0.4);
}
.luffy-mic-btn.listening {
  animation: throb .6s infinite;
  background: linear-gradient(90deg, #ff0033, #ffb020) !important;
}
.luffy-q-chip {
  font: 600 10px var(--mono);
  background: rgba(255, 255, 255, 0.05);
  color: #e5e7eb;
  border: 1px solid #2e3440;
  border-radius: 999px;
  padding: 3px 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .2s, background .2s;
}
.luffy-q-chip:hover {
  border-color: #ffb020;
  background: rgba(255, 176, 32, 0.14);
  color: #fff;
}
.luffy-tts-toggle {
  margin-left: auto;
  font-size: 10px;
  color: #fcd34d;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.luffy-tts-toggle input { width: auto; accent-color: #ffb020; }
.luffy-ask-row {
  display: flex;
  gap: 6px;
}
.luffy-ask-row input {
  flex: 1;
  padding: 5px 8px;
  font-size: 11px;
  background: rgba(0, 0, 0, 0.6);
  border-color: #2d3748;
}

/* 🤫 Botón Callar a Luffy Inmediato */
.luffy-mute-btn {
  background: linear-gradient(90deg, #b91c1c, #dc2626) !important;
  color: #fff !important;
  font-weight: 800 !important;
  border: 1px solid #fca5a5 !important;
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.45);
}
.luffy-mute-btn:hover {
  background: #ef4444 !important;
  transform: scale(1.04);
}
.luffy-q-chip.highlight {
  border-color: var(--green);
  color: var(--green);
  background: rgba(16, 240, 160, 0.10);
  font-weight: 800;
}

/* Pestañas compactas de los 7 Edificios */
.view-tabs {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  max-width: 78%;
  overflow-x: auto;
}
.vtab {
  padding: 3px 6px !important;
  font-size: 9.5px !important;
}

/* 🤝 Banner de Modo Trabajador Invitado */
.worker-guest-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 14px;
  background: linear-gradient(90deg, #06281e, #0c192c);
  border-bottom: 1px solid var(--cyan);
  font-size: 11px;
  color: #e0f2fe;
}
.worker-guest-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.worker-guest-actions input {
  width: 150px;
  padding: 4px 8px;
  font-size: 11px;
}

/* 🏛️ Centro de Mando del Holding Multi-Empresa */
.holding-modal {
  width: min(1260px, 97vw) !important;
  max-height: 93vh !important;
}
.holding-body {
  grid-template-columns: 1fr 1fr !important;
}
.holding-form-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
}
.holding-form-row input, .holding-form-row select {
  flex: 1;
  min-width: 110px;
  padding: 5px 8px;
  font-size: 11px;
  background: #070a10;
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: 6px;
}
.holding-list, .holding-mini-feed {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 155px;
  overflow-y: auto;
  margin-top: 6px;
}
.holding-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: #080b11;
  border: 1px solid #1e293b;
  border-left: 3px solid var(--cyan);
  border-radius: 6px;
  font-size: 10.5px;
}
.holding-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.holding-act-card {
  background: #06090f;
  border: 1px solid #1f2937;
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.holding-act-card b {
  font-size: 11px;
  color: var(--cyan);
}
.holding-table-wrap {
  overflow-x: auto;
}
.holding-costs-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 10.5px;
}
.holding-costs-tbl th, .holding-costs-tbl td {
  padding: 6px 8px;
  border-bottom: 1px solid #1e293b;
  text-align: left;
}
.holding-costs-tbl th {
  color: var(--amber);
  background: #090d14;
}
.holding-bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.holding-tax-box {
  font-size: 11px;
  color: #d1fae5;
  background: #061812;
  border: 1px solid #10b981;
  padding: 7px 10px;
  border-radius: 7px;
  flex: 1;
}
.holding-bottom-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ════════ PANELES CONTEXTUALES POR EDIFICIO vs VISTA GENERAL CIUDAD ════════ */
.ctx-sidebar-view {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  overflow-y: auto;
  padding-right: 2px;
}
.ctx-b1-view {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  overflow-y: auto;
}
.ctx-card {
  background: linear-gradient(180deg, #0b1220 0%, #070b14 100%);
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 11px;
  line-height: 1.45;
  color: #e2e8f0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.ctx-card-title {
  font-family: 'Plus Jakarta Sans', 'JetBrains Mono', sans-serif;
  font-weight: 800;
  font-size: 11.5px;
  color: #38bdf8;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
  letter-spacing: 0.2px;
}
.ctx-rpg-badge {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  padding: 3px 6px;
  border-radius: 4px;
  background: #0f172a;
  border: 1px solid #38bdf8;
  color: #fde68a;
  letter-spacing: 0.4px;
}
.ctx-kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 4px;
}
.ctx-kpi-box {
  background: #050811;
  border: 1px solid #1e293b;
  border-radius: 6px;
  padding: 6px 8px;
}
.ctx-kpi-box span {
  display: block;
  font-size: 9.5px;
  color: #94a3b8;
}
.ctx-kpi-box b {
  font-size: 13px;
  color: #10f0a0;
}
.ctx-b-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.ctx-b-item {
  background: #070d19;
  border: 1px solid #1e293b;
  border-left: 3px solid #10f0a0;
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.ctx-b-item:hover {
  background: #0f172a;
  border-color: #38bdf8;
  transform: translateX(2px);
}
.ctx-b-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 11px;
  color: #f8fafc;
}
.ctx-b-item-sub {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 2px;
}
.ctx-step-box {
  background: #06101e;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 7px;
  padding: 8px;
  margin-bottom: 4px;
}
.ctx-step-box b {
  color: #fde047;
  font-size: 11px;
  display: block;
  margin-bottom: 4px;
}
.ctx-input-col {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 5px;
}
.ctx-input-col input, .ctx-input-col select {
  width: 100%;
  background: #04070e;
  border: 1px solid #334155;
  color: #f8fafc;
  border-radius: 5px;
  padding: 5px 7px;
  font-size: 10.5px;
}
.ctx-pill-sim {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 700;
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid #fbbf24;
  color: #fde68a;
}
.ctx-pill-real {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 700;
  background: rgba(16, 240, 160, 0.15);
  border: 1px solid #10f0a0;
  color: #10f0a0;
}

