:root {
  --water: #dde5e9;
  --land: #f2ede4;
  --land-out: #e8e3da;
  --border: #ffffff;
  --border-out: #d3cdc2;
  --district-line: #d9d1c4;
  --ink: #1d232b;
  --ink-2: #5b6570;
  --ink-3: #8a929b;
  --card: rgba(255, 253, 249, 0.94);
  --card-solid: #fffdf9;
  --line: #e6dfd3;
  --hover: #f6f1e8;
  --danger: #e4483f;
  --danger-d: #b8281f;
  --attention: #f4bf2a;
  --attention-d: #d9940a;
  --approach: #f9e3a0;
  --danger-soft: #f3b8b1;
  --clear: #2f9e6b;
  --clear-soft: #bfe3cd;
  --missile: #7a4bdf;
  --sea: #1f78c8;
  --fpv: #d4520e;
  --accent: #f4bf2a;
  --shadow: 0 1px 2px rgba(29, 35, 43, .06), 0 8px 24px rgba(29, 35, 43, .08);
  --radius: 14px;
  --panel-w: 384px;
  --font: "Onest", -apple-system, "Segoe UI", sans-serif;
  --font-display: "Unbounded", "Onest", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

:root[data-theme="dark"] {
  --water: #0e151c;
  --land: #1b252f;
  --land-out: #151d25;
  --border: #2c3946;
  --border-out: #222c36;
  --district-line: #26323d;
  --ink: #e9edf1;
  --ink-2: #a7b0b9;
  --ink-3: #75808b;
  --card: rgba(24, 32, 41, 0.94);
  --card-solid: #18202a;
  --line: #2a3541;
  --hover: #212b36;
  --danger: #f0544a;
  --danger-d: #b3261e;
  --attention: #f2bb2c;
  --attention-d: #c98a06;
  --approach: #6b5a24;
  --danger-soft: #6b2b27;
  --clear: #3fbf86;
  --clear-soft: #1e4a36;
  --missile: #a07dff;
  --sea: #4aa3f0;
  --fpv: #ff8a4c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.4 var(--font);
  color: var(--ink);
  background: var(--water);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
#map { position: fixed; inset: 0; }
button { font: inherit; color: inherit; cursor: pointer; }

.card {
  background: var(--card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- шапка ---------- */
.brand {
  position: fixed; top: 16px; left: 16px; z-index: 5;
  padding: 14px 16px 12px; min-width: 248px; max-width: 320px;
  animation: rise .5s ease-out both;
}
.brand__row { display: flex; align-items: center; gap: 10px; }
.brand h1 {
  margin: 0; font: 700 17px/1 var(--font-display); letter-spacing: -.01em;
}
.brand__meta { margin: 6px 0 12px 20px; color: var(--ink-2); font: 12px/1.3 var(--font-mono); }
.live {
  width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); flex: none;
  box-shadow: 0 0 0 0 currentColor;
}
.live.is-ok { background: var(--clear); color: rgba(47, 158, 107, .45); animation: beat 2.4s infinite; }
.live.is-warn { background: var(--attention-d); color: rgba(217, 148, 10, .45); animation: beat 2.4s infinite; }
.live.is-down { background: var(--danger); }
.stats { display: flex; gap: 6px; }
.stat {
  flex: 1; padding: 7px 9px 6px; border-radius: 10px; background: var(--hover);
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.stat b { font: 700 20px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--ink-2); white-space: nowrap; }
.stat--danger b { color: var(--danger); }
.stat--attention b { color: var(--attention-d); }

/* ---------- кнопки справа сверху ---------- */
.tools {
  position: fixed; top: 16px; right: calc(var(--panel-w) + 32px); z-index: 5;
  display: flex; gap: 2px; padding: 4px;
  animation: rise .5s .08s ease-out both;
}
.tools > button {
  width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent;
  display: grid; place-items: center;
}
.tools > button:hover, .tools > button[aria-expanded="true"] { background: var(--hover); }
.tools svg { width: 19px; height: 19px; fill: var(--ink); }
.layers {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 210px;
  background: var(--card-solid); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  padding: 6px;
}
.layers label {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.layers label:hover { background: var(--hover); }
.layers input { accent-color: var(--attention-d); width: 16px; height: 16px; margin: 0; }

/* ---------- лента ---------- */
.panel {
  position: fixed; top: 16px; right: 16px; bottom: 16px; z-index: 6; width: var(--panel-w);
  display: flex; flex-direction: column;
  background: var(--card); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  animation: slide .55s .12s cubic-bezier(.2, .8, .2, 1) both;
}
.panel__handle { display: none; }
.panel__head { padding: 12px 14px 10px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; margin-bottom: 10px; padding: 3px; background: var(--hover); border-radius: 11px; }
.tabs button {
  flex: 1; border: 0; background: transparent; border-radius: 8px; padding: 8px 10px;
  font: 700 13px/1 var(--font-display); color: var(--ink-2);
}
.tabs button[aria-selected="true"] { background: var(--card-solid); color: var(--ink); box-shadow: 0 1px 3px rgba(29, 35, 43, .1); }
.tabs small { font: 600 11.5px var(--font-mono); color: var(--ink-2); margin-left: 4px; }

/* ---------- «Сейчас» ---------- */
.now { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.now[hidden], .feed[hidden] { display: none; }
.row {
  display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center;
  padding: 10px 10px 10px 12px; border-radius: 10px; cursor: pointer;
}
.row + .row { margin-top: 2px; }
.row:hover { background: var(--hover); }
.row__sw { width: 12px; height: 12px; border-radius: 4px; background: var(--ink-3); }
.row--danger .row__sw { background: var(--danger); }
.row--attention .row__sw { background: var(--attention); }
.row--approach .row__sw { background: var(--approach); border: 1px solid var(--attention-d); }
.row--missile .row__sw { background: transparent; border: 2px dashed var(--missile); }
.row__main { min-width: 0; }
.row__main b { display: block; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__main span { font-size: 12px; color: var(--ink-2); }
.row--danger .row__lv { color: var(--danger); font-weight: 600; }
.row--attention .row__lv, .row--approach .row__lv { color: var(--attention-d); font-weight: 600; }
.row--missile .row__lv { color: var(--missile); font-weight: 600; }
.row--sea .row__sw { background: var(--sea); }
.row--sea .row__lv { color: var(--sea); font-weight: 600; }
.row--fpv .row__sw { background: var(--fpv); }
.row--fpv .row__lv { color: var(--fpv); font-weight: 600; }
.row__side { text-align: right; display: flex; flex-direction: column; gap: 2px; }
.row__dur { font: 600 12.5px var(--font-mono); }
.row__src { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.calm { padding: 36px 16px; text-align: center; color: var(--ink-2); }
.calm b { display: block; font: 700 15px var(--font-display); color: var(--clear); margin-bottom: 6px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--card-solid); border-radius: 999px;
  padding: 5px 11px 5px 9px; font-size: 12.5px; font-weight: 600;
  transition: background .15s, border-color .15s, opacity .15s;
}
.chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--clear); }
.chip i.is-err { background: var(--danger); }
.chip[aria-pressed="false"] { opacity: .45; }
.chip[aria-pressed="true"] { border-color: var(--ink-3); }

.feed { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.feed:empty::after {
  content: "За последние 6 часов событий нет"; display: block; padding: 32px 12px; text-align: center; color: var(--ink-3);
}
.ev { position: relative; padding: 10px 12px 10px 16px; border-radius: 10px; cursor: pointer; }
.ev.is-new { animation: fade .35s ease-out both; }
.ev.is-old:not(:hover):not(.is-open) { opacity: .6; }
.ev + .ev { margin-top: 2px; }
.ev:hover { background: var(--hover); }
.ev::before {
  content: ""; position: absolute; left: 5px; top: 12px; bottom: 12px; width: 3px; border-radius: 3px;
  background: var(--ink-3);
}
.ev--danger::before { background: var(--danger); }
.ev--attention::before { background: var(--attention); }
.ev--clear::before { background: var(--clear); }
.ev--missile::before, .ev--missile_clear::before { background: var(--missile); }
.ev--missile_clear::before { opacity: .45; }
.ev__n { margin-left: auto; align-self: center; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.ev--sea::before, .ev--sea_clear::before { background: var(--sea); }
.ev--sea_clear::before { opacity: .45; }
.ev--sea .ev__kind, .ev--sea_clear .ev__kind { color: var(--sea); }
.ev--fpv::before, .ev--fpv_clear::before { background: var(--fpv); }
.ev--fpv_clear::before { opacity: .45; }
.ev--fpv .ev__kind, .ev--fpv_clear .ev__kind { color: var(--fpv); }
.ev__top { display: flex; align-items: baseline; gap: 8px; font-size: 12px; color: var(--ink-2); }
.ev__time { font: 600 12px var(--font-mono); color: var(--ink); }
.ev__kind { font-weight: 600; }
.ev--danger .ev__kind { color: var(--danger); }
.ev--attention .ev__kind { color: var(--attention-d); }
.ev--clear .ev__kind { color: var(--clear); }
.ev--missile .ev__kind, .ev--missile_clear .ev__kind { color: var(--missile); }
.ev__ago { margin-left: auto; font-family: var(--font-mono); color: var(--ink-3); }
.ev__title { margin: 3px 0 6px; font-weight: 500; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.ev__drone {
  display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px;
  background: var(--ink); -webkit-mask: var(--drone-mask) center/contain no-repeat; mask: var(--drone-mask) center/contain no-repeat;
}
.ev__src { display: flex; gap: 4px; flex-wrap: wrap; }
.badge {
  font: 600 11px/1 var(--font); padding: 4px 7px; border-radius: 6px; background: var(--hover);
  color: var(--ink-2); border: 1px solid var(--line);
}
.badge b { font-family: var(--font-mono); font-weight: 600; margin-left: 3px; color: var(--ink-3); }
.ev__raw { display: none; margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 6px; }
.ev.is-open .ev__raw { display: block; }
.raw { margin: 6px 0; font-size: 12.5px; color: var(--ink-2); white-space: pre-line; }
.raw a { color: var(--ink); font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--line); }
.raw a:hover { border-color: var(--ink); }
.raw time { font-family: var(--font-mono); color: var(--ink-3); margin-left: 4px; }
.ev__go { display: none; }
@media (max-width: 760px) {
  .ev__go {
    display: block; width: 100%; margin-top: 8px; padding: 11px; border: 0; border-radius: 10px;
    background: var(--accent); color: #1d232b; font-weight: 700; font-size: 14px;
  }
}

/* ---------- легенда ---------- */
.legend {
  position: fixed; left: 16px; bottom: 16px; z-index: 5;
  display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 10px 14px; max-width: calc(100vw - var(--panel-w) - 110px);  /* не под кнопками масштаба */
  font-size: 12px; color: var(--ink-2);
  animation: rise .5s .16s ease-out both;
}
.lg { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sw { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }
.sw--danger { background: var(--danger); }
.sw--attention { background: var(--attention); }
.sw--approach { background: var(--approach); }
.sw--missile { background: transparent; border: 2px dashed var(--missile); height: 12px; }
.ic { width: 14px; height: 14px; display: inline-block; }
.ic--drone { background: var(--ink); -webkit-mask: var(--drone-mask) center/contain no-repeat; mask: var(--drone-mask) center/contain no-repeat; }
.ic--ring { border: 3px solid var(--danger-d); background: var(--card-solid); border-radius: 50%; width: 12px; height: 12px; }
.ic--fpv { width: 14px; height: 14px; background: var(--fpv);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M9 7.6 24.4 23 23 24.4 7.6 9Zm14-1.4 1.4 1.4L9 23l-1.4-1.4ZM12.5 12.5h7v7h-7ZM3.5 8a4.5 4.5 0 1 0 9 0 4.5 4.5 0 1 0-9 0Zm16 0a4.5 4.5 0 1 0 9 0 4.5 4.5 0 1 0-9 0Zm-16 16a4.5 4.5 0 1 0 9 0 4.5 4.5 0 1 0-9 0Zm16 0a4.5 4.5 0 1 0 9 0 4.5 4.5 0 1 0-9 0Z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M9 7.6 24.4 23 23 24.4 7.6 9Zm14-1.4 1.4 1.4L9 23l-1.4-1.4ZM12.5 12.5h7v7h-7ZM3.5 8a4.5 4.5 0 1 0 9 0 4.5 4.5 0 1 0-9 0Zm16 0a4.5 4.5 0 1 0 9 0 4.5 4.5 0 1 0-9 0Zm-16 16a4.5 4.5 0 1 0 9 0 4.5 4.5 0 1 0-9 0Zm16 0a4.5 4.5 0 1 0 9 0 4.5 4.5 0 1 0-9 0Z'/%3E%3C/svg%3E") center/contain no-repeat; }
.ic--sea { width: 16px; height: 16px; background: var(--sea);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M3 17h26l-4.5 7h-17ZM9.5 17l2-6h9l2 6Zm4.5-6V7h3v4ZM2 27h28v3H2Z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M3 17h26l-4.5 7h-17ZM9.5 17l2-6h9l2 6Zm4.5-6V7h3v4ZM2 27h28v3H2Z'/%3E%3C/svg%3E") center/contain no-repeat; }

:root {
  --drone-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16 2 L19.5 12 L30 25.5 L30 28 L18.5 25 L16 30 L13.5 25 L2 28 L2 25.5 L12.5 12 Z'/%3E%3C/svg%3E");
}

/* пульс над пунктом под угрозой: CSS-анимация, карту не перерисовывает */
.pulse { width: 30px; height: 30px; pointer-events: none; }
.pulse::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--danger-d); opacity: 0;
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(.25); opacity: .8; } 100% { transform: scale(1); opacity: 0; } }

/* ---------- объекты: летящий БПЛА по курсу, ракета, безэкипажный катер ---------- */
.obj { width: 0; height: 0; pointer-events: none; }
.obj svg { display: block; width: 100%; height: 100%; overflow: visible; }
.obj path { fill: currentColor; stroke: var(--card-solid); stroke-width: 1.6; paint-order: stroke; stroke-linejoin: round; }
.flyer { position: absolute; left: -11px; top: -11px; width: 22px; height: 22px; color: var(--ink);
  offset-rotate: auto 90deg; animation: fly 6s linear infinite; }
.flyer--small { left: -7px; top: -7px; width: 14px; height: 14px; }
.flyer[hidden] { display: none; }
@keyframes fly { 0% { offset-distance: 0%; opacity: 0; } 12%, 82% { opacity: .95; } 100% { offset-distance: 100%; opacity: 0; } }
.obj--missile, .obj--sea { color: var(--missile); }
.obj--sea { color: var(--sea); }
.obj--fpv { color: var(--fpv); }
.obj--airport { color: var(--ink-2); }
.obj--airport > svg { position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; }
.airport-note { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; font-size: 13.5px; color: var(--ink-2); }
.ic--plane { width: 14px; height: 14px; background: var(--ink-2); flex: none;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16 2c1.2 0 2 1 2 2.4V12l10 6v3l-10-3v6l3 2.5V29l-5-1.5-5 1.5v-2.5l3-2.5v-6L4 21v-3l10-6V4.4C14 3 14.8 2 16 2Z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16 2c1.2 0 2 1 2 2.4V12l10 6v3l-10-3v6l3 2.5V29l-5-1.5-5 1.5v-2.5l3-2.5v-6L4 21v-3l10-6V4.4C14 3 14.8 2 16 2Z'/%3E%3C/svg%3E") center/contain no-repeat; }
.obj--fpv > svg { position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; }
.obj--fpv::after { content: ""; position: absolute; left: -16px; top: -16px; width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid currentColor; opacity: 0; animation: pulse 1.6s ease-out infinite; }
.obj--missile > svg, .obj--sea > svg { position: absolute; left: -15px; top: -15px; width: 30px; height: 30px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .3)); }
.obj--missile > svg { animation: bob 1.6s ease-in-out infinite; }
.obj--sea .wave { fill: none; stroke: currentColor; stroke-width: 2.2; }
.obj--missile::after, .obj--sea::after { content: ""; position: absolute; left: -24px; top: -24px; width: 48px; height: 48px;
  border-radius: 50%; border: 2px solid currentColor; opacity: 0; animation: pulse 2.2s ease-out infinite; }
@keyframes bob { 50% { transform: translateY(-3px); } }
.objs-small .obj--missile > svg, .objs-small .obj--sea > svg { left: -10px; top: -10px; width: 20px; height: 20px; }
.objs-small .obj--fpv > svg, .objs-small .obj--airport > svg { left: -6px; top: -6px; width: 12px; height: 12px; }
.objs-small .obj::after, .objs-small .obj--missile > svg { animation: none; }

/* ---------- подсказка ---------- */
.tip {
  position: fixed; z-index: 20; pointer-events: none; max-width: 280px;
  background: var(--card-solid); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
  padding: 9px 11px; font-size: 12.5px;
}
.tip b { display: block; font-size: 13.5px; margin-bottom: 2px; }
.tip .lv { font-weight: 600; }
.tip .lv--danger { color: var(--danger); }
.tip .lv--attention { color: var(--attention-d); }
.tip .mut { color: var(--ink-3); font-family: var(--font-mono); font-size: 11.5px; }

/* ---------- диалог ---------- */
dialog {
  border: 1px solid var(--line); border-radius: 18px; padding: 22px 24px; max-width: 520px; width: calc(100% - 32px);
  background: var(--card-solid); color: var(--ink); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(14, 21, 28, .35); backdrop-filter: blur(2px); }
dialog h2 { margin: 0 0 12px; font: 700 18px var(--font-display); }
dialog p { margin: 0 0 12px; color: var(--ink-2); }
dialog b { color: var(--ink); }
.about__src { margin: 0 0 12px; padding: 0; list-style: none; display: grid; gap: 6px; }
.about__src a { color: var(--ink); font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--line); }
.about__small { font-size: 12.5px; }
.btn {
  border: 0; background: var(--accent); color: #1d232b; font-weight: 700; padding: 10px 18px; border-radius: 10px;
}

/* ---------- MapLibre ---------- */
.maplibregl-ctrl-group { background: var(--card-solid) !important; border: 1px solid var(--line); box-shadow: var(--shadow) !important; }
.maplibregl-ctrl-group button + button { border-top-color: var(--line) !important; }
:root[data-theme="dark"] .maplibregl-ctrl-icon { filter: invert(1); }
.maplibregl-ctrl-attrib { background: var(--card) !important; color: var(--ink-3); font-size: 10.5px; }
.maplibregl-ctrl-attrib a { color: var(--ink-2); }
.maplibregl-ctrl-bottom-right { right: calc(var(--panel-w) + 24px); }

@keyframes beat { 0% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes rise { from { opacity: 0; transform: translateY(-6px); } }
@keyframes slide { from { opacity: 0; transform: translateX(16px); } }
@keyframes fade { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .pulse::after { opacity: .7; transform: scale(.55); }
}

/* ---------- телефон: лента снизу шторкой ---------- */
@media (max-width: 760px) {
  :root { --panel-w: 0px; }
  .brand { top: 10px; left: 10px; right: 64px; min-width: 0; padding: 10px 12px; }
  .brand h1 { font-size: 15px; }
  .brand__meta { margin: 4px 0 8px 20px; font-size: 11px; }
  .stats { gap: 12px; padding-left: 20px; }
  .stat { padding: 0; background: none; flex: none; flex-direction: row; align-items: baseline; gap: 4px; }
  .stat span { font-size: 12px; }
  .chip { padding: 9px 14px 9px 12px; font-size: 13.5px; }
  .tabs button { padding: 12px 10px; }
  .stat b { font-size: 15px; }
  .maplibregl-ctrl-group { display: none; }
  .tools { top: 10px; right: 10px; flex-direction: column; }
  .tools > button { width: 44px; height: 44px; }
  .layers { top: 0; right: calc(100% + 8px); }
  .legend { display: none; }
  .panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 34vh;
    border-radius: 18px 18px 0 0; border-bottom: 0;
    transition: height .3s cubic-bezier(.2, .8, .2, 1);
    animation: none;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .panel.is-open { height: 78vh; }
  .panel.is-peek { height: calc(60px + env(safe-area-inset-bottom)); }
  .panel.is-dragging { transition: none; }
  .panel { overflow: hidden; touch-action: pan-y; }
  /* источники одной строкой с прокруткой вбок, а не тремя рядами */
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -14px; padding-right: 14px; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .panel__handle {
    display: grid; place-items: center; width: 100%; height: 28px; border: 0; background: transparent; padding: 0;
  }
  .panel__handle span { width: 38px; height: 4px; border-radius: 4px; background: var(--ink-3); opacity: .5; }
  .panel__head { padding: 0 14px 8px; }
  .maplibregl-ctrl-bottom-right { right: 0; bottom: var(--sheet-h, 34vh); transition: bottom .3s; }
  .maplibregl-ctrl-bottom-left { bottom: var(--sheet-h, 34vh); transition: bottom .3s; }
}

/* ---------- мой регион в шапке ---------- */
.mine {
  display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 10px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card-solid); text-align: left;
  font-size: 13px; line-height: 1.25;
}
.mine:hover { border-color: var(--ink-3); }
.mine__dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--clear); }
.mine b { font-weight: 700; }
.mine__lv { margin-left: auto; font-weight: 700; text-align: right; max-width: 52%; }  /* длинный статус переносится, а не вылезает */
.mine--danger { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--card-solid)); }
.mine--danger .mine__dot { background: var(--danger); animation: blink 1.2s steps(2, start) infinite; }
.mine--danger .mine__lv { color: var(--danger); }
.mine--attention, .mine--approach { border-color: var(--attention); background: color-mix(in srgb, var(--attention) 14%, var(--card-solid)); }
.mine--attention .mine__dot, .mine--approach .mine__dot { background: var(--attention-d); }
.mine--attention .mine__lv, .mine--approach .mine__lv { color: var(--attention-d); }
.mine--missile { border-color: var(--missile); background: color-mix(in srgb, var(--missile) 12%, var(--card-solid)); }
.mine--missile .mine__dot { background: var(--missile); animation: blink 1.2s steps(2, start) infinite; }
.mine--missile .mine__lv { color: var(--missile); }
.mine--calm .mine__lv { color: var(--clear); }
.mine--sea { border-color: var(--sea); background: color-mix(in srgb, var(--sea) 12%, var(--card-solid)); }
.mine--sea .mine__dot { background: var(--sea); animation: blink 1.2s steps(2, start) infinite; }
.mine--sea .mine__lv { color: var(--sea); }
.mine--fpv { border-color: var(--fpv); background: color-mix(in srgb, var(--fpv) 12%, var(--card-solid)); }
.mine--fpv .mine__dot { background: var(--fpv); animation: blink 1.2s steps(2, start) infinite; }
.mine--fpv .mine__lv { color: var(--fpv); }
.mine--unset { color: var(--ink-2); border-style: dashed; }
.mine--unset .mine__dot { background: var(--ink-3); }
@keyframes blink { to { opacity: .25; } }

