:root{--ink:#173849;--muted:#607888;--blue:#08689e;--green:#19865c;--line:#d8e6ed;--map-side:min(540px,calc(100dvh - 120px))}
*{box-sizing:border-box}html,body{margin:0;max-width:100%;font-family:Manrope,system-ui,sans-serif;color:var(--ink);background:#eff5f8}button,select{font:inherit}button{cursor:pointer}button:disabled{cursor:wait;opacity:.6}a{color:#08689e}h1,h2,h3,p{margin:0}.wrap{max-width:900px;margin:0 auto;padding:8px}.panel{padding:12px;background:white;border:1px solid var(--line);border-radius:20px;box-shadow:0 10px 28px #143f5810}.header{margin:0 0 9px;display:block}.header h1{font-size:20px;line-height:1.3;font-weight:800;letter-spacing:-.025em}.sub{font-size:11px;color:var(--muted);margin-top:2px}.layout{display:grid;grid-template-columns:var(--map-side) minmax(0,280px);justify-content:center;gap:12px;align-items:start;min-width:0}.layout>*{min-width:0}.map-wrap{width:100%;margin:0;align-self:start}#map{width:100%;height:auto;aspect-ratio:1/1;border-radius:13px;overflow:hidden;border:1px solid #c8dce6;background:#e0e9eb}.sidebar{padding:10px;background:#f6fafb;border:1px solid var(--line);border-radius:14px;min-width:0;font-size:13px}.tools{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px;margin-bottom:6px}.tools button{min-width:0;border:1px solid #cbdfe9;border-radius:8px;color:#295367;background:white;font-size:12px;font-weight:800;padding:7px 3px;line-height:1.2}.tools button.active{background:var(--blue);border-color:var(--blue);color:white}#refresh{display:block;width:100%;border:1px solid #bfdce8;border-radius:8px;background:#eaf6fa;color:#075480;font-size:12px;font-weight:800;padding:6px;line-height:1.3}.status{font-size:10px;color:var(--muted);line-height:1.35;margin:5px 0}.chooser-label{position:absolute;clip-path:inset(50%);width:1px;height:1px;overflow:hidden}.station-chooser{width:100%;max-width:100%;border:1px solid #c6dce6;border-radius:8px;padding:6px;background:white;color:var(--ink);font-size:12px;min-width:0}.sync{font-size:10px;line-height:1.35;color:var(--muted);margin:5px 0 7px;overflow-wrap:anywhere}.station-card{border-top:1px solid var(--line);padding-top:8px;min-height:0}.station-title-line{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px;align-items:start}.station-title-line h3{font-size:15px;line-height:1.3;font-weight:800;min-width:0;overflow-wrap:anywhere}.station-time{text-align:right;white-space:nowrap}.station-time strong{display:block;font-size:23px;font-weight:800;color:#075c8d;font-variant-numeric:tabular-nums;line-height:1.05}.station-time small{display:block;font-size:10px;color:var(--muted);margin-top:3px}.temp{font-size:32px;line-height:1.15;color:#075c8d;font-weight:800;margin:5px 0 3px;font-variant-numeric:tabular-nums}.extremes{font-size:12px;color:#426376;line-height:1.4}.metrics{display:grid;grid-template-columns:1fr 1fr;gap:5px 7px;margin-top:9px}.metric{font-size:11px;line-height:1.35;color:#537080}.metric b{display:block;font-size:14px;color:#173849;font-weight:800}.age{font-size:11px;margin-top:9px;line-height:1.35;color:#4b697b}.age.old,.age.delayed,.age.unknown{font-weight:800;color:#80511d}.rain-note{font-size:10px;color:#617888;line-height:1.3;margin-top:5px}.attribution{font-size:10px;line-height:1.4;color:#617888;margin:7px 0 0;overflow-wrap:anywhere}.attribution a{text-decoration:none}details{margin-top:4px}details>summary{font-size:10px!important;color:#617888;cursor:pointer;margin:0!important}#details{white-space:pre-wrap;overflow-wrap:anywhere;font:11px/1.5 monospace;color:#536d7e;background:#eef5f9;padding:8px;margin-top:5px;border-radius:8px}.marker-btn{display:flex;justify-content:center;align-items:center;width:84px;height:34px;padding:3px;background:#08689e;border:2px solid white;border-radius:18px;color:#fff;font:800 14px/1 Manrope,system-ui,sans-serif;white-space:nowrap;box-shadow:0 2px 6px #14354e60;cursor:pointer}.marker-btn.local{background:#19865c}.marker-btn.selected{outline:2px solid #133b54;outline-offset:2px}.tools button:focus-visible,#refresh:focus-visible,.station-chooser:focus-visible{outline:3px solid #27accb;outline-offset:2px}body.embed{background:transparent}body.embed .wrap{padding:0;max-width:900px}body.embed .panel{border:0;box-shadow:none;background:transparent;padding:0}body.embed .header{display:none}
body.tight .sidebar{padding:8px}body.tight .tools button{padding:5px 3px}body.tight #refresh{padding:5px}body.tight .sync{margin:4px 0 6px}body.tight .metrics{margin-top:6px;gap:4px 6px}body.tight .temp{font-size:29px}body.tight .age{margin-top:6px}body.short .sidebar{padding:6px}body.short .tools button{padding:4px 2px;font-size:11px}body.short .station-title-line h3{font-size:13px}body.short .station-time strong{font-size:21px}body.short .metric b{font-size:12px}body.short .temp{font-size:26px}body.short .metrics{gap:3px 5px}body.short .status,body.short .sync{font-size:9px;margin:3px 0}body.short .station-card{padding-top:5px}
@media(max-width:750px){.wrap{padding:8px}.panel{padding:10px}.header h1{font-size:18px}.layout{grid-template-columns:minmax(0,1fr);gap:10px}.map-wrap{max-width:540px;margin:auto}.sidebar{width:100%;padding:12px}.tools button{padding:8px 3px}.temp{font-size:32px}.metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.station-title-line h3{font-size:16px}.station-time strong{font-size:24px}.attribution{font-size:9px}body.embed .wrap{padding:0}#map{aspect-ratio:1/1}}

.status:not(.error){position:absolute;width:1px;height:1px;clip-path:inset(50%);overflow:hidden;margin:0}.short .temp{margin:2px 0}.short .metrics{margin-top:4px}.short .age{margin-top:4px}.short .station-time small{margin-top:1px}.short .station-card{padding-top:3px}

.marker-btn.compact{font-size:13px}

/* v1.0.8: cartografia pròpia lineal; només 24 botons d’estació. */
#map{position:relative;isolation:isolate;background:#eaf3f7;touch-action:pan-y}
.native-map{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.native-land{fill:#f8fbf9;stroke:#9db6b8;stroke-width:1.1;stroke-linejoin:round}
.native-boundaries{fill:none;stroke:#9ab2b7;stroke-width:.9;stroke-linejoin:round}
.native-coast{fill:none;stroke:#6c9dad;stroke-width:1.2;stroke-linejoin:round}
.station-connector{stroke:#6e8795;stroke-width:1.5;stroke-linecap:round;opacity:.95}.station-connector.local{stroke:#287a62;stroke-width:1.7}
.station-anchor-halo{fill:#ffffff;stroke:#8fb4c6;stroke-width:1.4;opacity:.98}.station-anchor-halo.local{stroke:#6bb394}
.station-anchor{fill:#0b6fa5;stroke:#ffffff;stroke-width:1.15}.station-anchor.local{fill:#19865c;stroke:#ffffff}
#map .marker-btn{position:absolute;transform:translate(-50%,-50%);z-index:1;margin:0;min-width:0;min-height:0;padding:2px;font-size:13px;line-height:1;transition:none}
#map .marker-btn.compact{font-size:11.5px}
#map .marker-btn.selected{z-index:2}
#map .marker-btn:focus-visible{outline:2px solid #133b54;outline-offset:2px}

/* v1.0.9: cap regla anterior d’escriptori canvia. El nou control és superposat. */
.panel{position:relative}
.map-view-tools{position:absolute;z-index:3;right:calc((100% - var(--map-side) - 292px)/2 + 300px);top:20px;display:flex;align-items:center;gap:8px}
.map-view-tools p{display:none;margin:0;color:#426376;font-size:12px;font-weight:800}
#map-expand{min-height:36px;border:1px solid #bdd4df;border-radius:9px;background:#fffffff0;color:#075c8d;font-size:12px;font-weight:800;padding:6px 10px;box-shadow:0 2px 6px #14354e15}
#map-expand span{font-size:19px;line-height:1;vertical-align:-1px}
#map-expand:focus-visible{outline:3px solid #27accb;outline-offset:2px}
body.embed .map-view-tools{top:8px;right:calc((100% - var(--map-side) - 292px)/2 + 300px)}
#map.mobile-markers .marker-btn{font-size:12px;font-variant-numeric:tabular-nums;box-shadow:0 1px 3px #14354e35;border-width:1px}
#map.overview .marker-btn{font-size:0;border-radius:50%;padding:0}
#map.overview .marker-btn.local::after{content:'★';font-size:12px}
@media(max-width:750px){
 .map-view-tools,body.embed .map-view-tools{position:static;display:flex;justify-content:space-between;margin:0 0 8px}
 .map-view-tools p{display:block}
 #map-expand{min-height:40px}
 #map .marker-btn.selected{outline-width:1px;outline-offset:1px}
}
/* Vista ampliada: l’element existent va al top layer del document principal. */
body.expanded{background:#f3f8fa}
body.expanded .wrap{padding:12px;max-width:none}
body.expanded .panel{padding:0;border:0;box-shadow:none;background:transparent;border-radius:0}
body.expanded .header,body.expanded .attribution{display:none}
body.expanded .map-view-tools{position:sticky;top:0;right:auto;display:flex;justify-content:space-between;background:#f3f8fa;z-index:4;padding:0 0 8px;margin:0}
body.expanded .map-view-tools p{display:block}
body.expanded .layout{grid-template-columns:minmax(0,560px) minmax(0,280px)}
body.expanded .map-wrap{width:100%;max-width:560px}
body.expanded #map{aspect-ratio:1}
body.expanded #map-expand{min-height:44px}
@media(max-width:750px){body.expanded .layout{grid-template-columns:minmax(0,1fr)}body.expanded .map-wrap{max-width:560px}body.expanded .sidebar{max-width:560px;margin:auto}}

#map-expand svg{width:17px;height:17px;vertical-align:-3px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
@media(min-width:751px) and (max-height:599px){body.expanded .layout{grid-template-columns:minmax(0,min(560px,calc(100dvh - 76px))) minmax(0,280px)}}

body.map-overview #map-mode::after{content:' · 24 punts; amplia el mapa per veure els valors';display:block;font-size:10px;font-weight:500}
@media(min-width:751px) and (max-height:499px){body.expanded .station-chooser{padding:4px}body.expanded .sync{margin:2px 0}body.expanded .age{margin-top:3px}body.expanded .metrics{margin-top:3px}}

@media(min-width:751px) and (max-width:1000px) and (min-height:600px){body.expanded .layout{grid-template-columns:minmax(0,1fr)}body.expanded .map-wrap,body.expanded .sidebar{max-width:560px;margin:auto}}
@media(max-width:750px) and (max-height:850px){body.expanded .sidebar{padding:10px}body.expanded .tools button{padding:7px 3px}body.expanded .station-chooser{padding:5px}body.expanded .metrics{margin-top:7px}body.expanded .age{margin-top:7px}}
@media(min-width:751px) and (max-width:1000px) and (min-height:600px){body.expanded .sidebar{width:100%}}


/* v1.0.9.2 · PALETA DEL MAPA · proposta B (més discreta).
 * Únic lloc per ajustar els colors: només canvien els farcits cartogràfics.
 * Variant A: mar #dff2f8; Alt #e7f2df; Baix #f8eedf.
 */
:root{
 --mt-map-sea:#e3f4fa;
 --mt-map-alt:#edf6e8;
 --mt-map-baix:#f9f1e6;
 --mt-map-context:#f8faf8;
}
#map{background:var(--mt-map-context)}
.native-sea{fill:var(--mt-map-sea);stroke:none}
.native-land.native-alt{fill:var(--mt-map-alt)}
.native-land.native-baix{fill:var(--mt-map-baix)}

/* v1.0.9.3: capa tèrmica opcional; sense afectar el mapa amb l'opció desactivada. */
.thermal-controls{margin:5px 0 7px;font-size:12px;color:#244c63;font-weight:800}.thermal-controls label{display:flex;align-items:center;gap:7px;cursor:pointer}.thermal-controls input{accent-color:#0879ab;width:16px;height:16px}.thermal-legend{margin:3px 0 8px}.thermal-legend[hidden],.thermal-controls[hidden]{display:none!important}.thermal-gradient{height:10px;border-radius:6px;background:linear-gradient(90deg,#a3cde8,#abdbeb,#b9e4cc,#d8ecaf,#fae1a2,#f6c093,#f19d8e,#e67f80)}.thermal-ticks{display:flex;justify-content:space-between;font-size:9px;color:#547386}.thermal-legend p{font-size:10px;line-height:1.3;color:#547386;margin-top:3px}

/* v1.0.9.4: només selector d'escala de la capa tèrmica. */
.thermal-mode-label{margin-top:5px;justify-content:space-between;font-weight:600;gap:8px}
.thermal-mode-label select{padding:3px 6px;border:1px solid #cbdfe9;border-radius:7px;background:white;color:#244c63;font-size:11px;font-weight:700}
.thermal-mode-label:has(select):not([hidden]){display:flex}

/* v1.0.9.6: punts geogràfics visibles quan alguna etiqueta els tapa. */
.station-point-overlay{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:3;overflow:visible}
