:root {
    --bg-dark: #0f111a;
    --panel-bg: #1a1d2d;
    --text-primary: #ffffff;
    --text-secondary: #8b9bb4;
    --accent: #3b82f6;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
}

/* Custom marker - allow overflow for TTL indicator */
.custom-marker {
    overflow: visible !important;
    background: transparent !important;
    border: none !important;
}

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
}

#app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

#map {
    flex-grow: 1;
    height: 100%;
    background-color: #0b0d14; /* Deep dark ocean color */
    z-index: 1;
}

/* Official alerts.in.ua status: quiet by default, clearly colored when active. */
.air-alert-status {
    position: fixed;
    top: 76px;
    left: 20px;
    z-index: 1000;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    max-width: calc(100vw - 40px);
    min-height: 20px;
    padding: 9px 13px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 12px;
    background: rgba(15, 17, 26, 0.82);
    color: #a8b3c7;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.26);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.01em;
    pointer-events: auto;
    transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}

html.view-mode .air-alert-status,
body.view-mode .air-alert-status {
    top: 20px;
}

.air-alert-status__dot {
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #64748b;
    box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.12);
}

.air-alert-status[data-state="active"] {
    color: #fdba74;
    border-color: rgba(249, 115, 22, 0.34);
    background: rgba(45, 27, 18, 0.84);
}

.air-alert-status[data-state="active"] .air-alert-status__dot {
    background: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.16), 0 0 11px rgba(249, 115, 22, 0.55);
}

.air-alert-status[data-state="clear"] {
    color: #86efac;
    border-color: rgba(34, 197, 94, 0.22);
}

.air-alert-status[data-state="clear"] .air-alert-status__dot {
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.13);
}

.air-alert-status[data-state="stale"] .air-alert-status__dot {
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.13);
}

.air-alert-tooltip {
    border: 1px solid rgba(249, 115, 22, 0.28) !important;
    border-radius: 8px !important;
    background: rgba(15, 17, 26, 0.94) !important;
    color: #dbe4f0 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35) !important;
    font-size: 12px;
}

.air-alert-tooltip::before {
    border-top-color: rgba(15, 17, 26, 0.94) !important;
}

@media (max-width: 640px) {
    .air-alert-status {
        top: 14px;
        left: 14px;
        max-width: calc(100vw - 72px);
        padding: 8px 11px;
        font-size: 12px;
    }

    html.view-mode .air-alert-status,
    body.view-mode .air-alert-status {
        top: 14px;
    }
}

#map-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000; /* Above map */
    display: flex;
    align-items: center;
    gap: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    pointer-events: none; /* Let clicks pass through if needed */
}

.overlay-brand {
    background-color: #0f111a;
    color: white;
    font-size: 24px;
    font-weight: 700;
    padding: 8px 16px;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
    letter-spacing: 1px;
}

.overlay-info {
    background-color: rgba(15, 17, 26, 0.85);
    backdrop-filter: blur(4px);
    color: #f59e0b; /* Orange/Yellow */
    font-size: 24px;
    font-weight: 600;
    padding: 8px 16px;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 2px solid #2d3748;
}

.overlay-divider {
    width: 2px;
    height: 20px;
    background-color: #2d3748;
}

/* Custom Map Tiles styling via CSS filter if needed, 
   but we will use a dark tile provider */
/* .leaflet-tile { } */

#controls {
    width: 320px;
    background-color: var(--panel-bg);
    border-left: 1px solid #2d3748;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-shadow: -4px 0 15px rgba(0,0,0,0.3);
    z-index: 2;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--panel-bg);
    padding: 30px;
    border-radius: 12px;
    width: 400px;
    border: 1px solid #2d3748;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.modal-content h2 {
    margin-top: 0;
    color: var(--accent);
}