.missile-banner {
  margin-top: 8px; padding: 8px 11px; border-radius: 10px; font-size: 12.5px; line-height: 1.3;
  background: color-mix(in srgb, var(--missile) 13%, var(--card-solid)); border: 1px solid var(--missile); color: var(--ink);
  cursor: pointer;
}
.missile-banner b { color: var(--missile); }

/* ---------- поиск ---------- */
.search { position: relative; display: flex; align-items: center; margin-bottom: 10px; }
.search__icon { position: absolute; left: 11px; width: 17px; height: 17px; fill: var(--ink-3); pointer-events: none; }
.search input {
  flex: 1; min-width: 0; height: 40px; padding: 0 44px 0 36px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--card-solid); color: var(--ink); font: 500 14px var(--font); outline: none;
}
.search input:focus { border-color: var(--ink-3); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.search input::-webkit-search-cancel-button { display: none; }
.search > button {
  position: absolute; right: 3px; width: 34px; height: 34px; border: 0; border-radius: 9px; background: transparent;
  display: grid; place-items: center;
}
.search > button:hover { background: var(--hover); }
.search > button svg { width: 18px; height: 18px; fill: var(--ink); }
.search > button.is-busy svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.results {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 4px; list-style: none;
  background: var(--card-solid); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  max-height: 340px; overflow-y: auto;
}
.results li { padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.results li:hover, .results li[aria-selected="true"] { background: var(--hover); }
.results b { display: block; font-weight: 600; font-size: 14px; }
.results span { font-size: 12px; color: var(--ink-2); }
.results .lvl { float: right; font-size: 11.5px; font-weight: 700; margin-left: 8px; }
.results .empty { color: var(--ink-3); cursor: default; }

/* ---------- карточка «мой регион» во вкладке «Сейчас» ---------- */
.mycard { margin: 4px 4px 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; }
.mycard:hover { border-color: var(--ink-3); }
.mycard small { display: block; font: 600 11px var(--font-mono); text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); margin-bottom: 3px; }
.mycard b { font-size: 15.5px; }
.mycard p { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); }
.mycard--unset { border-style: dashed; cursor: default; }
.mycard--unset p { margin-bottom: 8px; }
.mycard .btn-line { display: flex; gap: 6px; flex-wrap: wrap; }
.mini-btn {
  border: 1px solid var(--line); background: var(--card-solid); border-radius: 9px; padding: 8px 12px; font-weight: 600; font-size: 13px;
}
.mini-btn:hover { border-color: var(--ink-3); }
.mini-btn--accent { background: var(--accent); border-color: var(--accent); color: #1d232b; }

/* ---------- карточка региона ---------- */
.region { flex: 1; overflow-y: auto; padding: 4px 14px 18px; overscroll-behavior: contain; }
.region[hidden] { display: none; }
.region__top { display: flex; align-items: center; gap: 6px; padding: 6px 0 8px; }
.back {
  border: 0; background: var(--hover); border-radius: 9px; padding: 8px 12px 8px 9px; font-weight: 600; font-size: 13px;
  display: inline-flex; align-items: center; gap: 4px;
}
.region__top .spacer { flex: 1; }
.icon-btn { width: 36px; height: 36px; border: 1px solid var(--line); background: var(--card-solid); border-radius: 9px; display: grid; place-items: center; }
.icon-btn svg { width: 18px; height: 18px; fill: var(--ink); }
.icon-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
.icon-btn[aria-pressed="true"] svg { fill: #1d232b; }
.region h2 { margin: 2px 0 10px; font: 700 19px/1.2 var(--font-display); }
.status {
  border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; border: 1px solid var(--line);
}
.status__lv { font: 700 16px/1.2 var(--font-display); display: flex; align-items: center; gap: 8px; }
.status__lv::before { content: ""; width: 11px; height: 11px; border-radius: 50%; background: currentColor; flex: none; }
.status p { margin: 6px 0 0; font-size: 13.5px; color: var(--ink-2); }
.status .meta { font: 12px var(--font-mono); color: var(--ink-3); margin-top: 6px; }
.status--danger { background: color-mix(in srgb, var(--danger) 11%, var(--card-solid)); border-color: var(--danger); }
.status--danger .status__lv { color: var(--danger); }
.status--attention, .status--approach { background: color-mix(in srgb, var(--attention) 15%, var(--card-solid)); border-color: var(--attention); }
.status--attention .status__lv, .status--approach .status__lv { color: var(--attention-d); }
.status--missile { background: color-mix(in srgb, var(--missile) 12%, var(--card-solid)); border-color: var(--missile); }
.status--missile .status__lv { color: var(--missile); }
.status--sea { background: color-mix(in srgb, var(--sea) 12%, var(--card-solid)); border-color: var(--sea); }
.status--sea .status__lv { color: var(--sea); }
.status--fpv { background: color-mix(in srgb, var(--fpv) 12%, var(--card-solid)); border-color: var(--fpv); }
.status--fpv .status__lv { color: var(--fpv); }
.status--calm .status__lv { color: var(--clear); }
.status--nomissile { padding: 9px 14px; }
.status--nomissile .status__lv { font: 600 13.5px var(--font); color: var(--ink-2); }
.status--nomissile .status__lv::before { background: var(--ink-3); width: 8px; height: 8px; }
.todo { margin: 4px 0 12px; border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px; }
.todo summary { cursor: pointer; padding: 8px 0; font-weight: 700; font-size: 13.5px; }
.todo ul { margin: 0 0 10px; padding-left: 18px; font-size: 13px; color: var(--ink-2); display: grid; gap: 5px; }
.region h3 { margin: 16px 0 6px; font: 700 13px var(--font-display); color: var(--ink-2); text-transform: none; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.list li:last-child { border-bottom: 0; }
.list .t { font: 600 12.5px var(--font-mono); white-space: nowrap; min-width: 92px; }
.list .lv { font-weight: 600; }
.list .lv--danger { color: var(--danger); }
.list .lv--attention { color: var(--attention-d); }
.list .lv--missile { color: var(--missile); }
.lv--sea { color: var(--sea); }
.lv--fpv { color: var(--fpv); }
.list .note { margin-left: auto; color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.list .now { color: var(--danger); font-weight: 700; }
.muted { color: var(--ink-3); font-size: 13px; margin: 4px 0; }
.notify { display: flex; align-items: center; gap: 10px; margin: 12px 0 0; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.notify input { width: 18px; height: 18px; accent-color: var(--attention-d); margin: 0; }
.region .feed { padding: 0; overflow: visible; }
.region .more { margin-top: 6px; }

/* ---------- всплывающее предупреждение ---------- */
.toast {
  position: fixed; z-index: 40; left: 50%; top: 16px; transform: translateX(-50%); max-width: min(460px, calc(100vw - 24px));
  padding: 12px 16px; border-radius: 12px; background: var(--danger); color: #fff; font-weight: 700; box-shadow: var(--shadow);
  cursor: pointer; animation: rise .3s ease-out both;
}
.toast--attention { background: var(--attention); color: #1d232b; }
.toast--missile { background: var(--missile); }
.toast--calm { background: var(--clear); }

/* ---------- легенда в «О карте» ---------- */
dialog h3 { margin: 14px 0 8px; font: 700 14px var(--font-display); }
.about__legend { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 7px; font-size: 13px; color: var(--ink-2); }
.about__legend li { display: flex; gap: 9px; align-items: center; }
.about__legend .sw, .about__legend .ic { flex: none; }
.ic--arrow { width: 16px; height: 3px; background: var(--ink); position: relative; border-radius: 2px; }
.ic--arrow::after { content: ""; position: absolute; right: -2px; top: -4px; border: 5px solid transparent; border-left: 7px solid var(--ink); border-right: 0; }

@media (max-width: 760px) {
  .mine { margin-top: 8px; padding: 10px 11px; font-size: 13.5px; }
  .search input { height: 44px; font-size: 16px; } /* 16px: iOS не зумит поле при фокусе */
  .search > button { width: 40px; height: 40px; }
  .region { padding: 0 14px calc(18px + env(safe-area-inset-bottom)); }
  .back, .icon-btn { min-height: 40px; }
  .icon-btn { width: 40px; height: 40px; }
  .toast { top: auto; bottom: calc(var(--sheet-h, 34vh) + 10px); }
}

/* скрытие поверх display из классов */
.tabs[hidden], .chips[hidden], .mine[hidden], .missile-banner[hidden], .toast[hidden] { display: none; }
@media (max-width: 760px) {
  .panel.is-half { height: 56vh; }
}

.stale { margin: 8px 0 0; font-size: 12.5px; color: var(--ink-2); border-top: 1px dashed var(--line); padding-top: 7px; }
/* «вы здесь» */
.me { width: 16px; height: 16px; border-radius: 50%; background: #2f7de1; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25), 0 0 0 7px rgba(47,125,225,.22); }


/* ---------- частичные зоны, отбой ---------- */
.sw--partial { background: var(--danger-soft); }
.sw--cleared { background: var(--clear-soft); border: 1px solid var(--clear); }
.row--partial .row__sw { background: var(--danger-soft); border: 1px solid var(--danger); }
.row--partial .row__lv { color: var(--danger); font-weight: 600; }
.row--cleared .row__sw { background: var(--clear-soft); border: 1px solid var(--clear); }
.row--cleared .row__lv { color: var(--clear); font-weight: 600; }
.row--cleared:not(:hover) { opacity: .8; }
.status--partial { background: color-mix(in srgb, var(--danger) 6%, var(--card-solid)); border-color: var(--danger-soft); }
.status--partial .status__lv { color: var(--danger); }
.status--nearby { background: color-mix(in srgb, var(--attention) 12%, var(--card-solid)); border-color: var(--attention); }
.status--nearby .status__lv { color: var(--attention-d); }
.status--cleared { background: color-mix(in srgb, var(--clear) 10%, var(--card-solid)); border-color: var(--clear); }
.status--cleared .status__lv { color: var(--clear); }
.mine--partial { border-color: var(--danger-soft); background: color-mix(in srgb, var(--danger) 7%, var(--card-solid)); }
.mine--partial .mine__dot { background: var(--danger); }
.mine--partial .mine__lv { color: var(--danger); }
.mine--nearby .mine__dot { background: var(--attention-d); }
.mine--nearby { border-color: var(--attention); background: color-mix(in srgb, var(--attention) 12%, var(--card-solid)); }
.mine--nearby .mine__lv { color: var(--attention-d); }
.mine--cleared { border-color: var(--clear); }
.mine--cleared .mine__lv { color: var(--clear); }
.mine small { font-size: 11.5px; color: var(--ink-2); }

/* ---------- мои места ---------- */
.places { margin: 4px 4px 12px; padding: 10px 12px 12px; border: 1px solid var(--line); border-radius: 12px; list-style: none; }
.places__head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.places__head small { font: 600 11px var(--font-mono); text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.places__acts { margin-left: auto; display: flex; gap: 6px; }
.places__acts .mini-btn { padding: 6px 10px; font-size: 12.5px; }
.places__list { list-style: none; margin: 0; padding: 0; }
.place { display: flex; gap: 10px; align-items: flex-start; padding: 9px 4px; border-radius: 9px; cursor: pointer; }
.place + .place { border-top: 1px dashed var(--line); }
.place:hover { background: var(--hover); }
.place__dot { width: 11px; height: 11px; border-radius: 50%; margin-top: 4px; flex: none; background: var(--clear); }
.place__main { min-width: 0; }
.place__main b { font-weight: 700; font-size: 14.5px; }
.place__main small { margin-left: 6px; color: var(--ink-3); font-size: 12px; }
.place__main span { display: block; font-size: 12.5px; color: var(--ink-2); margin-top: 1px; }
.place__lv { display: inline !important; font-weight: 700; }
.place--missile .place__dot { background: var(--missile); animation: blink 1.2s steps(2, start) infinite; }
.place--missile .place__lv { color: var(--missile); }
.place--danger .place__dot { background: var(--danger); animation: blink 1.2s steps(2, start) infinite; }
.place--danger .place__lv, .place--partial .place__lv { color: var(--danger); }
.place--partial .place__dot { background: var(--danger-soft); border: 2px solid var(--danger); }
.place--attention .place__dot, .place--nearby .place__dot, .place--approach .place__dot { background: var(--attention); }
.place--attention .place__lv, .place--nearby .place__lv, .place--approach .place__lv { color: var(--attention-d); }
.place--cleared .place__lv, .place--calm .place__lv { color: var(--clear); }
.place--calm .place__dot { background: var(--clear); opacity: .55; }
.notify-box { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.notify-box .muted { margin: 6px 0; }
.notify-box .notify { margin-top: 8px; }

/* место человека в карточке региона */
.here { margin: -4px 0 10px; padding: 8px 11px; border-radius: 10px; background: var(--hover); font-size: 13.5px; }
.here b { font-weight: 700; }
.here--danger b, .here--missile b { color: var(--danger); }
.here--attention b { color: var(--attention-d); }
.here--clear b, .here--calm b { color: var(--clear); }
.here small { color: var(--ink-3); }

/* неделя по дням */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 92px; margin: 8px 0 4px; }
.week__col { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.week__col i { width: 100%; max-width: 30px; min-height: 2px; border-radius: 4px 4px 2px 2px; background: var(--danger); opacity: .85; }
.week__col span { font: 11px var(--font-mono); color: var(--ink-3); }
.week__col--na i { height: 14px; background: repeating-linear-gradient(135deg, var(--line) 0 3px, transparent 3px 6px); opacity: 1; }
.week__col--na span { opacity: .55; }

/* официальные источники */
.badge--official { background: color-mix(in srgb, var(--clear) 12%, var(--card-solid)); border-color: var(--clear); color: var(--ink); }
.chip--official[aria-pressed="true"] { border-color: var(--clear); }
.chip--local[aria-pressed="true"] { border-color: var(--fpv); }
.chip--regional[aria-pressed="true"] { border-color: var(--ink-3); }
.official-note { margin: 6px 0 0; font-size: 12.5px; font-weight: 600; color: var(--clear); }

.nw { white-space: nowrap; }
