/* ============================================================
   ALICE CITY v5 — CENTRO DE MANDO (estilo 80s pixel)
   ============================================================ */
:root {
  --bg: #0b1226;
  --panel: rgba(13, 18, 36, 0.92);
  --panel2: rgba(17, 23, 44, 0.94);
  --line: #243458;
  --cian: #00f0ff;
  --verde: #39ff88;
  --magenta: #ff2fb3;
  --amar: #ffd23f;
  --naranja: #ff9a3d;
  --txt: #cfe0ff;
  --dim: #6b7ba0;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: var(--bg); }
body {
  font-family: 'Lucida Console', Monaco, monospace;
  color: var(--txt);
  font-size: 12px;
}
#game {
  position: fixed; inset: 0;         /* v8.1 MÓVIL: SIEMPRE pantalla completa (sin franja ni bordes) */
  width: 100%; height: 100%;
  image-rendering: auto;             /* v8: render suave de alta definición */
  background: #182650;
  z-index: 1;
}
/* viñeta sutil (sin scanlines: fuera el efecto CRT sucio) */
#scan {
  position: fixed; inset: 0; z-index: 40; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 68%, rgba(10,16,38,0.22) 100%);
}
.hidden { display: none !important; }

/* ============ SPLASH ============ */
#splash {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(0,240,255,0.08), transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(255,47,179,0.06), transparent 55%),
    var(--bg);
}
.splash-logo {
  font-size: 52px; font-weight: bold; letter-spacing: 6px;
  color: #fff;
  text-shadow: 0 0 18px var(--cian), 3px 3px 0 #06364a;
}
.splash-logo span { color: var(--cian); }
.splash-sub {
  margin-top: 6px; letter-spacing: 4px; color: var(--dim); font-size: 12px;
}
.splash-badge {
  margin-top: 14px; padding: 4px 14px; border: 1px solid var(--line);
  color: var(--verde); font-size: 11px; letter-spacing: 2px;
  background: rgba(57,255,136,0.05);
}
#btn-entrar {
  margin-top: 34px; padding: 13px 42px;
  font-family: inherit; font-size: 15px; font-weight: bold; letter-spacing: 3px;
  color: #04101a; background: var(--cian);
  border: none; cursor: pointer;
  box-shadow: 0 0 22px rgba(0,240,255,0.45);
  transition: transform 0.12s, box-shadow 0.12s;
}
#btn-entrar:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 0 34px rgba(0,240,255,0.7); }
.splash-controles {
  margin-top: 26px; display: flex; gap: 14px; color: var(--dim); font-size: 11px;
}
.splash-controles b { color: var(--txt); border: 1px solid var(--line); padding: 1px 7px; margin-right: 4px; }
.splash-pie { position: absolute; bottom: 16px; color: #3a4666; font-size: 10px; letter-spacing: 2px; }

/* ============ BARRA SUPERIOR ============ */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 32px; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  padding: 0 12px;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  background: linear-gradient(180deg, rgba(10,14,30,0.97), rgba(8,11,24,0.94));
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}
#topbar .logo { color: #fff; font-weight: bold; letter-spacing: 2px; }
#topbar .logo b { color: var(--cian); }
.status { display: flex; align-items: center; gap: 6px; color: var(--verde); }
.status .dotv { width: 7px; height: 7px; background: var(--verde); border-radius: 50%; box-shadow: 0 0 8px var(--verde); animation: pulso 1.6s infinite; }
@keyframes pulso { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
#reloj { color: var(--amar); letter-spacing: 1px; }
.sp { flex: 1; }
#topbar .ver { color: #3a4666; }
#topbar a { color: var(--dim); text-decoration: none; border: 1px solid var(--line); padding: 2px 8px; }
#topbar a:hover { color: var(--cian); border-color: var(--cian); }

/* ============ MENÚ IZQUIERDO ============ */
#menu {
  position: fixed; left: 8px; top: 40px; bottom: 42px; width: 236px; z-index: 50;
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 2px solid var(--cian);
  box-shadow: 0 0 24px rgba(0,0,0,0.6);
}
#menu-tabs { display: flex; flex-wrap: wrap; gap: 3px; padding: 6px; border-bottom: 1px solid var(--line); }
#menu-tabs button {
  flex: 1 1 30%;
  background: rgba(0,240,255,0.04); color: var(--dim);
  border: 1px solid var(--line); padding: 5px 2px;
  font-family: inherit; font-size: 10px; letter-spacing: 1px; cursor: pointer;
}
#menu-tabs button:hover { color: var(--txt); border-color: #2e4a7a; }
#menu-tabs button.sel { color: #04101a; background: var(--cian); border-color: var(--cian); font-weight: bold; }
.panel { flex: 1; overflow-y: auto; padding: 8px; }
.panel::-webkit-scrollbar { width: 6px; }
.panel::-webkit-scrollbar-thumb { background: #22335a; }
.panel h3 { font-size: 11px; color: var(--cian); letter-spacing: 2px; margin-bottom: 8px; }

.card {
  border: 1px solid var(--line); background: var(--panel2);
  padding: 7px 8px; margin-bottom: 7px;
}
.card.op { opacity: 0.45; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.card-top b { font-size: 11px; color: #fff; }
.card-d { color: var(--dim); font-size: 10.5px; margin: 4px 0; line-height: 1.45; }
.card-bot { display: flex; align-items: center; gap: 6px; }
.card .cat { color: #3a4666; font-size: 9px; text-transform: uppercase; }
.alc { color: var(--amar); font-weight: bold; font-size: 11px; }
.tag { font-size: 9px; padding: 2px 6px; letter-spacing: 1px; }
.tag.verde { color: var(--verde); border: 1px solid var(--verde); }
.tag.cian { color: var(--cian); border: 1px solid var(--cian); }
.tag.amar { color: var(--amar); border: 1px solid var(--amar); }
.tag.gris { color: var(--dim); border: 1px solid var(--line); }
.mini-btn {
  font-family: inherit; font-size: 10px; letter-spacing: 1px;
  padding: 4px 8px; cursor: pointer; border: 1px solid; background: transparent;
}
.mini-btn.verde { color: var(--verde); border-color: var(--verde); }
.mini-btn.verde:hover { background: rgba(57,255,136,0.12); }
.mini-btn.cian { color: var(--cian); border-color: var(--cian); }
.mini-btn.cian:hover { background: rgba(0,240,255,0.12); }
.mini-btn.amar { color: var(--amar); border-color: var(--amar); }
.mini-btn.sel { background: rgba(0,240,255,0.15); }
.hint { color: var(--dim); font-size: 10px; }
.prog { color: var(--dim); font-size: 10px; }
.cats { display: flex; gap: 4px; margin-bottom: 8px; flex-wrap: wrap; }
.cats .mini-btn { flex: 1; padding: 3px 2px; font-size: 9px; }

/* agentes */
.ag-line { display: flex; align-items: center; gap: 6px; padding: 4px 2px; border-bottom: 1px solid rgba(29,43,74,0.5); font-size: 10.5px; }
.ag-line .zona { color: var(--dim); flex: 1; text-align: right; }
.ag-line .st { color: #3a4666; font-size: 9px; }
.dot { width: 6px; height: 6px; border-radius: 50%; }
.dot.ver { background: var(--verde); box-shadow: 0 0 5px var(--verde); }
.dot.cian { background: var(--cian); box-shadow: 0 0 5px var(--cian); }
.dot.ama { background: var(--amar); box-shadow: 0 0 5px var(--amar); }

/* billetera */
.big-bal { font-size: 30px; color: var(--amar); text-align: center; padding: 10px 0 14px; text-shadow: 0 0 14px rgba(255,210,63,0.4); }
.big-bal span { font-size: 14px; color: var(--dim); }
.addr { font-size: 9.5px; color: var(--verde); word-break: break-all; padding: 4px 0; }

/* logs */
.log-line { font-size: 10px; color: var(--dim); padding: 2.5px 0; border-bottom: 1px dotted rgba(29,43,74,0.6); }
.log-line span { color: #3a4666; margin-right: 6px; }
.log-line.verde { color: var(--verde); }
.log-line.cian { color: var(--cian); }
.log-line.amar { color: var(--amar); }

#mini { border: 1px solid var(--line); background: #0a0d1a; image-rendering: pixelated; width: 100%; }

/* ============ CHAT DERECHO ============ */
#chat {
  position: fixed; right: 8px; top: 40px; bottom: 42px; width: 224px; z-index: 50;
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 2px solid var(--magenta);
}
#chat-head { padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 11px; letter-spacing: 1px; }
#chat-head b { color: var(--magenta); }
#chat-head .st { color: var(--verde); font-size: 9px; }
#chat-feed { flex: 1; overflow-y: auto; padding: 8px; }
#chat-feed::-webkit-scrollbar { width: 6px; }
#chat-feed::-webkit-scrollbar-thumb { background: #22335a; }
.chat-msg { margin-bottom: 8px; font-size: 10.5px; line-height: 1.4; }
.chat-msg b { display: block; font-size: 10px; }
.chat-msg span { color: #b8c6e8; }
#chat-in { display: flex; border-top: 1px solid var(--line); }
#chat-inp {
  flex: 1; background: rgba(0,0,0,0.3); border: none; outline: none;
  color: var(--txt); font-family: inherit; font-size: 11px; padding: 8px;
}
#chat-send {
  background: var(--magenta); color: #1a0412; border: none;
  font-family: inherit; font-weight: bold; font-size: 10px; padding: 0 12px; cursor: pointer;
}

/* ============ BARRA INFERIOR ============ */
#bottombar {
  position: fixed; bottom: 0; left: 0; right: 0; height: 34px; z-index: 50;
  display: flex; align-items: center; gap: 18px;
  padding: 0 12px;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  background: linear-gradient(0deg, rgba(10,14,30,0.97), rgba(8,11,24,0.94));
  border-top: 1px solid var(--line);
  font-size: 11px;
}
#bottombar .lbl { color: var(--dim); letter-spacing: 1px; }
#energia-bar { width: 110px; height: 9px; border: 1px solid var(--line); background: rgba(0,0,0,0.4); }
#hud-energia-fill { height: 100%; width: 95%; background: var(--verde); transition: width 0.5s; }
#hud-alc { color: var(--amar); font-weight: bold; font-size: 13px; }
#ticker { color: #3f5f8f; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }

/* ============ TOASTS / DIALOG ============ */
#toasts { position: fixed; top: 42px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.toast {
  background: rgba(9,14,30,0.95); border: 1px solid var(--cian); color: var(--cian);
  padding: 7px 16px; font-size: 11.5px; letter-spacing: 1px;
  box-shadow: 0 0 18px rgba(0,240,255,0.25);
  animation: entra 0.25s ease-out;
  transition: opacity 0.4s, transform 0.4s;
}
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes entra { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; } }

/* ============================================================
   ALICE CITY v8.1 — ROTACIÓN EN MÓVIL (solo horizontal)
   ============================================================ */
#rotar {
  display: none;
  position: fixed; inset: 0; z-index: 300;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; text-align: center;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(0,240,255,0.10), transparent 60%),
    radial-gradient(ellipse at 80% 85%, rgba(255,47,179,0.07), transparent 55%),
    #0b1226;
}
@media (orientation: portrait) and (pointer: coarse) { #rotar { display: flex; } }
@media (orientation: portrait) { body.touch #rotar { display: flex; } }
.rotar-fono {
  width: 62px; height: 102px;
  border: 4px solid var(--cian); border-radius: 14px;
  position: relative;
  box-shadow: 0 0 26px rgba(0,240,255,0.4), inset 0 0 12px rgba(0,240,255,0.15);
  animation: giraFono 1.7s ease-in-out infinite;
}
.rotar-fono::before {
  content: ''; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 30px; height: 38px; border-radius: 4px;
  background: linear-gradient(180deg, rgba(0,240,255,0.45), rgba(0,240,255,0.08));
}
.rotar-fono::after {
  content: ''; position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  width: 18px; height: 4px; border-radius: 2px; background: var(--cian);
}
@keyframes giraFono {
  0%, 18%  { transform: rotate(0deg); }
  55%, 82% { transform: rotate(-90deg); }
  100%     { transform: rotate(-90deg); }
}
.rotar-t1 { font-size: 17px; font-weight: bold; letter-spacing: 4px; color: #fff; text-shadow: 0 0 14px rgba(0,240,255,0.6); }
.rotar-t2 { font-size: 12px; letter-spacing: 2px; color: var(--dim); }

/* ============================================================
   ALICE CITY v6 — TÁCTIL / MÓVIL
   ============================================================ */
/* botones de toggle (solo móvil) */
.mtn {
  display: none;
  background: rgba(0,240,255,0.06); color: var(--cian);
  border: 1px solid var(--line); padding: 3px 10px;
  font-family: inherit; font-size: 11px; cursor: pointer;
}
body.touch .mtn, body.movil .mtn { display: inline-block; }

/* ---- UI táctil ---- */
#touch-ui { position: fixed; inset: 0; z-index: 45; pointer-events: none; display: none; }
body.touch #touch-ui { display: block; }
#joy {
  position: absolute;
  left: max(16px, calc(env(safe-area-inset-left) + 8px)); bottom: 78px;
  width: 116px; height: 116px; border-radius: 50%;
  background: rgba(8,12,26,0.45);
  border: 2px solid rgba(0,240,255,0.35);
  pointer-events: auto; touch-action: none;
  box-shadow: 0 0 14px rgba(0,240,255,0.15), inset 0 0 18px rgba(0,240,255,0.05);
}
#joy.on { border-color: rgba(0,240,255,0.75); }
#knob {
  position: absolute; left: 50%; top: 50%;
  width: 48px; height: 48px; border-radius: 50%;
  margin: -24px 0 0 -24px;
  background: radial-gradient(circle at 35% 30%, #0e3a4a, #06121e);
  border: 2px solid rgba(0,240,255,0.6);
  box-shadow: 0 0 12px rgba(0,240,255,0.4);
  pointer-events: none;
}
#tbtns { position: absolute; right: max(14px, calc(env(safe-area-inset-right) + 6px)); bottom: 78px; width: 132px; height: 150px; pointer-events: none; }
.tbtn {
  position: absolute; pointer-events: auto; touch-action: none;
  border-radius: 50%; user-select: none; -webkit-user-select: none;
  font-family: inherit; font-weight: bold; color: var(--cian);
  background: rgba(8,12,26,0.55);
  border: 2px solid rgba(0,240,255,0.45);
  box-shadow: 0 0 12px rgba(0,240,255,0.18);
}
.tbtn.on { background: rgba(0,240,255,0.25); color: #fff; }
.tbtn.big { right: 8px; bottom: 46px; width: 68px; height: 68px; font-size: 26px; border-color: rgba(57,255,136,0.6); color: var(--verde); }
.tbtn.big.on { background: rgba(57,255,136,0.25); }
.tbtn { right: 84px; bottom: 60px; width: 52px; height: 52px; font-size: 10px; letter-spacing: 1px; }
.tbtn.mini { right: 84px; bottom: 6px; width: 40px; height: 40px; font-size: 16px; }
.tbtn.mini:last-child { right: 36px; bottom: 6px; }

/* ---- móvil: menú y chat como overlays (pantalla chica por ANCHO o por ALTO=landscape) ---- */
@media (max-width: 760px), (max-height: 500px) {
  body.movil #menu {
    display: none;
    left: 6px; right: 6px; width: auto; top: 40px; bottom: 42px; z-index: 60;
  }
  body.movil.menu-open #menu { display: flex; }
  body.movil #chat {
    display: none;
    left: 6px; right: 6px; width: auto; top: auto; height: 55%; bottom: 42px; z-index: 60;
  }
  body.movil.chat-open #chat { display: flex; }
  #topbar { gap: 8px; font-size: 10px; padding: 0 6px; }
  #topbar .status, #topbar .ver { display: none; }
  #bottombar { font-size: 10px; gap: 6px; }
  #bottombar .lbl:nth-of-type(2), #bottombar .lbl:nth-of-type(3) { display: none; }
}

/* ---- v8.1: HORIZONTAL de móvil (pantalla baja): HUD compacto, más juego visible ---- */
@media (max-height: 500px) {
  #topbar { height: 27px; gap: 10px; font-size: 10px; }
  #topbar .ver, #topbar a { display: none; }      /* fuera link 3D y versión */
  #bottombar { height: 27px; gap: 10px; font-size: 10px; }
  #energia-bar { width: 80px; }
  #ticker { display: none; }
  #menu { top: 32px; bottom: 32px; width: 210px; }
  #chat { top: 32px; bottom: 32px; width: 200px; }
  #toasts { top: 34px; }
  .toast { padding: 5px 12px; font-size: 10.5px; }
  #joy { bottom: 44px; width: 104px; height: 104px; }
  #tbtns { bottom: 44px; }
  .splash-logo { font-size: 36px; letter-spacing: 4px; }
  #btn-entrar { margin-top: 18px; padding: 11px 34px; }
  .splash-controles { margin-top: 14px; gap: 10px; font-size: 10px; }
  .splash-badge { margin-top: 10px; font-size: 10px; }
  .rotar-t1 { font-size: 15px; }
}

/* ============================================================
   v9 ALICE TOWER — panel modal (ascensor, términos, canales,
   RAG, MCP, directorio) + botón de convocatoria
   ============================================================ */
#panel-torre { position: fixed; inset: 0; z-index: 260; display: flex; align-items: center; justify-content: center; background: rgba(2,4,10,0.72); }
#panel-torre.hidden { display: none; }
.pt-box { width: min(620px, 94vw); max-height: 84vh; background: linear-gradient(160deg, #0b1022, #0e1630 60%, #101b3c); border: 1px solid rgba(0,240,255,0.45); border-radius: 12px; box-shadow: 0 0 40px rgba(0,240,255,0.18), inset 0 0 24px rgba(0,240,255,0.05); display: flex; flex-direction: column; }
.pt-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid rgba(0,240,255,0.25); font: bold 13px monospace; color: #00f0ff; letter-spacing: 1px; }
#pt-close { background: none; border: 1px solid rgba(0,240,255,0.4); color: #00f0ff; border-radius: 6px; width: 26px; height: 26px; cursor: pointer; font: bold 13px monospace; }
#pt-body { padding: 12px 14px; overflow-y: auto; font: 12px/1.6 monospace; color: #cfe6ff; }
#pt-body p { margin: 6px 0; }
.pt-fila { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; background: rgba(10,16,38,0.8); border: 1px solid rgba(0,240,255,0.28); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; cursor: pointer; color: #e6f4ff; }
.pt-fila:hover { border-color: #00f0ff; background: rgba(0,240,255,0.08); }
.pt-fila:disabled { opacity: 0.45; cursor: default; }
.pt-fila.act { border-color: #ffd23f; }
.pt-fila .pt-n { font: bold 12px monospace; color: #ffd23f; width: 34px; flex-shrink: 0; }
.pt-d { font-size: 10px; color: #8fb0d8; }
.pt-btn { background: linear-gradient(180deg, #00b4d8, #0077b6); border: none; color: #03121e; font: bold 12px monospace; padding: 9px 16px; border-radius: 8px; cursor: pointer; }
.pt-btn:active { transform: translateY(1px); }
.pt-inp { width: 100%; box-sizing: border-box; background: #0a0f24; border: 1px solid rgba(0,240,255,0.35); color: #e6f4ff; font: 12px monospace; padding: 8px; border-radius: 6px; margin: 4px 0 10px; }
.pt-tag { font: bold 10px monospace; padding: 2px 8px; border-radius: 20px; }
.pt-ok { background: rgba(57,255,136,0.15); color: #39ff88; border: 1px solid rgba(57,255,136,0.5); }
.pt-no { background: rgba(255,210,63,0.12); color: #ffd23f; border: 1px solid rgba(255,210,63,0.45); }
.pt-h3 { color: #00f0ff; font: bold 12px monospace; margin: 10px 0 4px; letter-spacing: 1px; }
.pt-res { background: rgba(10,16,38,0.8); border: 1px solid rgba(0,240,255,0.25); border-left: 3px solid #39ff88; border-radius: 6px; padding: 8px 10px; margin-bottom: 8px; font-size: 11px; }
.pt-res b { color: #7ae7ff; }

/* botón de convocatoria (solo escritorio; el móvil tiene el 📣 táctil) */
#btn-convocar { display: none; }
body:not(.touch) #btn-convocar {
  display: block; position: fixed; bottom: 44px; left: 50%; transform: translateX(-50%);
  z-index: 120; background: linear-gradient(180deg, #ffb347, #e6510f); border: 1px solid #ffd23f;
  color: #20080a; font: bold 12px monospace; padding: 9px 16px; border-radius: 22px; cursor: pointer;
  box-shadow: 0 0 18px rgba(255,120,60,0.45); letter-spacing: 1px;
}
body:not(.touch) #btn-convocar:hover { filter: brightness(1.12); }

/* 📣 táctil: encima del botón grande E */
.tbtn[data-k="r"] { right: 14px; bottom: 120px; width: 46px; height: 46px; font-size: 19px; }
