/* ---------- 1. Farben, Schriften, Maße ---------- */
:root {
  --schnee: #f2f6fa;      /* Hintergrund */
  --flaeche: #ffffff;     /* Karten und Knöpfe */
  --nacht: #14213d;       /* Text */
  --nebel: #657184;       /* Nebentext, geschlossene Gebiete (Kontrast mind. 4,5 : 1) */
  --gletscher: #0b7588;   /* offen (weiße Schrift darauf: Kontrast mind. 4,5 : 1) */
  --auf-gletscher: #ffffff; /* Schrift auf der türkisen Scheibe */
  --gletscher-hell: #d5f1f5;
  --sonne: #ffc53d;       /* Akzent */
  --warnung: #b4540a;
  --schatten: 0 6px 0 rgba(20, 33, 61, 0.14);
  --rund: 22px;
  --schrift-titel: "Fredoka", "Trebuchet MS", sans-serif;
  --schrift-text: "Figtree", system-ui, sans-serif;
  color-scheme: light;
}

/* Die App ist immer hell, auch wenn das Gerät auf dunkel steht. Das dunkle Design
   schaltet man selbst ein (Liste und Suche → Über diese App), siehe app.js. */
:root[data-theme="dark"] {
  --schnee: #0d1730;
  --flaeche: #1a2847;
  --nacht: #eaf1f8;
  --nebel: #9fb0c8;
  --gletscher: #4fd0e3;
  --auf-gletscher: #0d1730; /* auf hellem Türkis ist dunkle Schrift lesbar, weiße nicht */
  --gletscher-hell: #123c4b;
  --sonne: #ffc53d;
  --warnung: #ffb37a;
  --schatten: 0 6px 0 rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

/* ---------- 2. Grundgerüst ---------- */
* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--schrift-text);
  font-size: 1rem;
  line-height: 1.45;
  color: var(--nacht);
  background: var(--schnee);
}

button { font: inherit; color: inherit; cursor: pointer; }

:focus-visible {
  outline: 3px solid var(--sonne);
  outline-offset: 2px;
}

#karte {
  position: fixed;
  inset: 0;
  background: var(--schnee);
}

/* Kartenkacheln etwas entsättigen, damit die Markierungen hervorstechen */
.leaflet-tile-pane { filter: saturate(0.55) brightness(1.03); }

[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(190deg) saturate(0.5) brightness(0.9); }

.leaflet-container { font-family: var(--schrift-text); }

/* ---------- 3. Der Skipass (Titel und Zähler) ---------- */
/* Gemeinsamer Behälter für Skipass und Filter. Er selbst fängt keine Klicks ab,
   damit man die Karte auch in der Lücke daneben verschieben kann. */
.oben {
  position: fixed;
  z-index: 1100;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
}

.oben > * { pointer-events: auto; }

.skipass {
  position: relative;
  max-width: min(300px, 100%);
  padding: 12px 18px 12px 40px;
  background: var(--flaeche);
  border-radius: var(--rund);
  box-shadow: var(--schatten);
  transform: rotate(-1.5deg);
}

/* Das gestanzte Loch im Skipass */
.skipass::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--schnee);
  box-shadow: inset 0 2px 0 rgba(20, 33, 61, 0.18);
}

.skipass h1 {
  margin: 0;
  font-family: var(--schrift-titel);
  font-weight: 600;
  font-size: 1.6rem;
  line-height: 1.1;
}

.skipass p { margin: 2px 0 0; }

.skipass__stand {
  font-size: 0.8rem;
  color: var(--nebel);
}

.skipass__stand--hinweis { color: var(--warnung); font-weight: 600; }

/* Der Zähler ist ein Knopf, der die Liste öffnet. Er sieht aus wie Text mit Pfeil. */
.zaehler {
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
}

.zaehler::after {
  content: " ›";
  font-weight: 600;
  color: var(--gletscher);
}

/* Überschriften im Blatt bekommen den Fokus nur, damit Vorleseprogramme dort beginnen */
[tabindex="-1"]:focus { outline: none; }

