:root {

    --bg-primary: #0a0a0c;

    --bg-surface: rgba(18, 18, 22, 0.75);

    --border-color: rgba(255, 255, 255, 0.08);

    --text-primary: #f3f4f6;

    --text-secondary: #9ca3af;

    --accent-red: #ef4444;

    --accent-red-glow: rgba(239, 68, 68, 0.2);

    --accent-orange: #f97316;

    --accent-orange-glow: rgba(249, 115, 22, 0.2);

    --accent-yellow: #eab308;

    --accent-blue: #3b82f6;

    --accent-cyan: #06b6d4;

    --accent-green: #10b981;

    --accent-purple: #e11d48;

    --accent-violet: #a855f7;

    --accent-muted: #94a3b8;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    --sidebar-width: 390px;

}

* {

    box-sizing: border-box;

    margin: 0;

    padding: 0;

}

body, html {

    width: 100%;

    height: 100%;

    font-family: var(--font-sans);

    background-color: var(--bg-primary);

    color: var(--text-primary);

    overflow: hidden;

}

#app-container {

    display: flex;

    /* Source order is backdrop → sidebar → map; use order so web keeps map left / sidebar right
       without relying on row-reverse (critical CSS in index.html paints the same before this loads). */
    flex-direction: row;

    width: 100vw;

    height: 100vh;

    position: relative;

}

#sidebar-backdrop {
    order: 0;
}

#map-container {
    order: 1;
}

#sidebar {
    order: 2;
}

/* Mini App: sidebar first (left), map second */
body.is-telegram #sidebar {
    order: 0;
}

body.is-telegram #map-container {
    order: 1;
}

/* Glassmorphism Panel style - Liquid Glass effect */

.glass-panel {

    background: rgba(10, 10, 12, 0.55);

    backdrop-filter: blur(24px) saturate(180%);

    -webkit-backdrop-filter: blur(24px) saturate(180%);

    border: 1px solid rgba(255, 255, 255, 0.08);

    border-top-color: rgba(255, 255, 255, 0.16);

    border-left-color: rgba(255, 255, 255, 0.12);

    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65), inset 0 0 24px rgba(255, 255, 255, 0.02);

}

/* Sidebar */

#sidebar {

    width: min(var(--sidebar-width), 100vw);

    height: 100%;

    z-index: 1000;

    display: flex;

    flex-direction: column;

    transition: transform 0.3s ease;

    flex-shrink: 0;

}

#sidebar header {

    padding: 24px;

    border-bottom: 1px solid var(--border-color);

    display: grid;

    grid-template-columns: minmax(0, 1fr) auto;

    gap: 12px;

    align-items: center;

}

.sidebar-heading {

    min-width: 0;

}

.sidebar-title-row {

    display: flex;

    align-items: center;

    gap: 9px;

    min-width: 0;

}

#site-title {

    font-size: 1.25rem;

    font-weight: 600;

    letter-spacing: -0.025em;

    line-height: 1.2;

}

.connection-dot {

    width: 8px;

    height: 8px;

    border-radius: 50%;

    background: var(--accent-green);

    box-shadow: 0 0 9px rgba(16, 185, 129, 0.75);

    flex: 0 0 auto;

}

.connection-dot.is-loading {

    background: var(--accent-yellow);

    box-shadow: 0 0 9px rgba(234, 179, 8, 0.65);

}

.connection-dot.is-offline {

    background: var(--accent-red);

    box-shadow: 0 0 9px rgba(239, 68, 68, 0.75);

}

.last-updated {

    margin-top: 5px;

    padding-left: 17px;

    color: var(--text-secondary);

    font-size: 0.75rem;

    line-height: 1.25;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;

}

.badge {

    background: rgba(239, 68, 68, 0.15);

    color: var(--accent-red);

    border: 1px solid rgba(239, 68, 68, 0.3);

    padding: 4px 10px;

    border-radius: 9999px;

    font-size: 0.75rem;

    font-weight: 600;

    transition: all 0.3s ease;

    white-space: nowrap;

}

.badge.safe {

    background: rgba(16, 185, 129, 0.15);

    color: var(--accent-green);

    border: 1px solid rgba(16, 185, 129, 0.3);

}

.icon-btn {

    border: 0;

    background: transparent;

    color: var(--text-secondary);

    width: 40px;

    height: 40px;

    border-radius: 10px;

    cursor: pointer;

    align-items: center;

    justify-content: center;

}

.icon-btn:hover,

