/* ============================================================================
   TAGESWERTE (tageswerte.php) – Tageskalender aller Jahre
   Regeln .wetterhistorie-* stammen aus klima.css (dort nur von dieser Seite genutzt).
   Druckansicht (wetterhistorie_print.php) hat eigenes Inline-CSS → hier unabhängig.

   Gestaltung („ruhig“): neutraler Zellhintergrund, Farbe nur in der Schrift.
   Akzente: kalt (blau), heiß (orange), Niederschlag (himmelblau), Föhn (bernstein, nur Icon).
   Monatsextrem: fett + 1-px-Rahmen. GWL: nur schmaler Strich links in Zirkulationsfarbe.

   Ebenen innerhalb des Scrollbereichs (z-index):
     Zellen / später GWL-Blöcke + Föhn-Icons  ≤ 1  (nie höher!)
     Tag-Spalte (sticky links)                    3
     Kopfzeilen (sticky oben)                     4
     Eckzelle „Tag“ (sticky oben + links)         5
   ============================================================================ */

.tw-main { overflow-x: clip; }                  /* Seite selbst scrollt nie seitlich */
/* iOS: Text in breiten Tabellen nicht automatisch vergrößern (Schrift wie auf den anderen Seiten) */
.tw-main { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* Karten-Überschrift wie die Kartentitel in vorhersage.php (.fc-card-header) */
/* !important: js/mobile-nav.js setzt ≤ 600 px .heatmap-section h3 { 0.7rem !important } (für klima.php) */
.tw-karte h3 { font-size: var(--fs-sm) !important; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
/* Breite wie vorhersage.php: .container (max-width var(--max-width), zentriert) unverändert,
   die Tabelle scrollt innerhalb der Karte horizontal */

.tw-karte {
    --tw-leiste: 80px;        /* untere Navigationsleiste (includes/footer.php), Mobile */
    --tw-kopf1: 26px;         /* Höhe Kopfzeile 1 (Jahre) – Kopfzeile 2 klebt darunter */
    --tw-kopf2: 22px;         /* Höhe Kopfzeile 2 (Parameter) – GWL-Kürzel kleben darunter */
    --tw-luft: 10px;          /* Abstand Scrollbereich ↔ Leiste */
    --tw-fs-zelle: 0.8125rem; /* Tabellenzellen 13 px Desktop (Handy 12 px, siehe Mobile) – Mindestgröße Lesbarkeit */
    /* Flächen: Kopf und Tag-Spalte deckend (Sticky), Jahres-Kopf kaum abgesetzt */
    --tw-kopf-bg: #131a2e;
    --tw-jahr-bg: #161f38;
    --tw-heute-bg: #1c2d52;
    /* Linien: Zeilen kaum sichtbar, Monat etwas deutlicher, Jahr gedämpft blau */
    --tw-linie: rgba(255, 255, 255, 0.045);
    --tw-monat-linie: rgba(148, 163, 184, 0.30);
    --tw-jahr-linie: rgba(96, 165, 250, 0.38);
    --tw-gwl-linie: rgba(255, 255, 255, 0.10);
    /* Schrift: Grundfarbe etwas zurückgenommen, damit Hervorhebungen wirken (Text ≥ 4,5:1) */
    --tw-text: #cbd5e1;
    --tw-text-stark: #f8fafc;
    --tw-leer: rgba(148, 163, 184, 0.38);      /* „–“: reiner Platzhalter, bewusst schwach */
    --tw-kalt: #8ab4ff;
    --tw-heiss: #fb923c;
    --tw-ns: #4cc3f5;
    --tw-extrem: #60a5fa;
    --tw-foehn: #f59e0b;
    padding: 0.5rem 0.6rem 0.4rem;
    overflow: visible;        /* .heatmap-section hat hidden – Sticky braucht den Wrapper als Scroller */
}
:root.light .tw-karte {
    --tw-kopf-bg: #edf1f7;
    --tw-jahr-bg: #e6ecf4;
    --tw-heute-bg: #d6e4fb;
    --tw-linie: rgba(15, 23, 42, 0.06);
    --tw-monat-linie: rgba(71, 85, 105, 0.32);
    --tw-jahr-linie: rgba(37, 99, 235, 0.30);
    --tw-gwl-linie: rgba(15, 23, 42, 0.10);
    --tw-text: #334155;
    --tw-text-stark: #0f172a;
    --tw-leer: rgba(100, 116, 139, 0.40);
    --tw-kalt: #1d4ed8;
    --tw-heiss: #c2410c;
    --tw-ns: #0369a1;
    --tw-extrem: #2563eb;
    --tw-foehn: #b45309;
}
@media (min-width: 769px) {
    .tw-karte { --tw-leiste: 60px; }
}

/* ----- Einleitung + Legende (eigene Klassen: .heatmap-section p ist ausgeblendet) ----- */
.tw-intro {
    color: var(--text-muted);
    font-size: var(--fs-base);              /* Fließtext wie vorhersage.php */
    line-height: 1.45;
    margin: 0 0 0.3rem;
}
/* Legende: eine Zeile, kleine Punkte/Beispiele statt Farbflächen */
.tw-legende {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.2rem 0.75rem;
    margin: 0 0 0.45rem;
    font-size: var(--fs-xs);
    color: var(--text-secondary);
}
.tw-leg-liste { display: contents; }            /* Desktop: Einträge fließen wie direkte Kinder */
.tw-leg {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}
.tw-leg-punkt::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--tw-punkt);
}
.tw-leg-frost { --tw-punkt: var(--tw-kalt); }
.tw-leg-heiss { --tw-punkt: var(--tw-heiss); }
.tw-leg-ns    { --tw-punkt: var(--tw-ns); }
.tw-leg-extrem::before {
    content: "";
    width: 9px;
    height: 9px;
    border: 1px solid var(--tw-extrem);
    border-radius: 1px;
}
.tw-leg-gwl::before {
    content: "";
    width: 3px;
    height: 11px;
    background: rgb(var(--gwl-rgb));
}
.tw-leg-titel { color: var(--text-muted); }
.tw-leg-sep { width: 1px; height: 12px; background: var(--grid-line-strong); flex-shrink: 0; }
.tw-leg-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin: -4px 0 -4px -0.35rem;
    padding: 0;
    font: inherit;
    font-size: var(--fs-md);
    line-height: 1;
    color: var(--blue-light);
    background: none;
    border: none;
    border-radius: 50%;
    cursor: help;
}
.tw-leg-info:focus-visible { outline: 2px solid var(--blue-light); }

