:root {
    --bg-image: url('../img/waldspaziergang.JPEG');
    /* --bg-image: url('../img/background_summer.png'); */
    /* --bg-image: url('../img/background_winter2.jpg'); */
    /* --bg-image: url('../img/background_fall.png'); */

    --text: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.68);
    --text-faint: rgba(255, 255, 255, 0.45);
    /* Großer Block: leicht getönt, damit die Schrift auch vor den hellen
       Stellen im Bild lesbar ist; das Bild bleibt sichtbar */
    --glass: rgba(10, 23, 16, 0.3);
    --glass-strong: rgba(10, 23, 16, 0.3);
    --glass-border: rgba(255, 255, 255, 0.14);
    /* Lichtkante oben statt eines Verlaufs */
    --glass-edge: inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    --accent: #7dd3a8;
    --tint-h: 212;
    --tint-a: 0;
    --header-height: 64px;
    --cold: #8ec5ff;
    --warm: #ffb27a;
    --radius: 24px;
    --radius-sm: 14px;
    --shadow: none;
    --popup-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);

    /* Flächen und Linien auf den Karten; kleine Kacheln als dunkles Milchglas */
    --surface: rgba(12, 20, 16, 0.45);
    --surface-hover: rgba(12, 20, 16, 0.6);
    --control: rgba(255, 255, 255, 0.07);
    --control-hover: rgba(255, 255, 255, 0.12);
    --line: rgba(255, 255, 255, 0.08);
    --divider: rgba(255, 255, 255, 0.16);
    --text-off: rgba(255, 255, 255, 0.22);
    --panel: #17221d;
    --header-bg: rgba(10, 16, 13, 0.55);
    --menu-bg: rgba(14, 22, 18, 0.96);
    /* Hauptbuttons und aktuelle Seite in der Navigation, einfarbig ohne Verlauf */
    --primary-bg: #ffffff;
    --primary-text: #0b1f17;
    --amber: #fcd34d;
    --rain: #93c5fd;
    --danger: #f87171;

    /* Diagrammfarben, gelesen von chartColor() in js/ui.js */
    --chart-text: rgba(255, 255, 255, 0.6);
    --chart-grid: rgba(255, 255, 255, 0.08);
    --chart-line: rgba(255, 255, 255, 0.9);
    --chart-label: #ffffff;
    --chart-fill: rgba(255, 255, 255, 0.28);
    --chart-fill-end: rgba(255, 255, 255, 0);
    --chart-band: rgba(255, 255, 255, 0.07);
    --chart-range: rgba(255, 255, 255, 0.14);
    --chart-previous: rgba(255, 255, 255, 0.55);
    --chart-warm: #ffb27a;
    --chart-warm-fill: rgba(255, 178, 122, 0.3);
    --chart-warm-fill-end: rgba(255, 178, 122, 0);
    --chart-warm-soft: rgba(255, 178, 122, 0.5);
    --chart-cold-soft: rgba(142, 197, 255, 0.5);
    --chart-accent: #7dd3a8;
    --chart-rain: rgba(96, 165, 250, 0.45);
    --chart-gap: rgba(251, 191, 36, 0.14);
    --chart-pressure: #c4b5fd;
}

/* Tagsüber helles Design (Klasse setzen main.php und renderSky() in js/ui.js) */
:root.theme-light {
    /* Kräftiger als üblich, die Schrift steht direkt auf dem Bild */
    --text: #0a1710;
    --text-muted: rgba(10, 23, 16, 0.86);
    --text-faint: rgba(10, 23, 16, 0.74);
    --glass-border: rgba(255, 255, 255, 0.65);
    --glass-edge: inset 0 1px 0 rgba(255, 255, 255, 0.8), inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 8px 32px rgba(20, 45, 32, 0.08);
    --accent: #15804f;
    --cold: #2b6cb0;
    --warm: #c2560f;
    --popup-shadow: 0 8px 24px rgba(20, 45, 32, 0.14);

    --surface: rgba(255, 255, 255, 0.45);
    --surface-hover: rgba(255, 255, 255, 0.65);
    --control: rgba(18, 36, 27, 0.06);
    --control-hover: rgba(18, 36, 27, 0.11);
    --line: rgba(18, 36, 27, 0.1);
    --divider: rgba(18, 36, 27, 0.16);
    --text-off: rgba(18, 36, 27, 0.25);
    --panel: #f7faf8;
    --header-bg: rgba(255, 255, 255, 0.72);
    --menu-bg: rgba(255, 255, 255, 0.97);
    --primary-bg: #173f2c;
    --primary-text: #ffffff;
    --amber: #a16207;
    --rain: #1d64d8;
    --danger: #dc2626;

    /* Diagramme liegen auf dem Foto, sie behalten die hellen Farben aus :root */

    color-scheme: light;
}

*{
    box-sizing: border-box;
    margin:0;
    padding:0;
}

/* Abschneiden statt horizontal scrollen. "clip" (statt "hidden") macht den body
   nicht zum eigenen Scroll-Container, sonst greift Pull-to-Refresh am Handy
   nicht mehr. */
body {
    overflow-x: clip;
    background: #0f1a14;
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Bereiche (siehe js/navigation.js): immer nur einer sichtbar */
.page[hidden] {
    display: none;
}

/* ---------- Hintergrund ---------- */

/* Das Original hat 24 Megapixel (rund 100 MB im Speicher), das bremst am Handy
   jedes Scrollen */
@media (pointer: coarse) {
    :root {
        --bg-image: url('../img/waldspaziergang-mobile.jpg');
    }
}

/* Fest hinter allen Bereichen, damit das Bild beim Scrollen stehen bleibt.
   Feste Höhe (größte Fensterhöhe, lvh) statt inset: 0: Am Handy blendet sich
   beim Scrollen die Adressleiste ein und aus, mit "bottom: 0" würde sich die
   Fläche mitändern und das Bild (cover) jedes Mal neu skaliert. */
.app-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    height: 100lvh;
    /* Firefox am Handy ändert lvh trotzdem mit der Adressleiste, dort setzt
       js/ui.js eine feste Höhe in Pixeln */
    height: var(--bg-height, 100lvh);
    z-index: 0;
    background-image: var(--bg-image);
    background-size: cover;
    background-position: center;
}

.app-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(8, 14, 11, 0.3);
    transition: background 300ms ease;
}

/* Farbstich passend zur Temperatur: kalt blau, warm orange. --tint-h und
   --tint-a (Stärke 0..1) werden in js/ui.js gesetzt. */
.app-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, hsla(var(--tint-h), 85%, 55%, 0.32) 0%, hsla(var(--tint-h), 85%, 50%, 0.1) 55%, transparent 100%);
    opacity: var(--tint-a);
    transition: opacity 1.5s ease;
    pointer-events: none;
}

/* Außerhalb von "Aktuell" etwas dunkler, damit die Karten besser lesbar sind */
body:not([data-view="aktuell"]) .app-bg::before {
    background: rgba(8, 14, 11, 0.45);
}

/* Nachts dunkler und kühler */
.is-night .app-bg::before {
    background: rgba(4, 7, 20, 0.5);
}

.is-night:not([data-view="aktuell"]) .app-bg::before {
    background: rgba(4, 7, 20, 0.6);
}

