/* Radar da Plateia — sala de controle */
:root {
  --bg: #070c12;
  --panel: #0c141e;
  --panel2: #101b28;
  --line: rgba(120, 190, 255, .13);
  --txt: #d9e7f3;
  --dim: #7e96ab;
  --cyan: #3ee0ff;
  --ok: #34e08c;
  --warn: #ffc23e;
  --alert: #ff4d5e;
  --ghost: #ff9a3e;
  --font-d: "Chakra Petch", "Segoe UI", sans-serif;
  --font-m: "IBM Plex Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1200px 500px at 70% -10%, rgba(62, 224, 255, .07), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(120, 190, 255, .035) 39px 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(120, 190, 255, .035) 39px 40px),
    var(--bg);
  color: var(--txt);
  font-family: var(--font-d);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- topo ---------- */
.topo {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(12, 20, 30, .9), rgba(12, 20, 30, .6));
}
.marca { display: flex; gap: 14px; align-items: center; }
h1 { margin: 0; font-size: 19px; letter-spacing: .22em; font-weight: 700; color: #fff; }
.tag { margin: 2px 0 0; font-size: 11px; color: var(--dim); letter-spacing: .04em; }

.radar-logo {
  width: 40px; height: 40px; border-radius: 50%; position: relative; flex: none;
  border: 2px solid rgba(62, 224, 255, .55);
  background:
    radial-gradient(circle at center, rgba(62, 224, 255, .16) 0 2px, transparent 3px),
    repeating-radial-gradient(circle at center, transparent 0 8px, rgba(62, 224, 255, .18) 8px 9px);
  overflow: hidden;
}
.radar-logo .sweep {
  position: absolute; inset: 0;
  background: conic-gradient(from 0deg, rgba(62, 224, 255, .75), transparent 70deg, transparent 360deg);
  animation: girar 3.2s linear infinite;
}
.radar-logo.grande { width: 84px; height: 84px; margin: 0 auto 14px; }
@keyframes girar { to { transform: rotate(360deg); } }

.pills { display: flex; gap: 8px; }
.pill {
  font-family: var(--font-m); font-size: 11px; letter-spacing: .12em;
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px;
  color: var(--dim); display: inline-flex; align-items: center; gap: 7px;
  background: rgba(7, 12, 18, .6);
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.off { background: #45596c; }
.dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.carregando { background: var(--warn); box-shadow: 0 0 8px var(--warn); animation: pulsar 1s infinite; }
.dot.erro { background: var(--alert); box-shadow: 0 0 8px var(--alert); }
@keyframes pulsar { 50% { opacity: .35; } }

/* ---------- grade ---------- */
.grade {
  display: grid; grid-template-columns: 1fr 372px; gap: 16px;
  padding: 16px 22px; flex: 1; align-items: start;
}
@media (max-width: 980px) { .grade { grid-template-columns: 1fr; } }

.painel {
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
}
.painel h2 {
  margin: 0 0 10px; font-size: 11px; letter-spacing: .24em; font-weight: 600;
  color: var(--cyan); text-transform: uppercase;
  display: flex; justify-content: space-between; align-items: center;
}

/* ---------- feed ---------- */
.feed-painel { padding: 14px; position: sticky; top: 14px; }
.contadores { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.contador {
  flex: 1; min-width: 130px; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 14px; background: rgba(7, 12, 18, .5);
}
.contador .num { font-family: var(--font-m); font-size: 34px; font-weight: 600; line-height: 1; }
.contador .rot { font-size: 10px; letter-spacing: .2em; color: var(--dim); margin-top: 5px; text-transform: uppercase; }
.contador.ok .num { color: var(--ok); }
.contador.alerta .num { color: var(--alert); }
.contador.neutro .num { color: var(--cyan); }

.feed-wrap {
  position: relative; border-radius: 10px; overflow: hidden;
  background: #05080d; min-height: 380px;
  display: flex; align-items: center; justify-content: center;
}
.feed-wrap::after { /* scanlines */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(0, 0, 0, .12) 3px 4px);
}
.feed-wrap.alerta-flash { animation: flash-alerta .9s ease-out; }
@keyframes flash-alerta {
  0% { box-shadow: inset 0 0 0 6px var(--alert); }
  100% { box-shadow: inset 0 0 0 0 transparent; }
}
video, #overlay { display: block; width: 100%; height: auto; }
#overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.espelhado video, .espelhado #overlay { transform: scaleX(-1); }
video[hidden] { display: none; }

.canto { position: absolute; width: 26px; height: 26px; border: 2px solid rgba(62, 224, 255, .6); pointer-events: none; }
.c1 { top: 8px; left: 8px; border-right: none; border-bottom: none; }
.c2 { top: 8px; right: 8px; border-left: none; border-bottom: none; }
.c3 { bottom: 8px; left: 8px; border-right: none; border-top: none; }
.c4 { bottom: 8px; right: 8px; border-left: none; border-top: none; }

.feed-vazio { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; background: rgba(5, 8, 13, .92); z-index: 3; }
.feed-vazio p { color: var(--dim); max-width: 420px; line-height: 1.5; font-size: 14px; }
.feed-vazio strong { color: var(--txt); }

.btn-principal {
  font-family: var(--font-d); font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  background: var(--cyan); color: #04222b; border: none; border-radius: 8px;
  padding: 13px 30px; font-size: 14px; cursor: pointer; margin-top: 10px;
  box-shadow: 0 0 24px rgba(62, 224, 255, .35);
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn-principal:hover { transform: translateY(-1px); box-shadow: 0 0 34px rgba(62, 224, 255, .5); }
.btn-principal:disabled { opacity: .5; cursor: wait; }

.btn-tela-cheia {
  position: absolute; right: 12px; bottom: 12px; z-index: 4;
  background: rgba(7, 12, 18, .75); border: 1px solid var(--line); color: var(--txt);
  border-radius: 6px; width: 38px; height: 38px; font-size: 17px; cursor: pointer;
}

/* ---------- modos ---------- */
.modos { display: flex; flex-direction: column; gap: 8px; }
.modo {
  display: grid; grid-template-columns: 40px 1fr; gap: 4px 12px; align-items: center;
  text-align: left; cursor: pointer; width: 100%;
  background: rgba(7, 12, 18, .45); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; color: var(--txt); font-family: var(--font-d);
  transition: border-color .15s ease, background .15s ease;
}
.modo:hover { border-color: rgba(62, 224, 255, .4); }
.modo.ativo { border-color: var(--cyan); background: rgba(62, 224, 255, .08); box-shadow: 0 0 18px rgba(62, 224, 255, .12) inset; }
.modo .icone {
  grid-row: span 2; width: 40px; height: 40px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-m); font-size: 19px; color: var(--cyan);
  border: 1px solid var(--line); background: rgba(62, 224, 255, .06);
}
.modo .nome { font-weight: 600; font-size: 14px; letter-spacing: .05em; }
.modo .desc { font-size: 11.5px; color: var(--dim); line-height: 1.35; }
.modo.ativo .nome::after { content: " ●"; color: var(--cyan); font-size: 10px; vertical-align: 2px; }

/* ---------- campos ---------- */
.campo { margin-bottom: 14px; }
.campo:last-child { margin-bottom: 2px; }
.campo label { display: block; font-size: 12px; color: var(--dim); letter-spacing: .06em; margin-bottom: 6px; }
.campo label .mono { color: var(--cyan); font-weight: 600; }
.campo.dupla { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.campo.linha-fim { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--txt) !important; cursor: pointer; }
.check small { color: var(--dim); }
.dica { display: block; color: var(--dim); font-size: 11px; margin-top: 5px; }

input[type="range"] { width: 100%; accent-color: var(--cyan); background: transparent; }
select {
  width: 100%; background: var(--panel); color: var(--txt);
  border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px;
  font-family: var(--font-d); font-size: 13px;
}

.segmentos { display: flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.segmentos button {
  flex: 1; background: transparent; border: none; color: var(--dim);
  font-family: var(--font-d); font-size: 12.5px; letter-spacing: .05em;
  padding: 9px 4px; cursor: pointer; border-right: 1px solid var(--line);
}
.segmentos button:last-child { border-right: none; }
.segmentos button.ativo { background: rgba(62, 224, 255, .14); color: var(--cyan); font-weight: 600; }

.btn-secundario {
  background: transparent; border: 1px solid var(--alert); color: var(--alert);
  border-radius: 6px; padding: 8px 18px; font-family: var(--font-d);
  font-size: 12px; letter-spacing: .1em; cursor: pointer; text-transform: uppercase;
}
.btn-limpar {
  background: none; border: none; color: var(--dim); font-family: var(--font-m);
  font-size: 10px; cursor: pointer; letter-spacing: .1em; text-transform: lowercase;
}
.btn-limpar:hover { color: var(--txt); }

/* ---------- stats / log ---------- */
#stats-corpo { font-size: 12.5px; }
.stat-linha { display: grid; grid-template-columns: 84px 1fr 52px; gap: 10px; align-items: center; margin-bottom: 8px; font-family: var(--font-m); font-size: 12px; }
.stat-linha .barra { height: 8px; border-radius: 4px; background: rgba(120, 190, 255, .12); overflow: hidden; }
.stat-linha .barra > i { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), var(--cyan)); }
.stat-linha.ruim .barra > i { background: linear-gradient(90deg, var(--alert), var(--warn)); }
.stat-grande { font-family: var(--font-m); font-size: 26px; color: var(--cyan); }
#spark { width: 100%; height: 64px; display: block; margin-top: 8px; }

.log { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow-y: auto; font-size: 12px; }
.log li { padding: 7px 2px; border-bottom: 1px dashed var(--line); line-height: 1.4; }
.log li .hora { font-family: var(--font-m); color: var(--cyan); margin-right: 8px; font-size: 11px; }
.log li.vazio { color: var(--dim); border: none; }

/* ---------- rodape ---------- */
.rodape {
  display: flex; justify-content: space-between; padding: 10px 22px;
  border-top: 1px solid var(--line); color: var(--dim); font-size: 11px;
}
.mono { font-family: var(--font-m); }