/* ----- Toolbar (Download) – Stil wie Jahres-Chips/Unterleisten in klima.php ----- */
.wetterhistorie-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem 0.5rem;
    margin: 0 0 0.35rem;
    padding: 0;
    background: none;
    border: none;
}
.wetterhistorie-toolbar label,
.wetterhistorie-toolbar .wh-tb-label {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
}
.wetterhistorie-toolbar .wh-tb-label { font-weight: 600; }
/* Hinweis bei gesperrten Buttons: gut lesbar (Kontrast wie Legende); visibility statt display,
   damit die Tabelle beim Wählen nicht springt */
.wetterhistorie-toolbar .wh-tb-hint {
    color: var(--text-secondary);
    font-size: var(--fs-sm);
    font-weight: 600;
}
.wetterhistorie-toolbar .wh-tb-hint::before {
    content: "ⓘ ";
    color: var(--blue-light);
}
.wetterhistorie-toolbar select,
.wetterhistorie-toolbar button {
    height: 30px;
    padding: 0 0.65rem;
    font-family: inherit;
    font-size: var(--fs-sm);
    font-weight: 600;
    line-height: 1;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
}
.wetterhistorie-toolbar select {
    background: var(--bg-card-solid);
    color: var(--text-primary);
    border: 1px solid var(--blue-a25);
}
.wetterhistorie-toolbar select:hover { border-color: var(--blue); }
.wetterhistorie-toolbar button {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--blue-a25);
    border: 1px solid var(--blue);
    color: var(--blue-light);
}
.wetterhistorie-toolbar button:not(:disabled):hover {
    background: var(--blue);
    color: #fff;
}
.wetterhistorie-toolbar button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ----- Monats-Chips ----- */
.tw-nav {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin: 0 0 0.35rem;
    overflow-x: auto;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
}
.tw-nav::-webkit-scrollbar { display: none; }
.tw-chips {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}
.tw-chip {
    flex-shrink: 0;
    padding: 0.2rem 0.55rem;
    font-family: inherit;
    font-size: var(--fs-sm);
    font-weight: 600;
    line-height: 1.4;
    background: none;
    border: 1px solid var(--glass-medium, var(--blue-a25));
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.tw-chip:hover { color: var(--text-primary); border-color: var(--blue-a25); }
.tw-chip.active {
    background: var(--blue-a25);
    border-color: var(--blue);
    color: var(--blue-light);
}

/* ----- Scrollbereich: einziger Scroller, Höhe = sichtbarer Bereich ab Oberkante bis Leiste.
   --tw-oben misst js/tageswerte.js (Abstand Seitenanfang → Wrapper); Fallback 220px. */
.wetterhistorie-wrapper {
    --tw-hoehe: calc(var(--tw-oben, 220px) + var(--tw-leiste) + env(safe-area-inset-bottom, 0px) + var(--tw-luft));
    max-height: calc(100vh - var(--tw-hoehe));
    max-height: calc(100dvh - var(--tw-hoehe));
    min-height: 280px;                           /* sehr niedrige Viewports: Seite scrollt mit */
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--grid-line);
    border-radius: var(--radius-md);
    /* bewusst ohne eigenen deckenden Hintergrund: mit opakem Hintergrund wird der Scroller in Chrome
       eigenständig compositet → beim Theme-Wechsel ~1,5 s „Layerize“ (gemessen 16.11.2026) */
    box-sizing: border-box;
}
.wetterhistorie-wrapper:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 1px; }

