html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: Arial, sans-serif;
    color: #20313d;
}
#map {
    position: absolute;
    inset: 0;
}
.panel {
    position: absolute;
    z-index: 2;
    top: 12px;
    left: 12px;
    width: min(288px, calc(100vw - 72px));
    box-sizing: border-box;
    background: rgba(255,255,255,.96);
    border: 1px solid #dce4e9;
    border-radius: 14px;
    padding: 0;
    box-shadow: 0 4px 18px #17324626;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
}
.panel-details {
    padding: 13px;
}
.panel-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    list-style: none;
}
.panel-summary::-webkit-details-marker {
    display: none;
}
.panel-title { font-size: 20px; font-weight: bold; }
.panel-heading { display: grid; gap: 2px; min-width: 0; }
.panel-layer { color: #526c7e; font-size: 12px; font-weight: normal; }
.panel-toggle-text {
    color: #444;
    font-size: 12px;
    white-space: nowrap;
}
.panel-summary:focus-visible {
    outline: 2px solid #2171b5;
    outline-offset: 2px;
}
.station-refresh:focus-visible,
.station-filter input:focus-visible,
.map-options > summary:focus-visible,
.legend-codes summary:focus-visible,
.maplibregl-popup-close-button:focus-visible {
    outline: 2px solid #2171b5;
    outline-offset: 2px;
}
.panel-body {
    margin-top: 8px;
}
h2 {
    margin: 0 0 8px;
    font-size: 20px;
}
.small {
    color: #555;
    font-size: 12px;
    line-height: 1.45;
}
label {
    display: block;
    margin-top: 12px;
    font-size: 13px;
    font-weight: bold;
}
select {
    width: 100%;
    margin-top: 5px;
    padding: 8px;
    font-size: 14px;
}
.station-filter {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 44px;
    cursor: pointer;
}
.station-filter input {
    width: 18px;
    height: 18px;
    margin: 0;
    flex-shrink: 0;
}
.station-filter-help {
    margin: 0;
}
.station-refresh {
    flex-shrink: 0;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid #cfdae2;
    background: #f6f9fb;
    border-radius: 8px;
    color: #274f6b;
    cursor: pointer;
}
#legend {
    margin-top: 14px;
    font-size: 12px;
    line-height: 1.5;
}
.legend-title { margin-bottom: 7px; font-weight: bold; color: #344e60; }
.legend-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 10px; }
.legend-grid > div { display: flex; align-items: center; }
.legend-note { color: #657784; font-size: 11px; margin-top: 9px; }
.legend-swatch { width: 12px; height: 12px; margin-right: 6px; border: 1px solid #93a7b477; border-radius: 2px; flex-shrink: 0; }
.legend-glacier-swatch { background-image: repeating-linear-gradient(135deg, var(--glacier-stripe) 0 2px, transparent 2px 8px); }
.station-filter[hidden], .snow-field-only[hidden], .wind-field-only[hidden], #stationFilterOptions[hidden] { display: none !important; }
#snowFieldNotice, #windFieldNotice { margin: 8px 0 0; color: #657784; font-size: 12px; line-height: 1.45; }
.snow-timeline { position: absolute; z-index: 3; left: 50%; transform: translateX(-50%); bottom: calc(12px + var(--snow-attribution-height, 36px) + env(safe-area-inset-bottom, 0px)); width: min(480px, calc(100% - 20px)); box-sizing: border-box; border: 1px solid #cfdae2; border-radius: 12px; background: rgba(255,255,255,.97); box-shadow: 0 4px 18px #17324626; }
.snow-timeline > summary { padding: 4px 8px; min-height: 32px; box-sizing: border-box; cursor: pointer; font-size: 12px; color: #274f6b; line-height: 1.45; overflow-wrap: anywhere; }
.snow-timeline > summary:focus-visible, .snow-time-actions button:focus-visible, .snow-timeline input:focus-visible { outline: 2px solid #2171b5; outline-offset: 2px; }
.snow-timeline-body { padding: 0 8px 4px; max-height: min(28vh, 210px); overflow-y: auto; overscroll-behavior: contain; }
.snow-timeline label { margin-top: 0; font-weight: normal; font-size: 11px; color: #526c7e; }
.snow-time-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.snow-timeline input[type="range"] { flex: 1; width: 100%; min-width: 0; margin: 0; height: 24px; accent-color: #274f6b; cursor: pointer; }
.snow-time-actions { display: flex; align-items: center; gap: 8px; }
.snow-time-actions button { min-width: 60px; min-height: 32px; padding: 3px 8px; border: 1px solid #cfdae2; border-radius: 6px; background: white; color: #274f6b; cursor: pointer; }
.snow-time-actions button:last-child { margin-left: 0; padding: 3px 8px; }
.snow-time-actions button:disabled { opacity: .45; cursor: default; }
.snow-time-actions button[aria-pressed="true"] { background: #274f6b; color: white; }
.snow-time-actions [data-time-playback] { min-width: 70px; flex-shrink: 0; }
.snow-time-actions [data-wind-time-latest] { max-width: 140px; overflow-wrap: anywhere; }
.snow-time-note { margin: 8px 0 0; font-size: 11px; line-height: 1.45; color: #657784; }
.snow-time-note:empty { display: none; }
.station-filter:has(input:disabled) { color: #7b8790; cursor: default; }
.legend-codes { margin-top: 6px; color: #657784; }
.legend-codes summary { cursor: pointer; min-height: 44px; display: list-item; padding-top: 11px; box-sizing: border-box; }
.map-options { border-top: 1px solid #e4eaee; margin-top: 10px; }
.map-options > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-size: 13px; color: #526c7e; }
.map-options > summary::after { content: "+"; margin-left: auto; }
.map-options[open] > summary::after { content: "−"; }
.panel-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.panel-footer .status { margin: 0; min-width: 0; }
.share-status { padding: 8px; border-radius: 6px; background: #eaf3f8; color: #244e68; overflow-wrap: anywhere; font-size: 12px; font-weight: normal; line-height: 1.4; }
.share-button { width: 100%; margin-top: 8px; }
.share-link input { width: 100%; box-sizing: border-box; min-height: 44px; padding: 8px; border: 1px solid #bdccd6; border-radius: 6px; font-size: 14px; }
.share-help { color: #526c7e; }
#stationUpdateStatus { margin: 7px 0 0; font-size: 11px; color: #657784; }
.dot {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: -1px;
    border: 1px solid #93a7b455;
    flex-shrink: 0;
}
.popup {
    min-width: 200px;
    max-width: 290px;
    font-size: 13px;
    line-height: 1.5;
}
.maplibregl-popup-content {
    box-sizing: border-box;
    max-height: min(78vh, calc(100vh - 48px));
    overflow-y: auto;
    overscroll-behavior: contain;
}
@supports (height: 100dvh) {
    .maplibregl-popup-content {
        max-height: min(78dvh, calc(100dvh - 48px));
    }
}
.popup h3 {
    margin: 0 30px 9px 0;
    font-size: 16px;
}
.history-details {
    margin-top: 0;
    border-top: 1px solid #e7edf1;
}
.history-details summary {
    min-height: 44px;
    box-sizing: border-box;
    padding: 11px 0;
    cursor: pointer;
    font-weight: bold;
}
.observation-hero { padding: 4px 0 13px; }
.observation-label { color: #657784; font-size: 12px; margin-bottom: 2px; }
.observation-value { color: #173f59; font-size: 28px; font-weight: bold; line-height: 1.2; margin-bottom: 5px; }
.observation-value.text-value { font-size: 19px; }
.weather-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 2px 10px; padding: 7px 0; overflow-wrap: anywhere; }
.weather-row + .weather-row { border-top: 1px solid #edf1f4; }
.weather-row strong { text-align: right; }
.weather-row .measurement-age { grid-column: 1 / -1; }
.station-metadata { color: #657784; font-size: 12px; padding-bottom: 8px; }
.station-metadata div { margin: 5px 0; }
.maplibregl-popup-close-button { width: 44px; height: 44px; font-size: 20px; color: #526c7e; border-radius: 6px; }
.maplibregl-ctrl-attrib { max-width: calc(100vw - 24px); }
.station-navigation { margin: 12px 0 4px; }
.station-navigation [hidden] { display: none !important; }
.nav-search-label { margin: 0 0 5px; font-size: 13px; }
.nav-search-row { display: flex; align-items: center; gap: 4px; }
.nav-search-input { box-sizing: border-box; width: 100%; min-width: 0; min-height: 44px; border: 1px solid #b8c9d5; border-radius: 8px; padding: 10px; font: inherit; font-size: 16px; color: #20313d; background: #fff; }
.nav-search-clear, .nav-remove-favorite { flex-shrink: 0; min-width: 44px; min-height: 44px; border: 1px solid #dce4e9; background: #f6f9fb; border-radius: 8px; color: #526c7e; cursor: pointer; }
.nav-search-results, .favorites-list { display: grid; gap: 4px; margin-top: 6px; }
.nav-station-button { width: 100%; min-width: 0; min-height: 44px; text-align: left; border: 1px solid #e2e9ee; border-radius: 8px; background: #fff; padding: 8px 9px; color: #20313d; cursor: pointer; font: inherit; }
.nav-station-button:hover { background: #edf5fa; border-color: #b7cedd; }
.nav-station-name, .nav-station-detail { display: block; overflow-wrap: anywhere; }
.nav-station-name { font-size: 13px; font-weight: bold; }
.nav-station-detail { color: #657784; font-size: 12px; margin-top: 2px; }
.nav-search-status { margin: 5px 0; color: #657784; font-size: 12px; }
.nav-search-status:empty { display: none; }
.favorites-details { margin-top: 4px; }
.favorites-details > summary { min-height: 44px; box-sizing: border-box; padding: 11px 0; color: #526c7e; font-size: 13px; cursor: pointer; }
.favorites-list { max-height: 230px; overflow-y: auto; overscroll-behavior: contain; }
.nav-favorite-missing { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 6px; font-size: 12px; color: #657784; }
.nav-favorite-missing > span { min-width: 0; overflow-wrap: anywhere; }
.nav-favorite-missing .nav-station-name, .nav-favorite-missing .nav-station-detail { grid-column: 1; }
.nav-favorite-missing .nav-remove-favorite { grid-column: 2; grid-row: 1 / 3; }
.station-overview { display: flex; align-items: flex-start; gap: 8px; }
.station-overview .observation-hero { flex: 1; min-width: 0; }
.station-favorite { flex-shrink: 0; width: 44px; height: 44px; margin-top: 4px; border: 1px solid #dce4e9; border-radius: 10px; background: #fff; color: #526c7e; font-size: 25px; cursor: pointer; }
.station-favorite[aria-pressed="true"] { color: #1c608f; background: #eaf4fb; border-color: #9fc4dd; }
.station-navigation button:focus-visible, .station-navigation input:focus-visible,
.favorites-details > summary:focus-visible, .station-favorite:focus-visible { outline: 2px solid #2171b5; outline-offset: 2px; }
.map-selection-status { margin: 0 0 8px; font-size: 12px; color: #526c7e; }
.map-selection-status:empty { display: none; }
.history-details summary:focus-visible {
    outline: 2px solid #2171b5;
    outline-offset: 2px;
}
#history {
    display: block;
    width: 280px;
    max-width: 100%;
    height: 150px;
    margin-top: 5px;
    cursor: crosshair;
}
.history-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    margin-top: 8px;
}
.history-controls label {
    margin-top: 0;
}
.history-status {
    margin-top: 4px;
}
.snow-model-result {
    padding: 7px 8px;
    border-radius: 4px;
    background: #f3f4f6;
    overflow-anchor: none;
}
.snow-model-result p {
    margin: 0 0 5px;
}
.snow-model-result p:last-child {
    margin-bottom: 0;
}
.snow-model-warning {
    color: #744400;
    font-weight: bold;
}
.snow-model-retry {
    min-height: 44px;
    padding: 8px;
    text-align: left;
    white-space: normal;
    cursor: pointer;
}
.snow-model-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}
.snow-model-actions button:focus-visible,
.snow-density-details summary:focus-visible {
    outline: 2px solid #2171b5;
    outline-offset: 2px;
}
.snow-density-details {
    margin: 7px 0;
}
.snow-density-details summary {
    min-height: 44px;
    box-sizing: border-box;
    padding: 10px 0;
}
.history-stats {
    margin-top: 5px;
    padding: 6px;
    border-radius: 4px;
    background: #f3f4f6;
    color: #333;
    font-size: 12px;
    line-height: 1.6;
}
.measurement-age {
    color: #555;
    font-size: 12px;
}
.missing-measurement {
    color: #666;
}
.status {
    margin-top: 8px;
    color: #555;
    font-size: 11px;
}
@media (pointer: coarse) {
    .panel-summary, .snow-timeline > summary, select,
    .snow-timeline input[type="range"], .snow-time-actions button {
        min-height: 44px;
    }
    select { font-size: 16px; }
    .maplibregl-ctrl-group button, .maplibregl-ctrl-attrib-button {
        width: 44px;
        height: 44px;
    }
    .maplibregl-ctrl-attrib-button {
        background-repeat: no-repeat;
        background-position: center;
    }
    .maplibregl-ctrl-attrib.maplibregl-compact {
        min-width: 44px;
        min-height: 44px;
        padding-right: 44px;
    }
}
@media (max-width: 600px), (max-height: 500px) {
    .panel {
        top: max(8px, env(safe-area-inset-top));
        left: max(8px, env(safe-area-inset-left));
        width: min(288px, calc(100vw - 72px));
        max-height: min(60vh, calc(100vh - var(--map-bottom-controls-height, 140px) - 20px));
        overflow-y: auto;
    }
    .panel.collapsed {
        width: fit-content;
        max-width: calc(100vw - 72px);
    }
    .panel-details {
        padding: 10px;
    }
    .panel-toggle-text {
        font-size: 11px;
    }
    .panel-title {
        font-size: 18px;
    }
    .small {
        font-size: 12px;
    }
    label {
        margin-top: 9px;
    }
    select {
        min-height: 44px;
        font-size: 16px;
    }
    .panel-summary, .snow-timeline > summary {
        min-height: 44px;
    }
    .snow-timeline input[type="range"], .snow-time-actions button {
        min-height: 44px;
    }
    .maplibregl-popup {
        z-index: 4;
        max-width: min(280px, calc(100vw - 48px)) !important;
    }
    .maplibregl-popup-content {
        min-height: 120px;
        max-height: min(60vh, calc(100vh - 80px));
        padding: 13px;
        touch-action: pan-y;
    }
    .popup {
        min-width: 0;
        max-width: 100%;
        font-size: 14px;
    }
    #history {
        height: 130px;
    }
}
@supports (height: 100dvh) {
    @media (max-width: 600px), (max-height: 500px) {
        .panel {
            max-height: min(60dvh, calc(100dvh - var(--map-bottom-controls-height, 140px) - 20px));
        }
        .maplibregl-popup-content {
            max-height: min(60dvh, calc(100dvh - var(--map-bottom-controls-height, 140px) - 80px));
        }
    }
}
