body {
    margin: 0;
    padding: 0;
    font-family: "Segoe UI", "Noto Sans", sans-serif;
    background: #0b1220;
    color: #ffffff;
}

#map {
    position: absolute;
    inset: 0;
    width: 100%;
}

.top-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
}

.app-badge {
    pointer-events: auto;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.92);
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    padding: 8px 12px;
    backdrop-filter: blur(8px);
}

.layers-menu-root {
    position: relative;
    pointer-events: auto;
}

.map-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
}

.map-action-button,
.layers-menu-button {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.52);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
}

.storm-mode-button {
    min-height: 42px;
    padding: 0 15px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.58);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    backdrop-filter: blur(8px);
}

.storm-mode-button[aria-pressed="true"] {
    border-color: #ff9d2e;
    background: rgba(151, 58, 0, 0.9);
    box-shadow: 0 0 18px rgba(255, 136, 25, 0.3);
}

.map-action-button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.map-action-button svg,
.layers-menu-button svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.location-status {
    position: absolute;
    top: 50px;
    right: 0;
    max-width: min(280px, calc(100vw - 20px));
    margin: 0;
    padding: 0;
    color: #ffd8d8;
    font-size: 12px;
    line-height: 1.35;
    text-align: right;
    text-shadow: 0 1px 3px #000;
    pointer-events: none;
}

.location-status:not(:empty) {
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(85, 10, 10, 0.78);
}

.user-location-dot {
    box-sizing: border-box;
    width: 22px;
    height: 22px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #1a73e8;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.45);
}

.layers-panel {
    position: absolute;
    right: 0;
    top: 48px;
    width: min(280px, calc(100vw - 20px));
    padding: 12px;
    border-radius: 12px;
    background: rgba(5, 10, 18, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    display: none;
}

.layers-panel.open {
    display: block;
}

.legend-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.88);
    margin-bottom: 8px;
}

.layer-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 8px;
}

.basemap-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
}

#basemap-select,
#product-select {
    width: 100%;
    margin-top: 4px;
    padding: 7px 8px;
    font-size: 13px;
    color: #e5ecf4;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
}

.storm-mode-control {
    display: none;
}

body.storm-mode .storm-mode-control {
    display: flex;
}

body.storm-mode .product-section,
body.storm-mode .active-site-display {
    display: block;
}

body.storm-mode .national-mode-control,
body.storm-mode .loop-controls {
    display: none;
}

.product-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.active-site-display {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.74);
}

.storm-crosshair {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: none;
    overflow: hidden;
    pointer-events: none;
}

body.storm-mode .storm-crosshair.is-active {
    display: block;
}

.storm-crosshair-horizontal,
.storm-crosshair-vertical,
.storm-crosshair-center {
    position: absolute;
    display: block;
    background: rgba(255, 255, 255, 0.72);
    filter: drop-shadow(0 0 1px #000);
}

.storm-crosshair-horizontal {
    left: 0;
    right: 0;
    top: var(--crosshair-y, 50%);
    height: 1px;
}

.storm-crosshair-vertical {
    top: 0;
    bottom: 0;
    left: var(--crosshair-x, 50%);
    width: 1px;
}

.storm-crosshair-center {
    left: calc(var(--crosshair-x, 50%) - 4px);
    top: calc(var(--crosshair-y, 50%) - 4px);
    width: 9px;
    height: 9px;
    border: 1px solid #fff;
    border-radius: 50%;
    background: transparent;
}

.storm-readout {
    position: absolute;
    right: 12px;
    bottom: 88px;
    z-index: 29;
    display: none;
    min-width: 190px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    font-size: 11px;
    line-height: 1.45;
    text-align: right;
    pointer-events: none;
    backdrop-filter: blur(8px);
}

.storm-readout span,
.storm-readout strong {
    display: block;
}

body.storm-mode .storm-readout {
    display: block;
}

.bottom-dock {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    pointer-events: none;
}

.bottom-dock-inner {
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.54);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
}

.legend-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 9px;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.82);
}

.legend-bar {
    width: 160px;
    height: 8px;
    border-radius: 999px;
}

/* Data-source credit. Lives in the legend row so it is only visible while the
   layer it belongs to is switched on. */
.legend-credit {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    white-space: nowrap;
}

.legend-credit:hover,
.legend-credit:focus-visible {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: underline;
}

.radar-gradient {
    background: linear-gradient(90deg, #00ffff, #00ff00, #ffff00, #ff7f00, #ff0000, #ff00ff);
}

.radar-gradient.velocity-gradient {
    background: linear-gradient(90deg, #00ffff, #00ff00, #005500, #2d2d2d, #afafaf, #550000, #ff0000, #ff00ff);
}

.lightning-gradient {
    background: linear-gradient(90deg, #fff68a, #fff, #ffef3a, #ffffff);
}

.loop-controls {
    padding: 1px 0 0;
}

.loop-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.loop-button {
    appearance: none;
    border: none;
    border-radius: 999px;
    padding: 7px 13px;
    background: #eaf2ff;
    color: #0c2443;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.loop-button.is-loading {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.loop-button.is-loading::before {
    content: '';
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(12, 36, 67, 0.28);
    border-top-color: #0c2443;
    animation: radar-button-spin 0.75s linear infinite;
}

@keyframes radar-button-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.loop-button:disabled,
.loop-button[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

.loop-range-inline {
    flex: 1 1 160px;
    min-width: 0;
}

.loop-time-label {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.76);
}

.storm-popup {
    font-size: 13px;
    line-height: 1.6;
}

.storm-popup strong {
    font-size: 14px;
}

.maplibregl-popup-content {
    background: rgba(0, 0, 0, 0.78);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.maplibregl-popup-content .maplibregl-popup-close-button {
    color: #ffffff;
}

.maplibregl-popup-anchor-top .maplibregl-popup-tip {
    border-bottom-color: rgba(0, 0, 0, 0.78);
}

.maplibregl-popup-anchor-bottom .maplibregl-popup-tip {
    border-top-color: rgba(0, 0, 0, 0.78);
}

.maplibregl-popup-anchor-left .maplibregl-popup-tip {
    border-right-color: rgba(0, 0, 0, 0.78);
}

.maplibregl-popup-anchor-right .maplibregl-popup-tip {
    border-left-color: rgba(0, 0, 0, 0.78);
}

@media (max-width: 680px) {
    .app-badge {
        font-size: 11px;
        padding: 7px 10px;
    }

    .legend-row {
        font-size: 10px;
    }

    .legend-bar {
        width: 118px;
    }

    .loop-range-inline {
        flex-basis: 0;
    }

    .storm-mode-button {
        min-height: 38px;
        padding: 0 11px;
        font-size: 10px;
    }

    .storm-readout {
        right: 8px;
        bottom: 82px;
    }
}
