/* WeatherSicily Earth — Observatory UI
 * Un solo sistema visivo per scena, navigazione, consultazione e dettaglio.
 * Il 3D nasce da luce, materiali e gerarchia; il dato resta sempre prioritario. */

:root {
  color-scheme: dark;
  --earth-bg: #03101b;
  --earth-surface: rgba(5, 20, 33, .88);
  --earth-surface-strong: rgba(5, 19, 31, .96);
  --earth-surface-soft: rgba(20, 48, 65, .72);
  --earth-raised: rgba(28, 61, 80, .66);
  --earth-inset: rgba(0, 8, 16, .44);
  --earth-line: rgba(163, 220, 247, .18);
  --earth-line-strong: rgba(177, 229, 252, .34);
  --earth-text: #f3f9fd;
  --earth-text-soft: #a5bdcb;
  --earth-text-dim: #7996a8;
  --earth-cyan: #4fd5ff;
  --earth-blue: #269ed6;
  --earth-mint: #71efc5;
  --earth-amber: #ffd36b;
  --earth-danger: #ff776d;
  --earth-radius-xs: 8px;
  --earth-radius-sm: 11px;
  --earth-radius-md: 16px;
  --earth-radius-lg: 22px;
  --earth-shadow-chrome: 0 8px 24px rgba(0, 7, 14, .25), inset 0 1px rgba(255,255,255,.09);
  --earth-shadow-panel: 0 22px 65px rgba(0, 6, 13, .44), inset 0 1px rgba(255,255,255,.1);
  --earth-shadow-focus: 0 0 0 3px rgba(79, 213, 255, .15), 0 16px 42px rgba(0, 8, 17, .34);
  --earth-ease: cubic-bezier(.2, .8, .2, 1);
  --earth-top: 14px;
  --earth-side: 16px;
  --earth-topbar-h: 48px;
  --earth-timeline-h: 72px;
  --earth-font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html.theme-light {
  color-scheme: light;
  --earth-bg: #dbe8ef;
  --earth-surface: rgba(245, 250, 253, .9);
  --earth-surface-strong: rgba(249, 252, 254, .97);
  --earth-surface-soft: rgba(226, 239, 247, .9);
  --earth-raised: rgba(255, 255, 255, .86);
  --earth-inset: rgba(63, 103, 126, .08);
  --earth-line: rgba(30, 73, 99, .16);
  --earth-line-strong: rgba(22, 107, 151, .31);
  --earth-text: #102839;
  --earth-text-soft: #496779;
  --earth-text-dim: #587485;
  --earth-cyan: #007eb9;
  --earth-blue: #0075aa;
  --earth-mint: #0d9875;
  --earth-shadow-chrome: 0 8px 24px rgba(34, 70, 91, .14), inset 0 1px #fff;
  --earth-shadow-panel: 0 22px 64px rgba(30, 67, 89, .22), inset 0 1px #fff;
  --earth-shadow-focus: 0 0 0 3px rgba(0, 126, 185, .13), 0 15px 38px rgba(32, 73, 97, .18);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body {
  background: var(--earth-bg);
  color: var(--earth-text);
  font-family: var(--earth-font);
  font-size: 14px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

#map { position: fixed; inset: 0; }
#fx { position: fixed; inset: 0; z-index: 8; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity .45s ease; }
.earth-icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.earth-icon { width: 20px; height: 20px; display: block; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.earth-atmospheric-ui {
  position: fixed; inset: 0; z-index: 9; pointer-events: none;
  background:
    radial-gradient(68% 48% at 50% 112%, rgba(0, 13, 24, .36), transparent 73%),
    linear-gradient(180deg, rgba(0, 8, 15, .18), transparent 15%, transparent 74%, rgba(0, 9, 17, .26));
  box-shadow: inset 0 0 110px rgba(0, 9, 16, .16);
}

/* Intro progressiva */
.veil {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: radial-gradient(100% 75% at 50% 35%, #0d3048 0%, #04121f 58%, #020a12 100%);
  transition: opacity .7s var(--earth-ease), visibility .7s;
}
.veil::before { content: ""; position: absolute; inset: 0; opacity: .34; background: radial-gradient(circle at 50% 48%, rgba(79,213,255,.16), transparent 34%); }
.veil.gone { opacity: 0; visibility: hidden; }
.veil-core { position: relative; text-align: center; }
.veil-mark { color: #f5fbff; font-size: clamp(30px, 5vw, 62px); font-weight: 760; letter-spacing: -.045em; }
.veil-sub { margin-top: 8px; color: #85e4ff; font-size: 11px; font-weight: 800; letter-spacing: .42em; padding-left: .42em; }
.veil-bar { width: 190px; height: 3px; margin: 24px auto 0; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.1); }
.veil-bar span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--earth-cyan), var(--earth-mint)); animation: earth-load 2.1s var(--earth-ease) forwards; box-shadow: 0 0 15px rgba(79,213,255,.6); }
@keyframes earth-load { to { width: 100%; } }

/* Materiale comune: tre sole quote, senza estrusioni pesanti. */
.brand,
.earth-search-shell,
.earth-search-top,
.hud-actions,
.earth-data-cockpit,
.earth-camera-cockpit,
.earth-timebar,
.timeline,
.readout,
.legend,
.earth-view-options > button,
.earth-view-options > section,
.earth-panel,
.station-drawer,
.wslam-panel,
.measure-chip {
  border: 1px solid var(--earth-line);
  background: linear-gradient(145deg, color-mix(in srgb, var(--earth-surface) 93%, white 7%), var(--earth-surface));
  color: var(--earth-text);
  box-shadow: var(--earth-shadow-chrome);
  -webkit-backdrop-filter: blur(20px) saturate(1.18);
  backdrop-filter: blur(20px) saturate(1.18);
}

/* Top command bar */
.hud { position: fixed; z-index: 40; left: 0; right: 0; display: flex; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud-top {
  top: 0; height: calc(var(--earth-topbar-h) + var(--earth-top) * 2); padding: var(--earth-top) var(--earth-side);
  align-items: center; gap: 10px;
  background: linear-gradient(180deg, rgba(1, 9, 16, .28), transparent);
}
.earth-commandbar, .earth-command-bar { display: flex; min-width: 0; align-items: center; gap: 10px; flex: 1; }
.brand {
  position: relative; height: var(--earth-topbar-h); min-width: 248px; display: flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 8px; border-radius: var(--earth-radius-md); cursor: pointer; text-align: left;
  transition: border-color .18s, background .18s, transform .18s var(--earth-ease), box-shadow .18s;
}
.brand::after, .earth-data-cockpit::before, .earth-panel::before, .station-drawer::before, .earth-timebar::before {
  content: ""; position: absolute; pointer-events: none; height: 1px; left: 14px; right: 14px; top: 0;
  background: linear-gradient(90deg, transparent, rgba(120,224,255,.72), rgba(113,239,197,.55), transparent);
}
.brand:hover { border-color: var(--earth-line-strong); transform: translateY(-1px); }
.brand:active { transform: translateY(1px); }
.brand-menu { width: 20px; height: 20px; display: block; flex: none; color: var(--earth-text-soft); }
.brand-identity { min-width: 0; display: flex; align-items: center; gap: 7px; }
.brand img, .brand-identity img { width: 31px; height: 31px; object-fit: contain; flex: none; }
.brand-wordmark { min-width: 0; display: grid; line-height: 1.05; }
.brand-wordmark strong { overflow: hidden; color: var(--earth-text); font-size: 11px; font-weight: 820; letter-spacing: -.02em; white-space: nowrap; text-overflow: ellipsis; }
.brand-wordmark small { color: var(--earth-text-dim); font-size: 7px; font-weight: 720; letter-spacing: .05em; white-space: nowrap; }
.brand-copy { min-width: 0; display: grid; gap: 1px; }
.brand-name { overflow: hidden; color: var(--earth-text); font-size: 12px; font-weight: 800; letter-spacing: -.015em; white-space: nowrap; text-overflow: ellipsis; }
.brand-sub { display: flex; align-items: center; gap: 5px; color: var(--earth-text-dim); font-size: 8px; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.brand-edition { margin-left: auto; display: inline-flex; align-items: center; gap: 3px; padding: 4px 6px; border: 1px solid rgba(113,239,197,.17); border-radius: 8px; background: rgba(113,239,197,.07); color: var(--earth-mint); font-size: 7px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.brand-edition .earth-icon { width: 11px; height: 11px; }
.brand-edition em { color: var(--earth-cyan); font-size: 6px; font-style: normal; }

.earth-search-wrap { position: relative; min-width: 0; }
.earth-search-top { width: min(420px, 34vw); height: var(--earth-topbar-h); display: flex; align-items: center; padding: 0; border-radius: var(--earth-radius-md); transition: border-color .18s, box-shadow .18s, background .18s; }
.earth-search-top:focus-within { border-color: rgba(79,213,255,.62); box-shadow: var(--earth-shadow-focus); background: var(--earth-surface-strong); }
.earth-search-shell { position: relative; height: var(--earth-topbar-h); display: flex; align-items: center; border-radius: var(--earth-radius-md); transition: border-color .18s, box-shadow .18s, background .18s; }
.earth-search-shell:focus-within { border-color: rgba(79,213,255,.62); box-shadow: var(--earth-shadow-focus); background: var(--earth-surface-strong); }
.earth-search-icon { position: absolute; left: 14px; z-index: 1; color: var(--earth-text-dim); pointer-events: none; }
.earth-search-icon .earth-icon { width: 18px; height: 18px; }
.earth-search-top input {
  width: 100%; height: 100%; min-width: 0; padding: 0 72px 0 42px; border: 0; outline: 0; border-radius: inherit;
  background: transparent; color: var(--earth-text); font-size: 13px; font-weight: 650;
}
.earth-search-top input::placeholder { color: var(--earth-text-soft); opacity: .88; }
.earth-search-shortcut, .earth-search-top kbd { position: absolute; right: 10px; padding: 4px 7px; border: 1px solid var(--earth-line); border-radius: 7px; color: var(--earth-text-dim); background: var(--earth-inset); font-family: inherit; font-size: 8px; font-weight: 750; line-height: 1; }
.earth-search-results {
  position: absolute; z-index: 90; left: 0; right: 0; top: calc(100% + 8px); max-height: min(420px, calc(100dvh - 88px)); overflow: auto;
  padding: 7px; border: 1px solid var(--earth-line-strong); border-radius: var(--earth-radius-md);
  background: linear-gradient(var(--earth-surface-strong), var(--earth-surface-strong)), var(--earth-bg);
  color: var(--earth-text); box-shadow: var(--earth-shadow-panel); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); scrollbar-width: thin;
}
.earth-search-result { width: 100%; min-height: 52px; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--earth-text); text-align: left; cursor: pointer; }
.earth-search-result:hover, .earth-search-result.active, .earth-search-result[aria-selected="true"] { border-color: rgba(79,213,255,.18); background: rgba(79,213,255,.1); }
.earth-search-result > i { width: 32px; height: 32px; display: grid; place-items: center; flex: none; border-radius: 10px; background: var(--earth-surface-soft); font-style: normal; font-size: 16px; }
.earth-search-result > span { min-width: 0; display: grid; gap: 2px; }
.earth-search-result b { overflow: hidden; font-size: 12.5px; white-space: nowrap; text-overflow: ellipsis; }
.earth-search-result small { color: var(--earth-text-soft); font-size: 10.5px; }

.hud-actions { margin-left: auto; height: var(--earth-topbar-h); display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: var(--earth-radius-md); }
.hud-tool, .hud-share {
  position: relative; min-width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--earth-text-soft); cursor: pointer;
  transition: color .15s, background .15s, border-color .15s, transform .15s;
}
.hud-tool:hover, .hud-share:hover { color: var(--earth-text); border-color: var(--earth-line); background: var(--earth-surface-soft); transform: translateY(-1px); }
.hud-tool:active, .hud-share:active { transform: translateY(1px); }
.hud-tool.is-on, .hud-tool[aria-pressed="true"] { color: #041923; border-color: rgba(113,239,197,.46); background: linear-gradient(135deg, var(--earth-cyan), var(--earth-mint)); }
.hud-share { padding: 0 12px; color: var(--earth-text); font-size: 11.5px; font-weight: 780; }
.hud-share .earth-icon { width: 17px; height: 17px; color: var(--earth-cyan); }
.hud-clock { display: none; }
#search-btn, #dimension-btn { display: none; }

/* Tooltip coerente, solo dove il puntatore consente hover. */
@media (hover:hover) and (pointer:fine) {
  [data-tooltip]::after {
    content: attr(data-tooltip); position: absolute; z-index: 160; top: calc(100% + 9px); left: 50%; transform: translate(-50%, -3px);
    width: max-content; max-width: 220px; padding: 7px 9px; border: 1px solid var(--earth-line); border-radius: 8px;
    background: var(--earth-surface-strong); color: var(--earth-text); box-shadow: var(--earth-shadow-chrome);
    font-size: 10px; font-weight: 650; line-height: 1.2; white-space: normal; opacity: 0; visibility: hidden; pointer-events: none; transition: .15s;
  }
  [data-tooltip]:hover::after, [data-tooltip]:focus-visible::after { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
  .earth-camera-cockpit [data-tooltip]::after, .earth-view-options > [data-tooltip]::after { top: 50%; right: calc(100% + 9px); left: auto; transform: translate(3px, -50%); white-space: nowrap; }
  .earth-camera-cockpit [data-tooltip]:hover::after, .earth-camera-cockpit [data-tooltip]:focus-visible::after,
  .earth-view-options > [data-tooltip]:hover::after, .earth-view-options > [data-tooltip]:focus-visible::after { transform: translate(0, -50%); }
}

/* Scrim e menu layer */
.earth-scrim { position: fixed; inset: 0; z-index: 54; background: rgba(1, 8, 14, .42); -webkit-backdrop-filter: blur(4px) saturate(.86); backdrop-filter: blur(4px) saturate(.86); animation: earth-fade .18s ease; }
@keyframes earth-fade { from { opacity: 0; } }
.earth-panel {
  position: fixed; z-index: 60; top: 76px; bottom: 16px; left: 16px; width: min(368px, calc(100vw - 32px));
  display: flex; flex-direction: column; overflow: hidden; border-color: var(--earth-line-strong); border-radius: var(--earth-radius-lg);
  background: linear-gradient(155deg, color-mix(in srgb, var(--earth-surface-strong) 94%, #173d52 6%), var(--earth-surface-strong));
  box-shadow: var(--earth-shadow-panel); opacity: 0; pointer-events: none;
  transform: translateX(-22px) scale(.985); transform-origin: left top; transition: opacity .2s, transform .26s var(--earth-ease);
}
.earth-panel.open { opacity: 1; pointer-events: auto; transform: none; }
.earth-panel-head { min-height: 66px; display: flex; align-items: center; gap: 12px; padding: 12px 14px 10px 16px; border-bottom: 1px solid var(--earth-line); }
.earth-panel-title, .earth-panel-heading { min-width: 0; display: grid; gap: 2px; }
.earth-panel-title b { color: var(--earth-text); font-size: 15px; font-weight: 800; letter-spacing: -.015em; }
.earth-panel-title small { color: var(--earth-text-dim); font-size: 10px; font-weight: 650; }
.earth-panel-heading h1 { margin: 0; color: var(--earth-text); font-size: 15px; font-weight: 800; letter-spacing: -.015em; line-height: 1.15; }
.earth-panel-heading p { margin: 0; color: var(--earth-text-dim); font-size: 9.5px; font-weight: 620; }
.earth-panel-kicker { color: var(--earth-cyan); font-size: 8px; font-weight: 850; letter-spacing: .15em; text-transform: uppercase; }
.earth-panel-kicker { display: flex; align-items: center; gap: 5px; }
.earth-panel-kicker .earth-icon { width: 12px; height: 12px; }
.earth-panel-head-actions { margin-left: auto; display: flex; gap: 6px; }
.panel-close, .panel-collapse, .station-drawer-close, #cockpit-toggle {
  width: 40px; height: 40px; display: grid; place-items: center; flex: none; border: 1px solid var(--earth-line); border-radius: 12px;
  background: var(--earth-surface-soft); color: var(--earth-text-soft); cursor: pointer; transition: .15s;
}
.panel-close:hover, .panel-collapse:hover, .station-drawer-close:hover, #cockpit-toggle:hover { color: var(--earth-text); border-color: var(--earth-line-strong); background: var(--earth-raised); }
.panel-close .earth-icon, .panel-collapse .earth-icon, .station-drawer-close .earth-icon, #cockpit-toggle .earth-icon { width: 18px; height: 18px; }
.earth-panel > .body { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 11px 16px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(79,213,255,.28) transparent; }
.earth-menu-tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0 2px 10px; }
.earth-menu-tools button { min-width: 0; height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 1px solid var(--earth-line); border-radius: 11px; background: var(--earth-surface-soft); color: var(--earth-text-soft); cursor: pointer; font-size: 10px; font-weight: 800; transition: .15s; }
.earth-menu-tools button:hover, .earth-menu-tools button[aria-pressed="true"] { color: var(--earth-text); border-color: var(--earth-line-strong); background: var(--earth-raised); }
.earth-menu-tools .earth-icon { width: 18px; height: 18px; }
.earth-menu-tools button span { max-width: 100%; overflow: hidden; font-size: 8px; font-weight: 760; line-height: 1.1; text-align: center; white-space: nowrap; text-overflow: ellipsis; }
.earth-what { width: 100%; min-height: 42px; display: flex; align-items: center; gap: 9px; padding: 8px 11px; border: 1px solid var(--earth-line); border-radius: 11px; background: rgba(79,213,255,.065); color: var(--earth-text); cursor: pointer; font-size: 12px; font-weight: 750; text-align: left; }
.earth-what .earth-icon { width: 17px; height: 17px; color: var(--earth-cyan); }
.earth-what > span { min-width: 0; display: grid; gap: 1px; flex: 1; }
.earth-what > span b { font-size: 11.5px; }
.earth-what > span small { color: var(--earth-text-dim); font-size: 8.5px; font-weight: 600; }
.earth-what .earth-chevron { width: 15px; height: 15px; color: var(--earth-text-dim); }
.earth-active-box { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 3px 10px; margin: 7px 0 8px; padding: 10px 11px; border: 1px solid var(--earth-line); border-radius: 11px; background: var(--earth-inset); color: var(--earth-text-soft); }
.earth-active-box > span { font-size: 11px; }
.earth-active-box b { color: var(--earth-mint); font-size: 12px; }
.earth-active-box small { grid-column: 1 / -1; color: var(--earth-text-dim); font-size: 9.5px; }
.earth-active-box > .earth-icon { width: 27px; height: 27px; grid-row: 1 / span 2; color: var(--earth-cyan); }
.earth-active-box > span { min-width: 0; display: grid; gap: 1px; }
.earth-active-box > span small { grid-column: auto; font-size: 7.5px; font-weight: 760; letter-spacing: .08em; text-transform: uppercase; }
.earth-active-box > span strong { overflow: hidden; font-size: 10.5px; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.earth-active-box > #parameter-available { grid-column: 2 / -1; }

.earth-group, .wsv2-group { border-top: 1px solid var(--earth-line); }
.wsv2-group__head { position: relative; width: 100%; min-height: 47px; display: flex; align-items: center; gap: 8px; padding: 8px 8px; border: 0; background: transparent; color: var(--earth-text); cursor: pointer; text-align: left; font-size: 12.5px; font-weight: 800; }
.wsv2-group__head::after { content: ""; width: 7px; height: 7px; margin-left: auto; border-right: 1.5px solid var(--earth-text-dim); border-bottom: 1.5px solid var(--earth-text-dim); transform: rotate(45deg); transition: transform .16s; }
.earth-group.is-open > .wsv2-group__head::after, .wsv2-group.is-open > .wsv2-group__head::after { transform: rotate(225deg) translate(-2px, -2px); }
.wsv2-group__head:hover { color: var(--earth-cyan); }
.wsv2-group__body { display: grid; gap: 3px; padding: 0 1px 9px; }
.earth-layer-toggle, .wsv2-toggle { min-height: 44px; display: flex; align-items: center; gap: 9px; padding: 7px 8px; border: 1px solid transparent; border-radius: 10px; color: var(--earth-text-soft); cursor: pointer; transition: color .14s, background .14s, border-color .14s; }
.earth-layer-toggle:hover, .wsv2-toggle:hover { color: var(--earth-text); border-color: rgba(79,213,255,.12); background: rgba(79,213,255,.07); }
.earth-layer-toggle > span, .wsv2-toggle > span { min-width: 0; display: flex; align-items: center; gap: 8px; flex: 1; font-size: 12px; font-weight: 590; line-height: 1.28; }
.earth-layer-toggle > span > i, .wsv2-toggle > span > i { width: 25px; height: 25px; display: grid; place-items: center; flex: none; border-radius: 8px; background: var(--earth-surface-soft); font-style: normal; font-size: 13px; }
.earth-layer-toggle input, .wsv2-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.wsv2-switch { position: relative; width: 38px; height: 22px; margin-left: auto; flex: none; border: 1px solid var(--earth-line); border-radius: 999px; background: var(--earth-inset); box-shadow: inset 0 2px 5px rgba(0,0,0,.22); transition: .18s; }
.wsv2-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--earth-text-dim); box-shadow: 0 2px 5px rgba(0,0,0,.3); transition: transform .18s var(--earth-ease), background .18s; }
.earth-layer-toggle input:checked + .wsv2-switch, .wsv2-toggle input:checked + .wsv2-switch { border-color: rgba(113,239,197,.45); background: linear-gradient(90deg, var(--earth-blue), #1cad91); }
.earth-layer-toggle input:checked + .wsv2-switch::after, .wsv2-toggle input:checked + .wsv2-switch::after { background: #f4ffff; transform: translateX(16px); }
.earth-layer-toggle:has(input:focus-visible), .wsv2-toggle:has(input:focus-visible) { outline: 2px solid var(--earth-cyan); outline-offset: 2px; }

.earth-filter-body { padding: 0 7px 10px; }
.earth-filter-body > label { display: flex; justify-content: space-between; gap: 8px; margin: 10px 0 5px; color: var(--earth-text-soft); font-size: 10px; font-weight: 700; }
.province-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.network-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.province-grid button, .network-grid button, .earth-tool-grid button, .saved-view {
  min-height: 36px; border: 1px solid var(--earth-line); border-radius: 9px; background: var(--earth-surface-soft); color: var(--earth-text-soft); cursor: pointer; font-size: 10px; font-weight: 750;
}
.network-grid button { min-height: 30px; padding: 4px 8px; border-radius: 999px; }
.province-grid button:hover, .network-grid button:hover, .earth-tool-grid button:hover, .saved-view:hover { color: var(--earth-text); border-color: var(--earth-line-strong); }
.province-grid button.is-on, .network-grid button.is-on, .province-grid button[aria-pressed="true"], .network-grid button[aria-pressed="true"] { color: #03151f; border-color: transparent; background: linear-gradient(135deg, var(--earth-cyan), var(--earth-mint)); }
.filter-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filter-pair input, #earth-time-range, .tl-range, .wslam-range { width: 100%; accent-color: var(--earth-mint); }
.filter-values { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 7px; }
.filter-values input { width: 100%; min-width: 0; height: 36px; padding: 0 8px; border: 1px solid var(--earth-line); border-radius: 9px; outline: 0; background: var(--earth-inset); color: var(--earth-text); font-size: 11px; font-weight: 650; }
.filter-values input:focus { border-color: var(--earth-cyan); box-shadow: 0 0 0 3px rgba(79,213,255,.1); }
.earth-filter-reset { width: 100%; min-height: 38px; margin-top: 10px; border: 1px solid var(--earth-line); border-radius: 9px; background: transparent; color: var(--earth-text-soft); cursor: pointer; font-size: 10px; font-weight: 750; }
.earth-filter-reset:hover { color: var(--earth-text); border-color: var(--earth-line-strong); background: var(--earth-surface-soft); }
.earth-tool-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; padding: 2px 5px; }
.earth-tool-grid button { min-height: 40px; }
.saved-views { display: flex; gap: 6px; overflow: auto; padding: 7px 5px 2px; }
.saved-view { flex: none; padding: 6px 10px; color: var(--earth-mint); }
.earth-deprecated, .dock { display: none !important; }

/* Cockpit dati: compatto, leggibile e richiudibile. */
.earth-data-cockpit {
  position: fixed; z-index: 32; top: 80px; right: 16px; width: 306px; overflow: hidden;
  border-color: var(--earth-line-strong); border-radius: 19px; box-shadow: var(--earth-shadow-panel);
  transition: width .22s var(--earth-ease), opacity .18s, transform .22s var(--earth-ease);
}
.data-cockpit-head { min-height: 58px; display: flex; align-items: center; gap: 9px; padding: 10px 10px 8px 13px; border-bottom: 1px solid var(--earth-line); }
.data-cockpit-status, .data-cockpit-heading { min-width: 0; display: flex; align-items: center; gap: 9px; flex: 1; }
.data-cockpit-heading > span:last-child { min-width: 0; display: grid; gap: 2px; }
.data-cockpit-heading small { color: var(--earth-text-dim); font-size: 8px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.data-cockpit-heading b { overflow: hidden; font-size: 12px; font-weight: 790; white-space: nowrap; text-overflow: ellipsis; }
.data-cockpit-head-actions { display: flex; align-items: center; gap: 5px; }
.data-cockpit-copy { min-width: 0; display: grid; gap: 2px; }
.data-cockpit-copy small { color: var(--earth-text-dim); font-size: 8px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.data-cockpit-copy b { overflow: hidden; font-size: 12px; font-weight: 790; white-space: nowrap; text-overflow: ellipsis; }
.live-pulse { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--earth-mint); box-shadow: 0 0 0 5px rgba(113,239,197,.09), 0 0 13px rgba(113,239,197,.55); animation: live-pulse 2.4s ease-in-out infinite; }
@keyframes live-pulse { 50% { box-shadow: 0 0 0 8px rgba(113,239,197,0), 0 0 16px rgba(113,239,197,.65); } }
#cockpit-update { align-self: flex-start; padding: 4px 7px; border: 1px solid rgba(113,239,197,.2); border-radius: 999px; background: rgba(113,239,197,.1); color: var(--earth-mint); font-size: 8px; font-weight: 900; letter-spacing: .08em; }
#cockpit-toggle { width: 34px; height: 34px; border-radius: 10px; }
.data-cockpit-body { padding: 10px 12px 12px; }
.earth-data-cockpit label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 0; color: var(--earth-text-soft); font-size: 9px; font-weight: 820; letter-spacing: .1em; text-transform: uppercase; }
.data-cockpit-field-head { min-height: 28px; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
#parameter-help { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--earth-line); border-radius: 9px; background: var(--earth-inset); color: var(--earth-text-soft); cursor: pointer; font-size: 11px; font-weight: 850; }
.data-cockpit-select { position: relative; display: flex; align-items: center; }
.data-cockpit-select > .earth-icon:first-child { position: absolute; z-index: 1; left: 11px; width: 16px; height: 16px; color: var(--earth-cyan); pointer-events: none; }
.data-cockpit-select-chevron { position: absolute; right: 11px; width: 14px; height: 14px; color: var(--earth-text-dim); pointer-events: none; }
.earth-data-cockpit select { width: 100%; height: 42px; padding: 0 38px 0 36px; border: 1px solid var(--earth-line); border-radius: 11px; outline: 0; appearance: none; background: var(--earth-surface-soft); color: var(--earth-text); font-size: 12.5px; font-weight: 760; }
.earth-data-cockpit select:focus { border-color: var(--earth-cyan); box-shadow: 0 0 0 3px rgba(79,213,255,.12); }
.earth-data-cockpit select option { background: var(--earth-surface-strong); color: var(--earth-text); }
.cockpit-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 9px; overflow: hidden; border: 1px solid var(--earth-line); border-radius: 11px; background: var(--earth-inset); }
.cockpit-stats > div { min-width: 0; padding: 8px 5px; text-align: center; }
.cockpit-stats > div + div { border-left: 1px solid var(--earth-line); }
.cockpit-stats small { display: block; margin-bottom: 3px; color: var(--earth-text-dim); font-size: 8px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.cockpit-stats strong { display: block; overflow: hidden; color: var(--earth-text); font-size: 12px; font-weight: 830; font-variant-numeric: tabular-nums; white-space: nowrap; text-overflow: ellipsis; }
.cockpit-coverage { margin-top: 9px; }
.cockpit-coverage > div { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.cockpit-coverage > div small { margin: 0; font-size: 8px; font-weight: 700; letter-spacing: .04em; }
.cockpit-coverage > div strong { color: var(--earth-text-soft); font-size: 8px; font-weight: 800; text-transform: uppercase; }
.cockpit-coverage > span { height: 4px; display: block; overflow: hidden; border-radius: 999px; background: var(--earth-inset); }
.cockpit-coverage i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--earth-cyan), var(--earth-mint)); transition: width .35s var(--earth-ease); }
.cockpit-coverage small { display: block; margin-top: 5px; overflow: hidden; color: var(--earth-text-dim); font-size: 9.5px; font-variant-numeric: tabular-nums; white-space: nowrap; text-overflow: ellipsis; }
.earth-data-cockpit.is-collapsed { width: 218px; }
.earth-data-cockpit.is-collapsed .data-cockpit-body { display: none; }
.earth-data-cockpit.is-collapsed .data-cockpit-head { border-bottom: 0; }

/* Rail unica della scena */
.earth-camera-cockpit {
  position: fixed; z-index: 31; top: 356px; right: 16px; width: 52px; display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 6px; border-radius: 17px; transition: opacity .18s, transform .2s var(--earth-ease);
}
.camera-mode-label { width: 100%; display: grid; place-items: center; gap: 2px; padding: 5px 0 6px; border-bottom: 1px solid var(--earth-line); }
.camera-mode-label span { color: var(--earth-text-dim); font-size: 7px; font-weight: 850; letter-spacing: .12em; }
.camera-mode-label b { color: var(--earth-mint); font-size: 11px; }
.earth-camera-cockpit button { position: relative; width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--earth-text-soft); cursor: pointer; font-size: 10px; font-weight: 850; transition: .15s; }
.earth-camera-cockpit button:hover { color: var(--earth-text); border-color: var(--earth-line); background: var(--earth-surface-soft); }
.earth-camera-cockpit button.is-on, .earth-camera-cockpit button[aria-pressed="true"] { color: #03151e; border-color: rgba(113,239,197,.4); background: linear-gradient(135deg, var(--earth-cyan), var(--earth-mint)); box-shadow: 0 7px 16px rgba(22,172,180,.2); }
.earth-camera-cockpit button .earth-icon { width: 19px; height: 19px; }
.camera-compass { position: absolute; right: 6px; top: 5px; display: grid; place-items: center; width: 10px; height: 10px; color: var(--earth-danger); font-size: 6px; font-style: italic; transition: transform .15s linear; }
.camera-button-label { position: absolute; right: 3px; bottom: 2px; padding: 1px 2px; border-radius: 3px; background: var(--earth-inset); color: currentColor; font-size: 6px; line-height: 1; }
.camera-divider { width: 28px; height: 1px; margin: 1px 0; background: var(--earth-line); }
.camera-readout { width: 100%; display: grid; gap: 1px; padding-top: 5px; border-top: 1px solid var(--earth-line); color: var(--earth-text-dim); text-align: center; font-size: 8.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.maplibregl-ctrl-top-right .maplibregl-ctrl-group { display: none; }

.earth-view-options { position: fixed; z-index: 33; top: 80px; right: 332px; }
.earth-view-options > button { position: relative; width: 44px; height: 44px; display: grid; place-items: center; border-color: var(--earth-line-strong); border-radius: 14px; cursor: pointer; color: var(--earth-text-soft); transition: .16s; }
.earth-view-options > button:hover { color: var(--earth-text); transform: translateY(-1px); }
.earth-view-options > button[aria-expanded="true"] { color: #03151f; background: linear-gradient(135deg, var(--earth-cyan), var(--earth-mint)); }
.earth-view-options > section { position: absolute; right: 0; top: 52px; width: 296px; max-height: calc(100dvh - 150px); overflow: auto; padding: 10px; border-color: var(--earth-line-strong); border-radius: var(--earth-radius-md); box-shadow: var(--earth-shadow-panel); }
.earth-view-options > section > b { display: block; padding: 2px 7px 8px; color: var(--earth-cyan); font-size: 9px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.earth-view-options > section > header { display: grid; gap: 1px; padding: 2px 7px 8px; }
.earth-view-options > section > header span { color: var(--earth-text-dim); font-size: 7px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.earth-view-options > section > header b { color: var(--earth-cyan); font-size: 10px; font-weight: 850; letter-spacing: .08em; }

/* Timeline: una sola barra visibile per volta. */
.earth-timebar, .timeline {
  position: fixed; z-index: 35; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(700px, calc(100vw - 760px)); min-width: 480px;
  min-height: var(--earth-timeline-h); display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-color: var(--earth-line-strong); border-radius: 19px;
  transition: opacity .18s, transform .2s var(--earth-ease);
}
.earth-time-play, .tl-play, .earth-time-now { min-width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--earth-line); border-radius: 12px; background: var(--earth-surface-soft); color: var(--earth-text); cursor: pointer; font-weight: 850; }
.earth-time-play, .tl-play { color: #03151f; border-color: rgba(113,239,197,.4); background: linear-gradient(135deg, var(--earth-cyan), var(--earth-mint)); box-shadow: 0 8px 18px rgba(27,174,185,.18); }
.earth-time-play .earth-icon, .tl-play .earth-icon { width: 17px; height: 17px; fill: currentColor; stroke: none; }
.earth-time-play:active, .tl-play:active, .earth-time-now:active { transform: translateY(1px); }
.earth-time-main { min-width: 0; flex: 1; }
.earth-time-head { display: grid; grid-template-columns: auto auto 1fr; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.earth-time-head b { color: var(--earth-mint); font-size: 9px; font-weight: 900; letter-spacing: .12em; }
.earth-time-head span { overflow: hidden; color: var(--earth-text-soft); font-size: 10px; font-weight: 650; white-space: nowrap; text-overflow: ellipsis; }
.earth-time-head output { overflow: hidden; color: var(--earth-text-soft); text-align: right; font-size: 10px; font-weight: 650; white-space: nowrap; text-overflow: ellipsis; }
.earth-time-eyebrow { color: var(--earth-text-dim) !important; font-size: 8px !important; font-weight: 800 !important; letter-spacing: .08em; text-transform: uppercase; }
#earth-time-range { display: block; height: 18px; margin: 0; }
.earth-time-scale { display: flex; justify-content: space-between; color: var(--earth-text-dim); font-size: 8px; font-variant-numeric: tabular-nums; }
.earth-time-now { min-width: 48px; padding: 0 8px; color: var(--earth-mint); font-size: 10px; }
.earth-time-now { display: flex; flex-direction: column; gap: 1px; }
.earth-time-now .earth-icon { width: 16px; height: 16px; }
.earth-time-now span { font-size: 7px; font-weight: 850; text-transform: uppercase; }
.timeline { min-height: 62px; }
.tl-track { min-width: 0; display: grid; gap: 4px; flex: 1; }
.tl-track > span { color: var(--earth-text-soft); font-size: 9px; font-weight: 760; }
.tl-track-head { display: flex; align-items: center; gap: 7px; }
.tl-track-head b { color: var(--earth-text-soft); font-size: 9px; font-weight: 780; }
.tl-track-head i { width: 76px; height: 5px; margin-left: auto; border-radius: 999px; background: linear-gradient(90deg,#5ec8ff,#2e6bff,#39d98a,#e9e36b,#e83a3a,#b21fb2); box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.tl-track-head em { color: var(--earth-text-dim); font-size: 7px; font-style: normal; font-weight: 750; }
.tl-range { flex: 1; }
.tl-label { min-width: 58px; color: var(--earth-text); text-align: center; font-size: 11px; font-weight: 750; font-variant-numeric: tabular-nums; }
body:has(#timeline:not([hidden])) .earth-timebar { opacity: 0; visibility: hidden; pointer-events: none; transform: translate(-50%, 10px); }

.hud-bottom { z-index: 34; bottom: 16px; left: 16px; right: auto; width: 330px; display: grid; gap: 7px; }
.readout { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; padding: 7px 9px; border-radius: 13px; }
.readout-label { display: none; }
.ro-item { min-width: 0; display: grid; gap: 1px; padding: 2px 6px; }
.ro-item + .ro-item { border-left: 1px solid var(--earth-line); }
.ro-item b { overflow: hidden; font-size: 11px; font-weight: 760; font-variant-numeric: tabular-nums; white-space: nowrap; text-overflow: ellipsis; }
.ro-item i { color: var(--earth-text-dim); font-size: 7px; font-style: normal; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.legend { display: grid; gap: 5px; padding: 7px 10px; border-radius: 13px; font-size: 9px; }
.legend-head, .legend-scale { display: flex; align-items: center; gap: 7px; }
.legend-head > span { color: var(--earth-text-dim); font-size: 7px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.legend-scale .legend-bar { flex: 1; }
.legend-title { color: var(--earth-text-soft); font-size: 8px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.legend-bar { height: 7px; min-width: 88px; border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.17); }
.legend-min, .legend-max { color: var(--earth-text); font-size: 8px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hint { display: none; }

/* Dettaglio stazione */
.station-drawer {
  position: fixed; z-index: 66; top: 80px; right: 16px; width: min(404px, calc(100vw - 32px)); max-height: calc(100dvh - 98px);
  overflow: auto; overscroll-behavior: contain; padding: 18px; border-color: var(--earth-line-strong); border-radius: 21px; box-shadow: var(--earth-shadow-panel);
  opacity: 0; pointer-events: none; transform: translateX(24px) scale(.985); transform-origin: right top;
  transition: opacity .2s, transform .26s var(--earth-ease); scrollbar-width: thin;
}
.station-drawer.open { opacity: 1; pointer-events: auto; transform: none; }
.station-drawer-close { position: sticky; z-index: 2; top: 0; float: right; margin: -8px -8px 0 8px; background: var(--earth-surface-strong); }
.station-hero { min-height: 58px; padding-right: 46px; }
.station-status { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; color: var(--earth-mint); font-size: 8px; font-weight: 900; letter-spacing: .13em; }
.station-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--earth-mint); box-shadow: 0 0 10px currentColor; }
.station-status.is-stale { color: var(--earth-amber); }
.station-status.is-stale i { background: var(--earth-amber); }
.station-status.is-forecast { color: var(--earth-cyan); }
.station-status.is-forecast i { background: var(--earth-cyan); }
.station-status.is-archive { color: var(--earth-amber); }
.station-status.is-archive i { background: var(--earth-amber); }
.station-hero h2 { margin: 0 0 4px; color: var(--earth-text); font-size: 20px; line-height: 1.12; letter-spacing: -.025em; }
.station-hero p { margin: 0; color: var(--earth-text-soft); font-size: 10.5px; }
.station-primary { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin: 18px 0 13px; padding: 14px 0; border-top: 1px solid var(--earth-line); border-bottom: 1px solid var(--earth-line); }
.station-primary small { color: var(--earth-text-dim); font-size: 9px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.station-value { margin-top: 5px; font-size: 38px; font-weight: 850; line-height: .95; letter-spacing: -.055em; font-variant-numeric: tabular-nums; text-shadow: 0 5px 24px color-mix(in srgb, currentColor 34%, transparent); }
.station-coordinate { color: var(--earth-text-dim); text-align: right; font-size: 9px; font-weight: 700; line-height: 1.55; font-variant-numeric: tabular-nums; }
.station-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.station-detail-grid > div { min-width: 0; min-height: 60px; display: grid; align-content: center; gap: 4px; padding: 9px 10px; border: 1px solid var(--earth-line); border-radius: 11px; background: var(--earth-surface-soft); }
.station-detail-grid span { color: var(--earth-text-dim); font-size: 8px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.station-detail-grid b { overflow: hidden; color: var(--earth-text); font-size: 12.5px; font-weight: 760; white-space: nowrap; text-overflow: ellipsis; }
.earth-station-ad { width: 100%; min-height: 284px; margin: 15px auto 4px; padding: 14px 0 18px; overflow: hidden; border-top: 1px solid var(--earth-line); border-bottom: 1px solid var(--earth-line); text-align: center; }
.earth-station-ad__label { display: block; margin-bottom: 8px; color: var(--earth-text-dim); font-size: 9px; font-weight: 750; line-height: 1.2; letter-spacing: .08em; text-transform: uppercase; }
.earth-station-ad .adsbygoogle { width: 300px; height: 250px; margin: 0 auto; }
.earth-station-ad:has(.adsbygoogle[data-ad-status="unfilled"]) { display: none; }
.station-actions { position: sticky; bottom: -18px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; margin: 12px -6px -8px; padding: 9px 6px 8px; background: linear-gradient(180deg, transparent, var(--earth-surface-strong) 26%); }
.station-actions a, .station-actions button { min-height: 42px; display: grid; place-items: center; padding: 7px 9px; border: 1px solid var(--earth-line); border-radius: 10px; background: var(--earth-surface-soft); color: var(--earth-text); text-align: center; text-decoration: none; cursor: pointer; font-size: 10.5px; font-weight: 750; }
.station-actions a:hover, .station-actions button:hover { border-color: var(--earth-line-strong); background: var(--earth-raised); }
#station-history { color: var(--earth-text-soft); font-size: 11px; }
#station-history p { padding: 10px; border: 1px solid var(--earth-line); border-radius: 10px; background: var(--earth-inset); }
.station-history-card { margin-top: 11px; overflow: hidden; border: 1px solid var(--earth-line); border-radius: 12px; background: var(--earth-inset); }
.station-history-card > header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 9px 10px 2px; }
.station-history-card > header span { color: var(--earth-text-dim); font-size: 8px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.station-history-card > header b { color: var(--earth-text); font-size: 10px; }
.station-history-card svg { display: block; width: 100%; height: 74px; overflow: visible; }
.station-history-area { fill: rgba(79,213,255,.09); }
.station-history-line { fill: none; stroke: var(--earth-cyan); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 4px rgba(79,213,255,.35)); }
.station-history-card > div { display: grid; grid-template-columns: repeat(3, 1fr) auto; align-items: center; border-top: 1px solid var(--earth-line); }
.station-history-card > div > span { display: grid; gap: 2px; padding: 7px 8px; }
.station-history-card > div > span + span { border-left: 1px solid var(--earth-line); }
.station-history-card small { color: var(--earth-text-dim); font-size: 7px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.station-history-card b { color: var(--earth-text); font-size: 10px; font-variant-numeric: tabular-nums; }
.station-history-card em { padding: 0 8px; color: var(--earth-text-dim); font-size: 8px; font-style: normal; }
.station-history-state { color: var(--earth-text-soft); }
body.station-inspecting .earth-data-cockpit, body.station-inspecting .earth-view-options, body.station-inspecting .earth-camera-cockpit { opacity: 0; pointer-events: none; transform: translateX(12px); }

/* Popup MapLibre e hover dato */
.maplibregl-popup { z-index: 70; }
.maplibregl-popup-content { overflow: hidden; padding: 0 !important; border: 1px solid var(--earth-line-strong); border-radius: 14px !important; background: var(--earth-surface-strong) !important; color: var(--earth-text) !important; box-shadow: var(--earth-shadow-panel); font-family: var(--earth-font); }
.maplibregl-popup-tip { border-top-color: var(--earth-surface-strong) !important; border-bottom-color: var(--earth-surface-strong) !important; }
.maplibregl-popup-close-button { width: 30px; height: 30px; color: var(--earth-text-soft) !important; font-size: 18px; }
.earth-station-hover .maplibregl-popup-content { min-width: 176px; padding: 11px 12px !important; }
.earth-hover-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.earth-hover-top b { overflow: hidden; max-width: 145px; font-size: 11.5px; white-space: nowrap; text-overflow: ellipsis; }
.earth-hover-top span { color: var(--earth-text-dim); font-size: 9px; }
.earth-hover-value { margin: 5px 0 3px; color: var(--earth-cyan); font-size: 22px; font-weight: 850; line-height: 1; letter-spacing: -.04em; }
.earth-station-hover small { color: var(--earth-text-soft); font-size: 9px; }
.stp-name { padding: 11px 12px 5px; font-size: 13px; font-weight: 800; }
.stp-prov { color: var(--earth-text-soft); }
.stp-grid { display: grid; grid-template-columns: auto auto; gap: 4px 14px; padding: 0 12px 11px; }
.stp-t { padding: 0 12px 7px; font-size: 24px; font-weight: 850; }
.stp-stale { padding: 0 12px 10px; color: var(--earth-amber); font-size: 10px; }
.stp-cam { display: block; width: 260px; max-width: 100%; background: #08131e; }
.stp-fill { height: 6px; margin: 6px 12px; overflow: hidden; border-radius: 999px; background: var(--earth-inset); }
.stp-fill > span { display: block; height: 100%; border-radius: inherit; }
.stp-ecmwf { width: calc(100% - 24px); margin: 4px 12px 10px; border-collapse: collapse; font-size: 10px; }
.stp-ecmwf th, .stp-ecmwf td { padding: 3px 5px; border-bottom: 1px solid var(--earth-line); text-align: left; }

/* Pannelli contestuali dei layer */
.wslam-panel { position: fixed; z-index: 37; left: 50%; bottom: 98px; transform: translateX(-50%); display: flex; align-items: center; gap: 9px; max-width: calc(100vw - 32px); padding: 8px 10px; border-radius: 14px; }
.wslam-panel select { height: 36px; max-width: 180px; padding: 0 9px; border: 1px solid var(--earth-line); border-radius: 9px; background: var(--earth-inset); color: var(--earth-text); font-size: 11px; font-weight: 700; }
.wslam-range { width: min(240px, 28vw); }
.wslam-lbl { min-width: 120px; color: var(--earth-text-soft); font-size: 10px; font-weight: 680; }
.measure-active #map { cursor: crosshair; }
.measure-chip { position: fixed; z-index: 70; top: 80px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px); padding: 7px 8px 7px 12px; border-radius: 12px; color: var(--earth-text); font-size: 10px; font-weight: 700; white-space: nowrap; }
.measure-chip-value { overflow: hidden; text-overflow: ellipsis; }
.measure-chip-stop { width: 27px; height: 27px; flex: 0 0 27px; border: 1px solid var(--earth-line-strong); border-radius: 8px; background: var(--earth-inset); color: var(--earth-text); font-size: 18px; line-height: 1; cursor: pointer; }
.measure-chip-stop:hover { border-color: var(--earth-cyan); color: var(--earth-cyan); }
.earth-toast { position: fixed; z-index: 150; left: 50%; bottom: 102px; max-width: min(520px, calc(100vw - 24px)); padding: 10px 14px; border: 1px solid var(--earth-line-strong); border-radius: 11px; background: var(--earth-surface-strong); color: var(--earth-text); box-shadow: var(--earth-shadow-panel); font-size: 11px; font-weight: 680; text-align: center; opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: .2s; }
.earth-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Dialoghi applicativi: sostituiscono alert e prompt nativi. */
.earth-dialog { width: min(460px, calc(100vw - 28px)); max-height: min(78dvh, 680px); padding: 0; overflow: visible; border: 1px solid var(--earth-line-strong); border-radius: 20px; background: transparent; color: var(--earth-text); box-shadow: var(--earth-shadow-panel); }
.earth-dialog::backdrop { background: rgba(1, 8, 14, .62); -webkit-backdrop-filter: blur(7px) saturate(.8); backdrop-filter: blur(7px) saturate(.8); }
.earth-dialog-card { max-height: inherit; display: flex; flex-direction: column; overflow: hidden; border-radius: inherit; background: linear-gradient(150deg, color-mix(in srgb, var(--earth-surface-strong) 94%, #173d52 6%), var(--earth-surface-strong)); }
.earth-dialog-card > header { min-height: 70px; display: flex; align-items: center; gap: 14px; padding: 14px 14px 11px 18px; border-bottom: 1px solid var(--earth-line); }
.earth-dialog-card > header > div { min-width: 0; display: grid; gap: 3px; }
.earth-dialog-card > header small { color: var(--earth-cyan); font-size: 8px; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.earth-dialog-card > header h2 { margin: 0; color: var(--earth-text); font-size: 18px; line-height: 1.15; letter-spacing: -.025em; }
.earth-dialog-close { width: 40px; height: 40px; display: grid; place-items: center; margin-left: auto; flex: none; border: 1px solid var(--earth-line); border-radius: 12px; background: var(--earth-surface-soft); color: var(--earth-text-soft); cursor: pointer; font-size: 24px; line-height: 1; }
.earth-dialog-body { overflow: auto; padding: 16px 18px; overscroll-behavior: contain; }
.earth-dialog-body > p { margin: 0; color: var(--earth-text-soft); font-size: 12.5px; line-height: 1.55; }
.earth-dialog-body ul { display: grid; gap: 7px; margin: 13px 0 0; padding: 0; list-style: none; }
.earth-dialog-body li { position: relative; padding: 9px 10px 9px 28px; border: 1px solid var(--earth-line); border-radius: 10px; background: var(--earth-surface-soft); color: var(--earth-text); font-size: 11.5px; }
.earth-dialog-body li::before { content: ""; position: absolute; top: 14px; left: 12px; width: 7px; height: 7px; border-radius: 50%; background: var(--earth-mint); box-shadow: 0 0 8px rgba(113,239,197,.5); }
.earth-dialog-body label { display: grid; gap: 6px; margin-top: 13px; color: var(--earth-text-soft); font-size: 10px; font-weight: 750; }
.earth-dialog-body input { width: 100%; height: 44px; padding: 0 11px; border: 1px solid var(--earth-line); border-radius: 10px; outline: 0; background: var(--earth-inset); color: var(--earth-text); font-size: 12.5px; }
.earth-dialog-body input:focus { border-color: var(--earth-cyan); box-shadow: 0 0 0 3px rgba(79,213,255,.12); }
.earth-dialog-card > footer { display: flex; justify-content: flex-end; gap: 7px; padding: 10px 14px 14px; border-top: 1px solid var(--earth-line); }
.earth-dialog-primary, .earth-dialog-secondary { min-height: 42px; padding: 0 14px; border: 1px solid var(--earth-line); border-radius: 10px; cursor: pointer; font-size: 11px; font-weight: 780; }
.earth-dialog-primary { border-color: rgba(113,239,197,.4); background: linear-gradient(135deg, var(--earth-cyan), var(--earth-mint)); color: #03151f; }
.earth-dialog-secondary { background: var(--earth-surface-soft); color: var(--earth-text-soft); }

/* Stati globali e accessibilità */
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--earth-cyan); outline-offset: 3px; }
.earth-ui-idle:not(.earth-menu-open):not(.earth-search-open):not(.station-inspecting) .earth-camera-cockpit,
.earth-ui-idle:not(.earth-menu-open):not(.earth-search-open):not(.station-inspecting) .earth-data-cockpit { opacity: .86; }
.earth-embed .hud, .earth-embed .dock, .earth-embed .earth-timebar, .earth-embed .timeline, .earth-embed .earth-panel, .earth-embed .earth-scrim, .earth-embed .station-drawer, .earth-embed .earth-camera-cockpit, .earth-embed .earth-data-cockpit, .earth-embed .earth-view-options { display: none !important; }
.maplibregl-ctrl-attrib { color: rgba(180,205,219,.72) !important; background: rgba(2,10,17,.58) !important; font-size: 8px !important; }
.maplibregl-ctrl-attrib a { color: inherit !important; }

/* Laptop */
@media (max-width: 1180px) {
  :root { --earth-side: 12px; }
  .brand { min-width: 218px; }
  .brand-name, .brand-wordmark strong { font-size: 10.5px; }
  .earth-search-top { width: min(360px, 31vw); }
  .hud-share span { display: none; }
  .hud-share { width: 40px; padding: 0; }
  .earth-data-cockpit { right: 12px; width: 270px; }
  .earth-view-options { right: 294px; }
  .earth-camera-cockpit { right: 12px; }
  .earth-timebar, .timeline { width: min(620px, calc(100vw - 610px)); min-width: 430px; }
  .hud-bottom { left: 12px; width: 292px; }
}

/* Fascia laptop compatta: timeline e HUD occupano corsie distinte. */
@media (min-width: 901px) and (max-width: 1180px) {
  .earth-timebar, .timeline {
    right: auto;
    left: 316px;
    width: min(700px, calc(100vw - 392px));
    min-width: 0;
    transform: none;
  }
  body:has(#timeline:not([hidden])) .earth-timebar { transform: translateY(10px); }
}

/* Tablet e mobile: controlli ricomposti, pannelli come bottom sheet. */
@media (max-width: 900px) {
  :root { --earth-top: 8px; --earth-side: 8px; --earth-topbar-h: 48px; --earth-timeline-h: 66px; }
  .earth-atmospheric-ui { box-shadow: inset 0 0 62px rgba(0, 9, 16, .13); }
  .hud-top { gap: 8px; }
  .brand { min-width: 80px; width: 80px; padding: 5px 7px; gap: 4px; }
  .brand img { width: 27px; height: 27px; }
  .brand-menu { width: 28px; }
  .brand-copy, .brand-wordmark, .brand-edition { display: none; }
  .earth-commandbar { flex: 1; }
  .earth-search-top { flex: 1; width: auto; max-width: none; }
  .earth-search-shortcut, .earth-search-top kbd { display: none; }
  .earth-search-top input { padding-right: 12px; font-size: 12.5px; }
  .hud-actions { display: none; }
  .earth-search-results {
    position: absolute; z-index: 92; top: calc(100% + 8px); right: 0; left: -88px;
    max-height: min(62dvh, 480px);
    background: #071927;
  }
  .earth-search-result { min-height: 54px; }
  .earth-search-result b {
    display: -webkit-box;
    overflow: hidden;
    white-space: normal;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  body.earth-search-open .earth-data-cockpit, body.earth-search-open .earth-view-options, body.earth-search-open .earth-camera-cockpit, body.earth-search-open .earth-timebar { opacity: 0; pointer-events: none; }

  .earth-panel { top: auto; right: 0; bottom: 0; left: 0; width: auto; max-height: 76dvh; border-right: 0; border-bottom: 0; border-left: 0; border-radius: 23px 23px 0 0; transform: translateY(34px) scale(.99); transform-origin: center bottom; }
  .earth-panel::after { content: ""; position: absolute; z-index: 3; top: 6px; left: 50%; width: 42px; height: 4px; border-radius: 999px; background: var(--earth-line-strong); transform: translateX(-50%); }
  .earth-panel.open { transform: none; }
  .earth-panel-head { padding-top: 18px; }
  .earth-panel > .body { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  body.earth-menu-open .earth-data-cockpit, body.earth-menu-open .earth-view-options, body.earth-menu-open .earth-camera-cockpit, body.earth-menu-open .earth-timebar, body.earth-menu-open .timeline { opacity: 0; pointer-events: none; }

  .earth-data-cockpit { top: 68px; right: 8px; width: 204px; border-radius: 16px; }
  .data-cockpit-head { min-height: 42px; padding: 6px 7px 5px 10px; }
  .data-cockpit-copy small, .data-cockpit-heading small { display: none; }
  .data-cockpit-copy b, .data-cockpit-heading b { font-size: 10.5px; }
  #cockpit-update { display: none; }
  #cockpit-toggle { width: 30px; height: 30px; }
  .data-cockpit-body { padding: 7px 9px 9px; }
  .earth-data-cockpit label { display: none; }
  .data-cockpit-field-head { min-height: 0; justify-content: flex-end; margin: 0 0 4px; }
  #parameter-help { width: 26px; height: 26px; }
  .earth-data-cockpit select { height: 40px; font-size: 11.5px; }
  .cockpit-stats, .cockpit-coverage { display: none; }
  .earth-data-cockpit.is-collapsed { width: 162px; }

  .earth-camera-cockpit { top: auto; right: 8px; bottom: 82px; width: auto; flex-direction: row; gap: 3px; padding: 5px; border-radius: 15px; }
  .camera-mode-label, .camera-readout, #camera-north { display: none; }
  #camera-orbit, #camera-zoom-in, #camera-zoom-out, .camera-divider { display: none; }
  .earth-camera-cockpit button { width: 40px; height: 40px; }
  .earth-view-options { top: auto; right: 8px; bottom: 142px; }
  .earth-view-options > button { width: 46px; height: 46px; border-radius: 15px; }
  .earth-view-options > section { position: fixed; top: auto; right: 8px; bottom: 196px; left: 8px; width: auto; max-height: 54dvh; border-radius: 18px; }
  body.earth-view-open .earth-data-cockpit,
  body.earth-view-open .earth-camera-cockpit,
  body.earth-view-open .earth-timebar,
  body.earth-view-open .timeline,
  body.earth-view-open .hud-bottom,
  body.earth-view-open .wslam-panel { opacity: 0; pointer-events: none; }

  .earth-timebar, .timeline { right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); left: 8px; width: auto; min-width: 0; min-height: 66px; transform: none; gap: 7px; padding: 8px; border-radius: 17px; }
  body:has(#timeline:not([hidden])) .earth-timebar { transform: translateY(10px); }
  .earth-time-play, .tl-play, .earth-time-now { min-width: 40px; width: 40px; height: 40px; }
  .earth-time-now { font-size: 9px; }
  .earth-time-head { margin-bottom: 1px; }
  .earth-time-scale { font-size: 7px; }
  .hud-bottom { z-index: 34; right: auto; bottom: 82px; left: 8px; width: min(250px, calc(100vw - 122px)); }
  .readout { display: none; }
  .legend { display: grid; min-height: 36px; padding: 6px 9px; }
  .legend-title { max-width: 74px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .hint { display: none; }

  .station-drawer { top: auto; right: 0; bottom: 0; left: 0; width: auto; max-height: min(76dvh, calc(100dvh - 8px)); padding: 18px 15px max(18px, env(safe-area-inset-bottom)); border-right: 0; border-bottom: 0; border-left: 0; border-radius: 23px 23px 0 0; transform: translateY(34px) scale(.99); transform-origin: center bottom; }
  .station-drawer::after { content: ""; position: absolute; top: 6px; left: 50%; width: 42px; height: 4px; border-radius: 999px; background: var(--earth-line-strong); transform: translateX(-50%); }
  .station-drawer.open { transform: translateY(0) scale(1); }
  .station-drawer-close { top: 0; }
  .station-actions { position: static; bottom: auto; margin: 12px 0 0; padding: 0; background: none; }
  .wslam-panel { right: 62px; bottom: 142px; left: 8px; max-width: none; transform: none; flex-wrap: wrap; }
  .wslam-range { flex: 1; width: auto; min-width: 120px; }
  .wslam-lbl { width: 100%; }
  .maplibregl-ctrl-attrib { max-width: 60vw; opacity: .55; }
}

@media (max-width: 520px) {
  .earth-search-icon { left: 12px; }
  .earth-search-top input { padding-left: 38px; }
  .earth-data-cockpit { width: 190px; }
  .data-cockpit-status { gap: 7px; }
  .live-pulse { width: 7px; height: 7px; }
  .earth-menu-tools { grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: visible; }
  .earth-menu-tools button { min-width: 0; height: 48px; }
  .earth-menu-tools button span { overflow: visible; font-size: 8px; line-height: 1.1; text-align: center; white-space: normal; text-overflow: clip; }
  .earth-panel-head-actions { gap: 5px; }
  .panel-close, .panel-collapse { width: 38px; height: 38px; }
  .earth-camera-cockpit #camera-flat { display: grid; }
  .hud-bottom { bottom: 83px; width: calc(100vw - 162px); max-width: none; }
  .station-value { font-size: 35px; }
}

@media (max-width: 360px) {
  .brand { width: 66px; min-width: 66px; }
  .brand img { display: none; }
  .earth-data-cockpit { width: 176px; }
  .earth-data-cockpit.is-collapsed { width: 150px; }
  .earth-search-results { left: -74px; }
  .earth-camera-cockpit button { width: 38px; height: 38px; }
  #camera-zoom-in, #camera-zoom-out { display: none; }
  .legend-title { display: none; }
  .hud-bottom { width: calc(100vw - 156px); }
  .legend-bar { min-width: 56px; }
  .station-detail-grid > div { min-height: 56px; }
}

@media (prefers-contrast: more) {
  :root { --earth-line: rgba(205,238,252,.36); --earth-line-strong: rgba(224,246,255,.62); --earth-text-soft: #c9dce7; --earth-text-dim: #adc4d1; }
  .earth-layer-toggle, .wsv2-toggle { color: var(--earth-text); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