/* Theme-Wechsel: die globale Überblendung (html.theme-transition * in style.css) nicht auf die
   ~29.000 Tabellenelemente anwenden – sonst bis zu 2 s Hänger. Zellen wechseln sofort. */
html.theme-transition .wetterhistorie-table,
html.theme-transition .wetterhistorie-table *,
html.theme-transition .wetterhistorie-table *::before,
html.theme-transition .wetterhistorie-table *::after {
    transition: none !important;
}

/* ----- Tabelle ----- */
.wetterhistorie-table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--tw-fs-zelle);
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
    white-space: nowrap;
    margin: 0;
}
/* nur feine Zeilenlinien, keine senkrechten Linien innerhalb eines Jahres */
.wetterhistorie-table th,
.wetterhistorie-table td {
    padding: 2px 5px;
    text-align: right;
    border-bottom: 1px solid var(--tw-linie);
}

/* Kopf: beide Zeilen sticky, deckender Hintergrund, wenig Kontrast */
.wetterhistorie-table thead th {
    position: sticky;
    top: 0;
    z-index: 4;
    background: var(--tw-kopf-bg);
    color: var(--text-secondary);
    font-weight: 600;
    text-align: center;
    box-sizing: border-box;
}
.wetterhistorie-table thead tr:first-child th {
    height: var(--tw-kopf1);
}
.wetterhistorie-table thead tr:nth-child(2) th {
    top: var(--tw-kopf1);
    height: var(--tw-kopf2);
    border-bottom: 1px solid var(--grid-line-strong);
}
.wetterhistorie-table thead .jahr-header {
    background: var(--tw-jahr-bg);
    color: var(--text-primary);
    font-size: var(--fs-sm);
    letter-spacing: 0.5px;
    border-bottom-color: transparent;
}
.wetterhistorie-table thead .param-h {
    font-size: var(--fs-xs);
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 2px 4px;
}

/* Tag-Spalte sticky links; Eckzelle sticky in beide Richtungen */
.wetterhistorie-table th.tag-col {
    position: sticky;
    left: 0;
    z-index: 3;
    background: var(--tw-kopf-bg);
    color: var(--text-secondary);
    font-weight: 500;
    text-align: left;
    min-width: 64px;
    border-right: 1px solid var(--grid-line);
}
.wetterhistorie-table thead th.tag-col {
    z-index: 5;
    font-weight: 600;
    border-bottom: 1px solid var(--grid-line-strong);
}

/* Körper: einheitliche Schriftstärke, Farbe nur bei Auffälligem */
.wetterhistorie-table tbody td {
    font-weight: 400;
    color: var(--tw-text);
}

/* Jahresblöcke: gedämpfte Trennlinie links der T-MIN-Spalte, durchgehend bis in den Kopf */
.wetterhistorie-table .jahr-start,
.wetterhistorie-table .jahr-header {
    border-left: 2px solid var(--tw-jahr-linie);
}

