:root {
    color-scheme: dark;
    --surface: rgba(8, 17, 24, 0.90);
    --surface-strong: rgba(6, 14, 20, 0.97);
    --surface-soft: rgba(18, 32, 41, 0.82);
    --line: rgba(214, 235, 245, 0.16);
    --line-strong: rgba(214, 235, 245, 0.28);
    --text: #f4f9fc;
    --muted: #9fb3bf;
    --cyan: #5de1cf;
    --blue: #4bc5ff;
    --yellow: #ffd25a;
    --orange: #ff9e57;
    --red: #ff6579;
    --violet: #ae8cff;
    --ice: #b9e8ff;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.34);
    --layout-edge: 14px;
    --layout-bar-edge: calc(var(--layout-edge) + 1.5cm);
    --layout-footer-lift: 3mm;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --topbar-bottom: 92px;
    --footer-clearance: 86px;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    min-height: 100%;
    margin: 0;
    overflow: hidden;
    color: var(--text);
    background: #071017;
    font-size: 15px;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

[hidden] {
    display: none !important;
}

button,
select,
a {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 2px;
}

.modernIconSprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

#modernMapShell {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    background: #0a1820;
}

#modernMap {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: #0b1c24;
}

#modernMap::after {
    position: absolute;
    inset: 0;
    z-index: 420;
    pointer-events: none;
    content: "";
    background:
        linear-gradient(180deg, rgba(4, 12, 18, 0.18), transparent 24%, transparent 72%, rgba(4, 12, 18, 0.24)),
        radial-gradient(circle at 50% 44%, transparent 42%, rgba(1, 8, 12, 0.16) 100%);
}

.leaflet-container {
    background: #0e222c;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.leaflet-tile {
    filter: saturate(0.78) contrast(1.08) brightness(0.70) hue-rotate(3deg);
}

.leaflet-control-zoom a {
    color: var(--text) !important;
    border-color: var(--line) !important;
    background: var(--surface-strong) !important;
}

.leaflet-control-attribution {
    color: #8499a4;
    background: rgba(3, 10, 14, 0.72) !important;
}

.leaflet-control-attribution a {
    color: #b9d8e6;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    color: #eaf6fb;
    background: rgba(6, 15, 21, 0.97);
}

.leaflet-popup-content-wrapper {
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.leaflet-popup-content {
    min-width: 170px;
    font-size: 13px;
    line-height: 1.55;
}

.leaflet-popup-content strong {
    font-size: 16px;
}

#modernTopbar {
    position: absolute;
    z-index: 700;
    top: calc(14px + var(--safe-top));
    right: calc(var(--layout-bar-edge) + var(--safe-right));
    left: calc(var(--layout-bar-edge) + var(--safe-left));
    display: grid;
    grid-template-columns: minmax(230px, 1fr) minmax(220px, 340px) minmax(280px, 1fr);
    align-items: center;
    gap: 14px;
    min-height: 64px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px) saturate(1.15);
}

.modernBrand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.modernBrandMark {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid rgba(93, 225, 207, 0.35);
    border-radius: 12px;
    color: var(--cyan);
    background: rgba(93, 225, 207, 0.10);
}

.modernBrandMark svg {
    width: 25px;
    height: 25px;
    fill: currentColor;
}

.modernBrand strong {
    display: block;
    overflow: hidden;
    font-size: 20px;
    letter-spacing: -0.02em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modernBrand em {
    margin-left: 5px;
    padding: 2px 5px;
    border: 1px solid rgba(93, 225, 207, 0.35);
    border-radius: 5px;
    color: var(--cyan);
    font-size: 10px;
    font-style: normal;
    letter-spacing: 0.14em;
    vertical-align: 2px;
}

#modernStatus {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

.statusDot {
    display: inline-block;
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 0 4px rgba(93, 225, 207, 0.10);
}

.statusDot.loading {
    background: var(--yellow);
    box-shadow: 0 0 0 4px rgba(255, 210, 90, 0.10);
    animation: statusPulse 1.3s ease-in-out infinite;
}

.statusDot.warning {
    background: var(--orange);
    box-shadow: 0 0 0 4px rgba(255, 158, 87, 0.12);
}

.statusDot.failed {
    background: var(--red);
    box-shadow: 0 0 0 4px rgba(255, 101, 121, 0.12);
}

@keyframes statusPulse {
    50% { opacity: 0.42; }
}

.modernCityControl {
    display: grid;
    grid-template-columns: 22px auto 1fr;
    align-items: center;
    gap: 7px;
    height: 44px;
    padding: 0 8px 0 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(245, 250, 252, 0.07);
}

.modernCityControl > svg {
    width: 18px;
    height: 18px;
    color: var(--cyan);
    fill: rgba(93, 225, 207, 0.20);
    stroke: currentColor;
    stroke-width: 1.5;
}

.modernCityControl label {
    color: var(--muted);
    font-size: 12px;
}

#modernCitySelect {
    min-width: 0;
    height: 34px;
    padding: 0 26px 0 8px;
    border: 0;
    color: var(--text);
    background: transparent;
    font-size: 16px;
    font-weight: 700;
}