.icon-btn:focus-visible {

    color: var(--text-primary);

    background: rgba(255, 255, 255, 0.07);

    outline: none;

}

.close-sidebar-btn {

    display: none;

}

.legend {

    display: flex;

    flex-wrap: wrap;

    gap: 7px;

    padding: 12px 16px;

    border-bottom: 1px solid var(--border-color);

    background: rgba(0, 0, 0, 0.08);

}

.legend-item {

    display: inline-flex;

    align-items: center;

    gap: 5px;

    color: var(--text-secondary);

    font-size: 0.75rem;

    font-weight: 500;

}

.legend-dot {

    width: 7px;

    height: 7px;

    border-radius: 50%;

    background: currentColor;

    box-shadow: 0 0 7px currentColor;

}

.legend-critical { color: var(--accent-red); }

.legend-uav { color: var(--accent-orange); }

.legend-pvo { color: var(--accent-blue); }

.legend-other { color: var(--accent-yellow); }

.about-map {

    flex: 0 0 auto;

    border-bottom: 1px solid var(--border-color);

    background: rgba(0, 0, 0, 0.05);

}

.about-map summary {

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 10px;

    min-height: 34px;

    padding: 8px 16px;

    color: var(--text-secondary);

    font-size: 0.75rem;

    font-weight: 500;

    cursor: pointer;

    list-style: none;

    user-select: none;

}

.about-map summary::-webkit-details-marker { display: none; }

.about-map summary::after {

    content: '+';

    color: rgba(255, 255, 255, 0.45);

    font-size: 1rem;

    line-height: 1;

    transition: transform 0.2s ease;

}

.about-map[open] summary::after { transform: rotate(45deg); }

.about-map summary:hover,

.about-map summary:focus-visible {

    color: var(--text-primary);

    background: rgba(255, 255, 255, 0.035);

    outline: none;

}

.about-map-content {

    max-height: min(42vh, 360px);

    overflow-y: auto;

    padding: 2px 16px 14px;

    color: var(--text-secondary);

    font-size: 0.75rem;

    line-height: 1.45;

}

.about-map-content h2 {

    margin: 7px 0 10px;

    color: var(--text-primary);

    font-size: 0.88rem;

    line-height: 1.3;

}

.about-map-content h3 {

    margin: 10px 0 3px;

    color: rgba(255, 255, 255, 0.78);

    font-size: 0.78rem;

    line-height: 1.35;

}

.scroll-container {

    flex-grow: 1;

    overflow-y: auto;

    padding: 16px;

    scrollbar-width: thin;

    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;

}

.scroll-container::-webkit-scrollbar { width: 8px; }

.scroll-container::-webkit-scrollbar-track { background: transparent; }

.scroll-container::-webkit-scrollbar-thumb {

    background: rgba(255, 255, 255, 0.16);

    border-radius: 999px;

    border: 2px solid transparent;

    background-clip: padding-box;

}

/* Sidebar list items */

.threat-item {

    display: block;

    width: 100%;

    background: rgba(255, 255, 255, 0.02);

    border: 1px solid var(--border-color);

    color: var(--text-primary);

    font: inherit;

    text-align: left;

    border-radius: 12px;

    padding: 16px;

    margin-bottom: 12px;

    cursor: pointer;

    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;

}

.threat-item:hover {

    background: rgba(255, 255, 255, 0.05);

    border-color: rgba(255, 255, 255, 0.15);

    transform: translateY(-2px);

}