/* Monatswechsel: etwas deutlichere Linie, erster Tag fett */
.wetterhistorie-table tr.monatswechsel > th,
.wetterhistorie-table tr.monatswechsel > td {
    border-top: 1px solid var(--tw-monat-linie);
}
.wetterhistorie-table tr.monatswechsel > th.tag-col {
    font-weight: 700;
    color: var(--text-primary);
}

/* Heute: nur Tag-Zelle hervorgehoben + feine Linie unter der Zeile */
.wetterhistorie-table tr.heute > th.tag-col {
    background: var(--tw-heute-bg);
    color: var(--text-primary);
    font-weight: 700;
    box-shadow: inset 2px 0 0 var(--blue-light);
}
.wetterhistorie-table tr.heute > th,
.wetterhistorie-table tr.heute > td {
    border-bottom-color: var(--blue-a40);
}

/* ----- Werte: Farbe nur in der Schrift ----- */
.wetterhistorie-table tbody td.spalte-wr { color: var(--text-muted); }
.wetterhistorie-table tbody td.spalte-sh { color: var(--tw-text); }
/* leere Tage (keine Daten, js-frei per Klasse aus tageswerte.php) */
.wetterhistorie-table tbody td.leer { color: var(--tw-leer); }
/* Temperatur: < 0 °C blau (Frost/Eistag), T-MAX ≥ 25 °C orange, dazwischen normal */
.wetterhistorie-table tbody td.zelle-frost,
.wetterhistorie-table tbody td.zelle-eis { color: var(--tw-kalt); }
.wetterhistorie-table tbody td.zelle-temp-heiss { color: var(--tw-heiss); }
/* Wind ≥ 10 km/h: nur heller/kräftiger */
.wetterhistorie-table tbody td.zelle-wind-stark { color: var(--tw-text-stark); font-weight: 500; }
/* Niederschlag: 0,0 gedimmt, > 0 blau, ≥ 10 mm kräftiger */
.wetterhistorie-table tbody td.zelle-ns-null { color: var(--text-muted); }
.wetterhistorie-table tbody td.zelle-ns-aktiv { color: var(--tw-ns); }
.wetterhistorie-table tbody td.zelle-ns-viel { font-weight: 700; }
/* Monatsextrem: fett + 1-px-Rahmen in Akzentfarbe (Schriftfarbe bleibt die der Spalte) */
.wetterhistorie-table tbody td.bold-extrem {
    font-weight: 700;
    outline: 1px solid var(--tw-extrem);
    outline-offset: -2px;
}

/* ----- Mobile ----- */
@media (max-width: 768px) {
    .tw-container { padding: 0 0.4rem; }
    .tw-karte { padding: 0.5rem 0.4rem 0.3rem; margin: 0.4rem 0; }
    .tw-intro { display: none; }                 /* Legende reicht, spart Höhe */
    /* ⓘ fest am Anfang, die übrigen Einträge wischen dahinter */
    .tw-legende { flex-wrap: nowrap; gap: 0.5rem; }
    .tw-leg-info { order: -1; flex-shrink: 0; margin: -4px 0; }
    .tw-leg-liste {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        flex: 1 1 auto;
        min-width: 0;
        overflow-x: auto;
        scrollbar-width: none;
        overscroll-behavior-x: contain;
    }
    .tw-leg-liste::-webkit-scrollbar { display: none; }
    .wetterhistorie-toolbar { gap: 0.3rem; flex-wrap: wrap; }
    .wetterhistorie-toolbar .wh-tb-label,
    .wetterhistorie-toolbar label { display: none; }
    /* Hinweis als eigene Zeile unter Selects/Buttons */
    .wetterhistorie-toolbar .wh-tb-hint { flex: 0 0 100%; order: 10; font-size: var(--fs-xs); }
    /* nach der ersten Auswahl (localStorage, js/tageswerte.js) ganz weg → Zeile spart Höhe */
    .wetterhistorie-toolbar.hinweis-weg .wh-tb-hint { display: none; }
    .wetterhistorie-toolbar select { min-width: 0; flex: 1 1 0; padding: 0 0.4rem; }
    .wetterhistorie-toolbar button { flex: 0 0 auto; padding: 0 0.5rem; }
    .tw-karte { --tw-fs-zelle: 0.75rem; }       /* 12 px Handy */
    .wetterhistorie-table th.tag-col { min-width: 54px; padding-left: 4px; }
}

