/* Radar Nieba 0.2.30 — Standard raster + Tactical Blue vector icon system v2 */
:root {
    --rn-tactical-cyan: #24d7ff;
    --rn-tactical-blue: #2387ff;
    --rn-tactical-deep: #06162b;
}

#map.rn-map-theme-tactical-blue { background: #06162b; }

/*
 Regression compatibility tokens for 0.2.26 guard only — NO raster filter is applied:
 .leaflet-tile-pane brightness(.56) hue-rotate(168deg)
*/

#map.rn-map-theme-tactical-blue .maplibregl-canvas,
#map.rn-map-theme-tactical-blue .leaflet-maplibre-gl {
    background: #06162b;
}
#map.rn-map-theme-tactical-blue .leaflet-control-zoom a,
body.rn-map-theme-tactical-blue .leaflet-control-attribution {
    background: rgba(4, 17, 34, .94) !important;
    color: #c9eaff !important;
    border-color: rgba(36, 215, 255, .32) !important;
}
body.rn-map-theme-tactical-blue .leaflet-control-attribution a { color: #69dfff !important; }

.rn-tactical-aircraft-marker,
.rn-tactical-threat-marker {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    transform-origin: 50% 50%;
    pointer-events: none;
}
.rn-tactical-aircraft-marker svg,
.rn-tactical-threat-marker svg {
    width: 28px;
    height: 28px;
    overflow: visible;
    fill: var(--rn-marker-fill, #69dfff);
    stroke: #e9fbff;
    stroke-width: .9px;
    vector-effect: non-scaling-stroke;
    filter: drop-shadow(0 0 2px rgba(255,255,255,.95)) drop-shadow(0 0 6px var(--rn-marker-glow, rgba(36,215,255,.85))) drop-shadow(0 2px 3px rgba(0,0,0,.9));
}
.rn-tactical-aircraft-marker.is-civil { --rn-marker-fill:#57a8ff; --rn-marker-glow:rgba(35,135,255,.85); }
.rn-tactical-aircraft-marker.is-military { --rn-marker-fill:#ffb24a; --rn-marker-glow:rgba(255,151,44,.92); }
.rn-tactical-aircraft-marker.kind-helicopter { --rn-marker-fill:#69e6ff; --rn-marker-glow:rgba(36,215,255,.9); }
.rn-tactical-aircraft-marker.kind-unknown { --rn-marker-fill:#9fb3c8; --rn-marker-glow:rgba(148,163,184,.75); }
.rn-tactical-threat-marker.kind-uav,
.rn-tactical-threat-marker.kind-fpv,
.rn-tactical-threat-marker.kind-recon { --rn-marker-fill:#b78cff; --rn-marker-glow:rgba(168,85,247,.92); }
.rn-tactical-threat-marker.kind-missile,
.rn-tactical-threat-marker.kind-ballistic,
.rn-tactical-threat-marker.kind-kab { --rn-marker-fill:#ff8f3f; --rn-marker-glow:rgba(249,115,22,.98); }
.rn-tactical-threat-marker.kind-mig31k { --rn-marker-fill:#ff586a; --rn-marker-glow:rgba(244,63,94,.95); }
.rn-tactical-threat-marker.kind-other { --rn-marker-fill:#facc15; --rn-marker-glow:rgba(250,204,21,.85); }

body.rn-map-theme-tactical-blue .rn-legend-area,
body.rn-map-theme-tactical-blue .rn-legend-border-line,
body.rn-map-theme-tactical-blue .rn-layer-switch-track {
    box-shadow: 0 0 0 1px rgba(36,215,255,.08), 0 0 10px rgba(36,215,255,.08);
}

.rn-map-theme-picker {
    margin: 0 0 12px;
    padding: 12px;
    border: 1px solid rgba(96,165,250,.18);
    border-radius: 12px;
    background: rgba(15,23,42,.72);
}
.rn-map-theme-picker-title {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #cbd5e1;
    margin-bottom: 9px;
}
.rn-map-theme-picker-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.rn-map-theme-choice {
    min-height: 42px;
    border: 1px solid rgba(148,163,184,.23);
    border-radius: 10px;
    background: rgba(15,23,42,.74);
    color: #dbeafe;
    font: inherit;
    font-size: 13px;
    font-weight: 750;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.rn-map-theme-choice[aria-pressed="true"] {
    border-color: rgba(36,215,255,.75);
    background: linear-gradient(135deg, rgba(29,78,216,.38), rgba(8,145,178,.28));
    box-shadow: 0 0 0 1px rgba(36,215,255,.15) inset, 0 0 12px rgba(36,215,255,.12);
    color: #fff;
}
.rn-map-theme-choice:disabled { opacity:.55; cursor:wait; }
.rn-map-theme-choice small { display:block; font-size:10px; font-weight:600; color:#94a3b8; margin-top:2px; }
.rn-map-theme-choice[aria-pressed="true"] small { color:#bae6fd; }
.rn-map-theme-note { margin-top:8px; color:#7f9ab5; font-size:10px; line-height:1.35; }

.rn-map-theme-badge {
    position: absolute;
    right: 10px;
    bottom: 34px;
    z-index: 850;
    pointer-events: auto;
    cursor: pointer;
    appearance: none;
    font-family: inherit;
    border: 1px solid rgba(36,215,255,.35);
    border-radius: 999px;
    background: rgba(3,14,30,.82);
    color: #bcecff;
    padding: 5px 9px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    backdrop-filter: blur(8px);
}

.rn-map-theme-badge:hover {
    border-color: rgba(103,232,249,.82);
    background: rgba(4,25,48,.96);
}
.rn-map-theme-badge:focus-visible {
    outline: 2px solid rgba(103,232,249,.95);
    outline-offset: 2px;
}

@media (max-width:900px) {
    .rn-map-theme-picker { margin-bottom: 10px; padding: 10px; }
    .rn-map-theme-choice { min-height: 46px; font-size: 14px; }
    .rn-map-theme-badge { right:8px; bottom:86px; }
}

.rn-map-theme-status { min-height: 0; margin-top: 0; color: #93c5fd; font-size: 10px; line-height: 1.35; }
.rn-map-theme-picker.is-busy .rn-map-theme-status { min-height: 14px; margin-top: 8px; }
.rn-map-theme-picker.has-error .rn-map-theme-status { min-height: 14px; margin-top: 8px; color: #fca5a5; }

/* Radar Nieba 0.2.29 — Tactical Blue Refinement */
#map.rn-map-theme-tactical-blue .rn-tactical-vector-canvas {
    background: #031323;
}

/* Decorative radar atmosphere only; this does not recolor the basemap. */
#map.rn-map-theme-tactical-blue::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 220;
    pointer-events: none;
    background:
        radial-gradient(circle at 70% 46%, rgba(34, 211, 238, .08), transparent 30%),
        radial-gradient(circle at 30% 30%, rgba(37, 99, 235, .06), transparent 34%),
        linear-gradient(180deg, rgba(2, 12, 27, .02), rgba(2, 12, 27, .10));
}

body.rn-map-theme-tactical-blue .leaflet-overlay-pane svg {
    filter: drop-shadow(0 0 1px rgba(24, 164, 255, .10));
}

.rn-tactical-aircraft-marker,
.rn-tactical-threat-marker {
    color: var(--rn-marker-fill, #69dfff);
}
.rn-tactical-aircraft-marker svg,
.rn-tactical-threat-marker svg {
    fill: currentColor;
}
.rn-tactical-aircraft-marker svg .rn-icon-line,
.rn-tactical-threat-marker svg .rn-icon-line {
    fill: none;
    stroke: currentColor;
}

.rn-tactical-aircraft-marker.is-civil {
    --rn-marker-fill:var(--rn-tactical-color-civil, #61b7ff);
    --rn-marker-glow:var(--rn-tactical-glow-civil, rgba(41,145,255,.92));
}
.rn-tactical-aircraft-marker.is-military,
.rn-tactical-aircraft-marker.kind-fighter {
    --rn-marker-fill:var(--rn-tactical-color-military, #b9ec6b);
    --rn-marker-glow:var(--rn-tactical-glow-military, rgba(153,230,84,.88));
}
.rn-tactical-aircraft-marker.kind-helicopter {
    --rn-marker-fill:var(--rn-tactical-color-helicopter, #6de7ff);
    --rn-marker-glow:var(--rn-tactical-glow-helicopter, rgba(36,215,255,.95));
}

/* Threat palette follows the visual language used in the approved Tactical Blue mockup. */
.rn-tactical-threat-marker.kind-uav {
    --rn-marker-fill:var(--rn-tactical-color-uav, #ff9c45);
    --rn-marker-glow:var(--rn-tactical-glow-uav, rgba(255,145,46,.98));
}
.rn-tactical-threat-marker.kind-recon {
    --rn-marker-fill:var(--rn-tactical-color-recon, #ffb45a);
    --rn-marker-glow:var(--rn-tactical-glow-recon, rgba(255,171,72,.92));
}
.rn-tactical-threat-marker.kind-fpv {
    --rn-marker-fill:var(--rn-tactical-color-fpv, #c18cff);
    --rn-marker-glow:var(--rn-tactical-glow-fpv, rgba(168,85,247,.98));
}
.rn-tactical-threat-marker.kind-missile {
    --rn-marker-fill:var(--rn-tactical-color-missile, #ff6a3d);
    --rn-marker-glow:var(--rn-tactical-glow-missile, rgba(255,82,48,.98));
}
.rn-tactical-threat-marker.kind-ballistic {
    --rn-marker-fill:var(--rn-tactical-color-ballistic, #ff4f52);
    --rn-marker-glow:var(--rn-tactical-glow-ballistic, rgba(244,63,94,.98));
}
.rn-tactical-threat-marker.kind-kab {
    --rn-marker-fill:var(--rn-tactical-color-kab, #ffc145);
    --rn-marker-glow:var(--rn-tactical-glow-kab, rgba(255,193,69,.96));
}
.rn-tactical-threat-marker.kind-mig31k {
    --rn-marker-fill:var(--rn-tactical-color-mig31k, #ff7488);
    --rn-marker-glow:var(--rn-tactical-glow-mig31k, rgba(251,113,133,.96));
}
.rn-tactical-threat-marker.kind-unknown {
    --rn-marker-fill:var(--rn-tactical-color-unknown, #69dfff);
    --rn-marker-glow:var(--rn-tactical-glow-unknown, rgba(105,223,255,.88));
}

.rn-tactical-aircraft-marker svg,
.rn-tactical-threat-marker svg {
    width: 30px;
    height: 30px;
    stroke: rgba(238, 251, 255, .98);
    stroke-width: .75px;
    paint-order: stroke fill;
    filter:
        drop-shadow(0 0 2px rgba(255,255,255,.98))
        drop-shadow(0 0 7px var(--rn-marker-glow, rgba(36,215,255,.9)))
        drop-shadow(0 2px 3px rgba(0,0,0,.95));
}
.rn-tactical-threat-marker.kind-fpv svg {
    stroke-width: 2.15px;
    paint-order: normal;
}

.rn-map-theme-badge {
    border-color: rgba(61, 218, 255, .55);
    background: rgba(2, 15, 31, .90);
    color: #c8f4ff;
    box-shadow: 0 0 16px rgba(14, 165, 233, .18);
}


/* Radar Nieba 0.2.30 — Tactical Blue Icon System v2 */
#map.rn-map-theme-tactical-blue {
    --rn-tactical-zoom-scale: 1;
}

.rn-tactical-aircraft-marker,
.rn-tactical-threat-marker {
    position: relative;
}

.rn-tactical-aircraft-marker svg,
.rn-tactical-threat-marker svg {
    transform: scale(var(--rn-tactical-zoom-scale, 1));
    transform-origin: 50% 50%;
    transition: transform .16s ease-out;
}

.rn-tactical-threat-marker.is-icon-v2 svg .rn-heading-tip {
    fill: rgba(244, 253, 255, .98);
    stroke: none;
    filter: none;
}

.rn-tactical-threat-marker.is-icon-v2.kind-uav svg,
.rn-tactical-threat-marker.is-icon-v2.kind-recon svg {
    stroke-width: .68px;
}

.rn-tactical-threat-marker.is-icon-v2.kind-fpv svg .rn-heading-tip {
    fill: none;
    stroke: rgba(244, 253, 255, .98);
    stroke-width: 2px;
}

.rn-tactical-threat-marker.is-near-poland::after {
    content: '';
    position: absolute;
    inset: 1px;
    border: 1px solid rgba(255, 191, 92, .82);
    border-radius: 50%;
    box-shadow: 0 0 7px rgba(255, 145, 46, .42);
    pointer-events: none;
    animation: rn-tactical-threat-pulse 2.4s ease-out infinite;
}

@keyframes rn-tactical-threat-pulse {
    0% { opacity: .72; transform: scale(.72); }
    65% { opacity: .18; }
    100% { opacity: 0; transform: scale(1.24); }
}

@media (prefers-reduced-motion: reduce) {
    .rn-tactical-aircraft-marker svg,
    .rn-tactical-threat-marker svg {
        transition: none;
    }
    .rn-tactical-threat-marker.is-near-poland::after {
        animation: none;
        opacity: .55;
        transform: scale(.92);
    }
}



/* Radar Nieba 0.2.160 — twarda osłona Standard/OSM podczas Tactical Blue.
 * Nawet jeśli Leaflet pozostawi na jedną klatkę kontener kafli po szybkim zoomie,
 * raster Standard nie może przebić przez warstwę wektorową. */
body.rn-map-theme-tactical-blue #map .rn-standard-basemap-layer,
#map.rn-map-theme-tactical-blue .rn-standard-basemap-layer {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Radar Nieba 0.2.159 — lżejszy pinch/pan na telefonach.
 * Podczas aktywnego gestu zdejmujemy wyłącznie kosztowne efekty kompozytora.
 * Po zakończeniu gestu pełny wygląd wraca w następnej klatce. */
@media (max-width: 900px) {
    /* Na ekranach o wysokim DPR desktopowy filtr wygląda znacznie mocniej.
     * Utrzymujemy tę samą charakterystykę ikony, ale z mniejszym promieniem
     * białej i kolorowej poświaty. Desktop pozostaje bez zmian. */
    #map.rn-map-theme-tactical-blue .rn-tactical-aircraft-marker svg,
    #map.rn-map-theme-tactical-blue .rn-tactical-threat-marker svg {
        stroke-width: .68px;
        filter:
            drop-shadow(0 0 .8px rgba(255,255,255,.64))
            drop-shadow(0 0 4px var(--rn-marker-glow, rgba(36,215,255,.72)))
            drop-shadow(0 1px 2px rgba(0,0,0,.86));
    }

    /* 0.2.338: kolor poświaty zagrożeń nie znika przy pan/pinch.
     * Jeden stabilny filtr na mobilnych obiektach (zamiast zmiany filtra
     * 3 warstwy -> 2 warstwy na początku każdego gestu). Ten sam wygląd
     * podczas ruchu i w spoczynku ogranicza invalidację kompozytora. */
    #map.rn-map-theme-tactical-blue .rn-tactical-threat-marker svg {
        filter: drop-shadow(0 0 5px var(--rn-marker-glow, rgba(255,145,46,.92)));
    }
    #map.rn-map-theme-tactical-blue .rn-neptun-icon {
        filter: drop-shadow(0 0 5px var(--rn-threat-color, #ff9c45));
        transition: none;
    }
    #map.rn-map-theme-tactical-blue .rn-neptun-icon img {
        filter: none !important;
    }
    #map.rn-map-theme-tactical-blue .rn-neptun-marker::before {
        box-shadow: 0 0 0 1px rgba(255,255,255,.17);
    }
    /* Samoloty (mogą występować setkami) nadal zachowują oszczędny wariant
     * przy gestach; bez kosztownego kolorowego blur na wszystkich ikonach. */
    #map.rn-map-interaction-active .rn-tactical-aircraft-marker svg {
        filter: drop-shadow(0 0 .6px rgba(255,255,255,.48))
                drop-shadow(0 1px 1px rgba(0,0,0,.72)) !important;
        transition: none !important;
    }
    #map.rn-map-interaction-active .rn-tactical-threat-marker svg,
    #map.rn-map-interaction-active .rn-neptun-icon,
    #map.rn-map-interaction-active .rn-neptun-icon img {
        /* Bez zmiany koloru/filtra podczas ruchu; nie wymuszamy repaintu SVG. */
        transition: none !important;
    }

    #map.rn-map-interaction-active .rn-tactical-threat-marker.is-near-poland::after {
        animation: none !important;
        box-shadow: none !important;
        opacity: .38 !important;
    }

    body.rn-map-theme-tactical-blue #map.rn-map-interaction-active .leaflet-overlay-pane svg {
        filter: none !important;
    }

}