/* ---------- 4. Filterknöpfe ---------- */
.filter {
  align-self: stretch;  /* volle Breite, damit die Knöpfe seitlich scrollen können */
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: none;
}

.filter::-webkit-scrollbar { display: none; }

.filter button {
  flex: none;
  padding: 8px 14px;
  border: 2px solid var(--nacht);
  border-radius: 999px;
  background: var(--flaeche);
  font-weight: 600;
  white-space: nowrap;
}

.filter button[aria-pressed="true"] {
  background: var(--nacht);
  color: var(--flaeche);
}

/* ---------- 5. Markierungen auf der Karte ---------- */
.stecker { background: none; border: 0; }

.stecker__scheibe {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  font-family: var(--schrift-titel);
  font-weight: 600;
}

/* offen: große Scheibe mit der Zahl der offenen Lifte */
.stecker--open .stecker__scheibe {
  background: var(--gletscher);
  color: var(--auf-gletscher);
  font-size: 1.05rem;
  border: 3px solid #fff;
  box-shadow: 0 4px 0 rgba(20, 33, 61, 0.3);
  animation: schneefall 0.6s cubic-bezier(0.3, 1.4, 0.5, 1) backwards;
}

/* geschlossen: kleiner grauer Punkt */
.stecker--closed .stecker__scheibe {
  background: var(--nebel);
  border: 2px solid #fff;
}

/* Die offenen Gebiete fallen beim Laden wie Schneeflocken auf die Karte */
@keyframes schneefall {
  from { transform: translateY(-60px) scale(0.4); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* ---------- 6. Listenknopf ---------- */
.listen-knopf {
  position: fixed;
  z-index: 1100;
  left: 12px;
  /* 48px: Auf schmalen Handys bricht die Quellenzeile der Karte in zwei Zeilen um.
     Der Knopf muss darüber liegen, sonst verdeckt er die Pflichtangabe. */
  bottom: calc(48px + env(safe-area-inset-bottom, 0px));
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--sonne);
  color: #14213d;
  font-weight: 600;
  box-shadow: var(--schatten);
}

.listen-knopf:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(20, 33, 61, 0.14); }

/* ---------- 7. Das Blatt mit den Details ---------- */
.blatt {
  position: fixed;
  z-index: 1200;
  left: 0;
  right: 0;
  bottom: 0;
  /* Höchstens 72 % der Höhe und nie über den Skipass. Die Filter sind ausgeblendet,
     solange das Blatt offen ist. --skipass-unten setzt app.js auf die Unterkante des Skipass. */
  max-height: min(72vh, calc(100vh - var(--skipass-unten, 0px) - 12px));
  max-height: min(72dvh, calc(100dvh - var(--skipass-unten, 0px) - 12px));
  overflow-y: auto;
  overscroll-behavior: contain;  /* kein „Ziehen zum Aktualisieren“ der ganzen Seite */
  padding: 22px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  background: var(--flaeche);
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -6px 0 rgba(20, 33, 61, 0.12);
  animation: hochfahren 0.28s ease-out;
}

.blatt[hidden] { display: none; }

/* Solange das Blatt offen ist, verschwinden die Filterknöpfe.
   visibility nimmt sie auch aus der Tab-Reihenfolge und für Vorleseprogramme heraus. */
.filter { transition: opacity 0.2s ease, visibility 0s linear 0s; }

body.blatt-offen .filter {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}

@keyframes hochfahren {
  from { transform: translateY(40%); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.blatt__zu {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--schnee);
  font-size: 1.5rem;
  line-height: 1;
}

.blatt h2 {
  margin: 0 100px 2px 0;  /* Platz für Stern und × */
  font-family: var(--schrift-titel);
  font-weight: 600;
  font-size: 1.45rem;
  line-height: 1.15;
}

.blatt__region { margin: 0; color: var(--nebel); }

/* Distanz vom Startort, direkt unter dem Bundesland */
.blatt__weg {
  margin: 2px 0 12px;
  font-weight: 600;
}

.abzeichen {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 600;
  background: var(--schnee);
}

.abzeichen--open { background: var(--gletscher-hell); color: var(--gletscher); }

.werte {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0;
  padding: 0;
  list-style: none;
}

.werte li {
  padding: 12px 10px;
  border-radius: 16px;
  background: var(--schnee);
}

.werte strong {
  display: block;
  font-family: var(--schrift-titel);
  font-weight: 600;
  font-size: 1.35rem;
  line-height: 1.1;
}

.werte span { font-size: 0.85rem; color: var(--nebel); }

.hinweis { margin: 8px 0; font-size: 0.9rem; color: var(--nebel); }
.hinweis--warnung { color: var(--warnung); font-weight: 600; }

.knopf {
  display: inline-block;
  margin-top: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--nacht);
  color: var(--flaeche);
  font-weight: 600;
  text-decoration: none;
}