/* Barrierefreiheit: Label nur für Screenreader */
.tw-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ============================================================================
   GWL-Spalte (7. Spalte je Jahr, rowspan-Blöcke): Fläche neutral, Zirkulation nur als
   3-px-Strich links (gedämpfte Farben). antizyklonal/zyklonal (gwl-a/gwl-z) nur im Tooltip.
   ============================================================================ */
.gwl-zonal      { --gwl-rgb: 94 178 166; }   /* Türkis, gedämpft */
.gwl-gemischt   { --gwl-rgb: 138 145 214; }  /* Indigo, gedämpft */
.gwl-meridional { --gwl-rgb: 208 132 168; }  /* Rosa, gedämpft   */
:root.light .gwl-zonal      { --gwl-rgb: 45 133 122; }
:root.light .gwl-gemischt   { --gwl-rgb: 99 102 186; }
:root.light .gwl-meridional { --gwl-rgb: 181 84 131; }

/* Breite so, dass das längste Wort („Nordwest“) waagrecht in eine Zeile passt; Schrift wie die Zellen */
.wetterhistorie-table .spalte-gwl {
    min-width: 4.6em;                    /* „Nordwest“ in Zellschrift (12/13 px) */
    padding: 0 3px;
    text-align: center;
    vertical-align: middle;
    font-weight: 500;
    letter-spacing: 0;
}
.wetterhistorie-table tbody td.spalte-gwl {
    color: var(--text-secondary);
    border-bottom: 1px solid var(--tw-gwl-linie);       /* Blockgrenze */
    box-shadow: inset 3px 0 0 rgb(var(--gwl-rgb) / 0.85);
    cursor: help;
}
.wetterhistorie-table tbody td.gwl-leer { box-shadow: none; cursor: default; }
/* Kürzel mittig; bei langen Blöcken klebt es beim Scrollen unter dem Kopf (Ebene 1, unter Tag-Spalte/Kopf) */
.gwl-kz {
    position: sticky;
    top: calc(var(--tw-kopf1) + var(--tw-kopf2) + 3px);
    bottom: 3px;
    z-index: 1;
    display: inline-block;
}

/* ============================================================================
   Föhn in der ØWR-Zelle: nur Icon vor der Windrichtung, Stufe über Deckkraft/Größe,
   vorläufig (live) = Richtung gepunktet unterstrichen (+ Tooltip)
   ============================================================================ */
.wetterhistorie-table tbody td[class*="zelle-foehn-"] { cursor: help; }
.wetterhistorie-table tbody td.zelle-foehn-1::before { opacity: 0.55; }
.wetterhistorie-table tbody td.zelle-foehn-2::before { opacity: 0.85; }
.wetterhistorie-table tbody td.zelle-foehn-3::before { width: 12px; height: 12px; vertical-align: -2px; }
.wetterhistorie-table tbody td.foehn-live {
    text-decoration: underline dotted var(--tw-foehn);
    text-underline-offset: 2px;
}
/* Föhn-Icon als Maske (--wh-foehn-maske aus wh_foehn_icon_css(), Quelle foehn_icon()) –
   in der Zelle per ::before, in der Legende als leeres <span class="wh-foehn-ic"> */
.wh-foehn-ic,
.wetterhistorie-table tbody td[class*="zelle-foehn-"]::before {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 2px;
    vertical-align: -1px;
    background-color: var(--tw-foehn);
    -webkit-mask: var(--wh-foehn-maske) center / contain no-repeat;
            mask: var(--wh-foehn-maske) center / contain no-repeat;
}

/* ----- Tooltip (Hover am Desktop, Tap am Handy) ----- */
.tw-tip {
    position: fixed;
    z-index: 9000;                       /* über Tabelle, unter Leiste/Menü */
    max-width: 260px;
    padding: 0.4rem 0.55rem;
    background: var(--bg-tooltip);
    color: var(--text-primary);
    border: 1px solid var(--blue-a40);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    font-size: var(--fs-sm);
    line-height: 1.4;
    white-space: pre-line;
    pointer-events: none;
}
.tw-tip[hidden] { display: none; }

/* ============================================================================
   GWL-Popup mit Schema-Karte (js/tageswerte.js Abschnitt 6/6b, js/gwl_karte.js)
   <dialog> (Touch) mit .ipu-header aus style.css: Desktop mittig, Handy Bottom-Sheet.
   .gk-panel: schwebende Vorschau am Desktop mit Maus (Hover, Klick fixiert).
   Kartenfarben nur hier (Klassen gk-*) → Theme-Wechsel ohne Neuzeichnen.
   ============================================================================ */
