:root {
  --bg: #1a1d21;
  --panel: #22262b;
  --cyan: #7aa2c4;
  --cyan-dim: rgba(122, 162, 196, 0.22);
  --red: #d16b6b;
  --red-dim: rgba(209, 107, 107, 0.22);
  --amber: #c4a35a;
  --text: #e6e8eb;
  --muted: #8b939c;
  --line: #2e343c;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  overflow: hidden;
}
body {
  display: flex;
  flex-direction: column;
}

#crit-flash {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(209, 107, 107, 0.08);
  opacity: 0;
  transition: opacity 220ms ease;
}
#crit-flash.on { opacity: 1; }

.topbar {
  height: 64px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: #1e2227;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.brand-mark {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 8px;
  display: block;
}
.brand-text { min-width: 0; }
.brand h1 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  white-space: nowrap;
}
.brand .sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
}

.status-cluster { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.pill {
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted);
}
.pill.live { color: #9db89a; border-color: #3a4a3a; }
.pill.live .dot { background: #7d9e78; }
.pill.down { color: var(--red); border-color: var(--red-dim); }
.pill.down .dot { background: var(--red); }
.pill.dim { color: var(--amber); }
.pill.toggle {
  cursor: pointer;
  font-family: inherit;
  background: var(--bg);
}
.pill.toggle.on {
  color: #9db89a;
  border-color: #3a4a3a;
}
.clock {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text);
  min-width: 88px;
  text-align: right;
}

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 360px;
  grid-template-rows: minmax(0, 1fr);
}

.map-wrap {
  position: relative;
  min-height: 0;
  min-width: 0;
  border-right: 1px solid var(--line);
}
#map { height: 100%; width: 100%; background: #2a2e33; }
.leaflet-container { background: #2a2e33; font-family: var(--sans); }
.leaflet-control-attribution {
  background: rgba(30, 34, 39, 0.85) !important;
  color: var(--muted) !important;
  font-size: 10px !important;
}

.map-hud {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 500;
  display: flex;
  gap: 8px;
  pointer-events: none;
}
.hud-item {
  background: rgba(30, 34, 39, 0.9);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 7px 10px;
  min-width: 86px;
}
.hud-item .k { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.hud-item span:last-child { color: var(--text); font-size: 13px; font-family: var(--mono); }

.leaflet-tooltip.map-tooltip {
  background: #1e2227;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 12px;
  padding: 6px 8px;
  box-shadow: none;
}
.leaflet-tooltip.map-tooltip::before {
  border-top-color: #1e2227;
}

.feed-wrap {
  background: var(--panel);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.feed-head {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.feed-head h2 { font-size: 13px; font-weight: 600; color: var(--text); }
.live-tag { font-size: 11px; color: var(--muted); }

.feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 8px;
}
.feed::-webkit-scrollbar { width: 8px; }
.feed::-webkit-scrollbar-thumb { background: #3a4149; border-radius: 4px; }

.row {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  font-size: 12.5px;
  line-height: 1.45;
}
.row.ban { background: rgba(209, 107, 107, 0.08); }
.row.ignored { opacity: 0.75; }
.row .meta { color: var(--muted); }
.row .ip { font-family: var(--mono); color: var(--text); font-weight: 500; }
.row .tag {
  display: inline-block;
  margin-top: 5px;
  padding: 1px 7px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 3px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.row .tag.ban { color: var(--red); border-color: var(--red-dim); }
.row .tag.ign { color: var(--cyan); }

.statsbar {
  height: 64px;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--line);
  background: #1e2227;
}
.stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 16px;
  border-right: 1px solid var(--line);
}
.stat:last-child { border-right: none; }
.stat .n { font-family: var(--mono); font-size: 20px; color: var(--text); font-weight: 500; }
.stat .l { font-size: 11px; color: var(--muted); margin-top: 2px; }
.stat.alert .n { color: var(--red); }

.leaflet-div-icon.radar-icon,
.leaflet-div-icon.hq-icon {
  background: none;
  border: none;
  overflow: visible;
}

.radar {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #8fb0c9;
  box-shadow: 0 0 0 1px rgba(143, 176, 201, 0.45);
  position: relative;
}
.radar::after {
  content: "";
  position: absolute;
  inset: -8px;
  border: 1.5px solid rgba(143, 176, 201, 0.7);
  border-radius: 50%;
  animation: ping 1.8s ease-out infinite;
}
.radar.ban {
  background: var(--red);
  box-shadow: 0 0 0 1px rgba(209, 107, 107, 0.5);
}
.radar.ban::after { border-color: rgba(209, 107, 107, 0.75); }

.leaflet-div-icon.shot-icon {
  background: none;
  border: none;
  overflow: visible;
}
.radar.shot {
  width: 4px;
  height: 4px;
  box-shadow: 0 0 4px 1px rgba(143, 176, 201, 0.45);
}
.radar.shot.ban {
  box-shadow: 0 0 4px 1px rgba(209, 107, 107, 0.55);
}
.radar.shot::after { display: none; }

.hq-mark {
  width: 8px;
  height: 8px;
  background: var(--amber);
  border-radius: 1px;
  transform: rotate(45deg);
  transform-origin: center center;
}

@keyframes ping {
  0% { transform: scale(0.4); opacity: 0.7; }
  100% { transform: scale(1.55); opacity: 0; }
}

@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: minmax(0, 55%) minmax(0, 45%); }
  .map-wrap { border-right: none; border-bottom: 1px solid var(--line); }
}

@media (max-width: 720px) {
  .topbar {
    height: 52px;
    padding: 0 10px;
    gap: 8px;
  }
  .brand-mark { width: 28px; height: 28px; border-radius: 6px; }
  .brand h1 { font-size: 15px; }
  .brand .sub,
  .pill-text,
  .pill-mode { display: none; }
  .clock {
    min-width: 0;
    font-size: 12px;
  }
  .status-cluster { gap: 6px; }
  .conn-pill {
    padding: 6px;
    min-width: 28px;
    justify-content: center;
  }
  .conn-pill .dot { width: 8px; height: 8px; }
  .pill.toggle { padding: 5px 8px; font-size: 11px; }
  .statsbar { height: auto; min-height: 52px; }
  .stat { padding: 6px 8px; }
  .stat .n { font-size: 16px; }
}