/* Ohne diese Zeile bliebe der Website-Knopf sichtbar (ohne Ziel), bis die Adresse geladen ist */
.knopf[hidden] { display: none; }

.liste { margin: 14px 0 0; padding: 0; list-style: none; }

.liste button {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 4px;
  border: 0;
  border-bottom: 2px solid var(--schnee);
  background: none;
  text-align: left;
}

.liste b { font-weight: 600; }
.liste span { color: var(--nebel); white-space: nowrap; }

/* ---------- 8. Größere Bildschirme ---------- */
@media (min-width: 720px) {
  .blatt {
    left: 16px;
    right: auto;
    bottom: 16px;
    width: 400px;
    max-height: calc(100vh - var(--skipass-unten, 0px) - 28px);
    max-height: calc(100dvh - var(--skipass-unten, 0px) - 28px);
    border-radius: 28px;
    box-shadow: var(--schatten);
  }
  .listen-knopf { left: auto; right: 16px; bottom: 100px; }
}

/* ---------- 9. Erweiterungen: Favoriten, Details, Teilen, Suche ---------- */

/* Nur für Vorleseprogramme sichtbar */
.unsichtbar {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Nach dem ersten Laden fallen die Scheiben nicht mehr (Aktualisierung, Filter, Favorit) */
#karte.ruhig .stecker__scheibe { animation: none; }

/* Favoriten bekommen einen Ring in Sonnengelb */
.stecker--favorit .stecker__scheibe {
  outline: 3px solid var(--sonne);
  outline-offset: 1px;
}

.blatt__stern {
  position: absolute;
  top: 12px;
  right: 62px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--schnee);
}

.blatt__stern svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linejoin: round;
}

.blatt__stern[aria-pressed="true"] svg {
  fill: var(--sonne);
  stroke: #c98f00;
}

/* Teilen-Icon direkt neben dem Favoritenstern im Gebietsheader. */
.blatt--gebiet .blatt__teilen {
  position: absolute;
  top: 12px;
  right: 110px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--schnee);
  color: var(--nacht);
}
.blatt--gebiet .blatt__teilen svg {
  width: 20px;
  height: 20px;
}
.blatt--gebiet h2 {
  margin-right: 144px;
}
/* Kleiner Website-Link unter der Anfahrt statt großer Button am Ende. */
.blatt--gebiet .blatt__website {
  display: table;
  width: fit-content;
  margin: 0 0 12px;
  padding: 0;
  color: var(--gletscher);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.blatt--gebiet .blatt__website[hidden] { display: none; }

/* Dezente Links in einer Zeile unter der Anfahrt. */
.blatt--gebiet .blatt__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 16px;
  margin: 0 0 12px;
}
.blatt--gebiet .blatt__links .blatt__website {
  margin: 0;
  color: var(--nebel);
  font-weight: 500;
  font-size: 0.81rem;
  text-decoration-color: color-mix(in srgb, var(--nebel) 48%, transparent);
}
.blatt--gebiet .blatt__links .blatt__website:hover,
.blatt--gebiet .blatt__links .blatt__website:focus-visible {
  color: var(--nacht);
  text-decoration-color: currentColor;
}
.blatt--gebiet .blatt__links .blatt__website[hidden] { display: none; }
@media (max-width: 359px) {
  .blatt--gebiet h2 { margin-right: 132px; }
  .blatt--gebiet .blatt__teilen { right: 108px; }
}