#modernCitySelect option {
    color: #10202a;
    background: #f5fafc;
}

.modernTopActions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: thin;
}

.modernTextLink,
.modernTextButton,
.modernMobileButton {
    min-height: 38px;
    padding: 0 11px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: #d9e8ef;
    background: transparent;
    cursor: pointer;
    font-size: 15px;
    text-decoration: none;
    transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.modernTextLink,
.modernTextButton,
.modernMobileButton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.modernTextLink:hover,
.modernTextButton:hover,
.modernMobileButton:hover,
.modernTextButton[aria-expanded="true"],
.modernTextButton[aria-pressed="true"],
.modernMobileButton[aria-expanded="true"] {
    border-color: var(--line);
    color: var(--text);
    background: rgba(245, 250, 252, 0.08);
}

.lightningSoundToggle[aria-pressed="true"] {
    border-color: rgba(247, 201, 72, 0.38);
    color: var(--yellow);
    background: rgba(247, 201, 72, 0.09);
}

.modernAiToggle {
    gap: 6px;
    border-color: rgba(171, 128, 255, 0.26);
}

.modernAiToggle small {
    padding: 2px 5px;
    border-radius: 5px;
    color: #d8c4ff;
    background: rgba(171, 128, 255, 0.14);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.modernMobileButton {
    display: none;
}

#modernLayerPanel,
#modernDetailPanel,
#modernOpsPanel,
#modernSymbolPanel,
#modernAiPanel {
    position: absolute;
    z-index: 650;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px) saturate(1.12);
}

#modernLayerPanel {
    top: var(--topbar-bottom);
    bottom: var(--footer-clearance);
    left: calc(var(--layout-edge) + var(--safe-left));
    width: 278px;
    overflow: auto;
    padding: 14px;
}

.telemetryConsent {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    margin-top: 16px;
    padding: 14px;
    border: 1px solid rgba(126, 231, 214, 0.26);
    border-radius: 13px;
    background: rgba(65, 224, 198, 0.055);
}

.telemetryConsent strong,
.telemetryConsent p,
.telemetryConsent small {
    display: block;
}

.telemetryConsent p {
    margin: 6px 0;
    color: var(--muted);
    line-height: 1.45;
}

.telemetryConsent small {
    color: #a9bac3;
}

#modernTelemetryToggle {
    min-height: 40px;
    padding: 0 13px;
    border: 1px solid rgba(126, 231, 214, 0.45);
    border-radius: 10px;
    color: var(--text);
    background: rgba(65, 224, 198, 0.1);
    cursor: pointer;
    white-space: nowrap;
}

#modernTelemetryToggle[aria-pressed="true"] {
    border-color: rgba(255, 101, 121, 0.48);
    background: rgba(255, 101, 121, 0.09);
}

.panelHeading,
.detailHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.panelHeading small,
.detailHeader small {
    display: block;
    margin-bottom: 4px;
    color: var(--cyan);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.15em;
}

.panelHeading strong,
.detailHeader strong {
    display: block;
    font-size: 16px;
}

.panelClose {
    display: grid;
    width: 30px;
    height: 30px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
}

#modernLayerPanelClose {
    display: none;
}

.layerGroup {
    display: grid;
    gap: 5px;
    margin-top: 18px;
}

.layerGroupTitle {
    margin: 0 0 3px 3px;
    color: #7f949f;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.modernLayerButton {
    display: grid;
    grid-template-columns: 34px 1fr auto;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 57px;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: #c9d8df;
    background: transparent;
    cursor: pointer;
    text-align: left;
    transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.modernLayerButton:hover {
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.045);
    transform: translateX(2px);
}

.modernLayerButton.active {
    border-color: rgba(93, 225, 207, 0.22);
    color: var(--text);
    background: rgba(93, 225, 207, 0.08);
}

.modernLayerButton > span:nth-child(2) {
    min-width: 0;
}

.modernLayerButton strong,
.modernLayerButton small {
    display: block;
}

.modernLayerButton strong {
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modernLayerButton small {
    margin-top: 2px;
    overflow: hidden;
    color: #7f949f;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modernLayerButton b {
    min-width: 22px;
    padding: 3px 5px;
    border-radius: 8px;
    color: #93a8b2;
    background: rgba(255, 255, 255, 0.06);
    font-size: 10px;
    text-align: center;
}

.layerIcon,
.catalogIcon {
    display: grid;
    place-items: center;
    border-radius: 10px;
}

.layerIcon {
    width: 34px;
    height: 34px;
    color: #748993;
    background: rgba(255, 255, 255, 0.05);
}

.modernLayerButton.active .layerIcon {
    color: var(--cyan);
    background: rgba(93, 225, 207, 0.12);
}

.layerIcon svg,
.catalogIcon svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
}

