/* Wasserpegel Neusiedl — Gestaltung
   Farbwelt: Seewasser, Schilf, Dunst. Hell ist die Grundfassung, damit die
   Seite bei Sonne auf dem Wasser ablesbar bleibt.

   Alle Farben stehen als Variablen hier und nur hier — auch die der
   Zeichnungen, die app.js zur Laufzeit ausliest. Wer eine Farbe ändert,
   ändert sie damit überall zugleich. */

:root {
  color-scheme: light dark;   /* Browser rechnet die Seite nicht selbst um */

  --tiefe:       #0F3B44;     /* Schrift */
  --gemessen:    #2E7D8F;     /* gemessene Werte */
  --gerechnet:   #C1662F;     /* gerechnete Werte — anderer Farbton, nicht
                                 nur andere Helligkeit: sonst in der dunklen
                                 Fassung nicht mehr unterscheidbar */
  --schilf:      #B08A2E;     /* Markierung des aktiven Reiters */
  --dunst:       #E4EBEC;     /* Seitengrund */
  --papier:      #FFFFFF;     /* Kartengrund */
  --linie:       #C3D2D4;
  --leise:       #5E7276;     /* Nebentext */
  --warn:        #9A3B26;

  --kopfgrund:   #0F3B44;     /* Kopf und Reiterleiste */
  --kopfschrift: #EAF2F3;
  --kopfleise:   #9FBCC1;
  --gegen:       #FFFFFF;     /* Schrift auf gefülltem Grund */
  --meldgrund:   #FBEDE9;
  --hinweisgrund:#F7F1DF;

  --rand: 16px;
  --schrift: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
             Arial, sans-serif;
}

/* Dunkle Fassung. Eigens gestaltet statt dem Browser überlassen: dessen
   automatische Umrechnung dreht Helligkeiten um und macht ähnliche Farben
   ununterscheidbar. Die beiden Kennfarben bleiben Türkis und Orange, nur
   heller, weil sie jetzt auf dunklem Grund stehen. */
@media (prefers-color-scheme: dark) {
  :root {
    --tiefe:       #E3EDEE;
    --gemessen:    #4FA8BC;
    --gerechnet:   #E08A45;
    --schilf:      #D2A73E;
    --dunst:       #0C1416;
    --papier:      #16211F;
    --linie:       #2E3F43;
    --leise:       #9AAFB3;
    --warn:        #E0755A;

    --kopfgrund:   #0A2A31;
    --kopfschrift: #E3EDEE;
    --kopfleise:   #8FAAB0;
    --gegen:       #0C1416;
    --meldgrund:   #35201B;
    --hinweisgrund:#2E2718;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--dunst);
  color: var(--tiefe);
  font-family: var(--schrift);
  font-size: 16px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

main { max-width: 720px; margin: 0 auto; padding: 0 var(--rand) 8px; }

/* ------------------------------------------------------------------ Kopf */
/* Titel links, Teilen rechts. Der Platz neben dem Titel war ungenutzt. */
.kopf {
  background: var(--kopfgrund);
  color: var(--kopfschrift);
  padding: 12px var(--rand);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.kopf h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.teilknopf {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 6px;
  margin: -6px -6px -6px 0;
  cursor: pointer;
  flex: 0 0 auto;
  line-height: 0;
  border-radius: 3px;
}
.teilknopf svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--kopfschrift);
  stroke-width: 1.8;
  stroke-linecap: round;
}
.teilknopf svg circle { fill: var(--kopfschrift); stroke: none; }
.teilknopf:active { background: rgba(127, 127, 127, 0.28); }
.teilknopf:focus-visible { outline: 2px solid var(--kopfschrift); outline-offset: 1px; }

/* --------------------------------------------------------------- Reiter */
/* Vier Reiter auf 360 Pixel: kleinere Schrift, wenig Innenabstand, im
   Notfall waagrecht schiebbar statt umbrechend. */
.reiter {
  display: flex;
  background: var(--kopfgrund);
  padding: 0 var(--rand);
  gap: 2px;
  position: sticky;
  top: 0;
  z-index: 5;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.reiter::-webkit-scrollbar { display: none; }
.reiter button {
  flex: 1 1 auto;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--kopfleise);
  font: inherit;
  font-size: 0.82rem;
  padding: 9px 3px 10px;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.reiter button[aria-selected="true"] {
  color: var(--kopfschrift);
  border-bottom-color: var(--schilf);
}
.reiter button:focus-visible { outline: 2px solid var(--kopfschrift); outline-offset: -3px; }

/* ------------------------------------------------------------ Meldungen */
#meldungen { max-width: 720px; margin: 0 auto; padding: 0 var(--rand); }
.meldung {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-left: 4px solid var(--warn);
  background: var(--meldgrund);
  font-size: 0.88rem;
}
.meldung.hinweis { border-left-color: var(--schilf); background: var(--hinweisgrund); }

/* ------------------------------------------------------------- Pegelfeld */
/* Zahl oben, darunter die Wasserlinie. Ihre Füllhöhe folgt dem Pegel und
   trennt den Einstieg von den Einzelheiten weiter unten. Die Zeichnung
   entsteht in app.js, weil sie den Messwert braucht. */
.pegelfeld {
  position: relative;
  margin-top: 16px;
  background: var(--papier);
  border-radius: 3px;
  overflow: hidden;
}
.pegelfeld .zahl { position: relative; z-index: 2; padding: 18px 16px 6px; }
.pegelfeld .gross {
  display: block;
  font-size: 3.1rem;
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.pegelfeld .klein {
  display: block;
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--leise);
}
.pegelfeld .welle { display: block; width: 100%; height: 64px; margin-top: -18px; }

/* ---------------------------------------------------------------- Blöcke */
.block {
  background: var(--papier);
  border-radius: 3px;
  margin-top: 10px;
  padding: 12px 14px;
}
.block h2 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 600;
}
.block h3 {
  margin: 14px 0 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--leise);
}
.block p { margin: 0 0 8px; }
.block p:last-child { margin-bottom: 0; }