.abschnitt { margin-top: 18px; }

.abschnitt h3 {
  margin: 0 0 8px;
  font-family: var(--schrift-titel);
  font-weight: 600;
  font-size: 1.1rem;
}

.abschnitt .liste { margin-top: 0; }

/* Pisten nach Schwierigkeit: farbiger Punkt, Name, Wert und darunter ein Balken */
.pisten {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.piste {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 8px;
  row-gap: 4px;
}

.piste__punkt {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--nebel);
  box-shadow: 0 0 0 1.5px var(--flaeche), 0 0 0 3px var(--nebel);
}

.piste__punkt--easy { background: #2a6fdb; }
.piste__punkt--intermediate { background: #d93f3f; }
.piste__punkt--difficult { background: #000; }
.piste__punkt--ski_route { background: #e58a1f; }

.piste__wert {
  color: var(--nebel);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.piste__balken {
  grid-column: 1 / -1;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--schnee);
}

.piste__balken span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--gletscher);
}

/* Lifte nach Art als kleine Kacheln */
.liftarten {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.liftarten li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--schnee);
}

.liftarten b {
  font-family: var(--schrift-titel);
  font-weight: 600;
  white-space: nowrap;
}

.liftarten span { font-size: 0.9rem; color: var(--nebel); }

/* Messstationen */
.stationen { margin: 0; padding: 0; list-style: none; }

.stationen li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 12px;
  padding: 8px 0;
  border-bottom: 2px solid var(--schnee);
  font-size: 0.95rem;
}

.stationen b { font-weight: 600; }
.stationen span { color: var(--nebel); white-space: nowrap; }

/* Website und Teilen nebeneinander */
.knoepfe {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.knoepfe .knopf { margin-top: 0; }

.knopf--hell {
  border: 0;
  background: var(--schnee);
  color: var(--nacht);
}

/* Suchfeld in der Liste */
.suche {
  width: 100%;
  margin: 12px 0 4px;
  padding: 12px 18px;
  border: 2px solid var(--nacht);
  border-radius: 999px;
  background: var(--flaeche);
  color: var(--nacht);
  font: inherit;
}

.suche::placeholder { color: var(--nebel); }

/* Startort-Auswahl im Skipass */
.skipass .skipass__start {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 0.9rem;
  color: var(--nebel);
}

.skipass__start label { flex: none; }

.skipass__start select {
  flex: 0 1 auto;
  min-width: 0;  /* darf schmaler werden als der längste Ortsname, damit alles in eine Zeile passt */
  padding: 4px 8px;
  border: 2px solid var(--nacht);
  border-radius: 999px;
  background: var(--flaeche);
  color: var(--nacht);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* Markierung für den Startort: kleines dunkles Schild */
.start-stecker { background: none; border: 0; }

.start-stecker span {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 3px 10px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--nacht);
  color: var(--flaeche);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 3px 0 rgba(20, 33, 61, 0.25);
}

/* Umschalter für die Sortierung in der Liste */
.umschalter {
  display: inline-flex;
  margin: 0 0 6px;
  padding: 3px;
  border-radius: 999px;
  background: var(--schnee);
}

.umschalter button {
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--nebel);
}

.umschalter button[aria-pressed="true"] {
  background: var(--flaeche);
  color: var(--nacht);
  box-shadow: 0 2px 0 rgba(20, 33, 61, 0.12);
}