.modal-content ul {
    padding-left: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.status-badge {
    background-color: #2d3748;
    padding: 4px 12px;
    border-radius: 12px;
    font-family: monospace;
    font-size: 14px;
    color: var(--accent);
}

.tool-section {
    margin-bottom: 24px;
}

.tool-section h3 {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.button-group {
    display: flex;
    gap: 10px;
}

.tool-btn {
    flex: 1;
    background-color: #2d3748;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tool-btn:hover {
    background-color: #374151;
    color: var(--text-primary);
}

.tool-btn.active {
    background-color: rgba(59, 130, 246, 0.15);
    border-color: var(--accent);
    color: var(--accent);
}

#threat-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
    min-height: 200px;
}

.region-header {
    background-color: #1a1f2e;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 6px;
    margin-top: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #8b9bb4;
    border-left: 3px solid #3b82f6;
}

.region-header:first-child {
    margin-top: 0;
}

.region-name {
    font-weight: 600;
    color: #e2e8f0;
}

.region-count {
    font-size: 11px;
    color: #f59e0b;
}

.threat-item {
    background-color: #252a40;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 4px;
    margin-left: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 3px solid var(--warning);
}

.threat-item.missile {
    border-left-color: #ef4444;
}

.threat-item.ballistic {
    border-left-color: #8b5cf6;
}

.threat-item.hypersonic {
    border-left-color: #06b6d4;
}

.threat-item.nuclear {
    border-left-color: #facc15;
}

.threat-info {
    display: flex;
    flex-direction: column;
}

.threat-type {
    font-weight: 600;
    font-size: 14px;
}

.threat-coords {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.delete-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
}

.delete-btn:hover {
    color: var(--danger);
}

.action-section {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.action-btn {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: filter 0.2s;
}

.action-btn:hover {
    filter: brightness(110%);
}

.action-btn.primary {
    background-color: var(--accent);
    color: white;
}

.action-btn.danger {
    background-color: #2d3748;
    color: var(--danger);
}

/* Custom Marker Styles */
.drone-icon {
    transition: transform 0.3s;
}

.missile-icon {
    transition: transform 0.3s;
}

/* Count badge styles now inline in JS for dynamic coloring */

/* Selected Marker Animation */
.selected-marker .drone-icon,
.selected-marker .missile-icon {
    transform: scale(1.3);
}

.region-header {
    padding: 8px 12px;
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #2d3748;
    margin-top: 16px;
    margin-bottom: 8px;
    background-color: rgba(45, 55, 72, 0.3); /* Slight background */
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.region-header:hover {
    background-color: rgba(59, 130, 246, 0.1);
    cursor: pointer;
}

.region-header.selected {
    background-color: rgba(239, 68, 68, 0.2);
    border-left-color: #ef4444;
}

.region-header:first-child {
    margin-top: 0;
}

#selected-region-display {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.1));
    border: 2px solid #ef4444;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #fff;
}

/* Type header (collapsible) */
.type-header {
    background-color: #1e2433;
    padding: 8px 12px;
    margin-left: 12px;
    margin-bottom: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    border-left: 3px solid #f59e0b;
}

.type-header.missile { border-left-color: #ef4444; }
.type-header.ballistic { border-left-color: #8b5cf6; }
.type-header.hypersonic { border-left-color: #06b6d4; }
.type-header.nuclear { border-left-color: #facc15; }

.type-header:hover {
    background-color: #252a3a;
}

.type-toggle {
    transition: transform 0.2s;
    color: #8b9bb4;
    font-size: 10px;
}

.type-header.expanded .type-toggle {
    transform: rotate(90deg);
}

.type-name {
    flex: 1;
    font-weight: 500;
}

.type-count {
    background: rgba(255,255,255,0.1);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    color: #8b9bb4;
}

/* Type threats container */
.type-threats {
    list-style: none;
    padding: 0;
    margin: 0 0 8px 0;
    overflow: hidden;
    max-height: 500px;
    transition: max-height 0.3s ease;
}

.type-threats.collapsed {
    max-height: 0;
    margin-bottom: 0;
}

.type-threats .threat-item {
    margin-left: 24px;
}

.leaflet-container {
    background: #0b0d14 !important;
}
.leaflet-control-attribution {
    background: rgba(0,0,0,0.5) !important;
    color: #888 !important;
}
.leaflet-control-attribution a {
    color: #aaa !important;
}

/* Marker Cluster Styles */
.marker-cluster-custom {
    background: transparent !important;
}

.cluster-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ef4444, #f59e0b);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.6);
}

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background: transparent !important;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background: linear-gradient(135deg, #ef4444, #f59e0b) !important;
    color: white !important;
    font-weight: bold !important;
}

/* ==========================================
   AUTO Mode Styles
   ========================================== */

.beta-badge {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 8px;
    vertical-align: middle;
}

.auto-btn {
    background: linear-gradient(135deg, #2d3748, #1a202c);
    color: #8b9bb4;
    border: 1px solid #4a5568;
    transition: all 0.3s ease;
}

.auto-btn:hover {
    background: linear-gradient(135deg, #374151, #2d3748);
    border-color: #6366f1;
}

.auto-btn.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border-color: #8b5cf6;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}

.auto-btn.active:hover {
    background: linear-gradient(135deg, #7c3aed, #6366f1);
}

.auto-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 6px;
    font-size: 12px;
    color: #a5b4fc;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

/* AUTO notification toast */
.auto-notification {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, #1e293b, #0f172a);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border: 1px solid #334155;
    z-index: 3000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.auto-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Auto-generated threat marker indicator */
.threat-item.auto-generated {
    border-left-color: #8b5cf6;
    position: relative;
}

.threat-item.auto-generated::after {
    content: 'AUTO';
    position: absolute;
    top: 4px;
    right: 40px;
    font-size: 8px;
    background: #8b5cf6;
    color: white;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
}

/* ==========================================
   VIEW MODE - Fullscreen map without controls
   ========================================== */
html.view-mode,
html.view-mode body {
    background: #0b0d14 !important;
}

html.view-mode #controls,
body.view-mode #controls {
    display: none !important;
    width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    border: none !important;
    position: absolute !important;
    left: -9999px !important;
}

html.view-mode #help-btn,
body.view-mode #help-btn {
    display: none !important;
}

html.view-mode #map-overlay,
body.view-mode #map-overlay {
    display: none !important;
}

html.view-mode #app,
body.view-mode #app {
    background: transparent !important;
    display: block !important;
}

html.view-mode #map,
body.view-mode #map {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
}

/* Hide notifications in view mode */
html.view-mode .auto-notification,
body.view-mode .auto-notification {
    display: none !important;
}

/* Viewer floating UI - stylish pills */
.viewer-counter {
    display: none;
}

html.view-mode .viewer-counter,
body.view-mode .viewer-counter {
    display: flex !important;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(15, 17, 26, 0.85);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    overflow: visible;
}

.viewer-counter .counter-left {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
}

.viewer-counter .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
    animation: pulse-glow 2s infinite;
}

.viewer-counter .status-dot.offline {
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444;
    animation: none;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 1; box-shadow: 0 0 8px #22c55e; }
    50% { opacity: 0.6; box-shadow: 0 0 4px #22c55e; }
}

.viewer-counter .counter-time {
    font-size: 14px;
    font-weight: 600;
    color: white;
}

/* Compact threats button */
.counter-threats-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.3), rgba(239, 68, 68, 0.1));
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.counter-threats-btn:hover {
    transform: scale(1.05);
}

.counter-threats-btn .threats-icon {
    width: 18px;
    height: 18px;
    filter: brightness(0) saturate(100%) invert(36%) sepia(93%) saturate(2066%) hue-rotate(338deg) brightness(95%) contrast(97%);
}

.counter-threats-btn .threats-total {
    font-size: 14px;
    font-weight: 700;
    color: #ef4444;
}

.counter-threats-btn.clear {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.3), rgba(34, 197, 94, 0.1));
    border-color: rgba(34, 197, 94, 0.3);
}

