:root {
  --ink: #f7f8f3;
  --muted: rgba(247, 248, 243, .66);
  --line: rgba(247, 248, 243, .16);
  --panel: rgba(14, 25, 29, .73);
  --panel-strong: rgba(9, 19, 22, .87);
  --accent: #f5bd4f;
  --weather-bg: linear-gradient(160deg, #2f6fa0, #74bdee);
  font-family: 'DM Sans', sans-serif;
  color: var(--ink);
  background: #0d1d21;
}

* { box-sizing: border-box; }
body { position: relative; margin: 0; min-width: 320px; background: #0d1d21; color: var(--ink); }
#site-update { position: absolute; top: 18px; right: 20px; z-index: 2; margin: 0; border: 1px solid transparent; border-radius: 8px; padding: 4px 8px; color: var(--ink); background: transparent; font: .78rem 'DM Sans', sans-serif; cursor: pointer; }
#site-update:hover { border-color: var(--line); color: var(--accent); }
.weather-backdrop { position: fixed; inset: 0; z-index: 0; background-image: linear-gradient(180deg, rgba(6, 14, 16, .22), rgba(6, 14, 16, .36)), var(--weather-bg); background-position: center; background-size: cover; background-repeat: no-repeat; transition: background-image 800ms ease; pointer-events: none; }
body::after { content: ''; position: fixed; inset: 0; z-index: 0; background: linear-gradient(180deg, rgba(6, 14, 16, .05), rgba(6, 14, 16, .42)); pointer-events: none; }
button { font: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: 'Space Grotesk', sans-serif; letter-spacing: 0; }
h1 { font-size: clamp(2.3rem, 7vw, 5.6rem); line-height: .92; margin-bottom: 16px; }
h1 em { color: var(--accent); font-style: normal; }
h2 { font-size: 1.3rem; margin-bottom: 18px; }
h3 { font-size: 1rem; }

#zone-gate, #site-content { position: relative; z-index: 1; width: min(1180px, calc(100% - 40px)); margin: auto; }
#zone-gate { min-height: 100vh; padding: 80px 0; display: grid; align-content: center; grid-template-columns: 1fr 1fr; gap: 70px; align-items: center; }
.gate-tools { display: grid; gap: 10px; max-width: 430px; }
.gate-tools label { color: var(--muted); font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.gate-tools select { width: 100%; min-height: 58px; padding: 0 18px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--panel-strong); font: 1rem 'DM Sans', sans-serif; cursor: pointer; }
.gate-tools select:focus { outline: 2px solid var(--accent); outline-offset: 3px; }
.gate-copy p { max-width: 360px; font-size: 1.1rem; color: var(--muted); line-height: 1.5; }
.eyebrow, .section-kicker { display: block; color: var(--accent); font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.warn { color: #ffb5a7; }
#site-header { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding: 65px 0 34px; animation: reveal 700ms ease both; }
#site-header h1 { font-size: clamp(2.2rem, 5vw, 4.7rem); margin: 9px 0 4px; }
.scene-label { color: var(--muted); text-transform: capitalize; }
.header-meta { text-align: right; color: var(--muted); font-size: .78rem; }
.live-clock { display: flex; justify-content: flex-end; align-items: center; gap: 7px; color: var(--ink); font-size: 1.35rem; font-family: 'Space Grotesk', sans-serif; }
.live-clock small { margin-left: 3px; color: var(--muted); font: .7rem 'DM Sans', sans-serif; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #7ee2a8; box-shadow: 0 0 0 5px rgba(126, 226, 168, .15); }
#change-zone-btn { border: 0; border-bottom: 1px solid var(--accent); padding: 0 0 3px; color: var(--accent); background: transparent; cursor: pointer; }

.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.card { min-width: 0; padding: 27px; border: 1px solid var(--line); border-radius: 26px; background: var(--panel); backdrop-filter: blur(14px); animation: reveal 650ms ease both; }
.card:nth-child(2) { animation-delay: 70ms; } .card:nth-child(3) { animation-delay: 140ms; } .card:nth-child(4) { animation-delay: 210ms; }
.wide-card { grid-column: 1 / -1; }
.current-card { background: var(--panel-strong); }
.current-grid { display: grid; grid-template-columns: minmax(150px, 180px) minmax(0, 1fr); align-items: center; gap: 28px; }
.temperature-block { min-width: 0; }
.weather-symbol { line-height: 1; margin: 10px 0 2px; display: flex; }
.weather-symbol .wx-icon { width: 4.8rem; height: 4.8rem; }
.temp-big { margin: 0; font: 600 clamp(3.6rem, 8vw, 6.5rem)/.9 'Space Grotesk', sans-serif; }
.temp-big.long-temp { font-size: clamp(2.7rem, 6.2vw, 4.9rem); }
.condition-name { color: var(--muted); text-transform: capitalize; }
.current-details { color: var(--muted); line-height: 1.7; }
.current-details strong { color: var(--ink); }
.status-key { display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; line-height: 1.2; }
.status-key small { display: block; margin-top: 4px; color: var(--muted); font-size: .72rem; }
.status-dot { width: 11px; height: 11px; flex: 0 0 11px; margin-top: 5px; border-radius: 50%; background: #7ee2a8; box-shadow: 0 0 0 5px rgba(126, 226, 168, .12); }
.status-dot.gialla { background: #f4d35e; box-shadow: 0 0 0 5px rgba(244, 211, 94, .12); } .status-dot.arancione { background: #f58c42; box-shadow: 0 0 0 5px rgba(245, 140, 66, .12); } .status-dot.rossa, .status-dot.score { background: #ef665b; box-shadow: 0 0 0 5px rgba(239, 102, 91, .12); }
.status-dot.unknown { background: #aab7b6; box-shadow: 0 0 0 5px rgba(170, 183, 182, .12); }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; }
.muted { color: var(--muted); font-size: .83rem; line-height: 1.5; }
.hourly-scroll { display: flex; gap: 9px; overflow-x: auto; padding: 3px 2px 10px; scrollbar-color: var(--accent) transparent; }
.hour-card { min-width: 148px; padding: 14px 12px; display: grid; gap: 8px; border-left: 1px solid var(--line); color: var(--muted); font-size: .75rem; }
.hour-card strong, .hour-card b { color: var(--ink); } .hour-icon { display: block; } .hour-icon .wx-icon { width: 1.8rem; height: 1.8rem; } .hour-card small { white-space: nowrap; }
.hour-card .hour-condition { white-space: normal; overflow-wrap: break-word; line-height: 1.3; }
.day-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 10px; }
.day-tab, .mode-tab, .risk-tab { border: 1px solid var(--line); border-radius: 14px; padding: 9px 16px; color: var(--muted); background: transparent; cursor: pointer; }
.day-tab.active, .day-tab:hover, .mode-tab.active, .mode-tab:hover, .risk-tab.active, .risk-tab:hover { border-color: var(--accent); color: #102023; background: var(--accent); }
.day-panel, .risk-day-panel { display: none; }
.day-panel.active, .risk-day-panel.active { display: block; animation: reveal 300ms ease both; }
.day-date { margin: 0 0 10px; color: var(--muted); font-size: .8rem; }
.day-panel h3 { margin: 26px 0 12px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 1.5rem; font-weight: 600; }
.day-panel h3:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.tendency-note { margin: 0 0 14px; padding: 10px 14px; border: 1px dashed var(--line); border-radius: 12px; background: rgba(245, 189, 79, .08); }
.risk-list { display: grid; gap: 3px; margin-bottom: 20px; }
.risk-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.risk-level { padding: 4px 9px; border-radius: 99px; font-size: .7rem; text-transform: uppercase; } .risk-level.basso { background: rgba(126, 226, 168, .17); color: #a8efc1; } .risk-level.medio { background: rgba(244, 211, 94, .18); color: #ffe58a; } .risk-level.alto, .risk-level.estremo { background: rgba(239, 102, 91, .2); color: #ffaaa1; }
.safe-message { color: #a8efc1; }
.card ul { padding-left: 20px; color: var(--muted); line-height: 1.7; }
table { width: 100%; border-collapse: collapse; font-size: .8rem; } td { padding: 8px; border-bottom: 1px solid var(--line); } td:last-child { color: var(--accent); text-align: right; }
footer { padding: 25px 0 45px; } .disclaimer { color: var(--muted); font-size: .72rem; }

.mode-tabs, .risk-day-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.chart-block { margin-bottom: 30px; } .chart-block:last-child { margin-bottom: 0; }
.chart-block h4 { margin: 0 0 4px; font-size: .9rem; color: var(--ink); } .chart-block .chart-meta { display: block; margin-bottom: 8px; }
.chart-svg { width: 100%; height: auto; aspect-ratio: 920 / 260; display: block; overflow: visible; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: rgba(245, 189, 79, .14); stroke: none; }
.chart-bar { fill: var(--accent); opacity: .82; }
.chart-dot { fill: var(--accent); }
.chart-grid-line { stroke: var(--line); stroke-width: 1; }
.chart-axis-label { fill: var(--muted); font-size: 12px; font-family: 'DM Sans', sans-serif; }
.chart-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.highlights-list { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 2px; }
.highlights-list li { display: flex; gap: 14px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); }
.highlights-list time { flex: 0 0 52px; color: var(--accent); font-family: 'Space Grotesk', sans-serif; font-weight: 600; }
.ai-text { line-height: 1.6; color: var(--ink); margin-bottom: 18px; }
.insights-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 10px; }
.insights-list li { padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; color: var(--muted); line-height: 1.5; } .insights-list strong { color: var(--ink); }
.icon-veil { opacity: .78; filter: saturate(.75); }
#radar-map { height: 420px; border: 1px solid var(--line); border-radius: 22px; overflow: hidden; margin: 4px 0 10px; filter: saturate(.85); }
.radar-legend { margin: 0; }
.lightning-dot { border-radius: 50%; box-shadow: 0 0 6px 2px rgba(255, 200, 80, .5); }
@keyframes reveal { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 760px) { #site-update { top: 12px; right: 14px; max-width: calc(100% - 28px); text-align: right; } #zone-gate, #site-content { width: min(100% - 28px, 600px); } #zone-gate { grid-template-columns: 1fr; gap: 38px; padding: 55px 0; } #site-header { align-items: flex-start; flex-direction: column; padding-top: 38px; } .header-meta { width: 100%; text-align: left; } .live-clock { justify-content: flex-start; } .dashboard-grid { grid-template-columns: 1fr; } .wide-card { grid-column: auto; } .current-grid { grid-template-columns: minmax(100px, .8fr) minmax(0, 1.2fr); gap: 12px; } .weather-symbol .wx-icon { width: 3.2rem; height: 3.2rem; } .temp-big { font-size: 3.5rem; } .card { padding: 21px; } .day-tab { flex: 1 1 calc(50% - 4px); min-width: 0; padding-inline: 10px; } }
.modal-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(6,14,16,.75); align-items: center; justify-content: center; padding: 20px; display: flex; }
.modal-overlay[hidden] { display: none; }
.modal-box { width: min(480px, 100%); max-height: 82vh; overflow-y: auto; background: var(--panel-strong); border: 1px solid var(--line); border-radius: 20px; padding: 22px; box-shadow: 0 30px 60px rgba(0,0,0,.4); }
.alert-toast { position: fixed; right: 20px; bottom: 20px; z-index: 60; width: min(360px, calc(100% - 40px)); background: var(--panel-strong); border: 1px solid var(--line); border-left: 4px solid #f58c42; border-radius: 16px; padding: 16px 18px; box-shadow: 0 20px 40px rgba(0,0,0,.35); animation: reveal 400ms ease both; }
.alert-toast.gialla { border-left-color: #f4d35e; }
.alert-toast.arancione { border-left-color: #f58c42; }
.alert-toast.rossa { border-left-color: #ef665b; }
.alert-toast[hidden] { display: none; }
.alert-toast .modal-header { margin-bottom: 8px; }
.alert-toast .modal-header h3 { font-size: .95rem; }
.alert-toast .modal-body { font-size: .85rem; line-height: 1.5; }
@media (max-width: 760px) { .alert-toast { right: 10px; bottom: 10px; left: 10px; width: auto; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.modal-header h3 { margin: 0; font-size: 1.05rem; }
.modal-close { background: transparent; border: 1px solid var(--line); border-radius: 10px; width: 30px; height: 30px; color: var(--muted); font-size: 1rem; cursor: pointer; }
.modal-close:hover { color: var(--ink); border-color: var(--accent); }
.modal-body table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.modal-body td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
.modal-body td:first-child { color: var(--muted); }
.modal-body td:last-child { text-align: right; color: var(--ink); font-weight: 600; }
.hour-detail-btn { grid-column: 1 / -1; margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 4px 8px; font-size: .68rem; color: var(--accent); background: transparent; cursor: pointer; }
.hour-detail-btn:hover { background: var(--accent); color: #102023; }