/* Filter-Knopf vorne in der Leiste: mit Symbol, gelb sobald ein Filter aktiv ist */
.filter .filter__mehr {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.filter__mehr svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.filter .filter__mehr.aktiv {
  border-color: #14213d;
  background: var(--sonne);
  color: #14213d;
}

/* Auswahlknöpfe im Filter-Blatt */
.wahlen {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wahl {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 12px;
  border: 2px solid var(--nebel);
  border-radius: 999px;
  background: var(--flaeche);
  font-size: 0.95rem;
  font-weight: 600;
}

.wahl[aria-pressed="true"] {
  border-color: var(--nacht);
  background: var(--nacht);
  color: var(--flaeche);
}

.wahl:disabled { opacity: 0.45; cursor: not-allowed; }

.wahl__zahl {
  font-size: 0.85rem;
  font-weight: 400;
  opacity: 0.75;
}

.filter-ergebnis {
  margin: 20px 0 0;
  font-weight: 600;
}

button.knopf { border: 0; }
.knopf:disabled { opacity: 0.45; cursor: not-allowed; }

/* „Filter ändern“ in der Liste: sieht aus wie ein Link */
.textknopf {
  padding: 0;
  border: 0;
  background: none;
  color: var(--gletscher);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Saisonzeit im Blatt, Über-diese-App */
.hinweis--saison { color: var(--nacht); font-weight: 600; }
.ueber-text { margin: 0 0 8px; }
.ueber-knopf { display: block; margin-top: 20px; text-align: left; }

/* ---------- 10. Weniger Bewegung, wenn gewünscht ---------- */
@media (prefers-reduced-motion: reduce) {
  .stecker--open .stecker__scheibe,
  .blatt { animation: none; transition: none; }
}


/* Mobile Suche: beim Tippen füllt das Blatt den sichtbaren Bereich oberhalb der Tastatur.
   visualViewport-Werte werden in app.js aktualisiert (auch bei iOS Safari). */
@media (max-width: 719px) {
  .blatt.blatt--suche-fokus {
    top: var(--suche-oben, 8px);
    bottom: var(--suche-unten, 8px);
    max-height: none;
    height: auto;
    padding-top: 18px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: none;
  }

  .blatt.blatt--suche-fokus .suche {
    font-size: 16px; /* iPhone: kein automatischer Zoom beim Fokussieren */
  }
}


/* ---------- 11. Skiwetter: 14 Tage ---------- */
.wetter-vorschau {
  margin-top: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.wetter-ueberblick {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}
.wetter-kachel {
  padding: 10px 8px;
  border-radius: 14px;
  background: var(--schnee);
  min-width: 0;
}
.wetter-kachel span {
  display: block;
  font-size: 0.75rem;
  color: var(--nebel);
  line-height: 1.25;
}
.wetter-kachel strong {
  display: block;
  margin-top: 5px;
  font-family: var(--schrift-titel);
  font-size: 1.1rem;
  white-space: nowrap;
}
.wetter-bester { margin: 12px 0 4px; font-weight: 600; }
.wetter-tage {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 12px 0 0;
  padding: 3px 2px 12px;
}
.wetter-tag {
  flex: 0 0 94px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 9px 5px;
  background: var(--flaeche);
  border: 2px solid var(--schnee);
  border-radius: 16px;
  scroll-snap-align: start;
  text-align: center;
  line-height: 1.3;
}
.wetter-tag[aria-pressed="true"] {
  border-color: var(--gletscher);
  background: var(--gletscher-hell);
}
.wetter-tag__datum { font-size: 0.76rem; color: var(--nebel); white-space: nowrap; }
.wetter-tag__symbol { font-size: 1.5rem; line-height: 1.4; }
.wetter-tag__schnee { font-size: 0.85rem; font-weight: 600; }
.wetter-tag__score { font-size: 0.78rem; color: var(--nebel); }
.wetter-details {
  margin-top: 2px;
  padding: 12px;
  border-radius: 14px;
  background: var(--schnee);
}
.wetter-details__werte {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 6px 14px;
  margin-top: 10px;
}
.wetter-details__werte p { margin: 0; font-size: 0.86rem; }
.wetter-details__werte span { display: block; color: var(--nebel); }
.wetter-details__werte b { display: block; }
.wetter-quelle a { color: var(--gletscher); }


/* Webcam-Vorschau: Originalbild unverändert im erlaubten 16:9-Format. */
.webcam-vorschau { margin-top: 18px; }
.webcam-vorschau__bild {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 16px;
  background: var(--schnee);
}
.webcam-vorschau__bild img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: contain;
}
.webcam-vorschau__titel {
  font-weight: 600;
  font-size: 0.9rem;
  margin: 8px 0 2px;
}
.webcam-vorschau__quelle { margin-top: 2px; }
.webcam-vorschau__quelle a { color: var(--gletscher); font-weight: 600; }


/* Skipasspreise: erwachsene Tages- und Halbtageskarten */
.ticketpreise__info { margin: 0 0 10px; color: var(--nebel); font-size: 0.9rem; }
.ticketpreise__datum { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 12px; }
.ticketpreise__datum label { font-weight: 600; font-size: 0.9rem; }
.ticketpreise__datum input { min-width: 0; max-width: 190px; padding: 8px 10px; border: 2px solid var(--nacht); border-radius: 10px; background: var(--flaeche); color: var(--nacht); font: inherit; font-size: 16px; }
.ticketpreise__saison { margin: 0 0 8px; color: var(--nebel); font-size: 0.85rem; }
.ticketpreise__karten { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.ticketpreise__karte { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; background: var(--schnee); padding: 12px; border-radius: 16px; }
.ticketpreise__kartenname { font-weight: 600; font-size: 0.93rem; }
.ticketpreise__preis { font-family: var(--schrift-titel); font-size: 1.45rem; line-height: 1.2; }
.ticketpreise__zeit, .ticketpreise__typ { color: var(--nebel); font-size: 0.78rem; line-height: 1.25; }
.ticketpreise__online { font-weight: 600; font-size: 0.84rem; margin-top: 7px; }
.ticketpreise__quelle a { color: var(--gletscher); font-weight: 600; }
.ticketpreise__fallback { margin: 12px 0 6px; }
.ticketpreise__fallback-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  max-width: 100%;
  padding: 9px 12px;
  border-radius: 12px;
  background: var(--schnee);
  color: var(--nacht);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.35;
}
.ticketpreise__fallback-link:hover { text-decoration: underline; }

@media (max-width: 350px) { .ticketpreise__karten { grid-template-columns: 1fr; } }


/* ---------- 12. Feste Kategorienleiste ohne durchscheinenden Inhalt ---------- */
/* Das äußere Blatt hat sonst 22px Scroll-Padding oben. Dadurch blieb beim
   alten sticky-Tab eine sichtbare Lücke, durch die Text scrollen konnte. */
.blatt--gebiet {
  padding-top: 0;
  scroll-behavior: smooth;
}
.blatt--gebiet #blatt-inhalt { padding-top: 22px; }
.blatt--gebiet .werte { margin: 12px 0; gap: 8px; }
.blatt--gebiet .werte li { padding: 10px 8px; }
.blatt--gebiet .blatt__weg { margin-bottom: 8px; }

/* Volle Breite, deckender Hintergrund, klare Kante zum Inhalt. */
.gebietsnav {
  position: sticky;
  top: 0;
  z-index: 30;
  margin: 12px -20px 18px;
  padding: 5px 16px 9px;
  background: var(--flaeche);
  border-bottom: 1px solid var(--schnee);
}
.gebietsnav--fixiert {
  box-shadow: 0 5px 12px rgba(20, 33, 61, 0.13);
}
.gebietsnav__kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 34px;
  margin-bottom: 4px;
}
.gebietsnav__name {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--schrift-titel);
  font-size: 0.95rem;
  font-weight: 600;
}
.gebietsnav__schliessen {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--schnee);
  font-size: 1.25rem;
  line-height: 1;
}
.gebietsnav__leiste {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px 0;
}
.gebietsnav__leiste::-webkit-scrollbar { display: none; }
.gebietsnav__tab {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 11px;
  border: 0;
  border-radius: 999px;
  font-size: 0.81rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  background: var(--schnee);
  color: var(--nacht);
}
.gebietsnav__tab[aria-current="true"] {
  background: var(--nacht);
  color: var(--flaeche);
}
.gebiet-abschnitt {
  display: flow-root; /* Verhindert, dass innere Abstände über die Trennlinie kollabieren. */
  min-width: 0;
  margin: 0;
  scroll-margin-top: 100px;
}
/* Leichte Trennung zwischen Pisten, Liften, Wetter, Preisen und Webcams.
   Die Linie nutzt die gleiche Farbe in Hell- und Dunkelmodus. */