.counter-threats-btn.clear .threats-total {
    color: #22c55e;
}

.counter-threats-btn.clear .threats-icon {
    filter: brightness(0) saturate(100%) invert(61%) sepia(73%) saturate(432%) hue-rotate(93deg) brightness(95%) contrast(91%);
}

/* Threats popup */
.threats-popup {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 10px;
    background: rgba(15, 17, 26, 0.95);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px;
    z-index: 1001;
    min-width: 200px;
    max-width: 90vw;
}

.threats-popup.show {
    display: block;
    animation: popupAppear 0.2s ease-out;
}

@keyframes popupAppear {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.threats-popup-content {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.threats-popup .threat-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
}

.threats-popup .threat-badge img {
    width: 18px;
    height: 18px;
}

.threats-popup .threat-badge.drone {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(245, 158, 11, 0.1));
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.threats-popup .threat-badge.missile {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.3), rgba(239, 68, 68, 0.1));
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.threats-popup .threat-badge.ballistic {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(168, 85, 247, 0.1));
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.threats-popup .threat-badge.hypersonic {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.3), rgba(6, 182, 212, 0.1));
    color: #06b6d4;
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.threats-popup .threat-badge.nuclear {
    background: linear-gradient(135deg, rgba(250, 204, 21, 0.3), rgba(250, 204, 21, 0.1));
    color: #facc15;
    border: 1px solid rgba(250, 204, 21, 0.3);
}

/* Batch Timer - circular countdown (inside viewer-counter) */
.batch-timer {
    display: none;
}