.threat-item.active-selection {

    background: color-mix(in srgb, var(--threat-color, #ffffff) 8%, rgba(255, 255, 255, 0.02));

    border-color: var(--threat-color, rgba(255, 255, 255, 0.35));

}

.threat-item:focus-visible {

    outline: 2px solid rgba(255, 255, 255, 0.8);

    outline-offset: 2px;

}

.threat-item-header {

    display: flex;

    justify-content: space-between;

    align-items: flex-start;

    gap: 10px;

    margin-bottom: 8px;

}

.threat-item-title {

    font-weight: 600;

    font-size: 0.95rem;

    line-height: 1.3;

    min-width: 0;

}

.threat-item-time {

    font-size: 0.75rem;

    color: var(--text-secondary);

    white-space: nowrap;

    flex: 0 0 auto;

}

.threat-item-kind {

    display: inline-flex;

    align-items: center;

    gap: 6px;

    font-size: 0.8rem;

    font-weight: 500;

    margin-bottom: 8px;

    padding: 2px 8px;

    border-radius: 6px;

}

.kind-uav { background: rgba(249, 115, 22, 0.1); color: var(--accent-orange); }

.kind-missile { background: rgba(239, 68, 68, 0.1); color: var(--accent-red); }

.kind-pvo { background: rgba(59, 130, 246, 0.1); color: var(--accent-blue); }

.kind-artillery { background: rgba(234, 179, 8, 0.1); color: var(--accent-yellow); }

.kind-flamingo { background: rgba(225, 29, 72, 0.15); color: #fda4af; }

.kind-aviation { background: rgba(168, 85, 247, 0.13); color: #c4b5fd; }

.kind-naval { background: rgba(6, 182, 212, 0.13); color: #67e8f9; }

.kind-pvo-prepare { background: rgba(59, 130, 246, 0.08); color: #93c5fd; }

.kind-unknown { background: rgba(148, 163, 184, 0.12); color: var(--accent-muted); }

.threat-item-note {

    font-size: 0.85rem;

    color: var(--text-secondary);

    line-height: 1.4;

    display: -webkit-box;

    -webkit-box-orient: vertical;

    -webkit-line-clamp: 3;

    overflow: hidden;

    white-space: pre-line;

}

.threat-item-note.is-empty {

    display: none;

}

#sidebar footer {

    padding: 16px;

    border-top: 1px solid var(--border-color);

}

.btn {

    width: 100%;

    background: rgba(255, 255, 255, 0.04);

    border: 1px solid rgba(255, 255, 255, 0.08);

    border-top-color: rgba(255, 255, 255, 0.15);

    color: var(--text-primary);

    padding: 12px;

    border-radius: 12px;

    font-family: var(--font-sans);

    font-size: 0.9rem;

    font-weight: 500;

    cursor: pointer;

    display: inline-flex;

    align-items: center;

    justify-content: center;

    gap: 8px;

    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.05);

}

.btn:hover {

    background: rgba(255, 255, 255, 0.08);

    border-color: rgba(255, 255, 255, 0.18);

    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.1);

    transform: translateY(-1px);

}

.btn-telegram:hover {

    background: rgba(0, 136, 204, 0.25) !important;

    border-color: rgba(0, 136, 204, 0.5) !important;

    box-shadow: 0 6px 20px rgba(0, 136, 204, 0.3) !important;

}

.btn:focus-visible,

.floating-btn:focus-visible {

    outline: 2px solid rgba(255, 255, 255, 0.85);

    outline-offset: 2px;

}

/* Map Area */

#map-container {

    flex-grow: 1;

    height: 100%;

    position: relative;

}

#map {

    width: 100%;

    height: 100%;

    background: var(--bg-primary);

}

/* Dark mode overrides for Leaflet */

.leaflet-container {

    background-color: var(--bg-primary) !important;

}

/* Custom leaflet popup */

.leaflet-popup-content-wrapper {

    background: var(--bg-surface) !important;

    backdrop-filter: blur(15px);

    -webkit-backdrop-filter: blur(15px);

    border: 1px solid var(--border-color);

    color: var(--text-primary) !important;

    border-radius: 12px !important;

    box-shadow: 0 4px 20px rgba(0,0,0,0.5) !important;

}

.leaflet-popup-tip {

    background: rgba(18, 18, 22, 0.9) !important;

    border: 1px solid var(--border-color);

}

.popup-content h3 {

    font-size: 1rem;

    font-weight: 600;

    margin-bottom: 6px;

    border-bottom: 1px solid var(--border-color);

    padding-bottom: 6px;

}

.popup-content p {

    font-size: 0.85rem;

    line-height: 1.4;

    color: var(--text-secondary);

}

/* Custom threat marker on map */

.threat-marker {

    display: flex;

    align-items: center;

    justify-content: center;

    width: 40px;

    height: 40px;

    border-radius: 50%;

    position: relative;

    cursor: pointer;

    background: rgba(10, 10, 12, 0.8);

    box-shadow: 0 4px 10px rgba(0,0,0,0.5);

    border: 1.5px solid transparent;

    /* Do not use contain:layout — it clips/isolates the name label under the icon */
    overflow: visible;

}

.threat-marker.uav {

    border-color: var(--accent-orange);

    color: var(--accent-orange);

}

.threat-marker.missile,

.threat-marker.artillery {

    border-color: var(--accent-red);

    color: var(--accent-red);

}

.threat-marker.aviation {

    border-color: var(--accent-violet);

    color: var(--accent-violet);

}

.threat-marker.naval {

    border-color: var(--accent-cyan);

    color: var(--accent-cyan);

}

.threat-marker.pvo-prepare {

    border-color: #93c5fd;

    color: #93c5fd;

}

.threat-marker.unknown {

    border-color: var(--accent-muted);

    color: var(--accent-muted);

}

.threat-marker.is-selected {

    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.16), 0 5px 18px rgba(0, 0, 0, 0.65);

}