.gebiet-abschnitt + .gebiet-abschnitt {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid color-mix(in srgb, var(--nebel) 22%, transparent);
}
.gebiet-abschnitt:last-of-type { margin-bottom: 18px; }
/* Gleicher Startpunkt für alle Sektionen, auch bei verschachtelten Komponenten. */
.gebiet-abschnitt > .abschnitt,
.gebiet-abschnitt > .wetter-vorschau,
.gebiet-abschnitt > .ticketpreise,
.gebiet-abschnitt > .webcam-vorschau { margin-top: 0; }
.gebiet-abschnitt > :first-child { margin-top: 0; }
.gebiet-abschnitt > .abschnitt > h3:first-child,
.gebiet-abschnitt > .wetter-vorschau > h3:first-child,
.gebiet-abschnitt > .ticketpreise > h3:first-child { margin-top: 0; }
/* Die Live-Messstationen liegen in einem zusätzlichen div. Dessen innere
   .abschnitt-Margin erzeugte nur bei „Schnee und Wetter“ 18px mehr Abstand. */
.gebiet-abschnitt > div:first-child > .abschnitt:first-child {
  margin-top: 0;
}
.gebiet-abschnitt > div:first-child:has(> .abschnitt) {
  display: flow-root;
}
.gebiet-abschnitt > h3 {
  margin: 0 0 8px;
  font-family: var(--schrift-titel);
  font-size: 1.1rem;
}
.gebiet-abschnitt > .webcam-vorschau { margin-top: 8px; }
.webcam-vorschau__link { display: inline-block; margin-top: 10px; }
@media (prefers-reduced-motion: reduce) {
  .blatt--gebiet { scroll-behavior: auto; }
}