.layerIcon.lightning,
.catalogIcon.lightning { color: var(--yellow) !important; }
.layerIcon.rain,
.layerIcon.rainFront,
.catalogIcon.rain { color: var(--blue) !important; }
.layerIcon.storm,
.layerIcon.risk,
.catalogIcon.storm { color: var(--red) !important; }
.layerIcon.temperature,
.catalogIcon.temperature { color: var(--orange) !important; }
.layerIcon.winter,
.catalogIcon.winter,
.catalogIcon.ice { color: var(--ice) !important; }
.layerIcon.cloud,
.catalogIcon.cloud { color: #c7d4dc !important; }
.layerIcon.wind,
.catalogIcon.wind { color: var(--cyan) !important; }
.catalogIcon.fog { color: #9fb3bf; }
.catalogIcon.hail { color: var(--violet); }

#precipitationLegend {
    margin-top: 16px;
    padding: 11px;
    border: 1px solid rgba(214, 235, 245, 0.12);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.035);
}

#precipitationLegend > div:first-child,
.intensityLabels {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

#precipitationLegend > div:first-child span {
    color: var(--cyan);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0.10em;
}

#radarFrameStatus {
    overflow: hidden;
    color: #dce9ef;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.intensityScale {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    height: 9px;
    margin-top: 9px;
    overflow: hidden;
    border-radius: 8px;
}

.intensityScale i:nth-child(1) { background: rgba(30, 144, 255, 0.75); }
.intensityScale i:nth-child(2) { background: rgba(0, 191, 99, 0.82); }
.intensityScale i:nth-child(3) { background: rgba(255, 214, 10, 0.90); }
.intensityScale i:nth-child(4) { background: rgba(255, 140, 0, 0.92); }
.intensityScale i:nth-child(5) { background: rgba(220, 53, 69, 0.94); }
.intensityScale i:nth-child(6) { background: rgba(128, 0, 128, 0.96); }

.intensityLabels {
    margin-top: 5px;
    color: #93a7b1;
    font-size: 10px;
}

#precipitationLegend > small {
    display: block;
    margin-top: 8px;
    color: #788e99;
    font-size: 10px;
    line-height: 1.4;
}

.layerFreshness {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 16px;
    padding: 10px 4px 2px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}

.layerFreshness span {
    display: flex;
    align-items: center;
    gap: 7px;
}

.layerFreshness strong {
    color: #d9e7ed;
    font-size: 12px;
}

#modernDetailPanel {
    top: var(--topbar-bottom);
    right: calc(var(--layout-edge) + var(--safe-right));
    width: 306px;
    max-height: calc(100dvh - var(--topbar-bottom) - var(--footer-clearance));
    overflow: auto;
    padding: 15px;
}

.sourceBadge {
    padding: 4px 7px;
    border: 1px solid rgba(93, 225, 207, 0.25);
    border-radius: 8px;
    color: var(--cyan);
    background: rgba(93, 225, 207, 0.08);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.heroTemperature {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: end;
    margin: 18px 0 16px;
}

.heroTemperature strong {
    font-size: 56px;
    font-weight: 650;
    letter-spacing: -0.07em;
    line-height: 0.9;
}

.heroTemperature > span {
    margin-left: 5px;
    color: var(--muted);
    font-size: 20px;
}

.heroTemperature small {
    grid-column: 1 / -1;
    margin-top: 10px;
    color: var(--muted);
    font-size: 13px;
}

.detailMetrics {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
}

.detailMetrics div {
    display: grid;
    min-height: 46px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 9px;
    border: 1px solid rgba(214, 235, 245, 0.10);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.035);
}

.detailMetrics span,
.detailMetrics strong {
    display: block;
}

.detailMetrics span {
    color: #8398a3;
    font-size: 11px;
}

.detailMetrics strong {
    margin-top: 0;
    overflow-wrap: anywhere;
    font-size: 16px;
    text-align: right;
}

.modernAlert {
    position: absolute;
    z-index: 680;
    top: var(--topbar-bottom);
    left: 50%;
    display: flex;
    align-items: center;
    gap: 10px;
    width: min(460px, calc(100% - 640px));
    padding: 10px 13px;
    border: 1px solid rgba(255, 101, 121, 0.38);
    border-radius: 12px;
    background: rgba(62, 17, 27, 0.92);
    box-shadow: 0 14px 42px rgba(0, 0, 0, 0.28);
    transform: translateX(-50%);
    backdrop-filter: blur(14px);
}

