:root {
  --bg: #0e1116;
  --panel: #151a21;
  --panel-2: #1c222b;
  --line: #262e39;
  --text: #e6e9ee;
  --muted: #8b95a5;
  --alert: #e5484d;
  --alert-fill: rgba(229, 72, 77, .42);
  --partial: #f5a524;
  --ok: #30a46c;
  --accent: #4c8dff;
  --drone: #ff8b3d;
  --jetdrone: #ff5d3d;
  --missile: #ff3b6b;
  --ballistic: #d94dff;
  --kab: #ffd23d;
  --aviation: #5fb4ff;
  --explosion: #ffffff;
  --top-h: 52px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { display: flex; flex-direction: column; overflow: hidden; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.top {
  height: var(--top-h); flex: none; display: flex; align-items: center; gap: 16px;
  padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); z-index: 1000;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 17px; margin: 0; font-weight: 650; letter-spacing: .2px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.dot.live { background: var(--ok); box-shadow: 0 0 0 0 rgba(48,164,108,.6); animation: live 2s infinite; }
.dot.stale { background: var(--partial); }
@keyframes live { 70% { box-shadow: 0 0 0 8px rgba(48,164,108,0); } 100% { box-shadow: 0 0 0 0 rgba(48,164,108,0); } }
.stats { display: flex; gap: 18px; margin-left: auto; font-size: 14px; font-variant-numeric: tabular-nums; }
.stat b { font-size: 16px; }
#alertCount { color: var(--alert); }
.icon-btn { background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px; height: 34px; width: 38px; display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--panel-2); }
.icon-btn.on { color: var(--kab); border-color: var(--kab); }

.layout { flex: 1; display: flex; min-height: 0; position: relative; }
#map { flex: 1; background: #0b0d11; }
.panel { width: 360px; flex: none; background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.panel-handle { display: none; }
.tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.tab { flex: 1; background: none; border: 0; color: var(--muted); padding: 12px 0; font: inherit; font-size: 14px; cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-body { display: none; overflow-y: auto; flex: 1; min-height: 0; }
.tab-body.active { display: block; }

.alert-list, .feed, .sources { list-style: none; margin: 0; padding: 0; }
.alert-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.alert-list li:hover { background: var(--panel-2); }
.alert-list .name { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.alert-list .name::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--alert); flex: none; }
.alert-list li.partial .name::before { background: var(--partial); }
.alert-list li.calm .name::before { background: var(--line); }
.alert-list li.calm { color: var(--muted); }
.alert-list .dur { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.alert-list .sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.alert-list .group { padding: 8px 16px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); background: var(--bg); cursor: default; }

.feed li { padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 14px; line-height: 1.4; }
.feed li.clear { color: var(--ok); }
.feed li.noise { color: var(--muted); font-size: 13px; }
.feed .meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.feed .meta a { color: var(--muted); }
.feed .tag { font-size: 11px; padding: 1px 6px; border-radius: 4px; color: #111; font-weight: 600; }
.feed li[data-located="1"] { cursor: pointer; }
.feed li[data-located="1"]:hover { background: var(--panel-2); }
.feed .txt { white-space: pre-wrap; word-break: break-word; }

.about { padding: 4px 16px 16px; font-size: 14px; line-height: 1.5; }
.about h3 { font-size: 14px; margin: 16px 0 6px; }
.about .warn { border-left: 3px solid var(--partial); padding: 6px 10px; background: rgba(245,165,36,.08); }
.sources li { padding: 3px 0; }
.sources a { color: var(--accent); }

.notices { position: absolute; top: calc(var(--top-h) + 10px); left: 50%; transform: translateX(-50%); z-index: 900; display: flex; flex-direction: column; gap: 6px; max-width: min(560px, calc(100% - 32px)); pointer-events: none; }
.notice { background: rgba(21,26,33,.95); border: 1px solid var(--line); border-left: 4px solid var(--aviation); padding: 8px 12px; border-radius: 8px; font-size: 14px; pointer-events: auto; box-shadow: 0 4px 20px rgba(0,0,0,.4); }
.notice.ballistic { border-left-color: var(--ballistic); }
.notice.missile { border-left-color: var(--missile); }
.notice .when { color: var(--muted); font-size: 12px; margin-left: 6px; }

.legend { position: absolute; left: 12px; bottom: 22px; z-index: 900; background: rgba(21,26,33,.92); border: 1px solid var(--line); border-radius: 10px; padding: 6px; display: flex; flex-wrap: wrap; gap: 4px; max-width: calc(100% - 400px); }
.legend button { display: flex; align-items: center; gap: 6px; background: none; border: 1px solid transparent; color: var(--text); font: inherit; font-size: 13px; padding: 4px 8px; border-radius: 6px; cursor: pointer; }
.legend button:hover { border-color: var(--line); }
.legend button.off { opacity: .35; }
.legend svg { width: 18px; height: 18px; }
.legend .n { color: var(--muted); font-variant-numeric: tabular-nums; }

/* map */
.city { position: relative; }
.city i { position: absolute; left: -2.5px; top: -2.5px; width: 5px; height: 5px; border-radius: 50%; background: #c9d1dc; }
.city span { position: absolute; left: 6px; top: -8px; white-space: nowrap; font-size: 11px; color: #c9d1dc; text-shadow: 0 0 3px #000, 0 0 2px #000, 0 0 1px #000; }
.city.big span { font-size: 13px; font-weight: 600; color: #e6e9ee; top: -9px; }
.leaflet-control-layers { background: var(--panel) !important; color: var(--text); border: 1px solid var(--line) !important; }
.leaflet-control-layers-toggle { filter: invert(1) brightness(.85); }
.leaflet-container { background: #0b0d11; font: inherit; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); border: 1px solid var(--line); }
.leaflet-popup-content { margin: 12px 14px; font-size: 14px; line-height: 1.45; }
.leaflet-popup-content a { color: var(--accent); }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-tooltip.obl-tip { background: var(--panel); color: var(--text); border: 1px solid var(--line); box-shadow: none; font-size: 13px; }
.leaflet-tooltip.obl-tip::before { display: none; }
.leaflet-control-attribution { font-size: 10px; background: rgba(14,17,22,.7) !important; color: var(--muted) !important; }
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-bar a { background: var(--panel); color: var(--text); border-color: var(--line); }
.leaflet-bar a:hover { background: var(--panel-2); color: var(--text); }

.tgt { position: relative; }
.tgt .ico { position: absolute; inset: 0; display: grid; place-items: center; filter: drop-shadow(0 0 3px rgba(0,0,0,.9)); }
.tgt .ico svg { width: 100%; height: 100%; }
.tgt .ring { position: absolute; inset: -7px; border-radius: 50%; border: 1.5px dashed currentColor; opacity: .55; }
.tgt.fresh .pulse { position: absolute; inset: -4px; border-radius: 50%; border: 2px solid currentColor; animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { from { transform: scale(.6); opacity: .9; } to { transform: scale(2.1); opacity: 0; } }
.tgt .cnt { position: absolute; right: -10px; top: -9px; background: #111; color: #fff; border: 1px solid currentColor; font-size: 11px; font-weight: 700; padding: 0 4px; border-radius: 8px; line-height: 15px; }
.pop-type { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 15px; margin-bottom: 4px; }
.pop-type svg { width: 20px; height: 20px; }
.pop-row { color: var(--muted); font-size: 13px; }
.pop-text { margin: 8px 0; padding: 6px 8px; background: var(--panel-2); border-radius: 6px; white-space: pre-wrap; }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; width: min(420px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.55); }
dialog h3 { margin: 0 0 6px; }
dialog label { display: block; margin: 12px 0; font-size: 14px; }
dialog label.row { display: flex; gap: 8px; align-items: center; }
dialog select { display: block; width: 100%; margin-top: 6px; padding: 8px; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; font: inherit; }
dialog menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 16px 0 0; }
dialog button { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; font: inherit; cursor: pointer; }
dialog button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }

@media (max-width: 760px) {
  .top { gap: 10px; padding: 0 12px; }
  .brand h1 { font-size: 15px; }
  .stats { gap: 10px; font-size: 13px; }
  #clock { display: none; }
  .panel {
    position: absolute; left: 0; right: 0; bottom: 0; width: auto; height: 46%; z-index: 950;
    border-left: 0; border-top: 1px solid var(--line); border-radius: 14px 14px 0 0;
    transform: translateY(calc(100% - 92px)); transition: transform .25s ease;
  }
  .panel.open { transform: none; }
  .panel-handle { display: block; background: none; border: 0; height: 18px; cursor: pointer; flex: none; padding: 0; }
  .panel-handle span { display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 7px auto; }
  .leaflet-bottom { bottom: 92px; }
  .legend { bottom: 116px; left: 8px; right: 8px; max-width: none; }
  .legend button { font-size: 12px; padding: 3px 6px; }
}