.threat-marker.pvo {

    border-color: var(--accent-blue);

    color: var(--accent-blue);

}

.threat-marker.flamingo {

    border-color: var(--accent-purple);

    color: var(--accent-purple);

}

.threat-svg {

    width: 20px;

    height: 20px;

    z-index: 2;

    display: flex;

    align-items: center;

    justify-content: center;

}

.threat-svg svg {

    width: 100%;

    height: 100%;

}

.threat-icon-inline {

    width: 18px;

    height: 18px;

    display: inline-flex;

    align-items: center;

    justify-content: center;

}

.threat-icon-inline svg {

    width: 100%;

    height: 100%;

}

/* Pulsing background circle on map */

.threat-pulse {

    position: absolute;

    width: 100%;

    height: 100%;

    border-radius: 50%;

    z-index: 1;

    animation: pulse 2s infinite ease-out;

    will-change: transform, opacity;

}

.uav .threat-pulse {

    background: var(--accent-orange);

    box-shadow: 0 0 15px var(--accent-orange);

}

.missile .threat-pulse, .artillery .threat-pulse {

    background: var(--accent-red);

    box-shadow: 0 0 15px var(--accent-red);

}

.aviation .threat-pulse {

    background: var(--accent-violet);

    box-shadow: 0 0 15px var(--accent-violet);

}

.naval .threat-pulse {

    background: var(--accent-cyan);

    box-shadow: 0 0 15px var(--accent-cyan);

}

.pvo-prepare .threat-pulse {

    background: #93c5fd;

    box-shadow: 0 0 12px #93c5fd;

}

.unknown .threat-pulse {

    background: var(--accent-muted);

    box-shadow: 0 0 12px var(--accent-muted);

}

.pvo .threat-pulse {

    background: var(--accent-blue);

    box-shadow: 0 0 15px var(--accent-blue);

}

.flamingo .threat-pulse {

    background: var(--accent-purple);

    box-shadow: 0 0 15px var(--accent-purple);

}

@keyframes pulse {

    0% {

        transform: scale(0.8);

        opacity: 0.5;

    }

    100% {

        transform: scale(2.2);

        opacity: 0;

    }

}

/* Alert dialog */

.alert {

    position: absolute;

    top: 20px;

    left: 50%;

    transform: translateX(-50%);

    z-index: 2000;

    background: rgba(239, 68, 68, 0.95);

    border: 1px solid rgba(255, 255, 255, 0.2);

    padding: 12px 24px;

    border-radius: 30px;

    display: flex;

    align-items: center;

    gap: 10px;

    box-shadow: 0 10px 25px rgba(0,0,0,0.5);

    font-size: 0.9rem;

    font-weight: 500;

    transition: all 0.3s ease;

}

.alert.hidden {

    opacity: 0;

    transform: translate(-50%, -40px);

    pointer-events: none;

    visibility: hidden;

}

/* Floating control buttons */

.floating-btn {

    position: absolute;

    top: max(18px, env(safe-area-inset-top, 18px));

    right: max(18px, env(safe-area-inset-right, 18px));

    left: auto;

    bottom: auto;

    z-index: 2500;

    width: 48px;

    height: 48px;

    border-radius: 12px;

    display: none; /* Only visible on mobile */

    align-items: center;

    justify-content: center;

    cursor: pointer;

    color: var(--text-primary);

    border: 1px solid var(--border-color);

    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);

}

/* Zoom stack under the menu button (top-right) */
#map-container .leaflet-top.leaflet-right {
    top: max(74px, calc(env(safe-area-inset-top, 0px) + 66px));
    right: max(10px, calc(env(safe-area-inset-right, 0px) + 2px));
    margin-top: 0;
}

#map-container .leaflet-control-zoom {
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 12px !important;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

#map-container .leaflet-control-zoom a {
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    background: rgba(12, 14, 20, 0.78) !important;
    color: var(--text-primary) !important;
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