.modernAlert > svg {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    color: var(--red);
    fill: rgba(255, 101, 121, 0.20);
}

.modernAlert strong,
.modernAlert small {
    display: block;
}

.modernAlert strong {
    font-size: 14px;
}

.modernAlert small {
    margin-top: 2px;
    color: #f2c7cf;
    font-size: 12px;
}

#modernTimeline {
    position: absolute;
    z-index: 640;
    left: 50%;
    bottom: calc(var(--footer-clearance) - 36px);
    display: grid;
    grid-template-columns: auto minmax(120px, 260px) auto auto;
    align-items: center;
    gap: 11px;
    width: min(560px, calc(100% - 640px));
    min-height: 42px;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface);
    box-shadow: var(--shadow);
    transform: translateX(-50%);
    backdrop-filter: blur(16px);
}

html.windowsWebView #modernTimeline {
    bottom: calc(var(--footer-clearance) - 36px - 5.5mm);
}

.liveBadge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--cyan);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.12em;
}

.liveBadge i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 10px rgba(93, 225, 207, 0.85);
}

.timelineTrack {
    position: relative;
    height: 3px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.14);
}

.timelineTrack::before {
    position: absolute;
    inset: 0;
    width: 100%;
    border-radius: inherit;
    content: "";
    background: linear-gradient(90deg, rgba(75, 197, 255, 0.35), var(--cyan));
}

.timelineTrack i {
    position: absolute;
    top: 50%;
    right: 0;
    width: 9px;
    height: 9px;
    border: 2px solid #071017;
    border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 0 3px rgba(93, 225, 207, 0.22);
    transform: translate(50%, -50%);
}

#modernUpdatedAt {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

#modernRefreshButton {
    min-height: 28px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    font-size: 12px;
}

#modernRefreshButton:disabled {
    opacity: 0.48;
    cursor: wait;
}

#modernSymbolPanel,
#modernOpsPanel,
#modernAiPanel {
    top: var(--topbar-bottom);
    right: calc(14px + var(--safe-right));
    width: min(540px, calc(100% - 28px));
    max-height: calc(100dvh - var(--topbar-bottom) - var(--footer-clearance) + 38px);
    overflow: auto;
    padding: 15px;
}

#modernSymbolPanel {
    z-index: 720;
}

#modernOpsPanel {
    z-index: 721;
}

#modernAiPanel {
    z-index: 723;
    width: min(620px, calc(100% - 28px));
}

.aiCompareContent {
    display: grid;
    gap: 12px;
    margin-top: 12px;
    color: var(--muted);
}

.aiCompareStatus {
    padding: 11px 12px;
    border: 1px solid rgba(171, 128, 255, 0.24);
    border-radius: 12px;
    background: rgba(171, 128, 255, 0.08);
}

.aiCompareStatus.unavailable {
    border-color: rgba(255, 210, 90, 0.25);
    background: rgba(255, 210, 90, 0.07);
}

.aiCompareStatus strong {
    color: #e8dcff;
    font-size: 14px;
}

.aiCompareStatus p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.aiMetrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
}

.aiMetric {
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.035);
}

.aiMetric span,
.aiMetric strong {
    display: block;
}

.aiMetric span {
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aiMetric strong {
    margin-top: 5px;
    color: var(--text);
    font-size: 17px;
}

.aiMetric.ai strong,
.aiMetric.delta strong {
    color: #d8c4ff;
}

.aiRangeSelector {
    display: flex;
    align-items: center;
    gap: 5px;
}

.aiRangeSelector > span {
    margin-right: auto;
    color: var(--muted);
    font-size: 12px;
}

.aiRangeSelector button {
    min-width: 48px;
    min-height: 32px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.035);
    cursor: pointer;
}

.aiRangeSelector button.active {
    border-color: rgba(171, 128, 255, 0.42);
    color: #eadfff;
    background: rgba(171, 128, 255, 0.14);
}

.aiChartWrap {
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(1, 8, 12, 0.32);
}

.aiChartWrap svg {
    display: block;
    width: 100%;
    max-height: 250px;
}

.aiGridLine {
    stroke: rgba(214, 235, 245, 0.11);
    stroke-width: 1;
}

.aiAxisLabel {
    fill: #8499a4;
    font: 11px Inter, "Segoe UI", sans-serif;
}

.aiChartLine {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.5;
    vector-effect: non-scaling-stroke;
}

