/* Радар ПФО — оперативная карта. Floating instrument panels over a full-bleed map. */
:root {
  color-scheme: light;
  --bg: #e4e7e2; --tile-bg: #eceae4;
  --panel: rgba(255, 255, 255, .86); --panel-solid: #fff; --surface: #f1f3f0; --surface-hover: #e8ebe7;
  --line: rgba(20, 30, 26, .1); --line-2: rgba(20, 30, 26, .18);
  --text: #121a17; --muted: #5d6a64; --dim: #8b958f;
  --ink: #121a17; --ink-text: #f4f6f3;
  --accent: #121a17; --ok: #2f9e6a; --warn: #c88a1e; --err: #d24b45;
  --shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 10px 30px -12px rgba(20, 30, 26, .28), 0 2px 6px -2px rgba(20, 30, 26, .12);
  --blur: saturate(1.4) blur(18px);
  --r: 14px; --r-s: 10px;
  --gap: 12px; --sidebar: 340px; --header: 64px;
  --ease: cubic-bezier(.77, 0, .18, 1); --ease-out: cubic-bezier(.16, 1, .3, 1); --spring: cubic-bezier(.34, 1.4, .64, 1);
  --sans: "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-family: var(--sans);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1113; --tile-bg: #15191b;
  --panel: rgba(16, 21, 24, .82); --panel-solid: #12171a; --surface: rgba(255,255,255,.05); --surface-hover: rgba(255,255,255,.09);
  --line: rgba(255, 255, 255, .08); --line-2: rgba(255, 255, 255, .16);
  --text: #e9eeec; --muted: #94a19b; --dim: #67736d;
  --ink: #e9eeec; --ink-text: #0d1113;
  --accent: #e9eeec; --ok: #4adea3; --warn: #ffc65c; --err: #ff6a62;
  --shadow: 0 1px 0 rgba(255,255,255,.05) inset, 0 16px 40px -14px rgba(0, 0, 0, .7), 0 2px 8px -2px rgba(0, 0, 0, .4);
}
@property --feed-height { syntax: "<length>"; inherits: true; initial-value: 0px; }
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body { overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button, select, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
::selection { background: #ffa00055; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* glass surface shared by all floating chrome */
.topbar, .activity-panel, .detail-panel, .legend, .place-search input, .search-results, .map-message,
.leaflet-control-zoom, .uav-tools, .mh-ctl, .mh-bar, .rl-ctl, .rl-bar, .map-tooltip {
  background: var(--panel) !important; border: 1px solid var(--line) !important; box-shadow: var(--shadow) !important;
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}

.map-shell { position: relative; width: 100%; height: 100%; height: 100dvh; overflow: hidden; isolation: isolate; }
.map-canvas { position: absolute; inset: 0; background: var(--tile-bg); }
.leaflet-container.map-canvas { background: var(--tile-bg); font: inherit; }
.map-canvas .leaflet-interactive:focus:not(:focus-visible) { outline: none; }
.base-tiles { filter: saturate(.75) contrast(.96); }
:root[data-theme="dark"] .base-tiles { filter: invert(1) hue-rotate(180deg) brightness(.86) contrast(.9) saturate(.4); }

/* ── top bar ─────────────────────────────── */
.topbar { position: absolute; z-index: 800; top: var(--gap); left: var(--gap); right: var(--gap); height: var(--header);
  display: flex; align-items: center; gap: 28px; padding: 0 10px 0 12px; border-radius: var(--r); }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; flex-shrink: 0; }
.brand-logo { width: 36px; height: 36px; border-radius: 9px; object-fit: cover; transition: transform .6s var(--spring); }
.brand:hover .brand-logo { transform: rotate(-8deg) scale(1.06); }
.brand-copy strong { display: block; font-size: 13px; font-weight: 700; letter-spacing: .16em; }
.brand-copy small { display: block; margin-top: 3px; color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.topbar-status { display: flex; align-items: center; gap: 4px; padding-left: 22px; border-left: 1px solid var(--line); height: 32px; }
.connection { display: flex; align-items: center; gap: 8px; padding-right: 18px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.status-dot { position: relative; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--dim); flex-shrink: 0; transition: background .4s; }
.connection[data-state="online"] .status-dot, .activity-foot .status-dot { background: var(--ok); }
.connection[data-state="online"] .status-dot::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 1px solid var(--ok); animation: ping 2.4s var(--ease-out) infinite; }
.connection[data-state="retry"] .status-dot { background: var(--warn); animation: blink 1s steps(1) infinite; }
.connection[data-state="error"] .status-dot { background: var(--err); }
@keyframes ping { 0% { transform: scale(.4); opacity: .9; } 100% { transform: scale(1.7); opacity: 0; } }
@keyframes blink { 50% { opacity: .3; } }
.summary { display: flex; gap: 7px; align-items: baseline; padding: 0 14px; border-left: 1px solid var(--line); font-size: 12px; color: var(--muted); white-space: nowrap; }
.summary b { display: inline-block; min-width: 1ch; color: var(--text); font-family: var(--mono); font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; }
.bump { animation: bump .6s var(--ease-out); }
@keyframes bump { 0% { transform: translateY(70%); opacity: 0; } 100% { transform: none; opacity: 1; } }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.theme-switch { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.theme-switch::before { content: ""; position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 7px; background: var(--panel-solid); box-shadow: 0 1px 3px rgba(0,0,0,.14), 0 0 0 1px var(--line); transition: transform .55s var(--spring); }
:root[data-theme="dark"] .theme-switch::before { transform: translateX(100%); background: rgba(255,255,255,.1); }
.theme-switch button { position: relative; z-index: 1; min-height: 32px; padding: 0 13px; border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 500; transition: color .35s; }
.theme-switch button[aria-pressed="true"] { color: var(--text); }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--text); transition: background .3s, transform .4s var(--spring); }
.icon-button:hover { background: var(--surface-hover); }
.icon-button:active { transform: scale(.92); }
.icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; transition: transform .6s var(--ease); }
.map-reset:hover svg { transform: scale(.82); }
.game-button { position: relative; display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 10px; background: var(--ink); color: var(--ink-text); font-size: 12.5px; font-weight: 600; text-decoration: none; white-space: nowrap; overflow: hidden; isolation: isolate; transition: color .4s, transform .4s var(--spring); }
.game-button::before { content: ""; position: absolute; inset: 0; z-index: -1; background: #FFA000; transform: translateY(101%); transition: transform .5s var(--ease); }
.game-button:hover { color: #1a1206; }
.game-button:hover::before { transform: none; }
.game-button:active { transform: scale(.95); }
.game-button .gb-short { display: none; }
.text-link { position: relative; font-size: 12.5px; color: var(--muted); text-decoration: none; padding: 8px 6px; transition: color .3s; }
.text-link::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: 4px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform .45s var(--ease); }
.text-link:hover { color: var(--text); }
.text-link:hover::after { transform: scaleX(1); transform-origin: left; }

/* ── search ──────────────────────────────── */
.place-search { position: absolute; z-index: 760; top: calc(var(--header) + var(--gap) * 2); left: var(--gap); width: 300px; max-width: calc(100% - var(--sidebar) - 100px); color: var(--text); }
.place-search::before { content: ""; position: absolute; z-index: 1; left: 14px; top: 13px; width: 16px; height: 16px; pointer-events: none; opacity: .55;
  background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m20 20-4.2-4.2'/%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 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m20 20-4.2-4.2'/%3E%3C/svg%3E") center/contain no-repeat; }
.place-search input { width: 100%; height: 42px; border-radius: 12px; padding: 0 14px 0 40px; color: var(--text); font-size: 13.5px; transition: box-shadow .4s; -webkit-appearance: none; appearance: none; }
.place-search input::placeholder { color: var(--muted); }
.place-search input:focus { outline: none; box-shadow: var(--shadow), 0 0 0 3px color-mix(in srgb, var(--text) 14%, transparent) !important; }
.search-results { margin-top: 6px; max-height: min(420px, 50vh); overflow: auto; border-radius: 12px; font-size: 13px; padding: 10px 14px; color: var(--muted); transform-origin: top; animation: drop .35s var(--ease-out); }
.search-results:has(button) { padding: 0; }
.search-results button { display: block; width: 100%; padding: 11px 14px; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); transition: background .2s, padding .3s var(--ease-out); }
.search-results button:last-child { border-bottom: 0; }
.search-results button:hover, .search-results button:focus { background: var(--surface-hover); padding-left: 18px; outline: none; }
.search-results strong { display: block; font-weight: 500; font-size: 13px; }
.search-results small { display: block; margin-top: 3px; font-size: 11px; color: var(--muted); }
@keyframes drop { from { opacity: 0; transform: translateY(-6px) scaleY(.96); } to { opacity: 1; transform: none; } }

/* ── legend ──────────────────────────────── */
.legend { position: absolute; z-index: 700; left: var(--gap); bottom: 30px; max-width: min(440px, calc(100% - var(--sidebar) - 40px)); padding: 0; border-radius: 12px; overflow: hidden; }
.legend summary { display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; list-style: none; font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.legend summary::-webkit-details-marker { display: none; }
.legend summary::after { content: ""; width: 6px; height: 6px; margin-left: auto; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(2px) rotate(-135deg); transition: transform .4s var(--ease); }
.legend[open] summary::after { transform: translateY(-2px) rotate(45deg); }
.legend-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 18px; padding: 2px 14px 13px; }
.legend[open] .legend-item { animation: fade-up .5s var(--ease-out) both; }
.legend-item:nth-child(2) { animation-delay: .03s !important; } .legend-item:nth-child(3) { animation-delay: .06s !important; }
.legend-item:nth-child(4) { animation-delay: .09s !important; } .legend-item:nth-child(5) { animation-delay: .12s !important; }
.legend-item:nth-child(6) { animation-delay: .15s !important; } .legend-item:nth-child(7) { animation-delay: .18s !important; }
.legend-item { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-size: 11.5px; white-space: nowrap; }
.swatch { width: 10px; height: 10px; display: inline-block; flex-shrink: 0; border-radius: 3px; }
.swatch.warning { background: #FFD166; } .swatch.danger { background: #FF4D5A; }
.swatch.fixation { background: #FFA000; border-radius: 50%; box-shadow: 0 0 0 3px #FFA00033; }
.swatch.missile-warning { background: #FF8A3D; } .swatch.missile-danger { background: #FF3D9A; }
.swatch.destroyed { background: #4ADEA3; } .swatch.air-defense { background: #A78BFA; }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── activity feed ───────────────────────── */
.activity-panel { position: absolute; z-index: 750; top: calc(var(--header) + var(--gap) * 2); right: var(--gap); bottom: var(--gap); width: var(--sidebar);
  display: flex; flex-direction: column; border-radius: var(--r); overflow: hidden; }
.activity-head { display: flex; align-items: flex-end; gap: 12px; padding: 20px 20px 0; }
.eyebrow { display: block; color: var(--muted); font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; }
.activity-head h1 { margin: 8px 0 0; font-size: 26px; line-height: 1; letter-spacing: -.035em; font-weight: 600; }
.feed-count { margin-left: auto; min-width: 34px; height: 26px; padding: 0 9px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--text); font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.feed-toggle { display: none; }
.activity-sub { margin: 10px 20px 14px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.activity-feed { flex: 1; min-height: 0; overflow: auto; padding: 4px 10px 12px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; -webkit-mask-image: linear-gradient(transparent, #000 8px, #000 calc(100% - 18px), transparent); mask-image: linear-gradient(transparent, #000 8px, #000 calc(100% - 18px), transparent); }
.feed-empty { margin: 4px 10px; padding: 18px 16px; border: 1px dashed var(--line-2); border-radius: 12px; color: var(--muted); font-size: 13px; line-height: 1.6; animation: fade-up .6s var(--ease-out) both; }
.feed-item { --tone: var(--muted); position: relative; display: block; width: 100%; margin: 0 0 4px; padding: 13px 14px 13px 20px; border: 0; border-radius: 12px; background: transparent; color: var(--text); text-align: left; font: inherit; overflow: hidden; isolation: isolate;
  opacity: var(--age-opacity, 1); transition: background .3s, opacity .3s, transform .45s var(--spring); }
.feed-item::before { content: ""; position: absolute; left: 8px; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--tone); transform-origin: top; transition: top .45s var(--ease-out), bottom .45s var(--ease-out); }
.feed-item:hover { background: var(--surface-hover); opacity: 1; }
.feed-item:hover::before { top: 8px; bottom: 8px; }
.feed-item:active { transform: scale(.98); }
.feed-item.enter { animation: feed-in .7s var(--ease-out) both; animation-delay: var(--d, 0s); }
.feed-item.enter::before { animation: bar-in .9s var(--ease-out) both; animation-delay: calc(var(--d, 0s) + .15s); }
.feed-item.fresh::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, color-mix(in srgb, var(--tone) 24%, transparent), transparent 75%); animation: flash 3s ease-out forwards; }
@keyframes feed-in { from { opacity: 0; transform: translateX(22px); } to { opacity: var(--age-opacity, 1); transform: none; } }
@keyframes bar-in { from { transform: scaleY(0); } to { transform: none; } }
@keyframes flash { 0%, 30% { opacity: 1; } 100% { opacity: 0; } }
.feed-time-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.feed-item time, .feed-time-row em { color: var(--muted); font-family: var(--mono); font-size: 10.5px; font-style: normal; letter-spacing: .02em; }
.feed-time-row em { color: var(--dim); }
.feed-item strong { display: block; margin: 7px 0 3px; font-size: 14.5px; line-height: 1.3; font-weight: 600; letter-spacing: -.01em; }
.feed-item small { display: block; color: var(--muted); font-size: 12px; line-height: 1.45; }
.feed-tags, .tooltip-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.feed-tag, .tooltip-tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 7px; border-radius: 999px; background: color-mix(in srgb, var(--tone) 15%, transparent); color: var(--text); font-size: 10.5px; font-weight: 500; line-height: 1.4; }
.feed-tag::before, .tooltip-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--tone); }
.activity-foot { min-height: 46px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 11px 20px; border-top: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: .04em; }
.foot-source { margin-left: auto; text-decoration: none; transition: color .3s; }
.foot-source:hover { color: var(--text); }

/* ── detail card ─────────────────────────── */
.detail-panel { --tone: var(--text); position: absolute; z-index: 780; left: var(--gap); width: min(460px, calc(100% - var(--sidebar) - var(--gap) * 3)); bottom: 30px; max-height: 45%; overflow: auto;
  padding: 18px 56px 18px 22px; border-radius: var(--r); display: block;
  opacity: 0; visibility: hidden; transform: translateY(18px) scale(.97); transform-origin: bottom left;
  transition: opacity .3s ease, transform .5s var(--ease-out), visibility 0s .5s; }
.detail-panel::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 3px; border-radius: 0 3px 3px 0; background: var(--tone); transform: scaleY(0); transition: transform .6s var(--ease-out) .1s, background .4s; }
.detail-panel.open { opacity: 1; visibility: visible; transform: none; transition: opacity .25s ease, transform .6s var(--spring), visibility 0s; }
.detail-panel.open::before { transform: none; }
.detail-panel.open .detail-copy > * { animation: fade-up .55s var(--ease-out) both; }
.detail-panel.open .detail-copy > :nth-child(2) { animation-delay: .05s; }
.detail-panel.open .detail-copy > :nth-child(3) { animation-delay: .1s; }
.detail-panel.open .detail-copy > :nth-child(4) { animation-delay: .15s; }
.detail-panel.swap .detail-copy > * { animation-name: fade-up-b; }
@keyframes fade-up-b { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.detail-panel h2 { margin: 7px 0 8px; font-size: 21px; line-height: 1.15; letter-spacing: -.025em; font-weight: 600; }
.detail-panel p { margin: 0; font-size: 13.5px; line-height: 1.6; }
.detail-meta { margin-top: 10px; color: var(--muted); font-family: var(--mono); font-size: 10.5px; line-height: 1.6; letter-spacing: .02em; }
#detail-text { white-space: pre-line; }
.detail-close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--text); font-size: 0; transition: background .3s, transform .5s var(--spring); }
.detail-close::before, .detail-close::after { content: ""; position: absolute; left: 10px; right: 10px; top: 15.5px; height: 1.5px; background: currentColor; transform: rotate(45deg); }
.detail-close::after { transform: rotate(-45deg); }
.detail-close:hover { background: var(--surface-hover); transform: rotate(90deg); }
.detail-admin-actions { display: none; margin-top: 12px; }
.detail-admin-actions button { padding: 9px 12px; border: 0; border-radius: 8px; background: #b93737; color: #fff; }

/* ── leaflet chrome ──────────────────────── */
.leaflet-top { top: calc(var(--header) + var(--gap)); }
.leaflet-right { right: calc(var(--sidebar) + var(--gap)); }
.leaflet-control-zoom { margin: 12px 12px 0 0 !important; border-radius: 12px !important; overflow: hidden; }
.leaflet-control-zoom a { width: 40px !important; height: 40px !important; line-height: 40px !important; background: transparent !important; color: var(--text) !important; border-color: var(--line) !important; font-weight: 400; transition: background .25s; }
.leaflet-control-zoom a:hover { background: var(--surface-hover) !important; }
.leaflet-control-attribution { background: transparent !important; color: var(--dim) !important; font-size: 9px !important; max-width: 100%; opacity: .8; }
.leaflet-control-attribution a { color: var(--dim) !important; }
.leaflet-control-scale { margin-bottom: 8px !important; }
.leaflet-control-scale-line { border-color: var(--muted); background: transparent; color: var(--muted); text-shadow: none; font-family: var(--mono); font-size: 9.5px; }
.map-tooltip { max-width: 290px; padding: 11px 13px !important; border-radius: 11px !important; color: var(--text) !important; font-family: var(--sans); font-size: 12.5px; }
.map-tooltip strong { font-weight: 600; }
.map-tooltip small { display: block; margin-top: 7px; color: var(--muted); font-family: var(--mono); font-size: 10px; }
.map-tooltip::before { display: none; }
.tooltip-areas { margin: 8px 0 0; padding: 0; list-style: none; font-size: 11px; line-height: 1.45; color: var(--text); }
.tooltip-areas li { margin-top: 2px; }
.tooltip-areas b { font-weight: 600; }
.region-label { display: none; }
.map-message { position: absolute; z-index: 790; left: var(--gap); bottom: 84px; max-width: calc(100% - var(--sidebar) - 40px); padding: 12px 15px; border-radius: 12px; font-size: 13px; line-height: 1.5; animation: fade-up .5s var(--ease-out); }
.map-message button { margin-left: 12px; border: 0; background: transparent; color: var(--text); font-weight: 600; text-decoration: underline; }

/* geometry: smooth status changes, entry of new zones */
.leaflet-pane path { transition: fill .7s ease, fill-opacity .7s ease, stroke .7s ease, stroke-opacity .7s ease; }
.leaflet-pane path.event-area { stroke-linejoin: round; }
.leaflet-pane path.event-fresh { animation: event-pulse 1.8s ease-in-out infinite; }
.leaflet-pane path.event-fresh-dot { animation: event-dot 1.8s ease-in-out infinite; }
.leaflet-pane path.event-new { animation: area-in 1.1s var(--ease-out) both; }
.leaflet-pane path.event-new.event-fresh { animation: area-in 1.1s var(--ease-out) both, event-pulse 1.8s ease-in-out 1.1s infinite; }
.leaflet-pane path.event-new-dot { animation: lock-on 1s var(--ease-out) both; }
.leaflet-pane path.event-new-dot.event-fresh-dot { animation: lock-on 1s var(--ease-out) both, event-dot 1.8s ease-in-out 1s infinite; }
@keyframes event-pulse { 0%, 100% { stroke-opacity: 1; stroke-width: 3px; } 50% { stroke-opacity: .45; stroke-width: 6px; } }
@keyframes event-dot { 0%, 100% { stroke-width: 1.8px; } 50% { stroke-width: 5px; stroke-opacity: .6; } }
@keyframes area-in { 0% { fill-opacity: 0; stroke-opacity: 0; stroke-width: 14px; } 45% { stroke-opacity: 1; } }
@keyframes lock-on { 0% { stroke-width: 46px; stroke-opacity: 0; } 50% { stroke-opacity: .7; } 100% { stroke-width: 1.8px; stroke-opacity: 1; } }

/* ── boot & page transitions ─────────────── */
.boot-cover { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; background: #0a0d10; pointer-events: none; clip-path: inset(0 0 0 0); }
.boot-cover span { font-family: var(--mono); font-size: 11px; letter-spacing: .3em; color: #5c686f; opacity: 0; animation: fade-up .5s ease .1s forwards; }
.boot-cover.off { clip-path: inset(0 0 100% 0); transition: clip-path .9s var(--ease); }
.leave-cover { position: fixed; inset: 0; z-index: 2000; background: #0a0d10; pointer-events: none; clip-path: inset(100% 0 0 0); transition: clip-path .55s var(--ease); }
.leave-cover.on { clip-path: inset(0 0 0 0); }
body.booting .map-canvas { opacity: 0; transform: scale(1.035); }
body.booting .topbar { opacity: 0; transform: translateY(-14px); }
body.booting .activity-panel { opacity: 0; transform: translateX(28px); }
body.booting .place-search, body.booting .legend, body.booting .leaflet-control-container .leaflet-control { opacity: 0; transform: translateY(10px); }
body.booted .map-canvas { transition: opacity 1s ease, transform 1.4s var(--ease-out); }
body.booted .topbar { transition: opacity .7s ease .15s, transform .9s var(--ease-out) .15s; }
body.booted .activity-panel { transition: opacity .7s ease .28s, transform 1s var(--ease-out) .28s; }
body.booted .place-search { transition: opacity .6s ease .38s, transform .9s var(--ease-out) .38s; }
body.booted .legend { transition: opacity .6s ease .46s, transform .9s var(--ease-out) .46s; }
body.booted .leaflet-control-container .leaflet-control { transition: opacity .6s ease .5s, transform .9s var(--ease-out) .5s; }

/* theme change: circular reveal from the switch */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: theme-reveal .75s var(--ease) both; }
@keyframes theme-reveal { from { clip-path: circle(0 at var(--vt-x, 100%) var(--vt-y, 0)); } to { clip-path: circle(var(--vt-r, 150vmax) at var(--vt-x, 100%) var(--vt-y, 0)); } }

/* ── UAV course icons (uav-tracks.js) ────── */
.uav-icon { background: none; border: 0; }
.uav-icon-body { width: 34px; height: 34px; transform-origin: 50% 50%; filter: drop-shadow(0 0 2px rgba(0,0,0,.9)) drop-shadow(0 1px 3px rgba(0,0,0,.6)); cursor: pointer; }
.uav-icon-body svg { display: block; }
.uav-icon-fly { animation: uav-fly 3.2s ease-in-out infinite; }
@keyframes uav-fly { 0%, 100% { transform: translateY(2px); } 50% { transform: translateY(-6px); } }
.uav-shot svg { display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.uav-tools { margin: 8px 12px 0 0 !important; border-radius: 12px !important; overflow: hidden; }
.uav-tools .uav-tool { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer; transition: background .25s, color .3s; }
.uav-tools .uav-tool:hover { background: var(--surface-hover); }
.uav-tools .uav-tool:last-child { border-bottom: 0; }
.uav-tool[aria-pressed="true"] { color: #FFA000; }
.uav-tool[aria-pressed="true"] .uav-off-slash { display: none; }
.uav-tool[aria-pressed="false"] { color: var(--muted); }
.uav-tool.busy svg { animation: uav-spin .8s linear infinite; }
@keyframes uav-spin { to { transform: rotate(360deg); } }

/* ── «История» timeline (map-history.js) ── */
.mh-ctl { margin: 8px 12px 0 0 !important; border-radius: 12px !important; }
.mh-tool { width: 40px !important; height: 40px !important; background: transparent !important; transition: background .25s, color .3s; }
.mh-tool:hover { background: var(--surface-hover) !important; }
.mh-tool[aria-pressed="true"], :root[data-theme="dark"] .mh-tool[aria-pressed="true"] { color: #FFA000 !important; }
.mh-bar { --mh-left: var(--gap); --mh-right: calc(var(--sidebar) + var(--gap) * 2); --mh-bottom: 30px; border-radius: var(--r) !important; padding: 12px 14px 10px !important; animation: sheet-up .6s var(--spring); }
.mh-title b { font-family: var(--mono); font-weight: 500 !important; }
.mh-strip { border-radius: 6px !important; }
.mh-btn, .mh-seg { border-radius: 9px !important; }
.mh-live, :root[data-theme="dark"] .mh-live { color: #FFA000 !important; }
@keyframes sheet-up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
body.mh-on .detail-panel { bottom: 200px; }
body.mh-on .map-message { bottom: 200px; }
body.mh-on .legend { opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity .3s, transform .4s var(--ease-out); }

/* ── «Линейка» (map-ruler.js) ── */
.rl-bar { --rl-left: var(--gap); --rl-right: calc(var(--sidebar) + var(--gap) * 2); --rl-bottom: 30px; border-radius: var(--r) !important; }
body.rl-on .legend { opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity .3s, transform .4s var(--ease-out); }
body.rl-on .detail-panel { display: none; }

/* embedded in the app (no top bar) */
body.embed { --header: 0px; }
body.embed .topbar { display: none; }
body.embed .leaflet-top { top: 0; }
body.embed .place-search, body.embed .activity-panel { top: var(--gap); }

/* ── responsive ──────────────────────────── */
@media (max-width: 1180px) { .topbar-status .summary { display: none; } .topbar { gap: 20px; } :root { --sidebar: 316px; } }
@media (max-width: 760px) {
  :root { --header: 56px; --sidebar: 0px; --gap: 8px; --feed-height: 214px; --r: 16px; }
  .topbar { padding: 0 6px 0 8px; gap: 8px; border-radius: 14px; }
  .brand { gap: 8px; }
  .brand-logo { width: 32px; height: 32px; border-radius: 8px; }
  .brand-copy strong { font-size: 11px; letter-spacing: .12em; }
  .brand-copy small { font-size: 8.5px; }
  .topbar-status, .text-link { display: none; }
  .top-actions { gap: 5px; }
  .theme-switch button { padding: 0 9px; font-size: 11px; min-height: 32px; }
  .icon-button { width: 38px; height: 38px; }
  .game-button { min-height: 38px; padding: 0 12px; }
  .map-canvas { bottom: calc(var(--feed-height) - 18px); }
  .leaflet-right { right: 0; }
  .leaflet-control-zoom { margin: 8px 8px 0 0 !important; }
  .uav-tools, .mh-ctl, .rl-ctl { margin-right: 8px !important; }
  .leaflet-bottom { bottom: 18px; }
  .leaflet-control-scale { display: none; }
  .place-search { top: calc(var(--header) + var(--gap) * 2); left: var(--gap); width: calc(100% - 72px); max-width: 320px; }
  .legend { bottom: calc(var(--feed-height) + 10px); left: var(--gap); max-width: calc(100% - 24px); }
  .legend summary { padding: 9px 12px; }
  .legend-items { gap: 8px 14px; padding: 0 12px 11px; }
  .legend-item { font-size: 11px; }
  .activity-panel { top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: var(--feed-height); border-radius: 20px 20px 0 0; border-bottom: 0 !important; border-left: 0 !important; border-right: 0 !important; }
  .activity-panel::before { content: ""; position: absolute; top: 7px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 4px; background: var(--line-2); }
  .activity-head { padding: 18px 16px 8px; align-items: center; min-height: 52px; }
  .activity-head .eyebrow, .activity-sub, .activity-foot { display: none; }
  .activity-head h1 { margin: 0; font-size: 18px; }
  .feed-count { height: 24px; font-size: 11px; }
  .feed-toggle { display: block; border: 0; padding: 6px 0 6px 10px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 500; }
  .activity-feed { display: flex; padding: 2px 12px 14px; gap: 8px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; -webkit-mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 24px), transparent); scrollbar-width: none; }
  .activity-feed::-webkit-scrollbar { display: none; }
  .feed-item { flex: 0 0 248px; margin: 0; padding: 12px 14px 12px 20px; background: var(--surface); border: 1px solid var(--line); scroll-snap-align: start; }
  .feed-empty { flex: 1; margin: 0 4px; }
  .feed-item strong { font-size: 14px; margin-top: 6px; }
  .feed-item small { font-size: 11.5px; }
  .feed-tags { margin-top: 7px; }
  .feed-item.enter { animation-name: feed-in-m; }
  @keyframes feed-in-m { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: var(--age-opacity, 1); transform: none; } }
  .detail-panel { z-index: 790; bottom: calc(var(--feed-height) + 10px); left: var(--gap); right: var(--gap); width: auto; max-height: 40%; padding: 15px 52px 15px 18px; transform-origin: bottom center; }
  .detail-panel h2 { font-size: 18px; }
  .map-message { bottom: calc(var(--feed-height) + 60px); max-width: calc(100% - 16px); }
  body.feed-collapsed { --feed-height: 58px; }
  body.feed-collapsed .activity-feed { display: none; }
  body.booting .activity-panel { transform: translateY(40px); }
  .rl-bar { --rl-left: 8px; --rl-right: 8px; --rl-bottom: calc(var(--feed-height) + 8px); }
  .mh-bar { --mh-left: 8px; --mh-right: 8px; --mh-bottom: calc(var(--feed-height) + 8px); }
  body.mh-on .detail-panel { bottom: calc(var(--feed-height) + 160px); }
  body.mh-on .map-message { bottom: calc(var(--feed-height) + 160px); }
  body.embed .place-search { top: var(--gap); }
  body.embed .activity-panel { top: auto; }
}
@media (max-width: 480px) {
  .game-button { padding: 0 10px; } .game-button .gb-full { display: none; } .game-button .gb-short { display: inline; }
  .theme-switch button { padding: 0 7px; }
}
@media (max-width: 360px) { .brand-logo { display: none; } .brand-copy small { display: none; } }
@media (max-height: 500px) and (max-width: 760px) { :root { --feed-height: 58px; } .activity-feed { display: none; } .feed-toggle { display: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  body.booting .map-canvas, body.booting .topbar, body.booting .activity-panel, body.booting .place-search, body.booting .legend, body.booting .leaflet-control { opacity: 1 !important; transform: none !important; }
  .boot-cover { display: none; }
}