.theme-light body {
    background: #e9efe9;
}

/* Hell: das Bild ohne Schleier auf allen Seiten, nur der Farbstich (::after) bleibt */
.theme-light .app-bg::before,
.theme-light body:not([data-view="aktuell"]) .app-bg::before {
    background: transparent;
}

/* Farbstich auf dem hellen Bild kräftiger, sonst geht er im Weiß unter */
.theme-light .app-bg::after {
    background: linear-gradient(180deg, hsla(var(--tint-h), 90%, 55%, 0.45) 0%, hsla(var(--tint-h), 90%, 55%, 0.22) 60%, hsla(var(--tint-h), 90%, 55%, 0.1) 100%);
}

/* Großer Block im hellen Design: Das Bild ist überwiegend dunkel (Wald),
   deshalb hier helle Schrift wie im dunklen Design; die milchigen Kacheln
   darin schalten unten wieder auf dunkle Schrift. */
.theme-light .hero,
.theme-light .card {
    --text: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.88);
    --text-faint: rgba(255, 255, 255, 0.75);
    --control: rgba(255, 255, 255, 0.14);
    --control-hover: rgba(255, 255, 255, 0.22);
    --line: rgba(255, 255, 255, 0.2);
    --divider: rgba(255, 255, 255, 0.3);
    --accent: #7dd3a8;
    --cold: #8ec5ff;
    --warm: #ffb27a;
    --amber: #fcd34d;
    --rain: #93c5fd;
    color: var(--text);
}

/* Kleine Kacheln milchig mit dunkler Schrift, der große Block darum bleibt
   durchsichtig. Ebenso die weißen Hinweise. */
.theme-light .stat,
.theme-light .record-period,
.theme-light .frost-tile,
.theme-light .forecast-day,
.theme-light .climate-tile,
.theme-light .climate-year,
.theme-light .year-switch,
.theme-light .hint {
    --text: #0a1710;
    --text-muted: rgba(10, 23, 16, 0.86);
    --text-faint: rgba(10, 23, 16, 0.74);
    --control: rgba(18, 36, 27, 0.06);
    --control-hover: rgba(18, 36, 27, 0.11);
    --line: rgba(18, 36, 27, 0.1);
    --accent: #15804f;
    --cold: #2b6cb0;
    --warm: #c2560f;
    --amber: #a16207;
    --rain: #1d64d8;
    color: var(--text);
}

/* Schrift direkt auf dem Bild kräftiger, sonst ist sie vor dem hellen Himmel
   zwischen den Stämmen kaum lesbar */
.hero,
.card,
.theme-light .hero,
.theme-light .card {
    --text-muted: rgba(255, 255, 255, 0.9);
    --text-faint: rgba(255, 255, 255, 0.8);
}

/* Kleine Kacheln in beiden Designs milchig weichgezeichnet */
.stat,
.record-period,
.frost-tile,
.forecast-day,
.climate-tile,
.climate-year,
.year-switch,
.hint {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

/* Hinweise: auf dem durchsichtigen Glas fast deckend weiß, die Art des
   Hinweises zeigen Rand und Schrift */
.theme-light .hint {
    background: rgba(255, 255, 255, 0.85);
}

.theme-light .hint--ice,
.theme-light .hint--frost {
    border-color: rgba(43, 108, 176, 0.55);
    color: #1e4f86;
}

.theme-light .hint--fog,
.theme-light .hint--snow {
    border-color: rgba(18, 36, 27, 0.35);
    color: var(--text);
}

.theme-light .hint--rain {
    border-color: rgba(29, 100, 216, 0.5);
    color: #1d4ea8;
}

.theme-light .hint--front {
    border-color: rgba(217, 119, 6, 0.6);
    color: #8a4b06;
}

.theme-light .hint--record {
    border-color: rgba(21, 128, 79, 0.55);
    color: #0f5c39;
}

.theme-light .hint--bio {
    border-color: rgba(109, 40, 217, 0.5);
    color: #5b21b6;
}

/* Das Statistik-Popup hat einen hellen Hintergrund: dort dunkle Diagrammfarben
   statt der hellen fürs Foto (gelesen von drawStatisticChart() in js/ui.js) */
.theme-light .modal-modern {
    --chart-text: rgba(18, 36, 27, 0.62);
    --chart-grid: rgba(18, 36, 27, 0.1);
    --chart-accent: #15804f;
    --chart-range: rgba(18, 36, 27, 0.12);
    --chart-pressure: #6d28d9;
}

/* Tooltips bleiben dunkel */
.theme-light .tooltip-modern {
    --text: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.68);
}

/* Mindestens so hoch wie das Fenster, längere Inhalte scrollen ganz normal.
   Oben Platz für die feste Kopfleiste. svh statt dvh: dvh ändert sich beim
   Ein- und Ausblenden der Adressleiste, die Seite würde beim Scrollen springen. */
.page-inner {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    padding: calc(var(--header-height) + clamp(12px, 3vw, 32px)) clamp(16px, 6vw, 80px) clamp(16px, 4vw, 40px);
}

/* Zentriert über margin statt justify-content: Ist der Inhalt höher als die
   Seite, bleibt er so oben erreichbar, statt abgeschnitten zu werden. */
.page-inner--center {
    align-items: center;
    gap: 24px;
}

.page-inner--center > :first-child {
    margin-top: auto;
}

.page-inner--center > :last-child {
    margin-bottom: auto;
}

/* ---------- Kopfleiste mit Navigation (templates/header.php, js/navigation.js) ---------- */

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--header-height);
    padding: 0 clamp(16px, 4vw, 40px);
    background: var(--header-bg);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 1.02rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.brand:hover {
    color: var(--text);
}

/* Gemeindewappen */
.brand-logo {
    width: auto;
    height: 38px;
}

@media only screen and (max-width: 1300px) {
    .brand-logo {
        height: 34px;
    }
}

.app-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.app-nav a {
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: background 150ms ease, color 150ms ease;
}

.app-nav a:hover {
    background: var(--control);
    color: var(--text);
}

.app-nav a[aria-current="page"] {
    background: var(--primary-bg);
    color: var(--primary-text);
}

.brand:focus-visible,
.app-nav a:focus-visible,
.location:focus-visible,
.theme-toggle:focus-visible,
.nav-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Link zur Gemeinde: nur die Pinnadel, der Name steht im Tooltip */
.location,
.theme-toggle {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: var(--control);
    color: var(--text-muted);
    text-decoration: none;
    transition: background 150ms ease, color 150ms ease;
}

.location:hover,
.theme-toggle:hover {
    background: var(--control-hover);
    color: var(--text);
}

/* Als Linien gezeichnet wie der Burger-Button, in Textfarbe statt Akzentgrün */
.location-pin {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linejoin: round;
}

/* Nur optisch ausgeblendet, Screenreader lesen den Namen weiterhin */
.location-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Burger-Button, nur am Handy sichtbar; wird beim Öffnen zum X */
/* Auswahl des Designs: Hell, Dunkel oder Automatisch (siehe js/ui.js) */
.theme-switch {
    position: relative;
    flex-shrink: 0;
}

.theme-toggle {
    padding: 0;
    cursor: pointer;
}

.theme-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.theme-icon-fill {
    fill: currentColor;
    stroke: none;
}