.providerLine { stroke: #4fc3f7; }
.fmiLine { stroke: #72e5a1; }
.aiLine { stroke: #ba91ff; stroke-width: 3; }

.aiChartLegend {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 14px;
    padding: 4px 4px 1px;
    color: var(--muted);
    font-size: 11px;
}

.aiChartLegend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.aiChartLegend i {
    width: 18px;
    height: 3px;
    border-radius: 2px;
    background: currentColor;
}

.aiChartLegend .provider { color: #4fc3f7; }
.aiChartLegend .fmi { color: #72e5a1; }
.aiChartLegend .ai { color: #ba91ff; }

.aiEmpty {
    margin: 0;
    padding: 26px 12px;
    color: var(--muted);
    text-align: center;
}

.aiMeta {
    display: grid;
    grid-template-columns: minmax(90px, auto) 1fr;
    gap: 6px 12px;
    margin: 0;
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.025);
    font-size: 12px;
}

.aiMeta dt {
    color: var(--muted);
}

.aiMeta dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--text);
}

.aiTemperatureMarker {
    display: inline-flex;
    min-width: 50px;
    height: 28px;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0 6px;
    border: 1px solid rgba(186, 145, 255, 0.68);
    border-radius: 9px;
    color: #f0e8ff;
    background: rgba(31, 20, 48, 0.91);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.30);
    backdrop-filter: blur(7px);
}

.aiTemperatureMarker small {
    color: #ba91ff;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: 0.05em;
}

.aiTemperatureMarker b {
    font-size: 12px;
}

.aiTemperatureMarker.unavailable {
    border-color: rgba(190, 198, 204, 0.35);
    color: #a7b0b6;
    background: rgba(30, 36, 41, 0.82);
}

.symbolIntro {
    margin: 14px 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.symbolGrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.symbolGrid > div {
    display: grid;
    grid-template-columns: 42px 1fr;
    align-items: center;
    min-height: 58px;
    padding: 8px;
    border: 1px solid rgba(214, 235, 245, 0.10);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.035);
}

.catalogIcon {
    grid-row: 1 / 3;
    width: 34px;
    height: 34px;
    background: rgba(255, 255, 255, 0.06);
}

.symbolGrid strong,
.symbolGrid small {
    display: block;
}

.symbolGrid strong {
    font-size: 13px;
}

.symbolGrid small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

.symbolGrid .future {
    opacity: 0.55;
}

.modernOpsRow {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(0, 1.45fr);
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid rgba(214, 235, 245, 0.10);
    color: var(--muted);
    font-size: 13px;
}

.modernOpsRow strong {
    color: var(--text);
    font-weight: 650;
}

.sourceRegistry {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(214, 235, 245, 0.16);
}

.sourceRegistryHeading,
.sourceLicenseHeading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.sourceRegistryHeading small,
.sourceRegistryHeading strong {
    display: block;
}

.sourceRegistryHeading small {
    color: var(--accent);
    font-size: 10px;
    letter-spacing: 0.12em;
}

.sourceRegistryHeading strong {
    margin-top: 3px;
    font-size: 15px;
}

.sourceRegistryHeading b {
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
}

.sourceRegistry > p {
    margin: 9px 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.sourceLicenseGroup {
    margin-top: 9px;
    border: 1px solid rgba(214, 235, 245, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.025);
}

.sourceLicenseGroup > summary {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    color: var(--text);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.sourceLicenseGroup > summary span {
    color: var(--accent);
}

.sourceLicenseList {
    display: grid;
    gap: 8px;
    padding: 0 8px 8px;
}

.sourceLicenseCard {
    padding: 10px;
    border: 1px solid rgba(214, 235, 245, 0.10);
    border-radius: 9px;
    background: rgba(5, 13, 18, 0.52);
}

.sourceLicenseHeading strong {
    color: var(--text);
    font-size: 12px;
}

.sourceLicenseHeading span {
    padding: 2px 6px;
    border-radius: 999px;
    color: var(--accent);
    background: rgba(126, 231, 214, 0.09);
    font-size: 9px;
    white-space: nowrap;
}

.sourceLicenseCard p,
.sourceLicenseCard dl {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.45;
}

.sourceLicenseCard dl div {
    display: grid;
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 6px;
    margin-top: 4px;
}

.sourceLicenseCard dt {
    color: var(--text);
    font-weight: 650;
}

.sourceLicenseCard dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.sourceLicenseCard .sourceLicenseNote {
    color: #d5b56e;
}

.sourceLicenseCard nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.sourceLicenseCard nav a {
    padding: 3px 7px;
    border: 1px solid rgba(126, 231, 214, 0.24);
    border-radius: 7px;
    color: var(--accent);
    text-decoration: none;
    font-size: 10px;
}

.sourceLicenseCard nav a:hover,
.sourceLicenseCard nav a:focus-visible {
    background: rgba(126, 231, 214, 0.10);
}

.sourceRegistryUnavailable {
    color: #d5b56e;
    font-size: 12px;
}

.downloadLink {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.downloadLink svg {
    width: 13px;
    height: 13px;
    color: var(--cyan);
}

.downloadLink small {
    color: #748892;
}

.mapWeatherMarker {
    display: grid;
    place-items: center;
    color: var(--text);
}

.mapWeatherMarker > span {
    position: relative;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 11px;
    background: rgba(8, 19, 26, 0.88);
    box-shadow: 0 7px 18px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(7px);
}

.mapWeatherMarker svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
}

.mapWeatherMarker b {
    position: absolute;
    top: -7px;
    right: -9px;
    min-width: 23px;
    padding: 2px 4px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 7px;
    color: var(--text);
    background: rgba(5, 13, 18, 0.94);
    font-size: 10px;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
}

.mapWeatherMarker.rain { color: var(--blue); }
.mapWeatherMarker.lightning { color: var(--yellow); }
.mapWeatherMarker.storm,
.mapWeatherMarker.risk { color: var(--red); }
.mapWeatherMarker.temperature { color: var(--orange); }
.mapWeatherMarker.wind { color: var(--cyan); }
.mapWeatherMarker.cloud { color: #d8e2e7; }
.mapWeatherMarker.fog { color: #9fb3bf; }
.mapWeatherMarker.snow,
.mapWeatherMarker.ice { color: var(--ice); }

.selectedCityMarker {
    position: relative;
    display: flex;
    width: max-content;
    min-width: 40px;
    height: 38px;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    filter: drop-shadow(0 6px 13px rgba(0, 0, 0, 0.72));
}

.selectedCityMarker i {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    border: 4px solid #ffffff;
    border-radius: 50% 50% 50% 0;
    background: var(--cyan);
    box-shadow: 0 0 0 4px rgba(65, 224, 198, 0.28);
    transform: rotate(-45deg);
}

.selectedCityMarker b {
    padding: 6px 10px;
    border: 1px solid rgba(126, 231, 214, 0.7);
    border-radius: 8px;
    background: rgba(5, 16, 22, 0.92);
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.38);
    font-size: 14px;
    font-weight: 850;
    letter-spacing: 0.01em;
    line-height: 1;
    white-space: nowrap;
}

.mapWeatherMarker.lightning > span::after,
.mapWeatherMarker.storm > span::after,
.mapWeatherMarker.risk > span::after {
    position: absolute;
    inset: -5px;
    border: 1px solid currentColor;
    border-radius: 14px;
    content: "";
    opacity: 0;
    animation: hazardPulse 1.8s ease-out infinite;
}

.mapWeatherMarker.stale {
    filter: grayscale(0.75);
    opacity: 0.48;
}

.cityMarkerActive {
    opacity: 1;
}

.cityMarkerInactive {
    filter: grayscale(1) saturate(0);
    opacity: 0.48;
}

.cityMarkerInactive .mapTemperatureLabel,
.cityMarkerInactive .windArrowMarker {
    border-color: rgba(210, 218, 222, 0.54);
    color: #9aa5ab;
}

@keyframes hazardPulse {
    0% { opacity: 0.55; transform: scale(0.78); }
    100% { opacity: 0; transform: scale(1.22); }
}

.mapTemperatureLabel {
    display: grid;
    min-width: 42px;
    height: 28px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 9px;
    color: #fff;
    background: rgba(18, 32, 41, 0.88);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.30);
    font-size: 12px;
    font-weight: 850;
    backdrop-filter: blur(7px);
}

.mapTemperatureLabel.cold { border-color: rgba(75, 197, 255, 0.55); color: #aee5ff; }
.mapTemperatureLabel.warm { border-color: rgba(255, 158, 87, 0.55); color: #ffc08f; }
.mapTemperatureLabel.hot { border-color: rgba(255, 101, 121, 0.65); color: #ff9ca9; }

.windArrowMarker {
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    color: var(--cyan);
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.6));
}

.windArrowMarker::before {
    width: 0;
    height: 0;
    border-right: 5px solid transparent;
    border-bottom: 14px solid currentColor;
    border-left: 5px solid transparent;
    content: "";
}

.windArrowMarker.dir-0 { transform: rotate(0deg); }
.windArrowMarker.dir-30 { transform: rotate(30deg); }
.windArrowMarker.dir-60 { transform: rotate(60deg); }
.windArrowMarker.dir-90 { transform: rotate(90deg); }
.windArrowMarker.dir-120 { transform: rotate(120deg); }
.windArrowMarker.dir-150 { transform: rotate(150deg); }
.windArrowMarker.dir-180 { transform: rotate(180deg); }
.windArrowMarker.dir-210 { transform: rotate(210deg); }
.windArrowMarker.dir-240 { transform: rotate(240deg); }
.windArrowMarker.dir-270 { transform: rotate(270deg); }
.windArrowMarker.dir-300 { transform: rotate(300deg); }
.windArrowMarker.dir-330 { transform: rotate(330deg); }

.rainMotionPath,
.stormMotionPath {
    stroke-linecap: round;
    stroke-linejoin: round;
}

.rainMotionPath {
    filter: drop-shadow(0 0 7px rgba(75, 197, 255, 0.68));
    animation: motionDash 1.1s linear infinite;
}

.stormMotionPath {
    filter: drop-shadow(0 0 8px rgba(255, 101, 121, 0.70));
    animation: motionDash 0.85s linear infinite;
}

@keyframes motionDash {
    to { stroke-dashoffset: -30; }
}

.modernRadarFrame,
.modernRadarAccumulation {
    pointer-events: none;
    transition: opacity 280ms ease;
}

.modernRadarFrame {
    filter: saturate(1.18) contrast(1.06) drop-shadow(0 0 8px rgba(75, 197, 255, 0.18));
}

.modernRadarAccumulation {
    filter: saturate(1.08) contrast(1.04);
}

.rainDirectionMarker,
.stormDirectionMarker {
    width: 58px;
    height: 22px;
    transform-origin: 8px 11px;
    filter: drop-shadow(0 0 5px currentColor) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.7));
}

.rainDirectionMarker { color: #65d7ff; }
.stormDirectionMarker { color: #ff6579; }

.rainDirectionMarker > span,
.stormDirectionMarker > span {
    position: absolute;
    top: 9px;
    left: 4px;
    width: 45px;
    height: 4px;
    border-radius: 4px;
    background: repeating-linear-gradient(90deg, transparent 0 5px, currentColor 5px 12px);
    background-size: 24px 4px;
    animation: directionFlow 0.85s linear infinite;
}

.rainDirectionMarker > span::after,
.stormDirectionMarker > span::after {
    position: absolute;
    top: -5px;
    right: -7px;
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left: 11px solid currentColor;
    content: "";
}

@keyframes directionFlow {
    to { background-position: 24px 0; }
}

.rainDirectionMarker.dir-0,
.stormDirectionMarker.dir-0 { transform: rotate(0deg); }
.rainDirectionMarker.dir-30,
.stormDirectionMarker.dir-30 { transform: rotate(30deg); }
.rainDirectionMarker.dir-60,
.stormDirectionMarker.dir-60 { transform: rotate(60deg); }
.rainDirectionMarker.dir-90,
.stormDirectionMarker.dir-90 { transform: rotate(90deg); }
.rainDirectionMarker.dir-120,
.stormDirectionMarker.dir-120 { transform: rotate(120deg); }
.rainDirectionMarker.dir-150,
.stormDirectionMarker.dir-150 { transform: rotate(150deg); }
.rainDirectionMarker.dir-180,
.stormDirectionMarker.dir-180 { transform: rotate(180deg); }
.rainDirectionMarker.dir-210,
.stormDirectionMarker.dir-210 { transform: rotate(210deg); }
.rainDirectionMarker.dir-240,
.stormDirectionMarker.dir-240 { transform: rotate(240deg); }
.rainDirectionMarker.dir-270,
.stormDirectionMarker.dir-270 { transform: rotate(270deg); }
.rainDirectionMarker.dir-300,
.stormDirectionMarker.dir-300 { transform: rotate(300deg); }
.rainDirectionMarker.dir-330,
.stormDirectionMarker.dir-330 { transform: rotate(330deg); }

.snowFrontArea {
    filter: drop-shadow(0 0 9px rgba(185, 232, 255, 0.72));
}

.snowFrontHeatmap {
    pointer-events: none;
    mix-blend-mode: screen;
    filter: saturate(1.15) contrast(1.08);
}

@media (max-width: 1180px) {
    #modernTopbar {
        grid-template-columns: minmax(210px, 1fr) minmax(210px, 300px) auto;
    }

    .modernTextLink {
        display: none;
    }

    #modernTimeline {
        width: min(460px, calc(100% - 560px));
    }
}

@media (max-width: 920px) {
    #modernTopbar {
        grid-template-columns: 1fr auto;
    }

    .modernCityControl {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .modernTopActions {
        grid-column: 2;
        grid-row: 1;
    }

    .modernMobileButton {
        display: inline-flex;
    }

    #modernLayerPanel {
        z-index: 730;
        top: var(--topbar-bottom);
        bottom: var(--footer-clearance);
        width: min(310px, calc(100% - 28px));
        transform: translateX(calc(-100% - 20px));
        transition: none;
    }

    #modernLayerPanel.open {
        transform: none;
    }

    #modernLayerPanelClose {
        display: grid;
    }

    #modernDetailPanel {
        top: var(--topbar-bottom);
    }

    .modernAlert {
        top: var(--topbar-bottom);
        left: 14px;
        width: calc(100% - 328px);
        transform: none;
    }

    #modernTimeline {
        left: 14px;
        width: calc(100% - 328px);
        transform: none;
    }
}