.map-layer-btn {

    position: absolute;

    top: 24px;

    left: 24px;

    z-index: 1500;

    min-height: 42px;

    padding: 0 14px;

    border-radius: 12px;

    display: inline-flex;

    align-items: center;

    gap: 7px;

    cursor: pointer;

    color: var(--text-primary);

    border: 1px solid var(--border-color);

    font: inherit;

    transition: background .2s ease, border-color .2s ease, transform .2s ease;

}

.map-layer-icon {

    width: 18px;

    height: 18px;

    display: inline-flex;

    align-items: center;

    justify-content: center;

    color: #f59e0b;

    flex: 0 0 18px;

}

.map-layer-icon svg {

    width: 100%;

    height: 100%;

}

.map-layer-btn:hover,

.map-layer-btn[aria-pressed="true"] {

    background: rgba(245, 158, 11, .22);

    border-color: rgba(245, 158, 11, .65);

}

.map-layer-btn[aria-pressed="true"] {

    box-shadow: 0 0 0 2px rgba(245, 158, 11, .12), 0 8px 24px rgba(0,0,0,.25);

}

.refineries-panel {

    position: absolute;

    z-index: 1450;

    top: 78px;

    left: 24px;

    width: min(360px, calc(100% - 48px));

    max-height: calc(100% - 102px);

    display: flex;

    flex-direction: column;

    overflow: hidden;

    border: 1px solid var(--border-color);

    border-radius: 16px;

    color: var(--text-primary);

    box-shadow: 0 18px 48px rgba(0, 0, 0, .42);

}

.refineries-panel[hidden] { display: none !important; }

.refineries-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 15px 10px; }

.refineries-panel-head strong, .refineries-panel-head small { display: block; }

.refineries-panel-head small { margin-top: 2px; color: var(--text-secondary); font-size: 11px; }

.refineries-panel-head button { width: 32px; height: 32px; border: 0; border-radius: 9px; background: rgba(255,255,255,.07); color: var(--text-primary); font-size: 22px; cursor: pointer; }

.refineries-legend { display: flex; flex-wrap: wrap; gap: 7px 12px; padding: 0 15px 11px; color: var(--text-secondary); font-size: 11px; }

.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 3px; }