html.view-mode .batch-timer,
body.view-mode .batch-timer {
    display: flex !important;
    position: relative;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.batch-timer svg {
    position: absolute;
    width: 44px;
    height: 44px;
    left: -4px;
    top: -4px;
    transform: rotate(-90deg);
    overflow: visible;
}

.batch-timer .ring-bg {
    fill: none;
    stroke: rgba(220, 38, 38, 0.2);
    stroke-width: 2.5;
}

.batch-timer .ring-progress {
    fill: none;
    stroke: #dc2626;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}

.batch-timer-seconds {
    font-size: 15px;
    font-weight: 700;
    color: #dc2626;
    text-shadow: 0 0 6px rgba(220, 38, 38, 0.9);
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    z-index: 1;
}

.report-window {
    display: none;
}

html.report-mode .report-window,
body.report-mode .report-window {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 36px;
    padding: 0 10px;
    box-sizing: border-box;
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

html.report-mode .batch-timer,
body.report-mode .batch-timer {
    display: none !important;
}

/* ==================== 1:1 TELEGRAM REPORT POSTER ==================== */
.report-poster {
    display: none;
}

html.report-mode .report-poster,
body.report-mode .report-poster {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: block;
    pointer-events: none;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html.report-mode .report-poster::before,
body.report-mode .report-poster::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 50% 42%, transparent 26%, rgba(4, 6, 10, 0.16) 65%, rgba(4, 6, 10, 0.58) 100%),
        linear-gradient(180deg, rgba(4, 6, 10, 0.90) 0%, rgba(4, 6, 10, 0.18) 25%, rgba(4, 6, 10, 0.08) 58%, rgba(4, 6, 10, 0.92) 83%, #06080d 100%);
}

.report-poster__header {
    position: absolute;
    top: 28px;
    left: 42px;
}

.report-poster__date {
    color: #f7b719;
    font-size: 24px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.report-poster__header h1 {
    margin: 6px 0 0;
    color: #f8fafc;
    font-size: 64px;
    font-weight: 750;
    line-height: 1.05;
    letter-spacing: -0.035em;
    text-shadow: 0 4px 18px rgba(0, 0, 0, 0.55);
}

html.report-mode .air-alert-status,
body.report-mode .air-alert-status {
    top: 148px;
    left: 42px;
    z-index: 1000;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 20px;
    color: #f8fafc;
    background: rgba(11, 13, 20, 0.84);
}

html.report-mode #info-btn,
body.report-mode #info-btn {
    top: 48px;
    right: 42px;
}

html.report-mode .viewer-counter,
body.report-mode .viewer-counter,
html.report-mode .threat-feed,
body.report-mode .threat-feed {
    display: none !important;
}

.report-summary {
    position: absolute;
    left: 42px;
    right: 42px;
    bottom: 145px;
    min-height: 190px;
    display: grid;
    grid-template-columns: 42% 58%;
    box-sizing: border-box;
    padding: 24px 26px;
    border: 1px solid rgba(148, 163, 184, 0.34);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(10, 12, 18, 0.92), rgba(7, 9, 14, 0.82));
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.025);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.report-total {
    display: flex;
    align-items: center;
    gap: 24px;
    min-width: 0;
}

.report-total > strong {
    color: #ffb000;
    font-size: 118px;
    font-weight: 800;
    line-height: 0.88;
    letter-spacing: -0.07em;
    text-shadow: 0 0 26px rgba(245, 158, 11, 0.35);
}

.report-total > span {
    color: #f1f5f9;
    font-size: 25px;
    font-weight: 450;
    line-height: 1.25;
}

.report-total > span b {
    font-weight: 650;
}

.report-breakdown {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 84px auto;
    gap: 10px 16px;
    min-width: 0;
}

.report-type-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 14px;
    background: rgba(13, 16, 24, 0.68);
}

.report-type-card span {
    color: #f5a900;
    font-size: 25px;
    font-weight: 700;
}

.report-type-card strong {
    color: #f8fafc;
    font-size: 36px;
    font-weight: 750;
}

.report-activity {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 0 18px;
    border: 1px solid rgba(148, 163, 184, 0.20);
    border-radius: 12px;
    background: rgba(13, 16, 24, 0.48);
    color: #7f8794;
    font-size: 18px;
    white-space: nowrap;
    overflow: hidden;
}

.report-activity strong {
    min-width: 0;
    overflow: hidden;
    color: #e5e7eb;
    font-weight: 500;
    text-overflow: ellipsis;
}

.report-freshness {
    position: absolute;
    left: 48px;
    bottom: 91px;
    display: flex;
    align-items: center;
    gap: 14px;
    color: #9ca3af;
    font-size: 22px;
}

.report-freshness__dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #8b5cf6;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.76);
}

