/* Equipe ao vivo — visual limpo para ficar num iframe do painel (modo claro). */
:root {
  --bg: #f6f8f5;
  --card: #ffffff;
  --line: #e3e9e4;
  --text: #0b1a12;
  --muted: #5d6f64;
  --green: #26b06a;
  --green-dk: #1e8a52;
  --danger: #e11d48;
  --pixel: "Press Start 2P", ui-monospace, monospace;
  --ui: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --title: "Space Grotesk", var(--ui);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { overflow-x: hidden; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  font-size: 14px;
  line-height: 1.35;
  padding: 12px;
}

button {
  font: 500 12px var(--ui);
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
}
button:hover { border-color: var(--green); }
button[aria-pressed="true"] { border-color: var(--green); color: var(--green-dk); background: #eaf7ef; }
button:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ---------- barra fina ---------- */
.bar {
  display: flex;
  align-items: center;
  gap: 8px 14px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.conn {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 700; font-size: 12px; color: var(--muted);
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 10px;
}
.conn::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: #b8c4bc;
}
.conn[data-state="on"] { color: var(--green-dk); }
.conn[data-state="on"]::before { background: var(--green); box-shadow: 0 0 0 3px #26b06a33; animation: pulse 1.6s ease-in-out infinite; }
.conn[data-state="off"] { color: var(--danger); }
.conn[data-state="off"]::before { background: var(--danger); }
.conn[data-state="demo"] { color: #7c3aed; }
.conn[data-state="demo"]::before { background: #8b5cf6; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px #26b06a00; } }

.empresa {
  font: 700 13px var(--title); color: var(--text);
  max-width: 40ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stats { display: flex; gap: 14px; flex: 1; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.stats b { color: var(--text); font-family: var(--title); font-size: 15px; margin-right: 3px; }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 12px;
  align-items: start;
}

.stage {
  position: relative;
  min-width: 0;
  border-radius: 16px;
  overflow: hidden;
  background: #1b1622;
  box-shadow: 0 1px 2px #0b1a1214, 0 8px 28px #0b1a1214;
  line-height: 0;
}
#game {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  cursor: default;
}

.tooltip {
  position: absolute;
  pointer-events: none;
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 6px 20px #0b1a1222;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.3;
  max-width: 260px;
  z-index: 5;
}
.tooltip .t-name { font-family: var(--title); font-weight: 700; margin-bottom: 2px; }
.tooltip .t-dim { color: var(--muted); font-size: 12px; }

.notice {
  position: absolute;
  left: 50%; bottom: 12px;
  transform: translateX(-50%);
  background: #ffffffee;
  color: var(--text);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  line-height: 1.3;
  box-shadow: 0 4px 14px #0b1a1233;
  white-space: nowrap;
}

/* ---------- painel ---------- */
.panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  min-width: 0;
}
.card h2 {
  font-family: var(--title);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}

.agents { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.agent {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  grid-template-rows: auto auto auto;
  gap: 0 8px;
  align-items: center;
  padding: 6px;
  border-radius: 10px;
  cursor: pointer;
}
.agent:hover { background: #f1f5f2; }
.agent.waiting { background: #fff1f3; box-shadow: inset 0 0 0 1px #e11d4855; }
.agent .av {
  grid-row: 1 / 4; align-self: start;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--c); color: #fff;
  font: 700 13px var(--title);
}
.agent .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent .st {
  font-size: 11px; font-weight: 700; color: var(--sc, var(--muted));
  background: color-mix(in srgb, var(--sc, #999) 12%, transparent);
  border-radius: 999px; padding: 1px 8px; white-space: nowrap;
}
.agent .role, .agent .det {
  grid-column: 2 / 4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.agent .role { color: var(--muted); font-size: 11.5px; }
.agent .det { color: var(--text); font-size: 12px; }
.agent .det:empty { display: none; }
.agents .none { color: var(--muted); font-size: 13px; padding: 4px; }

.card-log { max-height: 320px; overflow-y: auto; }
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 12.5px; }
.log li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; color: var(--muted); }
.log li .time { font-variant-numeric: tabular-nums; color: #8a998f; }
.log li .who { color: var(--c); font-weight: 700; }
.log li .txt { color: var(--text); }
.log .none { display: block; }

.legend-box { padding: 10px 12px; }
.legend-box summary { cursor: pointer; font-size: 12px; font-weight: 700; color: var(--muted); }
.legend-box summary:hover { color: var(--text); }
.legend {
  display: grid; grid-template-columns: 1fr; gap: 4px 12px;
  font-size: 12px; color: var(--muted);
  margin-top: 8px;
}
.legend i {
  display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--c); margin-right: 6px;
}

@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .panel { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .legend-box { grid-column: 1 / -1; }
  .legend { grid-template-columns: repeat(3, auto); justify-content: start; }
}
@media (max-width: 640px) {
  body { padding: 8px; }
  .stats { order: 3; flex-basis: 100%; gap: 10px; }
  .empresa { flex: 1; }
  .panel { grid-template-columns: minmax(0, 1fr); }
  .legend { grid-template-columns: 1fr; }
  .stage { border-radius: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .conn[data-state="on"]::before { animation: none; }
}

/* ---------- ?caber=1: ocupa a janela inteira e o desenho cabe (largura e altura) ---------- */
body.caber { height: 100vh; margin: 0; overflow: hidden; display: flex; flex-direction: column; }
body.caber .layout { flex: 1; min-height: 0; align-items: stretch; }
body.caber .stage { height: 100%; display: flex; align-items: center; justify-content: center; }
body.caber #game { width: auto; height: auto; max-width: 100%; max-height: 100%; }
body.caber .panel { max-height: 100%; overflow-y: auto; }
@media (max-width: 1100px) {
  body.caber { overflow-y: auto; height: auto; min-height: 100vh; }
  body.caber .stage { height: 70vh; }
  body.caber .panel { max-height: none; }
}

/* ---------- ?palco=1: só o escritório, sem barra nem painel (para embutir no site) ---------- */
body.palco { padding: 0; margin: 0; background: #1b1622; overflow: hidden; }
body.palco .bar, body.palco .panel { display: none; }
body.palco .layout { display: block; }
body.palco .stage { border-radius: 0; box-shadow: none; }