/* Im Button nur das Symbol der aktuellen Wahl */
.theme-toggle .theme-icon {
    display: none;
}

.theme-toggle[data-choice="hell"] .theme-icon--hell,
.theme-toggle[data-choice="dunkel"] .theme-icon--dunkel,
.theme-toggle[data-choice="auto"] .theme-icon--auto,
.theme-toggle[data-choice="weihnachten"] .theme-icon--weihnachten {
    display: block;
}

.theme-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 250px;
    padding: 6px;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    /* Deckend: Die große Temperatur dahinter schiene sonst durch den Text */
    background: #0e1612;
    box-shadow: var(--popup-shadow);
}

.theme-light .theme-menu {
    background: #fff;
}

.theme-menu[hidden] {
    display: none;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.92rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background 150ms ease;
}

.theme-option:hover {
    background: var(--control);
}

.theme-option:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.theme-option[aria-pressed="true"] {
    background: var(--control-hover);
    color: var(--accent);
}

.theme-option small {
    display: block;
    margin-top: 1px;
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 400;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    padding: 0 10px;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: var(--control);
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: var(--text);
    transition: transform 200ms ease, opacity 200ms ease;
}

.app-header.is-open .nav-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.app-header.is-open .nav-toggle span:nth-child(2) {
    opacity: 0;
}

.app-header.is-open .nav-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media only screen and (max-width: 1300px) {
    :root {
        --header-height: 56px;
    }

    .app-header {
        gap: 8px;
    }

    .nav-toggle {
        display: flex;
    }

    /* Menü klappt unter der Kopfleiste auf */
    .app-nav {
        position: fixed;
        top: calc(var(--header-height) + 6px);
        left: 8px;
        right: 8px;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: 8px;
        border: 1px solid var(--glass-border);
        border-radius: 18px;
        background: var(--menu-bg);
        box-shadow: var(--popup-shadow);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        transition: opacity 160ms ease, transform 160ms ease, visibility 0s linear 160ms;
    }

    .app-header.is-open .app-nav {
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: opacity 160ms ease, transform 160ms ease;
    }

    .app-nav a {
        padding: 14px 16px;
        border-radius: 12px;
        font-size: 1rem;
    }
}

/* Aktuelles Wetter in der Kopfleiste (Symbol, Temperatur, auf breiten Bildschirmen
   auch der Text); führt zur Vorhersage */
.header-weather {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-left: 14px;
    border-left: 1px solid var(--divider);
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.header-weather[hidden],
.header-weather-icon[hidden] {
    display: none;
}

.header-weather:hover {
    color: var(--text);
}

.header-weather:hover .header-weather-text {
    color: var(--text);
}

.header-weather:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.header-weather-icon {
    width: 30px;
    height: 30px;
}

.header-weather-temp {
    font-size: 1.1rem;
    font-weight: 600;
}

.header-weather-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

@media only screen and (max-width: 1500px) {
    .header-weather-text {
        display: none;
    }
}

/* Uhrzeit und Datum in der Kopfleiste, durch einen Strich vom Wetter getrennt */
.header-clock {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-right: auto;
    padding-left: 14px;
    border-left: 1px solid var(--divider);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.header-time {
    font-size: 1.1rem;
    font-weight: 600;
}

.header-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.header-date--short {
    display: none;
}

/* Zu wenig Platz für den vollen Wochentag neben allen Menüpunkten */
@media only screen and (max-width: 1500px) {
    .header-date--long {
        display: none;
    }

    .header-date--short {
        display: inline;
    }
}

/* Am Handy nur das Symbol als Logo, damit Uhrzeit, Pinnadel und Menü Platz haben */
@media only screen and (max-width: 560px) {
    .brand-name {
        display: none;
    }

    .header-weather,
    .header-clock {
        gap: 6px;
        padding-left: 10px;
    }

    .header-weather-icon {
        width: 26px;
        height: 26px;
    }

    .header-weather-temp,
    .header-time {
        font-size: 1.05rem;
    }

    .header-date {
        font-size: 0.8rem;
    }
}

/* Sehr schmale Handys: Wetter und Uhrzeit haben Vorrang vor dem Datum */
@media only screen and (max-width: 440px) {
    .header-date--short {
        display: none;
    }
}

/* ---------- Aktuelle Werte ---------- */

.hero {
    margin: auto;
    width: min(100%, 680px);
    padding: clamp(24px, 5vw, 40px);
    border-radius: var(--radius);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    box-shadow: var(--glass-edge);
    text-align: center;
    animation: fade-up 600ms ease both;
}

.hints {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.hints:not(:empty) {
    margin-bottom: 14px;
}

.hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(12, 20, 16, 0.7);
    cursor: help;
}



.hint--ice {
    border: 1px solid rgba(142, 197, 255, 0.4);
    color: #b9dcff;
}

.hint--frost {
    border: 1px solid rgba(142, 197, 255, 0.25);
    color: var(--cold);
}

.hint--fog {
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #e5e7eb;
}

.hint--snow {
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
}

.hint--rain {
    border: 1px solid rgba(96, 165, 250, 0.3);
    color: #bfdbfe;
}

.hint--front {
    border: 1px solid rgba(251, 191, 36, 0.4);
    color: #fcd34d;
}

.hint--record {
    border: 1px solid rgba(125, 211, 168, 0.4);
    color: var(--accent);
}

.hint--bio {
    border: 1px solid rgba(196, 181, 253, 0.45);
    color: #ddd6fe;
}

.temperature-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px 18px;
    flex-wrap: wrap;
}

.trend {
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    column-gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--control);
    text-align: left;
    cursor: help;
}

.trend[hidden] {
    display: none;
}

.trend-arrow {
    grid-row: span 2;
    font-size: 1.8rem;
    line-height: 1;
}