.paar { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.paar dt, .paar .name { color: var(--leise); font-size: 0.9rem; }
.paar dd, .paar .wert { margin: 0; font-size: 0.95rem; text-align: right; }

.wichtig { font-size: 1.5rem; font-weight: 600; line-height: 1.2; white-space: nowrap; }
.neben { color: var(--leise); font-size: 0.85rem; }

.windzeile { display: flex; align-items: center; gap: 12px; }
.windzeile svg { flex: 0 0 auto; }

/* ---------------------------------------------------------------- Listen */
details { margin-top: 10px; }
details > summary {
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--leise);
  padding: 4px 0;
}
details > summary:focus-visible { outline: 2px solid var(--tiefe); }

/* Einheitenzeile über der Tabelle. Spart die Einheit in jeder Zelle — das
   war der Grund für die vierzeiligen Windspalten. */
.einheiten {
  margin: 4px 0 2px;
  font-size: 0.78rem;
  color: var(--leise);
}

table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th, td { text-align: right; padding: 5px 3px; border-bottom: 1px solid var(--linie); }
th:first-child, td:first-child { text-align: left; }
thead th { color: var(--leise); font-weight: 600; border-bottom-width: 2px; }
tbody tr:last-child td { border-bottom: 0; }

td.zeit { white-space: nowrap; }
td.wind { white-space: nowrap; line-height: 1.25; }
td.wind .w1, td.wind .w2 { display: block; }
td.wind .w2 { color: var(--leise); font-size: 0.94em; }
td.spanne { white-space: nowrap; }
tr.flau td { color: var(--leise); }

/* Art des Wertes: farbiger Punkt vor der Uhrzeit, gleiche Farben wie in
   der Grafik und in der Legende darüber. In den Listen setzt app.js die
   Farbe, im Info-Reiter reichen diese beiden Klassen. */
.punkt {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: baseline;
}
.punkt.gemessen  { background: var(--gemessen); }
.punkt.gerechnet { background: var(--gerechnet); }

/* ---------------------------------------------------------------- Grafik */
.grafik { width: 100%; height: 130px; display: block; margin-top: 6px; }
.legende {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.8rem;
  color: var(--leise);
  margin: 0 0 2px;
}
.legende span { display: flex; align-items: center; }

/* ------------------------------------------------------- Richtungswahl */
.richtungen { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.richtungen button {
  appearance: none;
  border: 1px solid var(--linie);
  background: var(--papier);
  color: var(--tiefe);
  font: inherit;
  font-size: 0.9rem;
  padding: 8px 0;
  border-radius: 3px;
  cursor: pointer;
}
.richtungen button[aria-pressed="true"] {
  background: var(--tiefe);
  border-color: var(--tiefe);
  color: var(--gegen);
}
.richtungen button[disabled] { opacity: 0.4; cursor: default; }

/* ------------------------------------------------------------------ Fuß */
.fuss { max-width: 720px; margin: 0 auto; padding: 18px var(--rand) 32px; }
.beta {
  margin: 0 0 12px;
  font-size: 0.82rem;
  color: var(--leise);
  border-top: 1px solid var(--linie);
  padding-top: 12px;
}

.knopfreihe { display: flex; flex-wrap: wrap; gap: 8px; }
.knopf {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--tiefe);
  background: transparent;
  color: var(--tiefe);
  font: inherit;
  font-size: 0.88rem;
  padding: 8px 14px;
  border-radius: 3px;
  cursor: pointer;
}
.knopf:active { background: var(--tiefe); color: var(--gegen); }
.knopf:active .sinnbild { stroke: var(--gegen); }
.sinnbild {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--tiefe);
  stroke-width: 1.7;
  stroke-linejoin: round;
}

.rueckwahl {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--papier);
  border-radius: 3px;
}
.rueckwahl .neben { margin: 0 0 8px; }

.quellen { margin: 14px 0 0; font-size: 0.72rem; color: var(--leise); line-height: 1.5; }

/* ----------------------------------------------------------------- Toast */
/* Rückmeldung für das Kopieren. Der Teilen-Knopf trägt nur ein Sinnbild,
   sein Text kann nicht als Meldung dienen. */
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  background: var(--kopfgrund);
  color: var(--kopfschrift);
  border: 1px solid var(--linie);
  font-size: 0.85rem;
  padding: 10px 16px;
  border-radius: 3px;
  z-index: 20;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