/* Verifizierte Pistenpläne und georeferenzierte OpenSnowMap-Karte. */
.pistenplan__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.pistenplan__link,
.pistenplan__suche {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 9px 13px;
  border-radius: 12px;
  background: var(--schnee);
  color: var(--nacht);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.3;
}
.pistenplan__link--offiziell {
  background: var(--gletscher-hell);
  color: var(--gletscher);
}
.pistenplan__suche {
  background: transparent;
  color: var(--nebel);
  padding-left: 2px;
  padding-right: 2px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Original-Pistenplan nur anzeigen, wenn Einbettung und Quelle geklärt sind. */
.pistenplan__vorschau {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border-radius: 14px;
  background: var(--schnee);
}
.pistenplan__vorschau img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 380px;
  object-fit: contain;
}
.pistenplan__quelle {
  margin: 6px 0 14px;
  font-size: 0.75rem;
  color: var(--nebel);
  line-height: 1.35;
}
.pistenplan__inhalt > .hinweis { margin-top: 0; }

.pistenplan__quelle-link {
  color: inherit;
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.pistenplan__vorschau:focus-visible {
  outline: 3px solid var(--sonne);
  outline-offset: 3px;
}


/* Zusätzliche Schnee- und Pisteninformationen im Gebietskopf. */
.gebiet-offenanteil { margin: 2px 0 12px; }
.gebiet-offenanteil__text {
  margin: 0 0 7px;
  font-size: 0.88rem;
  font-weight: 600;
}
.gebiet-offenanteil__balken {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--schnee);
}
.gebiet-offenanteil__balken span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--gletscher);
}
.gebiet-schneedetails { margin: 10px 0; }
.gebiet-schneedetails:empty,
.gebiet-prognosekurz:empty { display: none; }
.gebiet-schneedetails__zeile {
  margin: 4px 0;
  font-size: 0.86rem;
  line-height: 1.4;
}
.gebiet-schneedetails__quelle { color: var(--nebel); font-size: 0.78rem; }
.gebiet-neuschnee {
  margin: 12px 0;
  padding: 12px;
  border-radius: 14px;
  background: var(--schnee);
}
.gebiet-neuschnee__titel { margin: 0 0 8px; font-size: 0.88rem; font-weight: 600; }
.gebiet-neuschnee__werte { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.gebiet-neuschnee__wert { min-width: 0; }
.gebiet-neuschnee__wert span { display: block; font-size: 0.75rem; color: var(--nebel); }
.gebiet-neuschnee__wert strong { display: block; font-family: var(--schrift-titel); font-size: 1.2rem; }
.gebiet-neuschnee__hinweis { font-size: 0.74rem; margin-bottom: 0; }

/* ---------- 14. Bedienbarkeit: Übersicht, Platz am Handy, Tippflächen ---------- */

/* Weit herausgezoomt sind die offenen Scheiben kleiner, damit sie einander weniger verdecken.
   Zusätzlich rückt app.js überlappende Scheiben ein Stück auseinander (siehe entzerreStecker). */
#karte.karte--weit .stecker--open .stecker__scheibe {
  width: 34px;
  height: 34px;
  margin: 5px;
  font-size: 0.92rem;
  border-width: 2px;
}