@media (max-width: 680px) {
    :root {
        --layout-edge: 8px;
        --layout-bar-edge: var(--layout-edge);
    }

    #modernTopbar {
        top: 8px;
        gap: 8px;
        border-radius: 13px;
    }

    .modernBrandMark {
        width: 36px;
        height: 36px;
    }

    .modernBrand strong {
        font-size: 17px;
    }

    #modernStatus {
        display: none;
    }

    .modernTopActions {
        width: min(58vw, 230px);
        max-width: 100%;
        justify-self: end;
        justify-content: flex-start;
    }

    .modernTopActions > button {
        flex: 0 0 auto;
    }

    .modernAiToggle {
        font-size: 0;
    }

    .modernAiToggle::before {
        content: "AI";
        font-size: 13px;
    }

    .modernAiToggle small {
        display: none;
    }

    #modernSymbolToggle {
        display: none;
    }

    #modernLayerPanel {
        top: var(--topbar-bottom);
        bottom: var(--footer-clearance);
        left: calc(var(--layout-edge) + var(--safe-left));
    }

    .telemetryConsent {
        grid-template-columns: 1fr;
    }

    #modernTelemetryToggle {
        width: 100%;
    }

    #modernDetailPanel {
        top: auto;
        right: calc(var(--layout-edge) + var(--safe-right));
        bottom: calc(var(--footer-clearance) + 34px);
        left: calc(var(--layout-edge) + var(--safe-left));
        width: auto;
        max-height: min(42dvh, 330px);
        padding: 11px;
    }

    .detailHeader,
    .heroTemperature {
        display: none;
    }

    .detailMetrics div {
        min-height: 42px;
        padding: 7px 9px;
    }

    .modernAlert {
        top: var(--topbar-bottom);
        right: calc(8px + var(--safe-right));
        left: calc(8px + var(--safe-left));
        width: auto;
    }

    #modernTimeline {
        right: calc(8px + var(--safe-right));
        bottom: calc(var(--footer-clearance) - 36px);
        left: calc(8px + var(--safe-left));
        grid-template-columns: auto 1fr auto;
        width: auto;
    }

    #modernRefreshButton {
        display: none;
    }

    #modernSymbolPanel,
    #modernOpsPanel,
    #modernAiPanel {
        top: var(--topbar-bottom);
        right: calc(8px + var(--safe-right));
        left: calc(8px + var(--safe-left));
        width: auto;
        max-height: calc(100dvh - var(--topbar-bottom) - var(--footer-clearance) + 32px);
    }

    #modernAiPanel {
        top: auto;
        bottom: calc(8px + var(--safe-bottom));
        max-height: min(70dvh, 720px);
        border-radius: 16px 16px 10px 10px;
    }

    .aiMetrics {
        grid-template-columns: 1fr;
    }

    .aiMetric {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
    }

    .aiMetric strong {
        margin-top: 0;
        font-size: 15px;
    }

    .downloadLink small {
        display: none;
    }
}