.report-source {
    position: absolute;
    left: 42px;
    right: 42px;
    bottom: 31px;
    padding-top: 18px;
    border-top: 1px solid rgba(148, 163, 184, 0.24);
    color: #4b5260;
    font-size: 18px;
}

/* Report images are viewed scaled down in Telegram, so targets and counters need
   a larger visual footprint than in the interactive map. */
html.report-mode .custom-marker img,
body.report-mode .custom-marker img {
    width: 40px !important;
    height: 40px !important;
}

html.report-mode .count-badge,
body.report-mode .count-badge {
    width: 20px !important;
    height: 20px !important;
    font-size: 12px !important;
}

/* Keep this override after the live-feed rules: report posters never show cards. */
html.report-mode .threat-feed,
body.report-mode .threat-feed {
    display: none !important;
}

/* Threat Feed - shows LLM results */
.threat-feed {
    display: none;
}

html.view-mode .threat-feed,
body.view-mode .threat-feed {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(to bottom, transparent 0%, black 30%, black 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 30%, black 100%);
}

.threat-feed::-webkit-scrollbar {
    display: none;
}

.threat-feed-item {
    background: rgba(15, 17, 26, 0.85);
    backdrop-filter: blur(12px);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 14px;
    margin-bottom: 8px;
    min-width: 200px;
    max-width: 300px;
    animation: feedItemAppear 0.3s ease-out;
    cursor: pointer;
}

.threat-feed-item:active {
    background: rgba(30, 35, 50, 0.9);
}

.threat-feed-item .feed-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    margin-bottom: 4px;
}

.threat-feed-item .feed-content {
    font-size: 13px;
    color: white;
    line-height: 1.4;
}

.threat-feed-item .feed-type {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 6px;
}

.threat-feed-item .feed-type.drone {
    background: rgba(251, 146, 60, 0.3);
    color: #fb923c;
}

.threat-feed-item .feed-type.missile {
    background: rgba(220, 38, 38, 0.3);
    color: #dc2626;
}

.threat-feed-item .feed-type.ballistic {
    background: rgba(168, 85, 247, 0.3);
    color: #a855f7;
}

.threat-feed-item .feed-type.hypersonic {
    background: rgba(6, 182, 212, 0.3);
    color: #06b6d4;
}

@keyframes feedItemAppear {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ballistic Alert Marker */
.ballistic-alert-marker {
    background: transparent !important;
    border: none !important;
}

.ballistic-alert-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: ballisticPulse 1s ease-in-out infinite;
}

.ballistic-alert-icon img {
    width: 70px;
    height: 70px;
    filter: brightness(0) saturate(100%) invert(20%) sepia(98%) saturate(4644%) hue-rotate(351deg) brightness(95%) contrast(120%) drop-shadow(0 0 20px rgba(220, 38, 38, 0.8));
}

@keyframes ballisticPulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 15px rgba(220, 38, 38, 0.9));
    }
    50% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 25px rgba(220, 38, 38, 1));
    }
}

.threat-feed-item .feed-type.ballistic_alert {
    background: rgba(220, 38, 38, 0.4);
    color: #ef4444;
    font-weight: 700;
}

.threat-feed-item .feed-type.ballistic_cancel {
    background: rgba(34, 197, 94, 0.4);
    color: #22c55e;
    font-weight: 700;
}

/* Flight Alert Marker */
.flight-alert-marker {
    background: transparent !important;
    border: none !important;
}

.flight-alert-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: flightPulse 1.5s ease-in-out infinite;
}

.flight-alert-icon img {
    width: 70px;
    height: 70px;
    filter: brightness(0) saturate(100%) invert(55%) sepia(60%) saturate(600%) hue-rotate(230deg) brightness(100%) contrast(100%) drop-shadow(0 0 20px rgba(168, 85, 247, 0.8));
}

@keyframes flightPulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 15px rgba(168, 85, 247, 0.9));
    }
    50% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 25px rgba(168, 85, 247, 1));
    }
}

.threat-feed-item .feed-type.flight_alert {
    background: rgba(168, 85, 247, 0.4);
    color: #a855f7;
    font-weight: 700;
}

