:root {
  --bg: #161616;
  --surface: #1c1c1c;
  --surface-2: #242424;
  --line: #2e2e2e;
  --text: #e8e8e8;
  --muted: #8a8a8a;
  --region: #262626;
  --region-line: #3c3c3c;
  --alert: #8e2c33;      /* ракетная тревога — приглушённый бордовый */
  --uav: #7a6a22;        /* дроновая тревога — приглушённый оливковый */
  --ok: #3fb950;
  --arrow: #f5c451;
  --top-h: 48px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden; }

/* ── Верхняя строка ── */
.top { position: fixed; inset: 0 0 auto 0; height: var(--top-h); z-index: 1000;
  display: flex; align-items: center; justify-content: space-between; padding: 0 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line); }
.title { font-weight: 650; letter-spacing: .2px; }
.status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status.live .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.status.lost .dot { background: var(--uav); }

.banner { position: fixed; top: calc(var(--top-h) + 8px); left: 50%; transform: translateX(-50%);
  z-index: 1000; max-width: calc(100% - 32px); padding: 8px 14px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; text-align: center; }
.banner.warn { border-color: var(--uav); }
.banner.stop { border-color: var(--alert); }

/* ── Карта ── */
#map { position: fixed; inset: var(--top-h) 0 0 0; background: var(--bg); }
.leaflet-container { background: var(--bg); font: inherit; }
.leaflet-control-attribution { background: color-mix(in srgb, var(--bg) 70%, transparent) !important;
  color: var(--muted) !important; font-size: 10px; }
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-tooltip { background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
  box-shadow: none; font-size: 13px; }
.leaflet-tooltip::before { display: none; }

.tgt { background: none; border: none; }   /* позиционирует Leaflet (absolute) — не переопределять */
.tgt-svg { display: block; overflow: visible; filter: drop-shadow(0 0 2px rgb(0 0 0 / .8)); transition: transform .3s; }
/* плавное движение метки между шагами; во время масштабирования — без анимации */
.leaflet-marker-icon.tgt { transition: transform 1s linear; }
.no-anim .leaflet-marker-icon.tgt, .leaflet-zoom-anim .leaflet-marker-icon.tgt { transition: none; }
.tgt.only-heading .tgt-svg { opacity: .55; }
.tgt-n { position: absolute; left: 18px; top: -6px; font: 700 10px/1 system-ui, sans-serif; color: #fff;
  text-shadow: 0 0 3px #000, 0 0 3px #000; white-space: nowrap; }

/* Подписи областей */
.obl-label { background: none; border: none; text-align: center; color: rgb(255 255 255 / .38);
  font: 600 9px/1.15 system-ui, sans-serif; letter-spacing: .4px; pointer-events: none; }

.zoomed-in .obl-label { display: none; }

/* Подписи городов */
.city-label { background: none; border: none; }
.city-label i { position: absolute; left: -2px; top: -2px; width: 4px; height: 4px; border-radius: 50%;
  background: rgb(255 255 255 / .55); }
.city-label span { position: absolute; left: 5px; top: -7px; white-space: nowrap;
  font: 600 10px/1 system-ui, sans-serif; letter-spacing: .3px; text-transform: uppercase;
  color: rgb(255 255 255 / .6); text-shadow: 0 0 3px rgb(0 0 0 / .9); pointer-events: none; }
.city-label.r1 span { font-size: 11px; color: rgb(255 255 255 / .75); }
.city-label.r3 i { display: none; }
.city-label.r3 span { left: 0; transform: translateX(-50%); font-size: 9px; color: rgb(255 255 255 / .45); }

/* Строка-счётчик целей сверху */
.counters { position: fixed; top: calc(var(--top-h) + 8px); left: 50%; transform: translateX(-50%);
  z-index: 1001; display: flex; gap: 14px; align-items: center; padding: 7px 14px;
  background: rgb(22 22 22 / .92); border: 1px solid var(--line); border-radius: 12px;
  max-width: calc(100% - 32px); overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.counters .cnt { display: inline-flex; align-items: center; gap: 5px; font: 600 11px/1 system-ui, sans-serif;
  text-transform: uppercase; letter-spacing: .3px; color: var(--muted); }
.counters .cnt b { color: var(--text); font-size: 12px; }
@media (min-width: 900px) { .counters { left: calc(50% - 182px); } }
.tgt-i { display: flex; align-items: center; justify-content: center; gap: 1px;
  min-width: 32px; height: 32px; padding: 0 6px; border-radius: 16px;
  background: var(--surface); border: 1.5px solid var(--arrow); font-size: 17px;
  box-shadow: 0 2px 8px rgb(0 0 0 / .5); white-space: nowrap; }
.tgt-i b { font-size: 11px; color: var(--arrow); }
.tgt.only-heading .tgt-i { border-style: dashed; opacity: .9; }
.arrowhead { background: none; border: none; color: var(--arrow); font-size: 16px; line-height: 16px; }
.arrowhead span { display: block; width: 16px; height: 16px; text-align: center; }

/* ── Панель: снизу на телефоне, справа на широком экране ── */
.panel { position: fixed; z-index: 1000; left: 0; right: 0; bottom: 0;
  max-height: 45vh; overflow-y: auto; overflow-x: hidden; padding: 4px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line); border-radius: 14px 14px 0 0;
  transition: max-height .2s ease; }
.panel.collapsed { max-height: 64px; overflow: hidden; }
.panel-handle { display: block; width: 44px; height: 18px; margin: 0 auto; border: 0; background: none; cursor: pointer; }
.panel-handle::after { content: ""; display: block; width: 36px; height: 4px; margin: 7px auto; border-radius: 2px; background: var(--line); }

@media (min-width: 900px) {
  .panel { left: auto; top: calc(var(--top-h) + 12px); right: 12px; bottom: 12px; width: 340px;
    max-height: none; border: 1px solid var(--line); border-radius: 14px; padding-top: 12px; }
  .panel.collapsed { max-height: none; overflow-y: auto; }
  .panel-handle { display: none; }
  #map { right: 364px; }
}

.summary { font-weight: 600; font-size: 16px; padding: 6px 0 10px; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted);
  margin: 10px 0 6px; font-weight: 600; }
.count { color: var(--text); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0;
  border-bottom: 1px solid var(--line); font-size: 14px; }
.list li:last-child { border-bottom: 0; }
.list .when { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.list .empty { color: var(--muted); }
.list .parts { color: var(--muted); font-size: 12px; }
.src { color: var(--muted); font-size: 11px; }
.kind-alert { color: #e5484d; }
.kind-uav { color: var(--uav); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); margin-top: 14px; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.sw-alert { background: var(--alert); }
.sw-uav { background: var(--uav); }
.sw-part { background: color-mix(in srgb, var(--alert) 25%, transparent); border: 1px dashed var(--alert); }
.sw-calm { background: var(--region); border: 1px solid var(--region-line); }

.disclaimer { font-size: 12px; color: var(--muted); margin: 12px 0 0; }
