:root{font-family:Manrope,system-ui,sans-serif;color:#ededdf;background:#181818;font-synthesis:none;--acid:#d7ed8b;--muted:#92958c;--line:#ffffff17}*{box-sizing:border-box}body{margin:0;overflow:hidden}button,input{font:inherit}button,a,input{-webkit-tap-highlight-color:transparent}button{cursor:pointer;color:inherit;border:0;background:none;transition:background .3s cubic-bezier(.22,1,.36,1),transform .3s cubic-bezier(.22,1,.36,1)}button:hover{background:#ffffff12}button:active{transform:scale(.98)}button:focus-visible,a:focus-visible,input:focus-visible{outline:2px solid var(--acid);outline-offset:4px}button:disabled{cursor:wait;opacity:.5}button[hidden],[hidden]{display:none!important}#map{position:absolute;inset:0;background:#272727}.map-vignette{pointer-events:none;position:absolute;inset:0;box-shadow:inset 200px 0 200px #18181860,inset 0 80px 80px #18181890}header{position:absolute;left:32px;right:32px;top:24px;display:flex;align-items:center;justify-content:space-between;pointer-events:none}header>*{pointer-events:auto}.brand{display:flex;gap:12px;align-items:center;color:inherit;text-decoration:none}.brand svg{width:40px;height:40px;color:var(--acid)}.brand strong{font-size:20px;line-height:28px;font-weight:700}.brand span{display:block;font-size:10px;letter-spacing:.16em;color:#b0b3a7;margin-top:4px}.header-right{display:flex;gap:24px;align-items:center;font-size:12px}.date{color:#d0d2c7}.quiet{background:#181818c9;border:1px solid var(--line);padding:8px 12px;border-radius:8px;font-size:14px;backdrop-filter:blur(16px)}.sidebar{position:absolute;left:32px;top:104px;bottom:32px;width:336px;border:1px solid var(--line);border-radius:16px;padding:24px;display:flex;flex-direction:column;background:#181818ed;backdrop-filter:blur(24px);box-shadow:0 16px 64px #0003}.section-eyebrow{display:flex;align-items:center;justify-content:space-between;font-size:10px;letter-spacing:.12em;color:#a6ab9c}.status{letter-spacing:0;font-size:10px;color:var(--acid);white-space:nowrap}.status:before{content:' ';display:inline-block;width:5px;height:5px;border-radius:50%;background:currentColor;margin-right:4px}h1{font-size:30px;line-height:36px;letter-spacing:-.055em;font-weight:500;margin:24px 0 12px;text-wrap:balance}.intro{color:var(--muted);font-size:12px;line-height:20px;margin:0 0 24px}.pollutants{display:flex;gap:4px;padding:4px;background:#272727;border-radius:8px}.pollutants button{flex:1;padding:8px 4px;border-radius:4px;font-size:12px}.pollutants button.active{background:var(--acid);color:#202719;font-weight:700}.reading{margin-top:24px}.reading-head{display:flex;justify-content:space-between;font-size:10px;color:#a3a699}.unit{color:#b4b8a8}.value-row{display:flex;gap:16px;align-items:center;margin:8px 0 16px}.value-row>strong{font-size:60px;line-height:1;font-weight:500;letter-spacing:-.065em}.value-row>div{display:flex;flex-direction:column;gap:8px}.level{font-size:12px;color:var(--acid)}#updated{color:var(--muted);font-size:10px}.spectrum{position:relative;display:flex;gap:4px;height:4px}.spectrum span{flex:1;border-radius:2px}.spectrum span:nth-of-type(1){background:#78c6a0}.spectrum span:nth-of-type(2){background:#d7ed8b}.spectrum span:nth-of-type(3){background:#f1d47d}.spectrum span:nth-of-type(4){background:#e99d6c}.spectrum span:nth-of-type(5){background:#d26e75}.spectrum span:nth-of-type(6){background:#aa82b6}.spectrum i{position:absolute;top:-4px;width:2px;height:12px;background:white;left:0;box-shadow:0 0 0 2px #181818}.scale-labels{display:flex;justify-content:space-between;font-size:10px;color:#7f8476;margin-top:8px}.station-heading{display:flex;justify-content:space-between;align-items:center;margin-top:24px}.station-heading h2{font-size:12px;font-weight:600;margin:0}.station-heading h2 span{font-size:10px;color:#acb29d;background:#313131;padding:2px 4px;margin-left:4px;border-radius:4px}.icon-button{font-size:20px;width:32px;height:32px}.search{display:flex;align-items:center;gap:8px;margin:8px 0;background:#272727;border-radius:8px;padding:8px 12px}.search svg{width:16px;stroke:#969b8a;fill:none;stroke-width:1.5}.search input{width:100%;min-width:0;background:none;border:0;color:inherit;font-size:12px;outline:none}.search input::placeholder{color:#858b7a}.stations{flex:1;min-height:48px;overflow:auto;scrollbar-width:thin;scrollbar-color:#42483b transparent;margin:4px -8px 0;padding:0 4px}.station{display:flex;width:100%;gap:12px;align-items:center;text-align:left;padding:12px 8px;border-radius:8px}.station.selected{background:#ffffff0a}.station .point{width:7px;height:7px;border-radius:50%;flex-shrink:0;box-shadow:0 0 12px currentColor}.station .station-text{flex:1;min-width:0}.station .name{display:block;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.station small{display:block;margin-top:4px;font-size:10px;color:#838b79}.station b{font-size:16px;font-weight:500}.station .arrow{color:#6a725e;font-size:14px}.sidebar-foot{padding-top:16px;display:flex;gap:8px;align-items:center;color:#939b85;font-size:10px}.dot{display:inline-block;width:6px;height:6px;border-radius:50%;background:var(--acid);flex-shrink:0}.sidebar-foot button{margin-left:auto;font-size:16px}.map-caption{position:absolute;left:400px;top:112px;display:flex;gap:12px;align-items:center;font-size:10px;color:#a8b09a;line-height:20px;pointer-events:none}.map-caption b{font-weight:500;color:#e1e5d7;font-size:12px}.crosshair{font-size:30px;color:#b4bf9a}.map-tools{position:absolute;right:32px;top:104px;display:flex;flex-direction:column;gap:12px;align-items:flex-end}.tool-group{display:flex;flex-direction:column;background:#181818e8;backdrop-filter:blur(16px);border:1px solid var(--line);border-radius:8px;overflow:hidden}.tool-group button{width:40px;height:40px;font-size:20px}.tool-group button:first-child{font-size:14px;font-weight:600}.tool-group button.active{color:var(--acid);background:#d7ed8b12}#layers-button{padding:12px;display:flex;flex-direction:row;gap:8px;align-items:center;font-size:20px}#layers-button span{font-size:12px}.layer-panel{position:absolute;right:32px;top:360px;background:#181818f5;border:1px solid var(--line);padding:24px;border-radius:12px}.layer-panel h2{font-size:14px;margin:0 0 16px}.layer-panel label{display:flex;gap:8px;font-size:12px;margin:12px 0}input[type=checkbox]{accent-color:var(--acid)}.bottom-panel{position:absolute;left:400px;right:32px;bottom:40px;border:1px solid var(--line);padding:16px 24px;border-radius:12px;background:#181818e8;backdrop-filter:blur(24px)}.timeline-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.timeline-title{display:flex;align-items:center;gap:8px;font-size:12px}.timeline-title strong{font-weight:500}.timeline-title>span:last-child{font-size:10px;color:#858d78}.mode-switch{display:flex;gap:4px;background:#272727;padding:4px;border-radius:8px}.mode-switch button{padding:8px 12px;font-size:12px;border-radius:4px;white-space:nowrap}.mode-switch button.active{background:#424939;color:#e3edce}.bottom-help{display:flex;justify-content:space-between;gap:12px;font-size:10px;color:#89917b;margin-top:12px}.bottom-help button{font-size:10px;color:#b8c49f;padding:0}#timeline{display:flex;gap:16px;align-items:center;margin-top:16px}#timeline input{flex:1;accent-color:var(--acid);min-width:40px}#hour-label{font-size:12px;min-width:112px;text-align:right}#play{width:32px;height:32px;border-radius:50%;background:var(--acid);color:#181818}#toast{position:fixed;bottom:180px;left:50%;transform:translateX(-50%);max-width:calc(100vw - 32px);background:#272727;border:1px solid #ffffff30;padding:12px 24px;border-radius:8px;font-size:12px;z-index:8;box-shadow:0 8px 32px #0004}.empty{font-size:12px;color:var(--muted);line-height:20px;padding:8px}.maplibregl-ctrl-bottom-right{bottom:4px;right:24px}.maplibregl-ctrl-attrib{background:#181818b8!important;color:#9ca58b!important;font:10px Manrope!important}.maplibregl-ctrl-attrib a{color:#b5bea5!important}.maplibregl-popup-content{background:#1f1f1f;color:#eee;border:1px solid #ffffff24;border-radius:12px;padding:24px;min-width:220px;font:12px Manrope}.maplibregl-popup-tip{border-top-color:#1f1f1f!important}.maplibregl-popup-close-button{padding:4px 8px}.popup-name{font-size:16px;margin:0 16px 12px 0;font-weight:500}.popup-value{font-size:36px;line-height:40px}.popup-unit{font-size:12px;color:#a3ab98}.popup-note{font-size:10px;color:#9ca78a;line-height:20px;margin:8px 0 0}dialog{width:480px;max-width:calc(100% - 32px);background:#1f1f1f;color:#e6eadc;border:1px solid #ffffff20;border-radius:16px;padding:32px}dialog::backdrop{background:#0009;backdrop-filter:blur(8px)}dialog h2{font-size:24px;line-height:32px;font-weight:500;margin:16px 0}dialog p{font-size:14px;line-height:24px;color:#b3bba6;text-wrap:pretty}dialog a{color:var(--acid)}.eyebrow{font-size:10px;letter-spacing:.15em;color:var(--acid)}.close{position:absolute;right:16px;top:12px;font-size:24px}.primary{background:var(--acid);color:#22291b;padding:8px 12px;border-radius:8px;font-size:16px;font-weight:600;margin-top:16px}.primary:hover{background:#e7f5b4}.skip{position:absolute;top:-80px;left:24px;z-index:99;padding:12px;background:var(--acid);color:#181818}.skip:focus{top:24px}
@media(min-height:900px){.sidebar{bottom:40px}.stations{margin-top:12px}.station{padding-top:16px;padding-bottom:16px}}
@media(max-width:1000px){.date{display:none}.sidebar{left:24px;width:304px;padding:24px;top:96px;bottom:24px}.map-caption{left:352px}.bottom-panel{left:352px;right:24px;padding:16px}.bottom-help>span{display:none}.timeline-title>span:last-child{display:none}.timeline-head{align-items:flex-start;flex-direction:column}.mode-switch{align-self:stretch}.mode-switch button{flex:1}.map-tools{right:24px}header{left:24px;right:24px}.bottom-help{justify-content:flex-end}}
@media (max-width:640px), (max-width:960px) and (max-height:540px) and (pointer:coarse) {header{top:16px;left:16px;right:16px}.brand strong{font-size:16px}.brand span{font-size:8px}.brand svg{width:32px;height:32px}.quiet{font-size:12px;padding:8px}.sidebar{left:12px;right:12px;bottom:12px;top:auto;width:auto;height:304px;padding:16px;display:grid;grid-template-columns:1fr 1fr;column-gap:16px;grid-template-rows:16px 40px 100px 1fr 20px}.section-eyebrow{grid-column:1/3;font-size:9px}h1,.intro{display:none}.pollutants{grid-column:1/3;grid-row:2;margin-top:8px}.pollutants button{padding:4px}.reading{grid-column:1;grid-row:3/5;margin-top:16px}.reading-head{font-size:9px;gap:4px;flex-wrap:wrap}.value-row{display:block;margin:8px 0}.value-row>strong{font-size:48px}.value-row>div{gap:4px;margin-top:4px}.level{font-size:10px}#updated{font-size:9px}.spectrum{margin-top:12px}.station-heading{grid-column:2;grid-row:3;margin:8px 0 auto}.station-heading h2{font-size:10px}.stations{grid-column:2;grid-row:3/5;margin-top:40px;min-height:0}.station{padding:8px 4px;gap:8px}.station .name{font-size:10px}.station small{font-size:9px}.station b{font-size:14px}.search{display:none}.sidebar-foot{grid-column:1/3;grid-row:5;padding:0;margin-top:8px}.bottom-panel{left:12px;right:12px;bottom:328px;padding:12px 16px}.timeline-head{flex-direction:row;align-items:center;gap:8px}.timeline-title{font-size:10px;gap:4px}.mode-switch{align-self:auto}.mode-switch button{font-size:10px;padding:4px 8px}.bottom-help{display:none}.map-caption{left:16px;top:88px;font-size:9px}.map-caption b{font-size:10px}.map-tools{right:16px;top:88px;gap:8px}.tool-group button{height:32px;width:32px;font-size:18px}#layers-button{padding:8px}#layers-button span{display:none}.layer-panel{right:56px;top:104px;padding:16px}.maplibregl-ctrl-bottom-right{bottom:316px;right:12px}#toast{bottom:440px}#hour-label{font-size:10px;min-width:88px}#timeline{gap:8px;margin-top:8px}.map-vignette{box-shadow:inset 0 80px 80px #18181880}}
@media(prefers-reduced-motion:reduce){*{transition:none!important}}
.leaflet-container{font-family:Manrope,system-ui,sans-serif;background:#272727}.leaflet-tile-pane{filter:grayscale(1) invert(1) brightness(.6) sepia(.1)}.leaflet-control-attribution{background:#181818!important;color:#a5b09a!important;font-size:9px!important}.leaflet-control-attribution a{color:#d7ed8b!important}.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:#1f1f1f;color:#e6eddb}.leaflet-popup-content{font:12px/20px Manrope}.map-vignette{z-index:401}header,.sidebar,.map-tools,.map-caption,.bottom-panel,.layer-panel{z-index:450}#toast{z-index:600}

/* Keep station coverage visible before decorative copy. */
h1{font-size:24px;line-height:32px;margin:16px 0 8px}.intro{margin-bottom:16px}.station-heading h2>span#station-title{font-size:12px;color:inherit;background:none;margin:0;padding:0}.station{padding-top:8px;padding-bottom:8px}.fit-all{background:#181818ed;border:1px solid var(--line);border-radius:8px;padding:12px;font-size:12px;color:var(--acid);backdrop-filter:blur(16px)}.data-warning{font-size:12px;line-height:20px;background:#313131;border:1px solid #d7ed8b44;border-radius:8px;padding:8px;margin:0 0 12px;color:#e0e5cd}.map-tools{max-width:240px}.stations{min-height:64px}
@media (max-width:640px), (max-width:960px) and (max-height:540px) and (pointer:coarse) {.fit-all{font-size:10px;padding:8px}.map-tools{max-width:160px}.data-warning{position:absolute;left:0;right:0;bottom:calc(100% + 80px);margin:0;background:#181818f5}.station-heading h2>span#station-title{font-size:10px}.stations{min-height:0}}

.category-switch{display:flex;gap:4px;margin-bottom:8px}.category-switch button{font-size:12px;padding:4px 12px;border-radius:4px;color:#9ca58c}.category-switch button.active{background:#d7ed8b16;color:var(--acid)}.metric-note{font-size:10px;line-height:16px;color:var(--muted);margin:8px 0 0}.metric-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:12px}.metric-item{padding:8px;background:#272727;border-radius:8px;display:flex;flex-direction:column;gap:4px}.metric-item>span{font-size:10px;color:#b4bcaa}.metric-item b{font-size:14px;font-weight:600}.metric-item small{font-size:10px;color:#8e9981}.metric-item.missing{opacity:.6}.popup-section{font-size:12px;font-weight:500;margin:16px 0 0}.maplibregl-popup-content{max-height:480px;overflow:auto}.leaflet-popup-content{min-width:260px}.station b{white-space:nowrap}.reading .level{max-width:140px}.metric-controls{flex-shrink:0}
@media (max-width:640px), (max-width:960px) and (max-height:540px) and (pointer:coarse) {.metric-controls{grid-column:1/3;grid-row:2;display:flex;gap:8px;align-items:center}.category-switch{margin:8px 0 0;gap:0;flex-direction:column}.category-switch button{font-size:9px;padding:2px 4px}.metric-controls .pollutants{flex:1;min-width:0}.metric-controls .pollutants button{font-size:10px}.metric-note{font-size:9px;line-height:12px}.metric-grid{gap:4px}.metric-item{padding:8px}.leaflet-popup-content{min-width:220px}.maplibregl-popup-content{max-height:360px}.value-row>div{max-width:100%}}

/* Daylight palette. The original rules above remain the nighttime palette. */
:root[data-theme="light"] {
    color-scheme: light;
    color: #202b22;
    background: #f5f7ef;
    --acid: #376133;
    --muted: #546252;
    --line: #31472b26;
    --day-panel: #fcfdf7f5;
    --day-inset: #edf1e7;
}
[data-theme="light"] :is(#map, .leaflet-container) { background: #e5ebdd; }
[data-theme="light"] .leaflet-tile-pane { filter: saturate(.68); }
[data-theme="light"] .map-vignette { box-shadow: inset 0 72px 72px #f5f7efad; }
[data-theme="light"] :is(.sidebar, .bottom-panel, .layer-panel, .tool-group, .fit-all, .quiet, #toast, .data-warning) {
    background: var(--day-panel);
    border-color: var(--line);
}
[data-theme="light"] .sidebar { box-shadow: 0 16px 48px #28372224; }
[data-theme="light"] :is(.pollutants, .search, .mode-switch, .metric-item) { background: var(--day-inset); }
[data-theme="light"] :is(.brand span, .date, .section-eyebrow, .reading-head, .unit, .scale-labels, .station small, .sidebar-foot, .timeline-title>span:last-child, .bottom-help, .popup-unit, .popup-note, .metric-item>span, .metric-item small, .category-switch button, .map-caption, .station .arrow, .search input::placeholder) {
    color: #4f5e4c;
}
[data-theme="light"] :is(.map-caption b, .crosshair) { color: #26392b; }
[data-theme="light"] .map-caption { text-shadow: 0 0 6px #fff, 0 0 3px #fff; }
[data-theme="light"] :is(button:hover, .station.selected) { background: #dce7d7; }
[data-theme="light"] :is(.tool-group button.active, .category-switch button.active, .mode-switch button.active, .station-heading h2 span) {
    background: #e0ebd8;
    color: #31502b;
}
[data-theme="light"] :is(.pollutants button.active, #play, .primary, .skip) {
    color: #fff;
    background: #376133;
}
[data-theme="light"] :is(.bottom-help button, dialog a) { color: #315b2c; }
[data-theme="light"] :is(.level, .station b, .popup-value) { filter: brightness(.55) saturate(1.35); }
[data-theme="light"] .spectrum i { background: #273c29; box-shadow: 0 0 0 2px #fff; }
[data-theme="light"] :is(dialog, .maplibregl-popup-content, .leaflet-popup-content-wrapper, .leaflet-popup-tip) {
    background: #fcfdf7;
    color: #202b22;
    border-color: var(--line);
}
[data-theme="light"] dialog p, [data-theme="light"] .data-warning { color: #465542; }
[data-theme="light"] .maplibregl-popup-tip { border-top-color: #fcfdf7 !important; }
[data-theme="light"] :is(.maplibregl-ctrl-attrib, .leaflet-control-attribution) {
    background: #fcfdf7eb !important;
    color: #465542 !important;
}
[data-theme="light"] :is(.maplibregl-ctrl-attrib a, .leaflet-control-attribution a) { color: #315b2c !important; }

/* Station sources, reading age and hourly details */
.station.is-old { opacity: .62; }
.station.is-old:focus-visible, .station.is-old:hover { opacity: 1; }
.government-key, .station.is-government .point {
    display: inline-block;
    border: 2px solid #3986cd;
    border-radius: 50%;
    width: 12px;
    height: 12px;
    box-shadow: none;
}
.layer-note { max-width: 180px; font-size: 12px; line-height: 1.4; color: var(--muted); }
.layer-note:empty { display: none; }
.station-chart-button {
    display: block;
    margin-top: 12px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
    font-weight: 700;
    color: var(--acid);
}
#station-chart { width: min(620px, calc(100vw - 24px)); }
#chart-body { min-height: 48px; font-size: 14px; line-height: 1.45; }
.hour-chart {
    display: grid;
    grid-template-columns: repeat(24, minmax(0,1fr));
    gap: 2px;
    height: 144px;
    border-block: 1px solid var(--line);
    margin: 12px 0 4px;
}
.chart-hour { position: relative; min-width: 0; padding: 0; border-radius: 2px; }
.chart-hour::before { content: ''; position: absolute; inset: 0 50%; border-left: 1px solid var(--line); }
.chart-hour span {
    position: absolute;
    width: 8px;
    height: 8px;
    left: 50%;
    transform: translate(-50%,50%);
    border-radius: 50%;
    background: var(--acid);
}
.chart-gap::before { border-left-style: dashed; }
.chart-times { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.chart-detail { display: block; margin-top: 12px; color: var(--acid); font-variant-numeric: tabular-nums; }
.share-url { width: 100%; padding: 10px; font: inherit; color: inherit; background: transparent; border: 1px solid var(--line); }
#panel-toggle { display: none; }

@media (max-width:640px), (max-width:960px) and (max-height:540px) and (pointer:coarse) {
    .header-right { gap: 4px; }
    .header-right .quiet { padding: 8px; font-size: 11px; }
    #panel-toggle {
        display: block;
        grid-area: 1 / 1 / 2 / 3;
        text-align: left;
        padding: 6px 8px;
        border: 1px solid var(--line);
        border-radius: 6px;
        font: inherit;
        font-size: 12px;
    }
    #panel-toggle::after { content: '⌃'; float: right; }
    .station-panel-open #panel-toggle::after { content: '⌄'; }
    .sidebar { height: 92px; grid-template-rows: 28px 36px; padding: 10px; }
    .sidebar .section-eyebrow { display: none; }
    .sidebar .metric-controls { grid-row: 2; }
    body:not(.station-panel-open) .sidebar :is(.reading,.station-heading,.search,.stations,.sidebar-foot) { display: none; }
    body:not(.station-panel-open) .bottom-panel { bottom: 114px; }
    .station-panel-open .sidebar {
        height: min(320px, 52dvh);
        grid-template-rows: 28px 36px auto minmax(36px,1fr) 20px;
    }
    .station-panel-open .bottom-panel { bottom: calc(min(320px, 52dvh) + 24px); }
    .station-panel-open .sidebar .reading { grid-row: 3; margin-top: 12px; }
    .station-panel-open .sidebar .station-heading { grid-row: 3; margin-top: 8px; }
    .station-panel-open .sidebar .stations { grid-row: 3 / 5; }
    .station-panel-open #freshness-note { display: none; }
    .layer-panel { max-height: 48dvh; overflow: auto; }
    .hour-chart { height: 110px; gap: 1px; }
    .chart-hour span { width: 6px; height: 6px; }
}
@media (max-width:640px), (max-width:960px) and (max-height:540px) and (pointer:coarse) {
    body:not(.station-panel-open) .maplibregl-ctrl-bottom-right { bottom: 106px; }
    body:not(.station-panel-open) #toast { bottom: 184px; }
}
@media (max-width:640px), (max-width:960px) and (max-height:540px) and (pointer:coarse) {
    .maplibregl-popup-content { max-height: min(340px, 46dvh); }
}

/* Live controls stay within the station panel. The map dock opens for playback. */
.sidebar-foot { gap: 6px; }
.sidebar-foot #source { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot #history, .timeline-return {
    flex: none;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 6px 10px;
    color: var(--acid);
    font: inherit;
    font-size: 11px;
    white-space: nowrap;
}
.sidebar-foot #history { margin-left: auto; }
.sidebar-foot #method { margin-left: 0; }
#history-panel {
    width: min(470px, calc(100% - 430px));
    left: auto;
    padding: 12px 16px;
    bottom: 32px;
}
#history-panel .timeline-head { flex-direction: row; align-items: center; }
#history-panel .timeline-title { min-width: 0; }
#history-panel .timeline-title span { display: inline; white-space: nowrap; }
#history-panel #timeline { margin-top: 8px; }
#history-panel #hour-label { min-width: 96px; }
@media (min-width:641px) and (max-width:1000px) {
    #history-panel { width: min(430px, calc(100% - 350px)); }
}
@media (max-width:640px), (max-width:960px) and (max-height:540px) and (pointer:coarse) {
    .sidebar { height: 122px; grid-template-rows: 28px 36px 28px; }
    .sidebar .sidebar-foot { grid-row: 3; margin-top: 0; }
    body:not(.station-panel-open) .sidebar .sidebar-foot { display: flex; }
    .station-panel-open .sidebar .sidebar-foot { grid-row: 5; }
    .sidebar-foot #history { min-height: 28px; padding: 4px 10px; }
    #history-panel { width: auto; padding: 8px 12px; }
    body:not(.station-panel-open) #history-panel { bottom: 146px; }
    .station-panel-open #history-panel { bottom: calc(min(320px, 52dvh) + 24px); }
    body:not(.station-panel-open) .maplibregl-ctrl-bottom-right { bottom: 136px; }
}
@media (max-width:640px), (max-width:960px) and (max-height:540px) and (pointer:coarse) {
    .station-panel-open .sidebar { grid-template-rows: 28px 36px auto minmax(36px,1fr) 28px; }
}

/* Mobile station sheet and touch controls */
#station-details { display: contents; }
.about-icon { display: none; }

@media (max-width:640px), (max-width:960px) and (max-height:540px) and (pointer:coarse) {
    body {
        --sheet-height: 170px;
        --sheet-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
        --sheet-left: max(8px, env(safe-area-inset-left, 0px));
        --sheet-right: max(8px, env(safe-area-inset-right, 0px));
        --mobile-top: max(8px, env(safe-area-inset-top, 0px));
    }
    body.station-panel-open { --sheet-height: min(490px, max(270px, 58dvh)); }

    header { top: var(--mobile-top); left: var(--sheet-left); right: var(--sheet-right); gap: 8px; }
    .brand { gap: 8px; min-width: 0; }
    .brand svg { flex: 0 0 28px; width: 28px; height: 28px; }
    .brand strong { font-size: 15px; line-height: 20px; }
    .brand span { margin-top: 2px; }
    .header-right .quiet { min-width: 44px; min-height: 44px; padding: 8px; font-size: 12px; }
    .about-label { display: none; }
    .about-icon { display: inline; font-size: 18px; }

    .map-caption { display: none; }
    .map-tools { top: calc(var(--mobile-top) + 56px); right: var(--sheet-right); gap: 6px; }
    .tool-group button, #layers-button { width: 44px; height: 44px; }
    #layers-button { display: grid; place-items: center; padding: 0; }
    .fit-all { min-height: 44px; padding: 8px 10px; font-size: 12px; }
    .layer-panel {
        right: calc(var(--sheet-right) + 50px);
        top: calc(var(--mobile-top) + 56px);
        max-width: calc(100vw - 76px);
        max-height: max(110px, calc(100dvh - var(--sheet-height) - 90px));
        padding: 12px 16px;
    }
    .layer-panel label { min-height: 44px; margin: 0; align-items: center; font-size: 13px; }

    .sidebar, .station-panel-open .sidebar {
        left: var(--sheet-left);
        right: var(--sheet-right);
        bottom: var(--sheet-bottom);
        height: var(--sheet-height);
        padding: 10px;
        grid-template-columns: minmax(0, 1fr) 76px;
        grid-template-rows: 44px auto;
        gap: 6px;
        border-radius: 14px;
    }
    .station-panel-open .sidebar { grid-template-rows: 44px auto minmax(0, 1fr) 44px; }

    #panel-toggle {
        grid-area: 1 / 1;
        min-height: 44px;
        font-size: 15px;
        font-weight: 700;
        padding-inline: 10px;
    }
    .sidebar .metric-controls {
        grid-area: 2 / 1 / 3 / 3;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    .metric-controls .category-switch {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) minmax(0, 1fr);
        gap: 4px;
        margin: 0;
    }
    .category-switch button {
        min-height: 46px;
        font-size: 14px;
        font-weight: 700;
        padding: 4px;
        border: 1px solid var(--line);
        border-radius: 7px;
    }
    .category-switch button.active { border-color: var(--acid); }
    .metric-controls .pollutants {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 3px;
        margin: 0;
        padding: 0;
        flex: none;
    }
    .metric-controls .pollutants button {
        min-height: 44px;
        font-size: 12px;
        font-weight: 600;
        padding: 4px 1px;
    }
    .metric-controls .pollutants[hidden] { display: none; }

    .sidebar .sidebar-foot, body:not(.station-panel-open) .sidebar .sidebar-foot { display: contents; }
    .sidebar-foot .dot { display: none; }
    .sidebar-foot #history {
        grid-area: 1 / 2;
        margin: 0;
        min-height: 44px;
        font-size: 14px;
        font-weight: 600;
    }
    .sidebar-foot #source {
        grid-area: 4 / 1;
        align-self: center;
        font-size: 12px;
    }
    .sidebar-foot #method {
        grid-area: 4 / 2;
        justify-self: end;
        width: 44px;
        min-height: 44px;
        font-size: 18px;
    }
    body:not(.station-panel-open) .sidebar-foot :is(#source, #method) { display: none; }

    #station-details {
        grid-area: 3 / 1 / 4 / 3;
        display: none;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    .station-panel-open #station-details { display: block; }
    #station-details .reading { margin: 6px 0 0; }
    #station-details .reading-head, #station-details .level, #updated { font-size: 12px; }
    #station-details .value-row { display: flex; align-items: center; gap: 12px; }
    #station-details .value-row>strong { font-size: 32px; }
    #station-details .scale-labels { font-size: 11px; }
    #station-details .station-heading { margin: 12px 0 4px; }
    #station-details .station-heading h2, #station-details #station-title { font-size: 14px; }
    #station-details .search { display: flex; min-height: 44px; margin: 4px 0; }
    #station-details .search input { font-size: 16px; }
    #station-details .stations { margin: 0; overflow: visible; }
    #station-details .station { min-height: 52px; padding: 8px 4px; }
    #station-details .station .name { font-size: 14px; }
    #station-details .station small { font-size: 11px; }
    #refresh { min-width: 44px; min-height: 44px; }

    #history-panel,
    body:not(.station-panel-open) #history-panel,
    .station-panel-open #history-panel {
        left: var(--sheet-left);
        right: var(--sheet-right);
        bottom: calc(var(--sheet-bottom) + var(--sheet-height) + 8px);
    }
    #history-panel .timeline-title, #history-panel #hour-label { font-size: 12px; }
    #history-panel :is(#live,#play,#hour) { min-height: 44px; }
    #history-panel #play { width: 44px; }
    .sidebar .data-warning { bottom: calc(100% + 8px); }
    body:not(.station-panel-open) .maplibregl-ctrl-bottom-right,
    .station-panel-open .maplibregl-ctrl-bottom-right,
    .leaflet-bottom.leaflet-right { bottom: calc(var(--sheet-bottom) + var(--sheet-height) + 2px); }
    #toast, body:not(.station-panel-open) #toast {
        bottom: calc(var(--sheet-bottom) + var(--sheet-height) + 96px);
    }
}

@media (max-width:640px) and (max-height:540px), (max-width:960px) and (max-height:540px) and (pointer:coarse) {
    .map-tools { flex-direction: row; align-items: center; max-width: calc(100% - 16px); }
    .map-tools .tool-group { flex-direction: row; }
    .map-tools .fit-all { position: absolute; top: 50px; right: 0; }
    .layer-panel { top: calc(var(--mobile-top) + 108px); }
}

@media (max-width:640px), (max-width:960px) and (max-height:540px) and (pointer:coarse) {
    html, body {
        width: 100%;
        overflow: hidden;
        overscroll-behavior: none;
    }
    .sidebar, .station-panel-open .sidebar {
        position: fixed;
        min-width: 0;
        margin: 0;
        z-index: 460;
    }
    .station-panel-open :is(.map-tools, .layer-panel) { display: none; }
    #history-panel { z-index: 461; }
    .station-panel-open #station-details {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 44px;
        grid-template-rows: auto auto auto;
        align-content: start;
        column-gap: 6px;
        overflow-x: hidden;
    }
    #station-details .reading {
        grid-area: 1 / 1 / 2 / 3;
        min-width: 0;
        margin: 4px 0 0;
    }
    #station-details .value-row { margin: 4px 0 6px; }
    #station-details .value-row>strong { font-size: 27px; flex: none; }
    #station-details .value-row>div { min-width: 0; margin-top: 0; }
    #station-details .reading :is(.spectrum,.scale-labels,.metric-note) { display: none; }
    #station-details .search { grid-area: 2 / 1; min-width: 0; }
    #station-details .search input { min-width: 0; }
    #station-details .station-heading { grid-area: 2 / 2; margin: 4px 0; }
    #station-details .station-heading h2 { display: none; }
    #station-details .stations { grid-area: 3 / 1 / 4 / 3; min-width: 0; }
    #station-details .station { grid-template-columns: 8px minmax(0, 1fr) auto; }
    #station-details .station .name { overflow-wrap: anywhere; }
}

@media (max-width:360px) {
    body.station-panel-open { --sheet-height: min(490px, max(290px, 64dvh)); }
    #station-details #updated { display: none; }
}

.wind-marker {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    pointer-events: none;
    padding: 3px 6px;
    border: 1px solid #6dc5eb66;
    border-radius: 6px;
    background: #162630eb;
    color: #c1edff;
    font: 700 11px/18px Manrope, sans-serif;
    font-variant-numeric: tabular-nums;
}
.wind-leaflet-icon { pointer-events: none; }
.wind-leaflet-icon .wind-marker { transform: translate(-50%, -50%); }
.wind-arrow { display: inline-block; width: 13px; text-align: center; font-size: 17px; }
[data-theme="light"] .wind-marker {
    border-color: #316d8c80;
    background: #edf8fdea;
    color: #163f55;
}
#wind-status { line-height: 1.5; }
#wind-status a { color: var(--acid); }

.category-switch #forecast-open {
    min-height: 44px;
    border: 1px solid var(--line);
    font-weight: 700;
}
.share-icon { display: none; }

#forecast {
    width: 640px;
    max-width: calc(100% - 24px);
    max-height: calc(100dvh - 32px);
    padding: 0;
    overflow: hidden;
}
#forecast[open] { display: flex; flex-direction: column; }
.forecast-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex: none;
    padding: 16px;
    border-bottom: 1px solid var(--line);
}
.forecast-head h2 { margin: 0; font-weight: 700; }
.forecast-head p { margin: 0; }
.forecast-close { width: 44px; min-height: 44px; padding: 0; font-size: 24px; }
.forecast-body { overflow-y: auto; overscroll-behavior: contain; padding: 16px; }
#forecast-status { margin: 0; }
#forecast-status:empty { display: none; }
#forecast-retry { min-height: 44px; margin-top: 8px; }
#forecast-content { font-size: 14px; line-height: 20px; }
#forecast-content section + section { margin-top: 24px; }
#forecast h3 { margin: 0 0 8px; font-size: 16px; line-height: 24px; }
#forecast table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
#forecast :is(td, th) { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: left; }
#forecast :is(td, th):first-child { padding-left: 0; }
#forecast :is(td, th):last-child { padding-right: 0; }
#forecast th { font-weight: 700; }
.forecast-date { display: block; font-size: 12px; font-weight: 400; }
.forecast-condition { display: flex; align-items: center; gap: 4px; }
.forecast-icon { flex: 0 0 24px; text-align: center; font-size: 18px; line-height: 24px; }
#forecast td:nth-child(3), #forecast td:nth-child(4) { white-space: nowrap; }
#forecast .forecast-source { margin: 16px 0 0; font-size: 12px; line-height: 16px; }
.category-switch #forecast-open:hover, #forecast button:hover { border-color: var(--acid); }
:is(#forecast-open, #forecast button):focus-visible { outline: 2px solid var(--acid); outline-offset: 2px; }

@media (max-width:640px), (max-width:960px) and (max-height:540px) and (pointer:coarse) {
    .header-right .share-label { display: none; }
    .header-right .share-icon { display: inline; font-size: 16px; line-height: 24px; }
    #forecast {
        inset: auto 0 0;
        margin: 0 auto;
        width: 100%;
        max-width: 100%;
        max-height: 82dvh;
        border-radius: 16px 16px 0 0;
    }
    .forecast-head, .forecast-body { padding: 12px; }
    .forecast-body { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
    .forecast-head h2 { font-size: 20px; line-height: 28px; }
    #forecast-content { font-size: 12px; line-height: 16px; }
}

#atlas-about { max-height: 85dvh; overflow: auto; }
.no-script { position: fixed; z-index: 1000; inset: auto 16px 16px; background: #181818; color: #fff; padding: 16px; border-radius: 12px; }
.no-script a { color: #d7ed8b; }

/* Keep the map open while the measurements are collapsed. */
@media (max-width:640px), (max-width:960px) and (max-height:540px) and (pointer:coarse) {
    body { --sheet-height: 116px; }
    body.station-panel-open {
        --sheet-height: min(520px, calc(100dvh - var(--mobile-top) - 72px - var(--sheet-bottom)));
    }

    .sidebar, .station-panel-open .sidebar { padding: 8px; gap: 6px; }
    .sidebar {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: 44px 48px;
        backdrop-filter: none;
    }
    .station-panel-open .sidebar {
        grid-template-rows: 44px auto minmax(0, 1fr) 44px;
    }
    body:not(.station-panel-open) .metric-controls .pollutants { display: none; }
    .category-switch button { min-height: 48px; }
    .category-switch #forecast-open { min-height: 48px; }
    #panel-toggle, .sidebar-foot #history { min-width: 0; }
    .sidebar-foot #history { min-width: 68px; }

    .map-tools {
        top: calc(var(--mobile-top) + 52px);
        right: var(--sheet-right);
        max-width: calc(100% - var(--sheet-left) - var(--sheet-right));
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-end;
        align-items: stretch;
        gap: 4px;
    }
    .map-tools .tool-group { flex-direction: row; }
    .map-tools .map-zoom { position: absolute; top: calc(100% + 4px); right: 0; flex-direction: column; }
    .map-tools .fit-all { position: static; }
    .layer-panel {
        top: calc(var(--mobile-top) + 104px);
        right: var(--sheet-right);
        width: min(292px, calc(100% - var(--sheet-left) - var(--sheet-right)));
        max-width: none;
        max-height: max(86px, calc(100dvh - var(--sheet-height) - var(--sheet-bottom) - var(--mobile-top) - 112px));
        overflow-y: auto;
    }
    #station-details {
        min-height: 0;
        overscroll-behavior-y: contain;
        scrollbar-gutter: stable;
    }
    #station-details #updated, #station-details #metric-note { display: block; }
    #station-details .station b { white-space: nowrap; }
    .maplibregl-popup-content { max-height: min(340px, 38dvh); overflow-y: auto; }
    #toast, body:not(.station-panel-open) #toast {
        inset: auto var(--sheet-right) calc(var(--sheet-bottom) + var(--sheet-height) + 10px) var(--sheet-left);
        width: auto;
        max-width: none;
        transform: none;
        pointer-events: none;
    }
    body:has(#history-panel:not([hidden])) #toast { bottom: calc(var(--sheet-bottom) + var(--sheet-height) + 124px); }
    #forecast table { table-layout: fixed; overflow-wrap: anywhere; }
    #forecast :is(td, th) { white-space: normal; }
    #forecast .forecast-condition { flex-wrap: wrap; gap: 2px; }
    #forecast .forecast-condition > span:last-child { min-width: 0; }
}

@media (max-width:360px) {
    .category-switch button { font-size: 12px; }
    .map-tools .fit-all { padding-inline: 6px; font-size: 11px; }
}

@media (max-width:640px) and (max-height:450px), (max-width:960px) and (max-height:450px) and (pointer:coarse) {
    .station-panel-open .sidebar { grid-template-rows: 44px auto minmax(0, 1fr); }
    body.station-panel-open .sidebar-foot :is(#source, #method) { display: none; }
}

#averages-open { width: 100%; min-height: 44px; margin-top: 8px; font-weight: 700; }
#averages-dialog { width: min(560px, calc(100% - 24px)); max-width: none; max-height: 85dvh; overflow-y: auto; }
#averages-dialog h2 { padding-right: 32px; }
#averages-dialog .close { min-width: 44px; min-height: 44px; }
#averages-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0 0; }
#averages-grid > div { border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
#averages-grid dt { font-size: 13px; font-weight: 700; }
#averages-grid dd { margin: 4px 0 0; }
#averages-grid strong { display: block; color: var(--acid); font-size: 16px; font-variant-numeric: tabular-nums; }
#averages-grid small { display: block; margin-top: 4px; font-size: 11px; }

html, body { overflow: visible; }
#atlas-view { position: relative; height: 100vh; height: 100dvh; isolation: isolate; }
#atlas-view #toast, #atlas-view .no-script { position: absolute; }
#about, .atlas-guide-return { display: inline-grid; place-items: center; color: inherit; text-decoration: none; }
#atlas-guide { border-top: 1px solid var(--line); }
.atlas-guide-content { max-width: 760px; margin: auto; padding: 40px 20px; }
.atlas-guide-content h2 { font-size: clamp(22px, 5vw, 32px); margin: 0 0 12px; }
.atlas-guide-content h3 { font-size: 18px; margin: 24px 0 4px; }
.atlas-guide-content p { margin: 0 0 12px; line-height: 1.65; }
.atlas-guide-content p a { color: var(--acid); }
.atlas-guide-return { min-height: 44px; margin-top: 8px; }
@media (max-width:640px), (max-width:960px) and (max-height:540px) and (pointer:coarse) {
    #atlas-view .sidebar { position: absolute; }
    #about { min-width: 44px; min-height: 44px; }
}