.wetterhistorie-table tbody td[data-g] { cursor: pointer; }
.wetterhistorie-table tbody td[data-g]:focus { outline: none; }
.wetterhistorie-table tbody td[data-g]:focus-visible { outline: 2px solid var(--blue-light); outline-offset: -2px; }
.wetterhistorie-table tbody td.gk-aktiv { background-color: rgb(var(--gwl-rgb) / 0.14); }   /* Block zum offenen Panel */
.gk-popup, .gk-panel, .gk-farben {  /* .gk-farben: Kartenfarben ohne Popup (Übersicht) */
    --gk-meer: #0f1b2e;
    --gk-land: #1f2b40;
    --gk-kueste: rgba(148, 163, 184, 0.35);
    --gk-at: #33486b;
    --gk-alpen: #6b5a45;
    --gk-h: #60a5fa;
    --gk-t: #f87171;
    --gk-warm: #f87171;
    --gk-kalt: #60a5fa;
    --gk-neutral: #94a3b8;
    --gk-at-rand: #fbbf24;
    --gk-foehn: #f59e0b;
}
.gk-popup {
    width: min(520px, 94vw);
    margin: auto;                 /* globales Reset nimmt dem <dialog> sonst die Zentrierung */
    max-width: none;
    max-height: 90vh;
    max-height: 90dvh;
    padding: 0;
    overflow: auto;
    color: var(--text-primary);
    background: var(--bg-tooltip);
    -webkit-backdrop-filter: blur(14px);
            backdrop-filter: blur(14px);
    border: 1.5px solid var(--glass-medium);
    border-top: 3px solid rgb(var(--gwl-rgb, 96 165 250));
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 48px var(--overlay-heavy);
    overscroll-behavior: contain;
}
:root.light .gk-popup, :root.light .gk-panel, :root.light .gk-farben {
    --gk-meer: #dbe7f3;
    --gk-land: #f4f1ea;
    --gk-kueste: rgba(71, 85, 105, 0.45);
    --gk-at: #e6d9bd;
    --gk-alpen: #b79f80;
    --gk-h: #2563eb;
    --gk-t: #dc2626;
    --gk-warm: #dc2626;
    --gk-kalt: #2563eb;
    --gk-neutral: #64748b;
    --gk-at-rand: #b45309;
    --gk-foehn: #b45309;
}
.gk-popup::backdrop { background: var(--overlay-heavy); }
.gk-innen { padding: 1.1rem 1.25rem 1rem; }
.gk-popup .ipu-header { margin-bottom: 0.5rem; padding-bottom: 0.5rem; gap: 0.4rem; }
/* Titel: Großwettertyp groß, Name der Lage klein darunter */
.gk-titel { display: flex; flex-direction: column; min-width: 0; margin-right: auto; }
.gk-typ  { font-size: var(--fs-lg); font-weight: 700; line-height: 1.2; color: var(--text-primary); }
.gk-name { font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.3; }
.gk-info {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    font: inherit;
    font-size: var(--fs-md);
    line-height: 1;
    color: var(--blue-light);
    background: none;
    border: none;
    border-radius: 50%;
    cursor: help;
}
.gk-info:hover, .gk-info[aria-expanded="true"] { background: var(--glass-medium); }
.gk-hinweis { margin: 0 0 0.5rem; font-size: var(--fs-xs); color: var(--text-muted); }
.gk-zeit { font-size: var(--fs-sm); color: var(--text-secondary); margin-bottom: 0.5rem; }
/* Schlagwörter wie die Chips der Seite (--fs-sm, 600); Farbe: warm rot, kalt blau, Föhn orange */
.gk-worte { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.gk-chip {
    padding: 0.2rem 0.55rem;
    font-size: var(--fs-sm);
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-secondary);
    border: 1px solid var(--glass-medium, var(--blue-a25));
    border-radius: var(--radius-sm);
}
.gk-chip-warm  { color: var(--gk-warm);  border-color: currentColor; }
.gk-chip-kalt  { color: var(--gk-kalt);  border-color: currentColor; }
.gk-chip-foehn { color: var(--gk-foehn); border-color: currentColor; }
.gk-bild { margin: 0 0 0.5rem; }
.gk-laedt {
    aspect-ratio: 472 / 420;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: var(--glass-light);
    border-radius: var(--radius-md);
}