.status-fire { background: #f97316; }

.status-alert { background: #eab308; }

.refineries-list { min-height: 70px; overflow-y: auto; padding: 0 9px 9px; }

.refineries-loading { padding: 24px 12px; text-align: center; color: var(--text-secondary); }

.refinery-list-item { width: 100%; padding: 11px 10px; border: 0; border-top: 1px solid rgba(255,255,255,.07); background: transparent; color: var(--text-primary); text-align: left; cursor: pointer; }

.refinery-list-item:hover { background: rgba(255,255,255,.055); }

.refinery-list-title, .refinery-list-status, .refinery-list-metrics { display: block; }

.refinery-list-title { font-weight: 650; font-size: 13px; }

.refinery-list-status { margin-top: 3px; color: #fbbf24; font-size: 12px; }

.refinery-list-suspected_attack .refinery-list-status { color: #fb7185; }

.refinery-list-fire_only .refinery-list-status { color: #fb923c; }

.refinery-list-metrics { margin-top: 5px; color: var(--text-secondary); font-size: 11px; }

.refinery-list-metrics i { margin: 0 5px; font-style: normal; opacity: .55; }

.refineries-panel footer { padding: 9px 14px 12px; border-top: 1px solid rgba(255,255,255,.07); color: var(--text-secondary); font-size: 10px; line-height: 1.4; }

.refinery-marker { background: transparent; border: 0; }

.refinery-marker span { display: grid; place-items: center; width: 32px; height: 32px; border: 2px solid #fde68a; border-radius: 10px; background: #9a6700; color: white; box-shadow: 0 4px 14px rgba(0,0,0,.6); }

.refinery-marker svg { width: 19px; height: 19px; }

.refinery-suspected_attack span { background: #b91c1c; border-color: #fecaca; }

.refinery-fire_only span { background: #c2410c; border-color: #fed7aa; }

.refinery-alert_only span { background: #9a6700; border-color: #fde68a; }

@media (max-width: 1024px) {

    .map-layer-btn {

        top: max(18px, env(safe-area-inset-top, 18px));

        left: auto;

        right: max(58px, env(safe-area-inset-right, 58px));

        min-height: 40px;

        padding: 0 11px;

    }

    .refineries-panel {

        top: max(68px, calc(env(safe-area-inset-top, 0px) + 60px));

        left: 12px;

        right: 12px;

        width: auto;

        max-height: min(58vh, 480px);

    }

}

.sidebar-backdrop {

    display: none;

    position: absolute;

    inset: 0;

    z-index: 900;

    border: 0;

    background: rgba(0, 0, 0, 0.48);

    opacity: 0;

    pointer-events: none;

    transition: opacity 0.25s ease;

}

/* Loading state */

.loading-spinner {

    width: 40px;

    height: 40px;

    border: 3px solid rgba(255, 255, 255, 0.05);

    border-top-color: var(--text-primary);

    border-radius: 50%;

    margin: 40px auto;

    animation: spin 1s infinite linear;

}

@keyframes spin {

    0% { transform: rotate(0deg); }

    100% { transform: rotate(360deg); }

}

/* Safe State placeholder */

.safe-state {

    text-align: center;

    padding: 40px 20px;

    color: var(--text-secondary);

}

.safe-state-icon {

    font-size: 3rem;

    margin-bottom: 12px;

    display: block;

}

/* Responsive behavior */

@media (max-width: 1024px) {

    #sidebar {
        width: min(var(--sidebar-width), calc(100vw - 28px));
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        height: 100%;
        height: 100dvh;
        max-height: 100dvh;
        transform: translateX(-100%);
        z-index: 2000;
        overflow-y: auto;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
        box-shadow: 10px 0 30px rgba(0,0,0,0.7);
        padding-top: max(12px, env(safe-area-inset-top, 12px));
    }

    #sidebar footer {
        padding: 16px 16px max(40px, calc(env(safe-area-inset-bottom, 0px) + 36px));
        margin-top: auto;
    }

    .scroll-container {
        flex-shrink: 0;
        overflow-y: visible;
    }

    

    #sidebar.open {

        transform: translateX(0);

    }

    #sidebar header {

        grid-template-columns: minmax(0, 1fr) auto auto;

    }

    .close-sidebar-btn {

        display: inline-flex;

    }

    .sidebar-backdrop {

        display: block;

    }

    .sidebar-backdrop.open {

        opacity: 1;

        pointer-events: auto;

    }

    #sidebar.open ~ #map-container .floating-btn,

    #sidebar.open ~ #map-container .map-layer-btn,

    #sidebar.open ~ #map-container .refineries-panel,

    #sidebar.open ~ #map-container .leaflet-top.leaflet-right {

        opacity: 0;

        pointer-events: none;

    }

    

    .floating-btn {
        display: flex !important;
        position: absolute;
        top: max(18px, env(safe-area-inset-top, 18px));
        right: max(18px, env(safe-area-inset-right, 18px));
        left: auto;
        bottom: auto;
        z-index: 2500;
    }

    #map-container .leaflet-top.leaflet-right {
        top: max(74px, calc(env(safe-area-inset-top, 0px) + 66px));
        right: max(10px, calc(env(safe-area-inset-right, 0px) + 2px));
    }

    .glass-panel {

        backdrop-filter: blur(20px) saturate(180%);

        -webkit-backdrop-filter: blur(20px) saturate(180%);

        background: rgba(10, 10, 12, 0.65);

    }

}

@media (max-width: 420px) {

    #sidebar header {

        padding: 18px 16px 14px;

        gap: 8px;

    }

    #site-title {

        font-size: 1.05rem;

    }

    .last-updated {

        padding-left: 16px;

    }

    .badge {

        padding: 4px 8px;

        font-size: 0.68rem;

    }

    .legend {

        padding: 10px 12px;

    }

    .scroll-container {

        padding: 12px;

    }

    .threat-item {

        padding: 14px;

        margin-bottom: 10px;

    }

    #sidebar footer {

        padding: 12px;

        padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));

    }

}

/* Custom Leaflet City Labels */

.city-div-icon,

.custom-div-icon {

    background: transparent !important;

    border: none !important;

    box-shadow: none !important;

    overflow: visible !important;

}

.city-label {

    color: rgba(255, 255, 255, 0.45);

    font-family: var(--font-sans);

    font-size: 11px;

    font-weight: 500;

    text-align: center;

    white-space: nowrap;

    text-shadow: 1px 1px 2px #000, -1px -1px 2px #000, 1px -1px 2px #000, -1px 1px 2px #000;

    pointer-events: none;

}

.city-label.city-capital {

    color: rgba(255, 255, 255, 0.7);

    font-weight: 600;

    font-size: 11.5px;

}

/* Custom Leaflet Tooltip for region names */