/* Die drei Kennzahlen: Zahl bleibt in einer Zeile, die Beschriftung bricht eng um */
.werte strong { white-space: nowrap; }
.werte span { display: block; margin-top: 4px; line-height: 1.25; }

.wetter-nochmal { margin-top: 4px; }

.ueber-design { margin-top: 4px; }

@media (max-width: 719px) {
  .werte strong { font-size: clamp(1rem, 5.4vw, 1.35rem); }

  /* Im Blatt eines Gebiets verschwindet der Skipass, das Blatt bekommt den Platz.
     In Liste und Filter bleibt er, weil man dort den Startort braucht. */
  .skipass { transition: opacity 0.2s ease, visibility 0s linear 0s; }
  body.gebiet-offen .skipass {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0s linear 0.2s;
  }
  body.gebiet-offen .blatt {
    max-height: 84vh;
    max-height: min(84dvh, calc(100dvh - 64px - env(safe-area-inset-top, 0px)));
  }

  /* Tippflächen mindestens 44 px hoch */
  .zaehler { min-height: 44px; margin: -6px 0; }
  .skipass select { min-height: 44px; }
  .blatt__zu,
  .blatt__stern,
  .blatt--gebiet .blatt__teilen { width: 44px; height: 44px; top: 10px; }
  .blatt__zu { right: 12px; }
  .blatt__stern { right: 62px; }
  .blatt--gebiet .blatt__teilen { right: 112px; }
  .blatt--gebiet h2 { margin-right: 152px; }
  .blatt--gebiet .blatt__links { gap: 0 18px; margin-bottom: 6px; }
  .blatt--gebiet .blatt__links .blatt__website {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-size: 0.88rem;
  }
  .gebietsnav__kopf { height: 44px; margin-bottom: 2px; }
  .gebietsnav__schliessen { flex-basis: 44px; width: 44px; height: 44px; }
  .gebietsnav__tab { min-height: 44px; padding: 10px 14px; font-size: 0.88rem; }
  .gebiet-abschnitt { scroll-margin-top: 118px; }
  .umschalter button { min-height: 44px; padding: 10px 16px; }
  .wahl { min-height: 44px; }
  .knopf,
  .pistenplan__link,
  .pistenplan__suche,
  .ticketpreise__fallback-link { min-height: 44px; }
  .leaflet-touch .leaflet-bar a { width: 44px; height: 44px; line-height: 44px; }
}
@media (max-width: 359px) {
  .blatt--gebiet h2 { margin-right: 150px; }
}
@media (max-width: 719px) {
  .filter button { min-height: 44px; }
}

/* Desktop: Die Landkarte als eigenständige, eingerahmte Fläche statt
   randloser Vollbild-Hintergrund. Mobil bleibt alles bildschirmfüllend. */
@media (min-width: 720px) {
  #karte {
    inset: 16px;
    border: 1px solid color-mix(in srgb, var(--nebel) 25%, transparent);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 12px 36px rgba(20, 33, 61, 0.11), 0 2px 7px rgba(20, 33, 61, 0.06);
  }
  .oben {
    top: 32px;
    left: 32px;
    right: 32px;
  }
  .blatt {
    left: 32px;
    bottom: 32px;
    max-height: calc(100dvh - var(--skipass-unten, 0px) - 48px);
  }
  .listen-knopf { right: 32px; bottom: 116px; }
}