@media (max-width: 420px) {
    #modernTopbar {
        padding-inline: 8px;
    }

    .modernBrand {
        gap: 6px;
    }

    .modernBrand em {
        display: none;
    }

    .modernTextButton,
    .modernMobileButton {
        min-height: 36px;
        padding-inline: 8px;
        font-size: 13px;
    }

    .modernCityControl {
        grid-template-columns: 18px 1fr;
    }

    .modernCityControl label {
        display: none;
    }

    #modernCitySelect {
        padding-left: 4px;
        font-size: 15px;
    }

    #modernUpdatedAt {
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

@media (max-height: 620px) {
    #modernTopbar {
        min-height: 54px;
        padding-block: 6px;
    }

    #modernStatus,
    .modernBrand em {
        display: none;
    }

    #modernLayerPanel {
        padding-block: 10px;
    }

    .layerGroup {
        margin-top: 10px;
    }

    .modernLayerButton {
        min-height: 48px;
    }

    #modernDetailPanel {
        max-height: calc(100dvh - var(--topbar-bottom) - var(--footer-clearance));
    }

    .heroTemperature {
        margin-block: 10px;
    }

    .heroTemperature strong {
        font-size: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
/* PWA-yhteystila ei sisällä palvelindataa, tunnuksia tai välimuistitietoja. */
.pwaConnectionStatus {
    position: fixed;
    z-index: 10000;
    right: 1rem;
    bottom: 1rem;
    max-width: min(28rem, calc(100vw - 2rem));
    padding: 0.75rem 1rem;
    border: 1px solid #f59e0b;
    border-radius: 0.75rem;
    background: #451a03;
    color: #fff7ed;
    box-shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 35%);
}

.pwaConnectionStatus[hidden] {
    display: none;
}
