/* Vista en vivo de City — mismo sistema visual que la portada:
   tinta azul, blueprint, ámbar sodio, mono de contabilidad. */

@font-face { font-family:'Space Grotesk'; src:url('/assets/fonts/space-grotesk-500.woff2') format('woff2'); font-weight:500; font-display:swap; }
@font-face { font-family:'Space Grotesk'; src:url('/assets/fonts/space-grotesk-700.woff2') format('woff2'); font-weight:700; font-display:swap; }
@font-face { font-family:'IBM Plex Mono'; src:url('/assets/fonts/ibm-plex-mono-400.woff2') format('woff2'); font-weight:400; font-display:swap; }
@font-face { font-family:'IBM Plex Mono'; src:url('/assets/fonts/ibm-plex-mono-500.woff2') format('woff2'); font-weight:500; font-display:swap; }

:root {
  color-scheme: dark;
  --ink:#0a0d12; --grid:#182230; --panel:#0d131b; --line:#1d2837;
  --text:#e9e2d4; --muted:#7c8896;
  --amber:#ffb454; --amber-dim:#8a6234; --mint:#57d9a3;
  --font-display:'Space Grotesk', system-ui, sans-serif;
  --font-mono:'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0; height: 100vh; overflow: hidden;
  background: var(--ink); color: var(--text);
  font: 13px/1.45 system-ui, sans-serif;
  display: flex; flex-direction: column;
}

/* ── barra superior ─────────────────────── */
.bar {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.back {
  font-family: var(--font-mono); text-decoration: none; color: var(--muted);
  border: 1px solid var(--line); border-radius: 3px; padding: 3px 9px;
  transition: border-color .15s, color .15s;
}
.back:hover { color: var(--amber); border-color: var(--amber); }
.livep { width: 8px; height: 8px; border-radius: 50%; background: #434e5c; transition: background .4s, box-shadow .4s; }
.livep.on { background: var(--mint); box-shadow: 0 0 10px #57d9a366; }
.bar h1 {
  font-family: var(--font-display); font-weight: 700; font-size: 14px;
  letter-spacing: -0.01em; margin: 0;
}
.bar h1 span { color: var(--muted); font-weight: 500; }
.stats { flex: 1; display: flex; gap: 14px; justify-content: center; }
.stat { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.stat b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.tools { display: flex; align-items: center; gap: 8px; }
.zoom { font-family: var(--font-mono); font-size: 11px; color: var(--muted); min-width: 40px; text-align: right; }
.bar button {
  font-family: var(--font-mono); font-size: 11px;
  background: transparent; border: 1px solid var(--line); color: var(--text);
  border-radius: 3px; padding: 4px 10px; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.bar button:hover { border-color: var(--amber); color: var(--amber); }

/* ── layout principal ───────────────────── */
#wrap { flex: 1; display: grid; grid-template-columns: 1fr 300px; min-height: 0; }
.stage { position: relative; min-width: 0; }
canvas {
  width: 100%; height: 100%; display: block;
  background: var(--ink); cursor: grab;
}
canvas:active { cursor: grabbing; }
canvas:focus-visible { outline: 2px solid var(--amber); outline-offset: -2px; }
.hint {
  position: absolute; left: 12px; bottom: 10px;
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--muted);
  background: #0d131bd9; border: 1px solid var(--line); border-radius: 3px;
  padding: 4px 9px;
  pointer-events: none;
  transition: opacity .6s;
}
.hint.fade { opacity: 0; }

/* ── panel lateral ──────────────────────── */
aside {
  border-left: 1px solid var(--line);
  background: var(--panel);
  display: flex; flex-direction: column; min-height: 0;
}
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab {
  flex: 1; padding: 9px 0;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--muted); cursor: pointer;
}
.tab.on { color: var(--amber); border-bottom-color: var(--amber); }

#agents, #feed { overflow-y: auto; padding: 10px 12px; scrollbar-width: thin; }

/* habitantes: chips con color propio */
.agent {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px; align-items: center;
  padding: 8px 8px;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
}
.agent:hover { background: #111927; }
.agent.following { border-color: var(--amber-dim); }
.agent .chip {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 12px;
  color: var(--ink);
}
.agent .who { min-width: 0; }
.agent strong {
  display: block; font-family: var(--font-display); font-weight: 500; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.agent .stat-line {
  display: block; color: var(--muted); font-size: 11px;
  font-family: var(--font-mono);
  margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.agent .fresh { font-family: var(--font-mono); font-size: 10px; color: var(--muted); white-space: nowrap; }
.agent .fresh.awake { color: var(--mint); }
.empty { color: var(--muted); font-family: var(--font-mono); font-size: 11px; padding: 20px 6px; text-align: center; }

/* pulso: eventos con sello de tiempo y tipo */
.ev {
  display: grid; grid-template-columns: 52px 58px 1fr; gap: 8px;
  padding: 5px 4px;
  border-bottom: 1px solid #141b26;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--muted);
}
.ev time { color: #4d5a6b; }
.ev .kind {
  text-transform: uppercase; font-size: 9.5px; letter-spacing: .06em;
  padding-top: 1px;
}
.ev .kind.move   { color: #7cbae8; }
.ev .kind.build  { color: var(--amber); }
.ev .kind.say    { color: #d7b3f5; }
.ev .kind.join   { color: var(--mint); }
.ev .kind.leave  { color: #e8734a; }
.ev .kind.beat   { color: #5d6a7a; }
.ev .body { color: #9aa6b3; overflow-wrap: anywhere; }
.ev .body .who { color: var(--text); }
.ev .body em { font-style: normal; color: #c4cdd8; }

@media (max-width: 860px) {
  #wrap { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  aside { border-left: 0; border-top: 1px solid var(--line); max-height: 42vh; }
  .stats { justify-content: flex-end; gap: 9px; }
  .zoom { display: none; }
  .bar h1 span { display: none; }
}