.threat-feed-item .feed-type.flight_cancel {
    background: rgba(34, 197, 94, 0.4);
    color: #22c55e;
    font-weight: 700;
}

/* ==================== INFO BUTTON & MODAL ==================== */

#info-btn {
    position: absolute;
    top: 110px;
    right: 20px;
    z-index: 1000;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(168, 85, 247, 0.6);
    background: rgba(15, 17, 26, 0.9);
    color: #a855f7;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.4), 0 0 24px rgba(168, 85, 247, 0.2);
}

#info-btn:hover {
    background: rgba(168, 85, 247, 0.2);
    border-color: rgba(168, 85, 247, 0.8);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.6), 0 0 40px rgba(168, 85, 247, 0.3);
    color: #c084fc;
}

#info-btn:active {
    transform: scale(0.95);
}

#help-btn {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(15, 17, 26, 0.9);
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#help-btn:hover {
    background: rgba(45, 55, 72, 0.9);
    color: white;
}

/* Info Modal */
.info-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 2000;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    animation: fadeIn 0.2s ease;
}

.info-modal.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.info-modal-content {
    background: linear-gradient(145deg, rgba(26, 29, 45, 0.98), rgba(15, 17, 26, 0.98));
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 16px;
    padding: 20px;
    padding-top: 48px;
    max-width: 360px;
    width: calc(100% - 40px);
    max-height: calc(100vh - 120px);
    margin: 60px 20px 20px 20px;
    overflow-y: auto;
    position: relative;
    box-shadow: 
        0 0 40px rgba(59, 130, 246, 0.2),
        0 0 80px rgba(59, 130, 246, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

.info-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    color: #ef4444;
}

.info-title {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    text-align: center;
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

.info-section {
    margin-bottom: 20px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.info-section h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-section h3 i {
    color: #3b82f6;
    font-size: 12px;
}

.info-section p {
    margin: 8px 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
}

.info-section.disclaimer {
    border-color: rgba(245, 158, 11, 0.2);
    background: rgba(245, 158, 11, 0.05);
}

.info-section.disclaimer h3 i {
    color: #f59e0b;
}

.info-warning {
    color: #f59e0b !important;
    font-weight: 500;
    padding: 8px 12px;
    background: rgba(245, 158, 11, 0.1);
    border-radius: 8px;
    border-left: 3px solid #f59e0b;
}

/* Info Grid for threat types */
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    padding-bottom: 16px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    position: relative;
}

.info-item:hover {
    transform: scale(1.02);
}

.info-item .info-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.info-item .info-label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    flex: 1;
}

.info-item .info-ttl {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(15, 17, 26, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
}

/* Threat type colors - matching actual marker colors from script.js */
/* drone: #f59e0b (orange/amber) */
.info-item.drone {
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.2);
}
.info-item.drone .info-icon {
    filter: brightness(0) saturate(100%) invert(67%) sepia(65%) saturate(588%) hue-rotate(360deg) drop-shadow(0 0 6px #f59e0b);
}

/* missile: #ef4444 (red) */
.info-item.missile {
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}
.info-item.missile .info-icon {
    filter: brightness(0) saturate(100%) invert(36%) sepia(93%) saturate(2053%) hue-rotate(337deg) drop-shadow(0 0 6px #ef4444);
}

/* ballistic: #a855f7 (purple) */
.info-item.ballistic {
    border-color: rgba(168, 85, 247, 0.4);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.2);
}
.info-item.ballistic .info-icon {
    filter: brightness(0) saturate(100%) invert(44%) sepia(94%) saturate(2726%) hue-rotate(243deg) drop-shadow(0 0 6px #a855f7);
}

/* hypersonic: #06b6d4 (cyan) */
.info-item.hypersonic {
    border-color: rgba(6, 182, 212, 0.4);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.2);
}
.info-item.hypersonic .info-icon {
    filter: brightness(0) saturate(100%) invert(63%) sepia(96%) saturate(1352%) hue-rotate(152deg) brightness(95%) contrast(94%) drop-shadow(0 0 6px #06b6d4);
}

/* Hide help button in view mode, but keep info button visible */
.view-mode #help-btn {
    display: none;
}

/* Final report-mode overrides must follow the live viewer rules above. */
html.report-mode .threat-feed,
body.report-mode .threat-feed,
html.report-mode .viewer-counter,
body.report-mode .viewer-counter {
    display: none !important;
}
