:root {
  --bg: #070b12;
  --panel: rgba(14, 20, 32, 0.72);
  --line: #1c2839;
  --text: #c9d6e5;
  --dim: #6b7d93;
  --accent: #35e0c9;
  --red: #ff4d5e;
  --amber: #ffb454;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background:
    radial-gradient(1200px 600px at 20% -10%, #0d2233 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 10%, #1a0f1e 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, "SF Mono", "Helvetica Neue", "PingFang SC", monospace;
  overflow: hidden;
}

#app { display: flex; flex-direction: column; height: 100%; }

header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 11, 18, .6);
  backdrop-filter: blur(8px);
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  font-size: 26px; color: var(--accent);
  text-shadow: 0 0 16px rgba(53, 224, 201, .55);
}
h1 { font-size: 16px; margin: 0; letter-spacing: .16em; font-weight: 600; }
.sub { margin: 2px 0 0; font-size: 11px; color: var(--dim); letter-spacing: .04em; }

.live {
  font-size: 11px; color: var(--red); letter-spacing: .12em;
  border: 1px solid rgba(255, 77, 94, .35);
  padding: 3px 8px; border-radius: 999px;
  animation: blink 2.2s infinite;
}
.live.off { color: var(--dim); border-color: var(--line); animation: none; }
@keyframes blink { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

.stats { display: flex; gap: 20px; flex-wrap: wrap; }
.stat { text-align: right; }
.stat b { display: block; font-size: 19px; color: #e8f1fb; font-variant-numeric: tabular-nums; }
.stat b.warn { color: var(--amber); }
.stat span { font-size: 10.5px; color: var(--dim); letter-spacing: .08em; }

main {
  flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 320px;
  gap: 0; min-height: 0;
}

.map-wrap { position: relative; min-width: 0; overflow: hidden; }
canvas#map { width: 100%; height: 100%; display: block; }

.map-legend {
  position: absolute; left: 14px; bottom: 62px; display: flex; gap: 16px;
  align-items: center; font-size: 11px; color: var(--dim);
  background: rgba(7,11,18,.55); padding: 5px 10px; border-radius: 8px;
  border: 1px solid var(--line);
}
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.dot.red { background: var(--red); box-shadow: 0 0 8px var(--red); }
.dot.green { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.muted { color: var(--dim); }

.spark {
  position: absolute; left: 0; right: 0; bottom: 0; height: 46px;
  border-top: 1px solid var(--line);
  background: rgba(7,11,18,.55);
}
canvas#spark { width: 100%; height: 46px; display: block; }

.tip {
  position: absolute; pointer-events: none; opacity: 0;
  transform: translate(-50%, -130%);
  background: rgba(6, 10, 16, .92); border: 1px solid var(--line);
  padding: 5px 9px; border-radius: 7px; font-size: 11.5px; white-space: nowrap;
  transition: opacity .12s; z-index: 5;
}
.tip.on { opacity: 1; }

aside {
  border-left: 1px solid var(--line);
  overflow-y: auto; padding: 10px;
  display: flex; flex-direction: column; gap: 10px;
  background: rgba(9, 13, 21, .5);
}
aside::-webkit-scrollbar { width: 6px; }
aside::-webkit-scrollbar-thumb { background: #223046; border-radius: 3px; }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 10px;
}
.panel h2 {
  margin: 0 0 7px; font-size: 10.5px; letter-spacing: .16em;
  color: var(--dim); font-weight: 500; text-transform: uppercase;
}

.feed { list-style: none; margin: 0; padding: 0; max-height: 210px; overflow-y: auto; }
.feed li {
  display: flex; gap: 8px; align-items: baseline;
  padding: 3px 0; border-bottom: 1px dashed rgba(28, 40, 57, .55);
  font-size: 11.5px; animation: slide .35s ease-out;
}
@keyframes slide { from { opacity: 0; transform: translateX(6px) } to { opacity: 1; transform: none } }
.feed .t { color: var(--dim); font-variant-numeric: tabular-nums; }
.feed .ip { color: #9fd4ff; }
.feed .geo { color: var(--dim); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .k { font-size: 10px; padding: 0 5px; border-radius: 4px; }
.k.failed { color: var(--red); border: 1px solid rgba(255,77,94,.35); }
.k.invalid { color: var(--amber); border: 1px solid rgba(255,180,84,.3); }
.k.maxauth { color: #fff; background: rgba(255,77,94,.3); }
.k.closed, .k.probe { color: var(--dim); border: 1px solid var(--line); }

.bars { list-style: none; margin: 0; padding: 0; }
.bars li { position: relative; display: flex; justify-content: space-between;
  padding: 3px 6px; font-size: 12px; margin-bottom: 2px; border-radius: 5px; overflow: hidden; }
.bars li .fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, rgba(53, 224, 201, .28), rgba(53, 224, 201, .04));
  z-index: 0;
}
.bars li span { position: relative; z-index: 1; }
.bars li b { position: relative; z-index: 1; color: #eaf5ff; font-variant-numeric: tabular-nums; }
.bars.small li { font-size: 11.5px; }

footer {
  display: flex; gap: 22px; align-items: center; justify-content: space-between;
  padding: 6px 18px; border-top: 1px solid var(--line);
  font-size: 11px; color: var(--dim);
  background: rgba(7, 11, 18, .6);
}
footer b { color: var(--text); }

@media (max-width: 860px) {
  main { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  aside { border-left: none; border-top: 1px solid var(--line);
          max-height: 42vh; display: grid; grid-template-columns: 1fr 1fr; }
  .stats { gap: 12px; }
  .stat b { font-size: 16px; }
}
