:root {
    --bg: #f4f7f4;
    --surface: #ffffff;
    --surface-soft: #eef4f7;
    --text: #172022;
    --muted: #607076;
    --line: #d6e0df;
    --accent: #0f8a8a;
    --accent-dark: #096567;
    --rain: #256f9c;
    --sun: #d99022;
    --shadow: 0 16px 40px rgba(25, 40, 44, .12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

a {
    color: inherit;
}

.forecast-shell {
    min-height: 100vh;
}

.forecast-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px clamp(16px, 3vw, 38px);
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .94);
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: block;
    flex: 0 0 42px;
}

.brand strong,
.brand small {
    display: block;
}

.brand small {
    margin-top: 2px;
    color: var(--muted);
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.top-actions a,
.zone-link,
button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    padding: 0 13px;
    color: #fff;
    background: var(--accent);
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.top-actions a {
    color: var(--accent-dark);
    background: #fff;
    border: 1px solid var(--line);
}

.forecast-layout {
    display: grid;
    grid-template-columns: minmax(340px, .9fr) minmax(460px, 1.1fr);
    grid-template-areas:
        "hero map"
        "forecast forecast";
    gap: 18px;
    padding: 18px;
}

.hero-panel,
.map-panel,
.forecast-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.hero-panel {
    grid-area: hero;
    padding: clamp(18px, 3vw, 28px);
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--accent-dark);
    font-size: .78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.hero-copy h1 {
    margin: 0 0 12px;
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: .95;
}

.hero-copy p:not(.eyebrow) {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.location-tools {
    margin-top: 22px;
    display: grid;
    gap: 12px;
}

.location-tools label {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.search-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

input {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    color: var(--text);
    background: #fff;
    font: inherit;
}

.zone-link {
    color: var(--accent-dark);
    background: var(--surface-soft);
    border: 1px solid var(--line);
}

.current-strip {
    margin-top: 20px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f9fbfb;
}

.current-icon,
.mini-icon {
    color: var(--sun);
}

.current-icon svg {
    width: 58px;
    height: 58px;
}

.current-place,
.current-strip strong,
.current-strip small {
    display: block;
}

.current-place {
    color: var(--muted);
    font-size: .85rem;
}

.current-strip strong {
    margin-top: 2px;
    font-size: 1.2rem;
}

.current-strip small {
    margin-top: 4px;
    color: var(--muted);
}

.current-strip dl {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 0;
}

.current-strip dl div,
.forecast-selected dl div {
    padding: 10px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--line);
}

dt {
    color: var(--muted);
    font-size: .74rem;
    font-weight: 900;
    text-transform: uppercase;
}

dd {
    margin: 4px 0 0;
    font-weight: 900;
}

.map-panel {
    grid-area: map;
    min-height: 530px;
    overflow: hidden;
}

#italyMap {
    width: 100%;
    height: 100%;
    min-height: 530px;
}

.forecast-panel {
    grid-area: forecast;
    padding: clamp(16px, 2vw, 24px);
}

.section-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.section-head h2 {
    margin: 0;
    font-size: 1.7rem;
}

.section-head p,
.section-head span {
    margin: 5px 0 0;
    color: var(--muted);
}

.forecast-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.forecast-controls > span,
.forecast-selected > span {
    color: var(--muted);
    font-weight: 900;
    text-transform: uppercase;
    font-size: .78rem;
}

.scale-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.scale-button {
    min-height: 34px;
    padding: 0 10px;
    color: var(--accent-dark);
    background: #fff;
    border: 1px solid var(--line);
    font-size: .82rem;
}

.scale-button[aria-pressed="true"] {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}

.forecast-chart-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 14px;
    align-items: stretch;
}

#forecastChart {
    width: 100%;
    height: 320px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f9fbfb;
}

.privacy-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(23, 32, 34, .46);
}

.privacy-modal[hidden] {
    display: none;
}

.privacy-dialog {
    width: min(520px, 100%);
    padding: 22px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    box-shadow: var(--shadow);
}

.privacy-dialog h2 {
    margin: 0 0 12px;
}

.privacy-dialog p {
    color: var(--muted);
    line-height: 1.5;
}

.privacy-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.secondary-button {
    color: var(--accent-dark);
    background: var(--surface-soft);
    border: 1px solid var(--line);
}

.forecast-selected {
    min-height: 320px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f9fbfb;
}

.mini-icon svg {
    width: 36px;
    height: 36px;
}

.forecast-selected > strong {
    display: block;
    min-height: 48px;
    margin: 12px 0;
    font-size: 1.2rem;
}

.forecast-selected dl {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 0;
}

.map-weather-marker {
    min-width: 90px;
    padding: 8px 10px;
    border-radius: 8px;
    color: #172022;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: 0 8px 22px rgba(25, 40, 44, .18);
    font-size: 12px;
    font-weight: 900;
}

@media (max-width: 980px) {
    .forecast-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "hero"
            "map"
            "forecast";
    }

    .forecast-chart-wrap {
        grid-template-columns: 1fr;
    }

    .forecast-controls {
        justify-content: flex-start;
    }

    .scale-buttons {
        justify-content: flex-start;
    }
}

@media (max-width: 620px) {
    body {
        overflow-x: hidden;
    }

    .forecast-topbar,
    .section-head {
        display: grid;
    }

    .forecast-topbar {
        padding: 12px;
    }

    .brand {
        min-width: 0;
    }

    .brand small {
        display: none;
    }

    .top-actions {
        justify-content: stretch;
    }

    .top-actions a {
        flex: 1 1 auto;
        font-size: .82rem;
        padding: 0 9px;
    }

    .forecast-layout {
        padding: 10px;
        gap: 10px;
    }

    .hero-copy h1 {
        font-size: 2.15rem;
    }

    .current-strip dl {
        grid-template-columns: 1fr;
    }

    .search-row {
        grid-template-columns: 1fr;
    }

    .map-panel,
    #italyMap {
        min-height: 360px;
    }

    .forecast-panel {
        padding: 12px;
    }

    .scale-buttons {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        width: 100%;
    }

    .scale-button {
        min-width: 0;
        padding: 0 4px;
        font-size: .72rem;
    }

    #forecastChart {
        height: 280px;
    }

    .forecast-selected {
        min-height: 0;
    }

    .forecast-selected dl {
        grid-template-columns: repeat(3, 1fr);
    }

    .forecast-selected dl div {
        padding: 8px;
    }

    .privacy-actions {
        display: grid;
    }
}
