:root {
  --bg: #0b1020;
  --panel: rgba(14, 20, 38, 0.82);
  --line: rgba(255, 255, 255, 0.12);
  --text: #eef2ff;
  --muted: #9aa4c2;
  --up: #34d399;
  --down: #f87171;
  --gold: #fbbf24;
  --blue: #60a5fa;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden; }
#scene { position: fixed; inset: 0; }
.muted { color: var(--muted); font-size: 12px; }
.up { color: var(--up); }
.down { color: var(--down); }

#hud { position: fixed; top: 12px; left: 12px; right: 12px; max-width: 560px; padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(8px); }
.hud-title { font-weight: 700; font-size: 16px; margin-bottom: 8px; }
.tag { font-size: 11px; font-weight: 600; color: var(--gold); border: 1px solid var(--gold);
  border-radius: 999px; padding: 1px 8px; margin-left: 6px; vertical-align: middle; }
.hud-row { display: flex; gap: 18px; margin-bottom: 6px; }
.kpi { display: flex; flex-direction: column; }
.kpi-label { font-size: 11px; color: var(--muted); }
.kpi-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-value.small { font-size: 15px; padding-top: 5px; }

#ranking { position: fixed; right: 12px; top: 12px; width: 250px; padding: 10px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(8px); }
#ranking h3 { margin: 0 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.rank-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0;
  border-top: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.rank-row:first-of-type { border-top: 0; }
.rank-name { display: flex; align-items: center; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.rank-val { font-variant-numeric: tabular-nums; font-weight: 600; }

.label { padding: 3px 9px; border-radius: 999px; background: rgba(10, 14, 28, 0.85); border: 1px solid var(--line);
  font-size: 12px; font-weight: 600; white-space: nowrap; pointer-events: none; font-variant-numeric: tabular-nums; }
.label .val { margin-left: 6px; }

#ficha { position: fixed; left: 12px; bottom: 12px; width: min(380px, calc(100vw - 24px)); max-height: 60vh;
  overflow: auto; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; backdrop-filter: blur(8px); }
#ficha.hidden { display: none; }
#ficha-close { position: absolute; top: 6px; right: 10px; background: none; border: 0; color: var(--muted);
  font-size: 22px; cursor: pointer; }
#ficha h2 { margin: 0 0 2px; font-size: 18px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.cell { background: rgba(255,255,255,0.04); border-radius: 10px; padding: 8px; }
.cell b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.cell span { font-size: 11px; color: var(--muted); }
.gates { list-style: none; padding: 0; margin: 8px 0; font-size: 13px; }
.gates li { padding: 3px 0; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
td { padding: 4px 0; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
td:last-child { text-align: right; }

@media (max-width: 720px) {
  #ranking { top: auto; bottom: 12px; right: 12px; left: 12px; width: auto; max-height: 34vh; overflow: auto; }
  #ficha { bottom: 12px; max-height: 70vh; z-index: 5; }
  .kpi-value { font-size: 19px; }
  .hud-row { gap: 14px; }
}
.label-hermes { border-color: #d4a548; color: #fde68a; }
.review { white-space: pre-wrap; font-size: 13px; line-height: 1.45; margin-top: 6px; padding: 10px;
  background: rgba(255,255,255,0.04); border-radius: 10px; }
@media (max-width: 720px) {
  .label { font-size: 10px; padding: 2px 6px; }
}

#camwrap { position: fixed; right: 12px; bottom: 12px; display: flex; flex-direction: column;
  align-items: flex-end; gap: 6px; max-width: min(62vw, 720px); }
#live { font-size: 11px; font-weight: 800; letter-spacing: .06em; color: #fecaca; background: rgba(127, 29, 29, .75);
  border-radius: 999px; padding: 3px 10px; animation: blink 2s infinite; }
@keyframes blink { 50% { opacity: .65; } }
#cams { display: flex; gap: 6px; overflow-x: auto; padding: 6px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; backdrop-filter: blur(8px); scrollbar-width: none; }
#cams button { flex: none; background: rgba(255,255,255,.05); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px 10px; font: 600 12px system-ui; cursor: pointer; white-space: nowrap; }
#cams button.on { background: var(--gold); color: #111827; border-color: var(--gold); }
.label-real { border-color: #d4a548; color: #fde68a; }
.label-dog { font-size: 11px; color: #fed7aa; border-color: #9a3412; }
.bubble { max-width: 190px; white-space: normal; text-align: center; padding: 6px 10px; border-radius: 12px;
  background: #fffbeb; color: #1f2937; font-size: 12px; font-weight: 600; box-shadow: 0 4px 14px rgba(0,0,0,.35);
  pointer-events: none; position: relative; }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: #fffbeb; border-bottom: 0; }
.bubble.hidden { display: none; }
#ficha { z-index: 6; }
@media (max-width: 720px) {
  #camwrap { left: 12px; right: 12px; bottom: 12px; max-width: none; align-items: flex-start; }
  #cams { width: 100%; }
  #ranking { bottom: 92px; max-height: 24vh; }
  .kpi.alvo { display: none; }
  .kpi-label, .kpi-value.small { white-space: nowrap; }
  .bubble { font-size: 10px; max-width: 140px; padding: 4px 7px; }
}
#hint { font-size: 11px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 10px; transition: opacity .6s; }
#hint.gone { opacity: 0; pointer-events: none; }