.leaflet-tooltip.region-label-tooltip {

    background: transparent !important;

    border: none !important;

    box-shadow: none !important;

    color: var(--text-secondary);

    font-family: var(--font-sans);

    font-size: 11px;

    font-weight: 500;

    pointer-events: none;

    white-space: normal;

    text-align: center;

    line-height: 1.35;

    max-width: 120px;

    text-shadow: 1px 1px 3px #000, -1px -1px 3px #000, 1px -1px 3px #000, -1px 1px 3px #000;

}

.leaflet-tooltip-pane {

    z-index: 550; /* Ensure tooltips sit behind markers (z-index 600) */

}

.region-label-tooltip { display: none !important; }

.zoom-5 .region-label-tooltip,

.zoom-6 .region-label-tooltip,

.zoom-7plus .region-label-tooltip { display: inline-block !important; }

/* Zoom-level-specific label sizing */

.zoom-5 .leaflet-tooltip.region-label-tooltip {

    font-size: 9px;

    opacity: 0.55;

    max-width: 90px;

}

/* Embedded Active Threat Labels on Markers */

.threat-marker-label {

    position: absolute;

    top: 44px; /* Placed exactly below the 40px marker circle with 4px margin */

    left: 50%;

    transform: translateX(-50%);

    color: var(--accent-red);

    font-family: var(--font-sans);

    font-size: 11px;

    font-weight: 600;

    white-space: nowrap;

    text-shadow: 0 0 8px rgba(239, 68, 68, 0.6), 1px 1px 1px #000, -1px -1px 1px #000, 1px -1px 1px #000, -1px 1px 1px #000;

    pointer-events: none;

    display: none;

}

.zoom-6 .threat-marker-label,

.zoom-7plus .threat-marker-label,

.threat-marker.is-selected .threat-marker-label {

    display: block;

}

/* Color coding for threat kinds */

.threat-marker.uav .threat-marker-label {

    color: var(--accent-orange);

    text-shadow: 0 0 8px rgba(249, 115, 22, 0.6), 1px 1px 1px #000, -1px -1px 1px #000, 1px -1px 1px #000, -1px 1px 1px #000;

}

.threat-marker.pvo .threat-marker-label,

.threat-marker.detection .threat-marker-label {

    color: var(--accent-blue);

    text-shadow: 0 0 8px rgba(59, 130, 246, 0.6), 1px 1px 1px #000, -1px -1px 1px #000, 1px -1px 1px #000, -1px 1px 1px #000;

}

.threat-marker.pvo-prepare .threat-marker-label {

    color: #bfdbfe;

    text-shadow: 0 0 8px rgba(147, 197, 253, 0.55), 1px 1px 1px #000, -1px -1px 1px #000, 1px -1px 1px #000, -1px 1px 1px #000;

}

.threat-marker.artillery .threat-marker-label {

    color: var(--accent-yellow);

    text-shadow: 0 0 8px rgba(234, 179, 8, 0.55), 1px 1px 1px #000, -1px -1px 1px #000, 1px -1px 1px #000, -1px 1px 1px #000;

}

.threat-marker.naval .threat-marker-label {

    color: #67e8f9;

    text-shadow: 0 0 8px rgba(6, 182, 212, 0.55), 1px 1px 1px #000, -1px -1px 1px #000, 1px -1px 1px #000, -1px 1px 1px #000;

}

.threat-marker.unknown .threat-marker-label {

    color: var(--accent-muted);

    text-shadow: 1px 1px 1px #000, -1px -1px 1px #000;

}

.threat-marker.flamingo .threat-marker-label {

    color: #fbcfe8;

    text-shadow: 0 0 8px rgba(225, 29, 72, 0.8), 1px 1px 1px #000, -1px -1px 1px #000, 1px -1px 1px #000, -1px 1px 1px #000;

}