/* Karte */
.gk-karte { display: block; width: 100%; height: auto; border-radius: var(--radius-md); }
.gk-meer  { fill: var(--gk-meer); }
.gk-land  { fill: var(--gk-land); stroke: var(--gk-kueste); stroke-width: 0.8; stroke-linejoin: round; }
.gk-at    { fill: var(--gk-at); }
.gk-alpen { fill: var(--gk-alpen); opacity: 0.45; }                  /* halbtransparent: Österreich scheint durch */
.gk-at-rand { fill: none; stroke: var(--gk-at-rand); stroke-width: 1.6; stroke-linejoin: round; }
.gk-iso   { fill: none; stroke-width: 1.4; }
.gk-iso-h { stroke: var(--gk-h); opacity: 0.55; }
.gk-iso-t { stroke: var(--gk-t); opacity: 0.55; }
.gk-zt {
    font: 800 24px/1 system-ui, sans-serif;
    text-anchor: middle;
    dominant-baseline: central;
    paint-order: stroke;
    stroke: var(--gk-meer);
    stroke-width: 4px;
}
.gk-zt-h { fill: var(--gk-h); }
.gk-zt-t { fill: var(--gk-t); }
.gk-achse { fill: none; stroke-width: 2.2; stroke-dasharray: 7 5; stroke-linecap: round; }
.gk-achse-trog { stroke: var(--gk-t); }
.gk-achse-keil, .gk-achse-bruecke { stroke: var(--gk-h); }
.gk-achse-schwach { stroke-width: 1.4; stroke-dasharray: 4 5; opacity: 0.6; }   /* unterbrochene Brücke (BMz) */
.gk-pfeil path    { fill: none; stroke: var(--gk-pfeil); stroke-linecap: round; opacity: 0.85; }
.gk-pfeil polygon { fill: var(--gk-pfeil); opacity: 0.85; }
.gk-warm    { --gk-pfeil: var(--gk-warm); }
.gk-kalt    { --gk-pfeil: var(--gk-kalt); }
.gk-neutral { --gk-pfeil: var(--gk-neutral); }
.gk-ort { fill: #fff; stroke: #0f172a; stroke-width: 1.2; }   /* Schladming: nur Punkt, ohne Beschriftung */

/* Vorschau-Panel (Desktop/Maus): kompakt, ohne Abdunklung, am body (nicht vom Scrollbereich abgeschnitten) */
.gk-panel {
    position: fixed;
    z-index: 9000;                       /* wie .tw-tip: über Tabelle, unter Leiste/Menü */
    width: 330px;
    max-height: calc(100vh - 16px);
    overflow: auto;
    color: var(--text-primary);
    background: var(--bg-tooltip);
    -webkit-backdrop-filter: blur(14px);
            backdrop-filter: blur(14px);
    border: 1px solid var(--glass-medium);
    border-top: 3px solid rgb(var(--gwl-rgb, 96 165 250));
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overscroll-behavior: contain;
}
.gk-panel[hidden] { display: none; }
.gk-panel .gk-innen { padding: 0.6rem 0.75rem 0.65rem; }
.gk-panel .ipu-header { margin-bottom: 0.4rem; padding-bottom: 0.4rem; gap: 0.3rem; }
.gk-panel .gk-typ { font-size: var(--fs-md); }
.gk-panel .gk-info { width: 24px; height: 24px; font-size: var(--fs-sm); }
.gk-panel .ipu-close { font-size: var(--fs-lg); }
.gk-panel:not(.fixiert) .ipu-close { display: none; }    /* X nur im fixierten Zustand */
.gk-panel .gk-zeit { margin-bottom: 0.4rem; }
.gk-panel .gk-bild { margin-bottom: 0.4rem; }
.gk-panel .gk-chip { padding: 0.1rem 0.45rem; font-size: var(--fs-xs); }
.gk-panel #gk-p-h:focus { outline: none; }

/* Handy: Bottom-Sheet */
@media (max-width: 600px) {
    .gk-popup {
        width: 100%;
        max-height: 88dvh;
        margin: auto 0 0;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        border-bottom: none;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .gk-innen { padding: 0.9rem 0.9rem 0.8rem; }
}
.gk-popup #gk-h:focus { outline: none; }   /* Startfokus auf dem Titel (kein Fokusrahmen am X) */