.trend-value {
    font-size: 1.05rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.trend-label {
    font-size: 0.7rem;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.trend--up .trend-arrow {
    color: var(--warm);
}

.trend--down .trend-arrow {
    color: var(--cold);
}

.trend--steady .trend-arrow {
    color: var(--text-muted);
}

.compare {
    min-height: 1.2em;
    margin-top: 2px;
    font-size: 0.9rem;
    color: var(--text);
}

/* Rekorde: heute bisher im Vergleich zum Durchschnitt, nur wenn Vorjahresdaten
   vorhanden sind */
.today-normal {
    color: var(--text);
    font-weight: 600;
    cursor: help;
}

.today-normal:empty {
    display: none;
}

/* Prognose der Station: etwas abgesetzt und kräftiger als die Vergleiche */
.compare--prognosis {
    margin-top: 6px;
    font-weight: 600;
    cursor: help;
}

.sparkline {
    margin-top: 18px;
}

.sparkline-chart {
    position: relative;
    height: 64px;
}

.sparkline-caption {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
    font-size: 0.72rem;
    color: var(--text-faint);
}

.sparkline-gaps {
    color: var(--amber);
    cursor: help;
}

.sky {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px 22px;
    margin-top: 18px;
    font-size: 0.88rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.sky-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sky-item svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: var(--amber);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sky-moon {
    font-size: 1rem;
    line-height: 1;
}

.temperature {
    font-size: clamp(4.5rem, 20vw, 9rem);
    font-weight: 200;
    line-height: 1;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
}

.temperature-unit {
    font-size: 0.35em;
    font-weight: 300;
    vertical-align: 0.95em;
    margin-left: 4px;
    color: var(--text-muted);
    letter-spacing: 0;
}

.updated {
    min-height: 1.2em;
    margin-top: 6px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: clamp(16px, 3vw, 24px);
}

.stat {
    padding: 14px 12px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--line);
    text-align: left;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    overflow-wrap: break-word;
    hyphens: auto;
    -webkit-hyphens: auto;
}

.stat-value {
    margin-top: 4px;
    font-size: clamp(1.15rem, 3.5vw, 1.5rem);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.stat-value--cold {
    color: var(--cold);
}

.stat-value--warm {
    color: var(--warm);
}

/* Prognose als Text statt Zahl, darf umbrechen */
.stat-value.stat-value--text {
    font-size: 0.95rem;
    line-height: 1.25;
}

.stat-sub {
    min-height: 1.1em;
    margin-top: 2px;
    font-size: 0.78rem;
    color: var(--text-faint);
}

.meter {
    height: 4px;
    margin-top: 10px;
    border-radius: 4px;
    background: var(--control-hover);
    overflow: hidden;
}

.meter-fill {
    width: 0;
    height: 100%;
    border-radius: 4px;
    background: var(--rain);
    transition: width 800ms ease;
}

/* ---------- Statistik ---------- */

.card {
    width: min(100%, 480px);
    padding: clamp(24px, 5vw, 36px);
    border-radius: var(--radius);
    background: var(--glass-strong);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    box-shadow: var(--glass-edge);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.card-text {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.card-text[data-tip] {
    cursor: help;
}

.card-subtitle {
    margin-top: 28px;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Überschrift mit Jahresauswahl daneben */
.card-subtitle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.card-subtitle-row .card-subtitle {
    margin-top: 0;
}

* + .card-subtitle-row {
    margin-top: 28px;
}

.wide-card {
    width: min(100%, 760px);
}

.year-switch {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px;
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    background: var(--surface);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.year-switch span {
    min-width: 44px;
    text-align: center;
}

.year-switch-button {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}

.year-switch-button:hover:not(:disabled) {
    background: var(--control-hover);
}

.year-switch-button:disabled {
    opacity: 0.25;
    cursor: default;
}

/* ---------- Rekorde ---------- */

.records-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.record-period {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--line);
}

.record-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 8px;
    margin-top: 10px;
}

.record-name {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.record-value {
    grid-row: span 2;
    align-self: center;
    font-size: 1.25rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.record-row--warm .record-value {
    color: var(--warm);
}

.record-row--cold .record-value {
    color: var(--cold);
}

/* Hell: Vor dem dunklen Wald wird das milchige Weiß grau, darauf ist das
   Orange kaum lesbar. Kacheln weißer und die Farben dunkler. */
.theme-light .record-period {
    --warm: #9a3412;
    --cold: #1e4f86;
    background: rgba(255, 255, 255, 0.65);
}

.record-date {
    font-size: 0.72rem;
    color: var(--text-faint);
}

.climate-chart {
    position: relative;
    height: clamp(220px, 34vh, 300px);
    margin-top: 14px;
}

/* ---------- Frost-Kalender ---------- */

.frost-current {
    display: grid;
    grid-template-columns: auto repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 10px;
    margin-top: 14px;
}

.frost-year {
    align-self: center;
    font-size: 1.1rem;
    font-weight: 600;
}

.frost-tile {
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--line);
}

.frost-tile--warn {
    border-color: rgba(251, 191, 36, 0.45);
}

.frost-tile--warn .stat-sub {
    color: var(--amber);
}

.frost-value {
    margin-top: 4px;
    font-size: 1.15rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.frost-years {
    margin-top: 10px;
}

.frost-row {
    display: grid;
    grid-template-columns: 52px minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 4px 12px;
    padding: 8px 2px;
    border-top: 1px solid var(--line);
    font-size: 0.85rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.frost-row b {
    color: var(--text);
}

.frost-row-free {
    text-align: right;
}

/* ---------- Jahres-Heatmap ---------- */

.heatmap {
    display: grid;
    grid-template-columns: 34px repeat(31, minmax(0, 1fr));
    gap: 2px;
    margin-top: 16px;
}

.heatmap-label,
.heatmap-day {
    font-size: 0.68rem;
    color: var(--text-faint);
    line-height: 1;
}

.heatmap-label {
    align-self: center;
}

.heatmap-day {
    text-align: center;
    padding-bottom: 2px;
}

.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 3px;
}

.heatmap-cell--empty {
    background: var(--surface);
}

.heatmap-cell--none {
    visibility: hidden;
}

.heatmap-cell--today {
    outline: 2px solid var(--text);
    outline-offset: -1px;
}

.heatmap-cell[data-tip],
.heatmap-cell[title] {
    cursor: help;
}

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 0.72rem;
    color: var(--text-faint);
}

.heatmap-scale {
    flex: 1;
    max-width: 260px;
    height: 8px;
    border-radius: 4px;
}

/* Vergrößerte Heatmap scrollt waagrecht. touch-action: Zwei Finger zoomen die
   Heatmap (js/ui.js) statt der ganzen Seite. */
.heatmap-scroll {
    overflow-x: auto;
    overscroll-behavior-x: contain;
    touch-action: pan-x pan-y;
}

/* Beim Scrollen bleiben die Monatsnamen links stehen */
.heatmap-scroll.is-zoomed .heatmap-label {
    position: sticky;
    left: 0;
    z-index: 1;
    align-self: stretch;
    display: flex;
    align-items: center;
    padding-right: 4px;
    background: var(--glass-strong);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.heatmap.is-detailed .heatmap-cell[data-value] {
    display: flex;
    align-items: center;
    justify-content: center;
}

.heatmap.is-detailed .heatmap-cell[data-value]::after {
    content: attr(data-value);
    font-size: 0.62rem;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
    font-variant-numeric: tabular-nums;
}

.heatmap-zoom {
    order: 1;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    color: var(--text);
}

.heatmap-zoom-level {
    min-width: 42px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    color: var(--text-faint);
}

/* Tooltip eines Tages in der Heatmap (dayTooltip() in js/ui.js). Der Tooltip
   ist in beiden Designs dunkel, deshalb feste helle Farben. */
.tooltip-modern.day-tip {
    gap: 6px;
    min-width: 170px;
    padding: 10px 14px 12px;
}

.day-tip-title {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.6);
}

.day-tip-main {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.day-tip-main b {
    font-size: 1.25rem;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: -0.01em;
}

.day-tip-main small,
.day-tip-range small {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.55);
}

.day-tip-swatch {
    align-self: center;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.day-tip-range {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.day-tip-range > span {
    display: flex;
    flex-direction: column;
}

.day-tip-range b {
    font-weight: 600;
}

.day-tip-min b {
    color: #8ec5ff;
}

.day-tip-max b {
    color: #ffb27a;
}

/* ---------- Vorhersage (templates/forecastPage.php) ---------- */

.forecast-source {
    font-size: 0.75rem;
    color: var(--text-faint);
    text-decoration: none;
}

.forecast-source:hover {
    color: var(--text-muted);
    text-decoration: underline;
}

/* Stundendiagramm; die Wettersymbole liegen als Bilder darunter */
.forecast-chart {
    position: relative;
    height: clamp(230px, 34vh, 290px);
    margin-top: 16px;
}

.forecast-chart-icons {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 50px;
    pointer-events: none;
}

/* Uhrzeit und Symbol einer Stunde, mittig unter dem Punkt der Kurve */
.forecast-chart-hour {
    position: absolute;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transform: translateX(-50%);
    pointer-events: auto;
    cursor: help;
}

.forecast-chart-hour span {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.forecast-chart-hour img {
    width: 28px;
    height: 28px;
}

/* Auswahl der Tage (eine Woche: heute und die sieben folgenden), am Handy
   in zwei Reihen */
.forecast-days {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 6px;
    margin-top: 16px;
}

.forecast-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 10px 4px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: background 150ms ease, border-color 150ms ease;
}

.forecast-day:hover {
    background: var(--surface-hover);
}

.forecast-day.is-selected {
    border-color: var(--text);
    background: var(--surface-hover);
}

.forecast-day:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.forecast-day-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.forecast-day-date {
    margin-top: -2px;
    font-size: 0.7rem;
    color: var(--text-faint);
}

.forecast-day img {
    width: 36px;
    height: 36px;
}

.forecast-day-temps {
    display: flex;
    gap: 6px;
    font-size: 0.95rem;
}

.forecast-day-temps span {
    color: var(--text-muted);
}

.forecast-day-rain {
    min-height: 1.1em;
    font-size: 0.72rem;
    color: var(--rain);
}

@media only screen and (max-width: 760px) {
    .forecast-days {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media only screen and (max-width: 520px) {
    .forecast-chart {
        height: 230px;
    }

    .forecast-days {
        gap: 4px;
    }

    .forecast-day {
        padding: 8px 2px;
    }

    .forecast-day img {
        width: 32px;
        height: 32px;
    }

    .forecast-day-temps {
        flex-direction: column;
        align-items: center;
        gap: 0;
        font-size: 0.85rem;
    }
}

.field-label {
    display: block;
    margin: 22px 0 8px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
}

.btn-primary-modern {
    display: block;
    width: 100%;
    margin-top: 26px;
    padding: 13px 18px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--primary-bg);
    color: var(--primary-text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 150ms ease;
}

.btn-primary-modern:hover {
    opacity: 0.88;
}

.btn-primary-modern:active {
    opacity: 0.75;
}

.btn-primary-modern:disabled {
    opacity: 0.6;
    cursor: wait;
}

.btn-primary-modern.btn-small {
    width: auto;
    margin-top: 0;
    padding: 9px 20px;
}

.made-by {
    position: relative;
    z-index: 1;
    padding: 0 16px 20px;
    text-align: center;
    font-size: 0.8rem;
    /* Steht direkt auf dem Foto, deshalb in beiden Designs weiß wie die Schrift
       im großen Block */
    color: rgba(255, 255, 255, 0.8);
}

.freepik {
    margin-top: 2px;
    font-size: 0.7rem;
}

a {
    color: inherit;
}

a:hover {
    color: var(--text);
}

/* ---------- Modals ---------- */

.modal-modern .modal-content {
    border-radius: var(--radius);
    background: var(--panel);
    border: 1px solid var(--glass-border);
    color: var(--text);
    box-shadow: var(--shadow);
}

/* Die Zoom-Erweiterung sperrt sonst alle Gesten auf dem Diagramm (touch-action: none).
   Senkrecht wischen scrollt das Fenster, waagrecht verschiebt das Diagramm. */
#statisticChart {
    touch-action: pan-y !important;
}

/* Bei .modal-dialog-scrollable scrollt nur der Inhalt; am Ende nicht die
   Seite dahinter mitscrollen */
.modal-modern .modal-body {
    overscroll-behavior: contain;
}

.modal-modern .modal-header,
.modal-modern .modal-footer {
    border-color: var(--line);
}

.modal-modern .modal-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
}

.modal-title--error {
    color: var(--danger);
}

.modal-backdrop.show {
    opacity: 0.7;
}

.result-message {
    margin: 0;
    color: var(--text-muted);
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.result-chart {
    position: relative;
    height: clamp(220px, 40vh, 340px);
    margin-top: 18px;
}

/* Umschalter Temperatur / Luftdruck im Statistik-Ergebnis */
.segmented {
    display: inline-flex;
    gap: 2px;
    margin-bottom: 14px;
    padding: 3px;
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    background: var(--control);
}

.segmented[hidden] {
    display: none;
}

.segmented-button {
    padding: 6px 14px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
}

.segmented-button:hover {
    color: var(--text);
}

.segmented-button.is-active {
    background: var(--primary-bg);
    color: var(--primary-text);
}

/* Luftdruck auf der Seite "Vorhersage": aktueller Wert und Prognose nebeneinander */
.pressure-now {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.pressure-now[hidden] {
    display: none;
}

.pressure-now + .card-text {
    margin-top: 14px;
}

.pressure-chart {
    position: relative;
    height: clamp(200px, 30vh, 260px);
    margin-top: 14px;
}

.result-chart-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    min-height: 30px;
    margin-top: 6px;
}

.result-chart-hint {
    font-size: 0.75rem;
    color: var(--text-faint);
}

.btn-secondary-modern.btn-tiny {
    flex-shrink: 0;
    padding: 5px 12px;
    border-radius: 10px;
    font-size: 0.78rem;
}

.btn-tiny[hidden] {
    display: none;
}

.result-gaps:not(:empty) {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.result-gaps .stat-label {
    color: var(--amber);
}

.result-gaps ul {
    margin: 6px 0 0;
    padding-left: 18px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.result-gaps-more {
    list-style: none;
    margin-left: -18px;
    color: var(--text-faint);
}

.btn-secondary-modern {
    padding: 9px 20px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: var(--control);
    color: var(--text);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background 150ms ease;
}

.btn-secondary-modern:hover {
    background: var(--control-hover);
}

/* ---------- Kenntage ---------- */

.climate-card {
    width: min(100%, 760px);
}

.climate-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.climate-tile {
    position: relative;
    padding: 14px 12px 12px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--line);
    overflow: hidden;
}

.climate-tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.climate-tile--cold::before {
    background: var(--cold);
}

.climate-tile--warm::before {
    background: var(--warm);
}

.climate-count {
    margin-top: 4px;
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.climate-compare {
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    cursor: help;
}

.climate-table-wrap {
    margin-top: 20px;
    overflow-x: auto;
}

.climate-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

.climate-table th,
.climate-table td {
    padding: 8px 10px;
    text-align: right;
    white-space: nowrap;
    border-bottom: 1px solid var(--line);
}

.climate-table th {
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-faint);
}

.climate-table th:first-child,
.climate-table td:first-child {
    text-align: left;
    font-weight: 600;
}

.climate-table tbody tr:last-child td {
    border-bottom: 0;
}

.climate-table .climate-days {
    color: var(--text-faint);
}

/* Jahresblöcke statt Tabelle, nur am Handy (siehe Responsive) */
.climate-years {
    display: none;
    gap: 8px;
    margin-top: 16px;
}

.climate-year {
    padding: 10px 12px 12px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--line);
}

.climate-year-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}

.climate-year-head b {
    font-size: 1rem;
    font-weight: 600;
}

.climate-year-head span {
    font-size: 0.72rem;
    color: var(--text-faint);
}

.climate-year-values {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    margin-top: 8px;
}

.climate-year-value {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 2px;
    border-radius: 8px;
    background: var(--surface);
    font-variant-numeric: tabular-nums;
}

.climate-year-value span {
    font-size: 0.62rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.climate-year-value--cold span {
    color: var(--cold);
}

.climate-year-value--warm span {
    color: var(--warm);
}

.climate-year-value b {
    font-size: 1rem;
    font-weight: 600;
}

/* ---------- Datumsauswahl (daterangepicker) im dunklen Design ---------- */

/* Zeitraum als zwei Felder "Von"/"Bis" untereinander */
.range-split {
    position: relative;
    display: grid;
    gap: 8px;
}

/* Das eigentliche Eingabefeld: unsichtbar am unteren Rand der beiden Felder,
   damit der Datepicker direkt darunter aufgeht */
.range-anchor {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

/* Öffnet der Datepicker nach oben, liegt das Feld am oberen Rand */
.range-split.is-up .range-anchor {
    top: 0;
    bottom: auto;
}

.daterangepicker.drop-up {
    margin-top: -10px;
}

.range-part {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: var(--control);
    color: var(--text);
    font: inherit;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    text-align: left;
    cursor: pointer;
}

.range-part:focus-visible {
    outline: none;
    border-color: var(--text);
}

.range-label {
    width: 30px;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
}

.daterangepicker {
    margin-top: 10px;
    padding: 6px;
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    background: var(--panel);
    color: var(--text);
    box-shadow: var(--popup-shadow);
    font-family: inherit;
    font-size: 14px;
}

.daterangepicker::before,
.daterangepicker::after {
    display: none;
}

.daterangepicker .ranges ul {
    padding: 6px;
}

.daterangepicker .ranges li {
    margin-bottom: 2px;
    padding: 9px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    transition: background 120ms ease, color 120ms ease;
}

.daterangepicker .ranges li:hover {
    background: var(--control);
    color: var(--text);
}

.daterangepicker .ranges li.active {
    background: var(--control-hover);
    color: var(--text);
    font-weight: 600;
}

.daterangepicker.show-ranges.ltr .drp-calendar.left {
    border-left: 1px solid var(--line);
}

.daterangepicker .calendar-table {
    border: 0;
    background: transparent;
}

.daterangepicker .calendar-table th,
.daterangepicker .calendar-table td {
    min-width: 36px;
    width: 36px;
    height: 34px;
    line-height: 34px;
    border: 0;
    border-radius: 10px;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.daterangepicker .calendar-table thead tr:first-child th {
    font-weight: 600;
}

.daterangepicker .calendar-table thead tr:last-child th {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    color: var(--text-faint);
}

.daterangepicker .calendar-table .next span,
.daterangepicker .calendar-table .prev span {
    border-color: var(--text-muted);
}

.daterangepicker td.available:hover,
.daterangepicker th.available:hover {
    background: var(--control-hover);
    color: var(--text);
}

.daterangepicker td.off,
.daterangepicker td.off.in-range,
.daterangepicker td.off.start-date,
.daterangepicker td.off.end-date {
    background: transparent;
    color: var(--text-off);
}

.daterangepicker td.in-range {
    background: var(--control);
    color: var(--text);
    border-radius: 0;
}

.daterangepicker td.start-date {
    border-radius: 10px 0 0 10px;
}

.daterangepicker td.end-date {
    border-radius: 0 10px 10px 0;
}

.daterangepicker td.start-date.end-date {
    border-radius: 10px;
}

.daterangepicker td.active,
.daterangepicker td.active:hover {
    background: var(--primary-bg);
    color: var(--primary-text);
    font-weight: 600;
}

.daterangepicker .calendar-time {
    margin-top: 8px;
    line-height: 34px;
    color: var(--text-faint);
}

.daterangepicker .calendar-time select,
.daterangepicker select.monthselect,
.daterangepicker select.yearselect {
    padding: 4px 6px;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: var(--control);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.daterangepicker .calendar-time select option,
.daterangepicker select.monthselect option,
.daterangepicker select.yearselect option {
    background: var(--panel);
    color: var(--text);
}

.daterangepicker .calendar-time select.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.daterangepicker .drp-buttons {
    padding: 10px 8px 6px;
    border-top: 1px solid var(--line);
}

.daterangepicker .drp-selected {
    font-size: 12px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.daterangepicker .drp-buttons .btn {
    margin-left: 6px;
    padding: 7px 16px;
    border: 0;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
}

.daterangepicker .drp-buttons .btn-primary {
    background: var(--primary-bg);
    color: var(--primary-text);
}

.daterangepicker .drp-buttons .cancelBtn {
    background: var(--control);
    color: var(--text-muted);
}

.daterangepicker .drp-buttons .cancelBtn:hover {
    background: var(--control-hover);
    color: var(--text);
}

/* Kompaktstufen der Startseite für niedrige Fenster am Desktop (z.B. Laptop
   1366×768), gesetzt von fitFirstPage() in js/ui.js. Am Handy siehe unten. */
@media only screen and (min-width: 521px) {
    .hero.is-dense {
        padding: 20px 28px;
    }

    .hero.is-dense .hints:not(:empty) {
        margin-bottom: 8px;
    }

    .hero.is-dense .temperature {
        font-size: clamp(4rem, 11vh, 6.5rem);
    }

    .hero.is-dense .sparkline {
        margin-top: 10px;
    }

    .hero.is-dense .sparkline-chart {
        height: 48px;
    }

    .hero.is-dense .stats {
        margin-top: 14px;
    }

    .hero.is-dense .stat {
        padding: 10px 12px;
    }

    .hero.is-dense .sky {
        margin-top: 10px;
    }

    .hero.is-denser .temperature {
        font-size: clamp(3.4rem, 9vh, 5rem);
    }

    .hero.is-denser .sparkline-chart {
        height: 36px;
    }

    .hero.is-denser .stat-sub {
        display: none;
    }
}

/* Handy (auch quer): als Panel am unteren Rand statt am Eingabefeld
   (überschreibt die vom Plugin gesetzte Position) */
@media only screen and (max-width: 563px), only screen and (max-height: 460px) {
    .daterangepicker {
        position: fixed;
        top: auto !important;
        left: 8px !important;
        right: 8px !important;
        bottom: 8px;
        width: auto;
        max-height: calc(100svh - 16px);
        margin: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .daterangepicker .ranges {
        float: none;
        width: 100%;
    }

    .daterangepicker .ranges ul {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
    }

    .daterangepicker .ranges li {
        margin: 0;
        padding: 7px 12px;
        border: 1px solid var(--glass-border);
        border-radius: 999px;
    }

    .daterangepicker .drp-calendar {
        max-width: none;
    }

    .daterangepicker .drp-calendar.left,
    .daterangepicker .drp-calendar.right {
        padding: 6px 0;
    }

    .daterangepicker.show-ranges.ltr .drp-calendar.left {
        border-left: 0;
    }

    .daterangepicker .drp-calendar.right {
        border-top: 1px solid var(--line);
    }

    .daterangepicker .calendar-table th,
    .daterangepicker .calendar-table td {
        width: 14.28%;
        min-width: 0;
    }

    .daterangepicker .drp-selected {
        display: block;
        margin-bottom: 8px;
        text-align: center;
    }

    .daterangepicker .drp-buttons {
        position: sticky;
        bottom: -6px;
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        background: var(--panel);
    }

    .daterangepicker .drp-buttons .btn {
        flex: 1;
        padding: 11px 16px;
    }
}

/* ---------- Tooltips (siehe js/ui.js) ---------- */

.tooltip-modern {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: min(280px, calc(100vw - 16px));
    padding: 9px 12px;
    border-radius: 10px;
    background: rgba(14, 22, 18, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: var(--popup-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.8rem;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity 140ms ease, transform 140ms ease, visibility 0s linear 140ms;
}

.tooltip-modern.is-below {
    transform: translateY(-4px);
}

.tooltip-modern.is-visible {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 140ms ease, transform 140ms ease;
}

/* Tooltip der kleinen Kurve auf Seite 1 (siehe sparklineTooltip() in js/ui.js) */
.chart-tooltip {
    align-items: center;
    white-space: nowrap;
}

.chart-tooltip-title {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.chart-tooltip-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

/* Pfeil zum Element; --arrow-x setzt js/ui.js */
.tooltip-modern::after {
    content: '';
    position: absolute;
    top: 100%;
    left: var(--arrow-x, 50%);
    width: 10px;
    height: 10px;
    margin-top: -5px;
    margin-left: -5px;
    background: inherit;
    border-right: 1px solid rgba(255, 255, 255, 0.14);
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    transform: rotate(45deg);
}

.tooltip-modern.is-below::after {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: -5px;
    transform: rotate(225deg);
}

[data-tip] {
    cursor: help;
}

a[data-tip],
button[data-tip] {
    cursor: pointer;
}

/* ---------- Animationen ---------- */

@keyframes fade-up {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .hero {
        animation: none;
    }
}

/* ---------- Responsive ---------- */

/* Kurzfassung eines Textes nur am Handy (siehe unten) */
.text-short {
    display: none;
}

/* Handy hochkant: alles kompakter, damit die erste Seite ohne Scrollen passt */
@media only screen and (max-width: 520px) {
    .text-long {
        display: none;
    }

    .text-short {
        display: inline;
    }

    .page-inner {
        padding: calc(var(--header-height) + 14px) 16px 12px;
    }

    /* Im Hochformat ist nur ein schmaler Streifen des Bildes zu sehen. Links
       steht die Sonne zwischen den Stämmen, dort wäre der Himmel weiß hinter
       der Schrift; deshalb den dunklen Wald rechts zeigen. */
    .app-bg {
        background-position: 72% center;
    }

    /* Karte direkt unter die Kopfleiste statt mittig */
    .hero {
        margin-top: 0;
        padding: 18px 16px 16px;
        border-radius: 20px;
    }

    .hints:not(:empty) {
        margin-bottom: 8px;
    }

    .hint {
        padding: 4px 10px;
        font-size: 0.72rem;
    }

    /* Reicht die Breite nicht (z.B. "-12,0 °C" auf 320 px), rutscht der Trend
       in eine zweite Zeile */
    .temperature-row {
        gap: 4px 10px;
    }

    .trend {
        flex-shrink: 0;
    }

    .trend-label {
        white-space: nowrap;
    }

    .temperature {
        font-size: clamp(3.4rem, 17vw, 4.5rem);
    }

    .trend {
        padding: 6px 10px;
        column-gap: 5px;
    }

    .trend-arrow {
        font-size: 1.4rem;
    }

    .trend-value {
        font-size: 0.95rem;
    }

    .trend-label {
        font-size: 0.6rem;
    }

    .updated,
    .compare {
        font-size: 0.8rem;
    }

    .sparkline {
        margin-top: 12px;
    }

    .sparkline-chart {
        height: 48px;
    }

    .sparkline-caption {
        font-size: 0.68rem;
    }

    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-top: 14px;
    }

    .stat {
        padding: 10px 11px;
        border-radius: 12px;
    }

    .stat-label {
        font-size: 0.66rem;
    }

    .stat-value {
        margin-top: 2px;
        font-size: 1.15rem;
    }

    .stat-sub {
        font-size: 0.7rem;
    }

    .meter {
        margin-top: 7px;
    }

    .sky {
        gap: 4px 16px;
        margin-top: 12px;
        font-size: 0.8rem;
    }

    .card {
        padding: 22px 16px;
        border-radius: 20px;
    }

    .card-title {
        font-size: 1.3rem;
    }

    .card-text {
        font-size: 0.88rem;
    }

    /* Statistik-Werte untereinander: Bezeichnung und Zeitpunkt links, Wert rechts */
    .modal-modern .modal-dialog {
        margin: 8px;
    }

    .modal-modern .modal-header,
    .modal-modern .modal-body,
    .modal-modern .modal-footer {
        padding-left: 14px;
        padding-right: 14px;
    }

    .modal-modern .modal-title {
        font-size: 0.92rem;
    }

    .result-stats {
        grid-template-columns: minmax(0, 1fr);
        gap: 6px;
    }

    .result-stats .stat {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        column-gap: 12px;
        align-items: center;
        padding: 9px 12px;
    }

    .result-stats .stat-label {
        grid-row: 1;
    }

    .result-stats .stat-sub {
        grid-row: 2;
        margin-top: 1px;
    }

    .result-stats .stat-value {
        grid-column: 2;
        grid-row: 1 / span 2;
        margin: 0;
        font-size: 1.25rem;
        text-align: right;
    }

    .result-chart {
        height: 220px;
        margin-top: 14px;
    }

    /* Kenntage als Liste: Name und Regel links, Anzahl rechts */
    .climate-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 6px;
        margin-top: 16px;
    }

    .climate-tile {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        column-gap: 12px;
        align-items: center;
        padding: 9px 12px 9px 15px;
    }

    .climate-tile::before {
        right: auto;
        bottom: 0;
        width: 3px;
        height: auto;
    }

    .climate-tile .stat-label {
        grid-row: 1;
    }

    .climate-tile .stat-sub {
        grid-row: 2;
        margin-top: 0;
    }

    .climate-compare {
        grid-row: 3;
        margin-top: 2px;
        font-size: 0.72rem;
    }

    .climate-count {
        grid-column: 2;
        grid-row: 1 / span 3;
        margin: 0;
        font-size: 1.6rem;
        text-align: right;
    }

    /* Tabelle wäre zu breit und müsste seitlich gescrollt werden */
    .climate-table-wrap {
        display: none;
    }

    .climate-years {
        display: grid;
    }

    /* Buttons nebeneinander, gleich breit */
    .modal-modern .modal-footer {
        flex-wrap: nowrap;
        gap: 8px;
    }

    .modal-modern .modal-footer > * {
        flex: 1;
        margin: 0;
        padding-left: 10px;
        padding-right: 10px;
    }

    /* Rekorde: ein Zeitraum pro Zeile, Höchst- und Tiefstwert nebeneinander */
    .records-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 6px;
        margin-top: 14px;
    }

    .record-period {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 12px;
        padding: 10px 12px;
    }

    .record-period .stat-label {
        grid-column: 1 / -1;
    }

    .record-row {
        margin-top: 6px;
    }

    .record-value {
        font-size: 1.1rem;
    }

    .card-subtitle,
    * + .card-subtitle-row {
        margin-top: 22px;
    }

    .climate-chart {
        height: 220px;
    }

    /* Frost-Kalender: Jahr als Überschrift, drei Kacheln darunter */
    .frost-current {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }

    .frost-year {
        grid-column: 1 / -1;
        font-size: 1rem;
    }

    .frost-tile {
        padding: 9px 10px;
    }

    .frost-value {
        font-size: 1rem;
    }

    .frost-row {
        grid-template-columns: 44px minmax(0, 1fr);
        font-size: 0.8rem;
    }

    .frost-row b {
        grid-row: span 3;
    }

    .frost-row-free {
        text-align: left;
    }

    .heatmap {
        grid-template-columns: 26px repeat(31, minmax(0, 1fr));
        gap: 1px;
    }

    .heatmap-label,
    .heatmap-day {
        font-size: 0.58rem;
    }

    /* Die Zellen sind schmaler als zweistellige Zahlen: links ausrichten und
       überstehen lassen statt umbrechen */
    .heatmap-day {
        overflow: visible;
        white-space: nowrap;
        text-align: left;
    }

    .heatmap-cell {
        border-radius: 2px;
    }

    /* Rekorde: Bezeichnung, Wert und Datum untereinander statt nebeneinander */
    .record-row {
        display: block;
    }

    .record-name,
    .record-date {
        display: block;
    }

    .record-value {
        display: block;
        margin: 1px 0;
    }

    /* Kompaktstufen der Startseite, gesetzt von fitFirstPage() in js/ui.js */
    .hero.is-dense {
        padding: 14px 14px 12px;
    }

    .hero.is-dense .hints:not(:empty) {
        margin-bottom: 6px;
    }

    .hero.is-dense .hints {
        gap: 5px;
    }

    .hero.is-dense .temperature {
        font-size: clamp(3rem, 15vw, 3.8rem);
    }

    .hero.is-dense .updated,
    .hero.is-dense .compare {
        font-size: 0.76rem;
    }

    .hero.is-dense .sparkline {
        margin-top: 8px;
    }

    .hero.is-dense .sparkline-chart {
        height: 40px;
    }

    .hero.is-dense .stats {
        gap: 6px;
        margin-top: 10px;
    }

    .hero.is-dense .stat {
        padding: 8px 10px;
    }

    .hero.is-dense .stat-value {
        font-size: 1.1rem;
    }

    .hero.is-dense .sky {
        margin-top: 8px;
    }

    .hero.is-denser .sparkline-chart {
        height: 30px;
    }

    .hero.is-denser .sparkline-caption,
    .hero.is-denser .meter {
        display: none;
    }

    .hero.is-denser .temperature {
        font-size: clamp(2.8rem, 13vw, 3.2rem);
    }
}

/* Hohe Handys (z.B. iPhone 15, große Androids): Die Karte sitzt oben, also ist
   unten Platz; alles eine Spur größer, passt aber weiterhin ohne Scrollen */
@media only screen and (max-width: 520px) and (min-height: 760px) {
    .hero {
        padding: 24px 18px 20px;
    }

    .hints:not(:empty) {
        margin-bottom: 12px;
    }

    .temperature {
        font-size: clamp(4rem, 20vw, 5.4rem);
    }

    .trend {
        padding: 8px 12px;
    }

    .trend-arrow {
        font-size: 1.6rem;
    }

    .trend-value {
        font-size: 1.05rem;
    }

    .updated,
    .compare {
        font-size: 0.88rem;
    }

    .compare {
        margin-top: 4px;
    }

    .sparkline {
        margin-top: 18px;
    }

    .sparkline-chart {
        height: 72px;
    }

    .stats {
        gap: 10px;
        margin-top: 20px;
    }

    .stat {
        padding: 14px 13px;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    .stat-value {
        margin-top: 4px;
        font-size: 1.35rem;
    }

    .stat-sub {
        font-size: 0.74rem;
    }

    .sky {
        margin-top: 18px;
        font-size: 0.86rem;
    }
}

/* Sehr hohe Handys (z.B. Pixel Pro, iPhone Pro Max) */
@media only screen and (max-width: 520px) and (min-height: 880px) {
    .hero {
        padding: 28px 20px 24px;
    }

    .sparkline {
        margin-top: 22px;
    }

    .sparkline-chart {
        height: 92px;
    }

    .stats {
        margin-top: 24px;
    }

    .stat {
        padding: 16px 14px;
    }

    .sky {
        margin-top: 22px;
    }
}

/* Kleine Handys (z.B. iPhone SE) oder Browser mit eingeblendeten Leisten */
@media only screen and (max-width: 520px) and (max-height: 700px) {
    .page-inner {
        padding-top: calc(var(--header-height) + 10px);
        padding-bottom: 8px;
    }

    .hero {
        padding: 14px 14px 12px;
    }

    .temperature {
        font-size: clamp(3rem, 15vw, 3.8rem);
    }

    .sparkline {
        margin-top: 8px;
    }

    .sparkline-chart {
        height: 40px;
    }

    .stats {
        margin-top: 10px;
    }

    .stat {
        padding: 8px 10px;
    }

    .sky {
        margin-top: 8px;
    }
}

/* Mittlere Höhe (z.B. iPhone SE, kleine Androids, Safari mit Leisten): etwas
   größer als ganz kompakt, der Platz unter der Karte wird genutzt */
@media only screen and (max-width: 520px) and (min-height: 640px) and (max-height: 759px) {
    .hero {
        padding: 18px 16px 16px;
    }

    .temperature {
        font-size: clamp(3.6rem, 18vw, 4.6rem);
    }

    .sparkline {
        margin-top: 14px;
    }

    .sparkline-chart {
        height: 60px;
    }

    .stats {
        margin-top: 16px;
    }

    .stat {
        padding: 12px 12px;
    }

    .stat-value {
        font-size: 1.22rem;
    }

    .sky {
        margin-top: 14px;
    }
}

@media only screen and (min-width: 521px) and (max-width: 760px) {
    .climate-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Handy quer / sehr niedrige Fenster */
@media only screen and (max-height: 520px) {
    .page-inner {
        padding-top: calc(var(--header-height) + 12px);
        padding-bottom: 12px;
    }

    .hero {
        padding: 16px 20px;
    }

    .temperature {
        font-size: clamp(3rem, 14vh, 5rem);
    }

    .stats {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        margin-top: 12px;
    }

    .sparkline {
        margin-top: 10px;
    }

    .sparkline-chart {
        height: 44px;
    }

    .sky {
        margin-top: 10px;
    }
}

/* Kopfleiste auf schmalen Handys: etwas kleinere Schaltflächen, damit auch eine
   längere Temperatur Platz hat; unter 360 px entfällt der Link zur Gemeinde */
@media only screen and (max-width: 400px) {
    .app-header {
        gap: 6px;
    }

    .location,
    .theme-toggle,
    .nav-toggle {
        width: 36px;
        height: 36px;
    }

    .nav-toggle {
        padding: 0 8px;
    }
}

@media only screen and (max-width: 359px) {
    .location {
        display: none;
    }
}