.threat-marker.aviation .threat-marker-label { color: #c4b5fd; }

.threat-marker.naval .threat-marker-label { color: #67e8f9; }

.threat-marker.pvo-prepare .threat-marker-label { color: #bfdbfe; }

.threat-marker.unknown .threat-marker-label { color: var(--accent-muted); }

/* BUG #6 fix: all labelGlow variants were identical — merged into one */

@keyframes labelGlow {

    0%, 100% {

        opacity: 0.85;

    }

    50% {

        opacity: 1;

    }

}

@media (hover: none) {

    .threat-item:hover {

        transform: none;

    }

}

.fire-popup {

    display: grid;

    gap: 5px;

    min-width: 210px;

    color: #f1f5f9;

    line-height: 1.35;

}

.fire-popup strong {

    color: #ffb347;

    font-size: 14px;

}

.fire-popup span,

.fire-popup small {

    display: block;

}

.fire-popup small {

    margin-top: 4px;

    color: #aebbd0;

}

@media (prefers-reduced-motion: reduce) {

    *,

    *::before,

    *::after {

        scroll-behavior: auto !important;

        animation-duration: 0.01ms !important;

        animation-iteration-count: 1 !important;

        transition-duration: 0.01ms !important;

    }

    .threat-pulse {

        display: none;

    }

}

/* Place-level pins: map-pin SVG + outlined label (no UAV circle icon) */
.event-div-icon {
    background: transparent !important;
    border: none !important;
    overflow: visible !important;
}

.event-pin {
    position: relative;
    width: 14px;
    height: 20px;
    margin: 0;
    color: var(--accent-orange);
    cursor: pointer;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55));
}

.event-pin__head {
    position: absolute;
    left: 0;
    top: 0;
    width: 14px;
    height: 20px;
    line-height: 0;
}

.event-pin__glyph {
    display: block;
    width: 14px;
    height: 20px;
}

/* Label to the right of the pin, dark chip + kind-colored border */
.event-pin__label {
    position: absolute;
    left: 16px;
    top: 0;
    white-space: nowrap;
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 600;
    line-height: 1.25;
    color: var(--accent-orange);
    pointer-events: none;
    max-width: none;
    overflow: visible;
    padding: 2px 6px;
    border-radius: 6px;
    border: 1px solid currentColor;
    background: rgba(10, 10, 12, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
    text-shadow: none;
}

.event-pin--compact .event-pin__label {
    display: none;
}

.event-pin--uav { color: var(--accent-orange); }
.event-pin--uav .event-pin__label { color: var(--accent-orange); border-color: var(--accent-orange); }

.event-pin--missile,
.event-pin--artillery { color: var(--accent-red); }
.event-pin--missile .event-pin__label,
.event-pin--artillery .event-pin__label { color: var(--accent-red); border-color: var(--accent-red); }

.event-pin--aviation { color: var(--accent-violet); }
.event-pin--aviation .event-pin__label { color: #c4b5fd; border-color: var(--accent-violet); }

.event-pin--flamingo { color: var(--accent-purple); }
.event-pin--flamingo .event-pin__label { color: var(--accent-purple); border-color: var(--accent-purple); }

.event-pin--pvo,
.event-pin--detection { color: var(--accent-blue); }
.event-pin--pvo .event-pin__label,
.event-pin--detection .event-pin__label { color: var(--accent-blue); border-color: var(--accent-blue); }

.event-pin--pvo-prepare { color: #93c5fd; }
.event-pin--pvo-prepare .event-pin__label { color: #bfdbfe; border-color: #93c5fd; }

.event-pin--naval { color: var(--accent-cyan); }
.event-pin--naval .event-pin__label { color: #67e8f9; border-color: var(--accent-cyan); }

.event-pin--unknown { color: var(--accent-muted); }
.event-pin--unknown .event-pin__label { color: var(--accent-muted); border-color: var(--accent-muted); }

.event-pin.is-selected .event-pin__head {
    filter: drop-shadow(0 0 6px currentColor);
}
.event-pin.is-selected .event-pin__label {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12), 0 4px 14px rgba(0, 0, 0, 0.55);
}

@media (max-width: 430px) {
    .event-pin__label {
        font-size: 9px;
        padding: 1px 5px;
        left: 15px;
    }

    .leaflet-popup-content-wrapper {
        max-width: min(280px, calc(100vw - 48px)) !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .event-pin {
        transition: none !important;
    }
}

#toggle-fires-btn, #refineries-panel {

    display: none !important;

}

/* Web layout: keep map left / sidebar right via flex order (see #app-container rules above). */

/* Hidden utility helper */

.hidden {

    display: none !important;

}

/* Custom push settings */

#web-push-regions-select {

    transition: all 0.3s ease;

}

#push-regions-list::-webkit-scrollbar {

    width: 6px;

}

#push-regions-list::-webkit-scrollbar-thumb {

    background: rgba(255, 255, 255, 0.12);

    border-radius: 3px;

}

#push-regions-list::-webkit-scrollbar-thumb:hover {

    background: rgba(255, 255, 255, 0.25);

}

/* Hide browser notifications block in Telegram Mini App */

body.is-telegram #push-settings-details {

    display: none !important;

}

