/* ==========================================================================
   Seegrund Schweiz 3D – Stylesheet
   Alles Wichtige zum Anpassen steht oben in :root (Farben, Schriften, Grössen).
   ========================================================================== */

:root {
  /* ---- Farben ---- */
  --bg:        #0c1a22;   /* Hintergrund der App */
  --panel:     rgba(19, 48, 61, .93);
  --panel-solid: #132f3b;   /* deckende Variante für die Kopfzeile des Menüs */
  --field:     #0c1a22;   /* Hintergrund der Eingabefelder */
  --line:      #2c5566;   /* Rahmen, Trennlinien */
  --ink:       #e6f1f2;   /* Haupttext */
  --mute:      #8fb1b8;   /* Nebentext, Beschriftungen */
  --acc:       #7fd1c4;   /* Akzent (Buttons, Auswahl) */
  --acc-ink:   #06231f;   /* Text auf Akzentfarbe */
  --err:       #ffb4a2;
  --chip:      rgba(12, 26, 34, .78);  /* Schilder über der 3D-Ansicht */

  /* ---- Schriften ----
     Eigene Webfont verwenden: in index.html den <link> zu Google Fonts aktivieren
     und hier den Namen vorne eintragen, z. B. "Inter", … */
  --font-ui:      "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-heading: var(--font-ui);
  --font-num:     var(--font-ui);   /* Zahlen: Tiefen, Koordinaten */

  /* ---- Schriftgrössen ---- */
  --fs-base:   15px;
  --fs-small:  13px;
  --fs-tiny:   12px;
  --fs-micro:  11px;
  --fs-input:  16px;   /* nicht kleiner als 16px, sonst zoomt iOS beim Tippen */
  --fs-title:  16px;
  --lh:        1.4;

  /* ---- Abstände und Touch ---- */
  --tap:       48px;   /* Mindesthöhe für Felder, Buttons, Zeilen (Touch) */
  --gap:       16px;   /* Abstand zwischen Feldgruppen */
  --gap-s:     6px;    /* Abstand Beschriftung -> Feld */
  --pad-x:     14px;   /* Innenabstand der Felder links/rechts */
  --panel-pad: 16px;
  --list-pad:  14px;   /* Innenabstand links/rechts in der Trefferliste */

  /* ---- Formen ---- */
  --radius:    6px;
  --radius-lg: 10px;
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* iPhone: iOS legt unter die Statusleiste einen Verlauf, der etwas tiefer reicht als der sichere Bereich.
     Bedienelemente oben beginnen erst darunter (auf Geräten ohne Notch/Dynamic Island = 0). */
  --top-fade: min(var(--safe-top), 32px);
  --top-ui: calc(var(--safe-top) + var(--top-fade));
}

/* ---------- Grundlage ---------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;            /* kein Gummiband-Effekt, der oben hellen Hintergrund zeigt */
  touch-action: pan-x pan-y;            /* kein Hineinzoomen in die Seite (Karte und 3D-Ansicht zoomen selbst) */
  -webkit-user-select: none;            /* kein Markieren von Text */
  user-select: none;
  -webkit-touch-callout: none;          /* kein Kontextmenü bei langem Drücken */
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
}

/* Zahlen gleich breit, damit Tiefen und Koordinaten nicht springen */
#xy, #mh, #tip, .lvl, #exb, #msl { font-variant-numeric: tabular-nums; }
#tip, .lvl, #exb, #msl { font-family: var(--font-num); }

#c {
  position: fixed;
  inset: 0;                     /* bis ganz oben, auch unter Statusleiste und Dynamic Island */
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* ---------- Menü (Panel) ---------- */
#ui {
  position: fixed;
  z-index: 10;
  left: 0; right: 0; top: 0;
  /* iPhone: Safari legt oben einen Verlauf über die Seite (unter der Statusleiste und etwas darunter).
     Mit Notch/Dynamic Island das Menü etwas tiefer setzen, damit der Verlauf hinter dem Menü endet. */
  padding: calc(var(--top-ui) + 8px) 10px 0;   /* Menü unterhalb des iOS-Verlaufs */
  pointer-events: none;
}

#panel {
  pointer-events: auto;
  will-change: height;
  max-width: 420px;
  /* iPhone: 100vh ist höher als der sichtbare Bereich (Safari-Leisten) -> unterster Teil war nicht
     erreichbar und sprang zurück. --app-h = tatsächlich sichtbare Höhe (per JS), sonst 100dvh. */
  /* Das Menü selbst scrollt nicht: Titel oben und Buttons unten stehen fest,
     nur der Bereich dazwischen (#pbody) scrollt und federt. Höhe von #pbody setzt JS (fitPanel). */
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* deckend in exakt derselben Farbe wie Titelzeile und Button-Bereich -> keine Farbunterschiede,
     auch nicht während der Auf-/Zuklapp-Animation */
  background: var(--panel-solid);
  border-radius: var(--radius-lg);
  padding: 12px var(--panel-pad) calc(var(--panel-pad) + var(--safe-bottom));
}

summary {
  cursor: pointer;
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
  font-family: var(--font-heading);
  font-size: var(--fs-title);
  font-weight: 600;
  letter-spacing: .01em;
  /* Titelzeile: fest oben im Menü, über die ganze Breite, Text und Pfeil vertikal mittig */
  position: relative;
  z-index: 3;
  margin: -12px calc(-1 * var(--panel-pad)) 0;  /* hebt den oberen Innenabstand des Menüs auf */
  padding: 16px var(--panel-pad) 16px;
  background: var(--panel-solid);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-bottom: 1px solid transparent;
  transition: border-color .15s;
}
/* Eigener Pfeil (Chevron): zu = nach rechts, offen = nach unten; in Textfarbe */
summary::-webkit-details-marker { display: none; }
summary::marker { content: ''; }
summary::before {
  content: '';
  flex: none;
  width: 22px;
  height: 22px;
  margin-left: -3px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M9 18L15 12L9 6' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M9 18L15 12L9 6' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform .4s cubic-bezier(.33,1,.68,1);   /* gleich ruhig wie das Menü */
}
#panel.is-open > summary::before { transform: rotate(90deg); }   /* dreht sofort beim Antippen, nicht erst nach der Animation */
#panel.is-open.scrolled summary { border-bottom-color: var(--line); }   /* nur bei offenem Menü */

/* Titel und Buttons behalten immer ihre Höhe (auch während der Auf-/Zuklapp-Animation);
   nur der Scrollbereich dazwischen darf schrumpfen -> die Titelschrift bleibt ruhig stehen */
#panel > summary, #acts { flex: none; }
/* Titelzeile und Button-Bereich scrollen nicht: hier jede Zoom-/Wischgeste unterbinden, Tippen bleibt möglich */
#panel > summary, #acts { touch-action: none; }
/* Eingabefelder bleiben markier- und bearbeitbar */
input, textarea, select { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
/* Während des Auf-/Zuklappens: Buttons kleben am unteren Rand des Menüs und gleiten unter dem Titel
   hervor bzw. darunter weg – sie sind von Anfang an sichtbar und stehen an ihrer Stelle */
#panel { position: relative; }
#panel.anim #acts { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; z-index: 2; }
/* Scrollbereich zwischen Titel und Buttons */
#pbody {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;          /* Scrollen und Federn bleiben im Menü */
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  margin: 0 calc(-1 * var(--panel-pad));
  padding: 0 var(--panel-pad) 4px;
}

/* Buttons unten im Menü: bei wenig Höhe kleben sie unten, der Inhalt scrollt dahinter durch.
   Hat es genug Platz, stehen sie einfach am Ende des Inhalts. */
#acts {
  position: relative;                    /* fest unten im Menü (nicht im Scrollbereich) */
  z-index: 2;
  margin: 0 calc(-1 * var(--panel-pad));
  padding: 12px var(--panel-pad) calc(12px + var(--safe-bottom));
  background: var(--panel-solid);
  border-top: 1px solid transparent;
  transition: border-color .15s;
}
/* Offenes Menü ohne Innenabstand unten: so schliessen die klebenden Buttons bündig mit dem
   Menürand ab und es bleibt keine Lücke, durch die Inhalt scheint. Den Abstand unten bringt der Button-Bereich selbst mit. */
#panel[open] { padding-bottom: 0; }
/* Fehlermeldung oben im klebenden Button-Bereich */
#err { display: none; padding: 2px 0 2px; color: var(--err); font-size: 15px; line-height: 1.4; }
#err.on { display: block; }
#panel.stuck #acts { border-top-color: var(--line); }   /* feine Linie wie unter dem Titel */
#panel:not([open]) summary { border-radius: var(--radius-lg); }
#panel:not([open]) { padding-bottom: 0; }   /* eingeklappt: nur die Titelzeile */

/* Schmale Bildschirme: Quellenangabe ausblenden, solange das Menü offen ist (scheint sonst durch) */
@media (max-width: 600px) { body.menu-open #spin { display: none; } }   /* Quellenangabe bleibt immer sichtbar */   /* Handy: Lade-Ring sitzt dann in der Trefferzeile */

/* Schmale Bildschirme: Überhöhung links unter dem (eingeklappten) Menü, Kompass rechts darunter,
   damit nichts vom Menü verdeckt wird. --menu-b = Unterkante des Menüs (per JS gemessen) */
@media (max-width: 600px) {
  /* Überhöhung: im Fluss direkt unter dem Menü (per JS in #ui verschoben) */
  #exb.inflow { position: static; margin: 10px 0 0; pointer-events: auto; font-size: 15px; padding: 10px 36px 10px 12px; min-height: 44px; }
  #cmp { top: calc(var(--menu-b, 70px) + 4px); }
}

label {
  display: block;
  margin-top: var(--gap);
  margin-bottom: var(--gap-s);
  color: var(--mute);
  font-size: var(--fs-small);
}

/* ---------- Formularfelder ---------- */
input[type=text], input[type=number], input[type=search], input[type=password], select, textarea {
  width: 100%;
  font-family: inherit;
  font-size: var(--fs-input);
  line-height: var(--lh);
  min-height: var(--tap);
  padding: 10px var(--pad-x);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--acc); outline-offset: -1px; }
input[type=search] { -webkit-appearance: none; appearance: none; }

select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 40px;
  cursor: pointer;
  background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238fb1b8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 16px center;
}

.row { display: flex; gap: 12px; }
.row > div { flex: 1; }

.chk {
  display: flex;
  align-items: flex-start;    /* Checkbox auf Höhe der ersten Textzeile */
  gap: 14px;
  margin: 10px 0 0;
  padding: 12px 0;            /* grosse Tippfläche, ganze Zeile klickbar */
  min-height: var(--tap);
  color: var(--ink);
  font-size: 15px;
  line-height: 24px;          /* = Höhe der Checkbox, damit die erste Zeile mittig sitzt */
  cursor: pointer;
}
.chk + .chk { border-top: 1px solid rgba(44, 85, 102, .5); margin-top: 0; }


/* Eigene, grössere Checkbox */
.chk input[type=checkbox] {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 24px;
  height: 24px;
  margin: 0;
  border-radius: 6px;
  border: 1.5px solid var(--mute);
  background: var(--field);
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.chk input[type=checkbox]:hover { border-color: var(--acc); }
.chk input[type=checkbox]:checked {
  border-color: var(--acc);
  background: var(--acc) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4 8-9' fill='none' stroke='%2306231f' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / 20px 20px;
}
.chk input[type=checkbox]:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* ---------- Buttons ---------- */
button {
  margin-top: 12px;
  width: 100%;
  min-height: var(--tap);
  font-family: inherit;
  font-size: var(--fs-input);
  font-weight: 600;
  padding: 12px 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--acc);
  color: var(--acc-ink);
  cursor: pointer;
}
button:disabled { opacity: .5; cursor: default; }
button.sec {
  background: transparent;
  border: 1px solid var(--acc);
  color: var(--acc);
  margin-top: var(--gap);
}

/* ---------- Suche ---------- */
.srow { display: flex; gap: 10px; }
.srow input { flex: 1; min-width: 0; }
/* Suchfeld mit X zum Leeren */
.qwrap { position: relative; flex: 1; min-width: 0; display: flex; }
.qwrap input { padding-right: 44px; }
input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
#qx {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; min-height: 0; margin: 0; padding: 0;
  display: none; align-items: center; justify-content: center;
  border-radius: 50%; background: transparent; color: var(--mute);
}
#qx svg { width: 18px; height: 18px; }
#qx:hover, #qx:active { color: var(--ink); background: rgba(143, 177, 184, .15); }
.qwrap.has #qx { display: flex; }
.srow button { width: auto; margin-top: 0; padding: 0 20px; }

#res { margin-top: 8px; max-height: 40vh; overflow: auto; }
/* Menü: keine sichtbaren Scrollleisten (Scrollen per Finger, Trackpad und Mausrad bleibt) */
#pbody, #res { scrollbar-width: none; -ms-overflow-style: none; }
#pbody::-webkit-scrollbar, #res::-webkit-scrollbar { display: none; width: 0; height: 0; }
#res .hint { font-size: var(--fs-tiny); color: var(--mute); padding: 4px var(--list-pad) 8px; }
#res .hit { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
#res .hit.act { background: rgba(127, 209, 196, .08); }
#res button.go {
  flex: 1;
  min-width: 0;                 /* lange Namen schieben Stern und Info nicht nach rechts */
  text-align: left;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-radius: 0;
  margin: 0;
  min-height: 56px;
  padding: 10px 8px 10px var(--list-pad);   /* Abstand zum linken Rand */
  font-weight: 500;
  font-size: 15px;
}
#res .hit.on button.go { color: var(--acc); }
#res button.go small { display: block; color: var(--mute); font-size: var(--fs-tiny); font-weight: 400; }
#res .lk { display: inline-block; margin-left: 8px; font-size: var(--fs-small); font-weight: 400; color: var(--acc); }   /* inline-block: See darf auf die nächste Zeile */
/* Info-Icon rechts in jeder Trefferzeile */
#res .hit a.info {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-right: calc(var(--list-pad) - 10px);   /* Abstand zum rechten Rand (Icon-Mitte bündig) */
  border-radius: 50%;
  color: var(--mute);
}
#res .hit a.info { transition: color .15s, background-color .15s, transform .15s; }
/* Lade-Ring in der Trefferzeile (ersetzt das Info-Icon während des Ladens) */
#res .hit .hspin { display: none; flex: none; width: 44px; height: 44px; margin-right: calc(var(--list-pad) - 10px); align-items: center; justify-content: center; }
#res .hit.loading .hspin { display: flex; }
#res .hit.loading a.info { display: none; }
#res .hit .hspin .r { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid rgba(127, 209, 196, .25); border-top-color: var(--acc); animation: spin .8s linear infinite; }
#res .hit a.info:hover { color: var(--acc); background: rgba(127, 209, 196, .12); }
#res .hit a.info:active { transform: scale(.9); }
#res .hit a.info:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; color: var(--acc); }
#res .hit a.info svg { width: 22px; height: 22px; }
/* Platzhalter, wenn ein Tauchplatz keinen Link hat -> Sterne stehen in allen Zeilen untereinander */
#res .hit .iph { flex: none; width: 44px; height: 44px; margin-right: calc(var(--list-pad) - 10px); }
#res .hit.loading .iph { display: none; }
/* Stern (Favorit) links vom Info-Icon */
#res .hit button.fav {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-height: 0;
  margin: 0 -6px 0 0;          /* etwas näher zum Info-Icon */
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--mute);
  transition: color .15s, background-color .15s, transform .15s;
}
#res .hit button.fav svg { width: 22px; height: 22px; fill: none; transition: fill .15s; }
#res .hit button.fav.on { color: #ffd23f; }
#res .hit button.fav.on svg { fill: currentColor; }
#res .hit button.fav:hover { background: rgba(127, 209, 196, .12); }
#res .hit button.fav:active { transform: scale(.9); }
#res .hit button.fav:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }

/* ---------- Status und Legende ---------- */


/* ---------- Kartenauswahl ---------- */
#mp { position: fixed; inset: 0; z-index: 2000; display: none; background: var(--bg); }
#map { position: absolute; inset: 0; }
/* Als App vom Homebildschirm (ohne Safari-Leisten):
   - Menü oben im gleichen Abstand zur Statusleiste wie im Browser (dort gibt es keinen Safari-Verlauf)
   - Pfeile und Radius-Leiste näher an den unteren Rand (Quellenangabe dichter am Home-Balken) */
/* Quellenangabe direkt über dem Home-Balken (der Balken belegt nur die untersten ~13 px) */
html.standalone #src { padding-top: 4px; padding-bottom: max(20px, calc(var(--safe-bottom) - 6px)); }   /* etwas Luft zum unteren Rand */
/* Karte als App: Leiste mit den Buttons so tief wie möglich (direkt über dem Home-Balken) */
html.standalone #mbar { padding-bottom: calc(min(var(--safe-bottom), 15px) + 6px); }
html.standalone .nav, html.standalone #zbar { bottom: calc(var(--src-top, 30px) + 6px); }

/* Ortsnamen (swissTLMRegio) als gestochen scharfe Schrift statt Rasterbild */
.mlab { background: none; border: 0; }
.mlab span {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%);
  white-space: nowrap; pointer-events: none;
  font-family: var(--font-ui); font-size: 13px; font-weight: 600; letter-spacing: .01em; color: #fff;
  text-shadow: 0 0 2px rgba(0,0,0,.9), 0 0 4px rgba(0,0,0,.7), 0 1px 2px rgba(0,0,0,.8);
}
.mlab.big span { font-size: 15px; font-weight: 700; }
/* Leaflet hat standardmässig einen hellgrauen Hintergrund (#ddd). Das iPhone färbt die Statusleiste
   nach dem Inhalt darunter ein -> heller Streifen oben. Dunkel wie die App, Karte bis ganz oben. */
.leaflet-container { background: var(--bg); }
#mp .leaflet-control-attribution { margin-bottom: calc(var(--safe-bottom)); }
/* Umschalter Luftbild / Karte im Stil der App */
/* Ortssuche auf der Karte (oben links, Vorschläge beim Tippen) */
#osr {
  position: absolute; z-index: 1600;
  top: calc(var(--top-ui) + 12px); left: 12px; right: calc(var(--lsw-w, 190px) + 20px); max-width: 420px;   /* links neben dem Umschalter, unterhalb des iOS-Verlaufs */
}
#osr .ow { position: relative; display: flex; }
#oq {
  min-height: 46px; padding: 10px 44px 10px 14px; border-radius: 12px;
  background: var(--chip); border: 1px solid var(--line); color: var(--ink);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
#oq::placeholder { color: var(--mute); }
#ox {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; min-height: 0; margin: 0; padding: 0; display: none;
  align-items: center; justify-content: center; border-radius: 50%; background: transparent; color: var(--mute);
}
#ox svg { width: 18px; height: 18px; }
#osr.has #ox { display: flex; }
#ores {
  display: none; margin-top: 6px; max-height: 50vh; overflow-y: auto;
  border-radius: 12px; background: var(--panel-solid); border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
}
#ores.on { display: block; }
#ores button {
  display: block; width: 100%; min-height: 48px; margin: 0; padding: 10px 14px; text-align: left;
  border: 0; border-bottom: 1px solid rgba(44, 85, 102, .5); border-radius: 0;
  background: transparent; color: var(--ink); font-size: 15px; font-weight: 500;
}
#ores button:last-child { border-bottom: 0; }
#ores button small { display: block; color: var(--mute); font-size: var(--fs-tiny); font-weight: 400; }
#ores button.act, #ores button:hover { background: rgba(127, 209, 196, .12); }
#ores .hint { padding: 10px 14px; color: var(--mute); font-size: var(--fs-small); }
/* Handy: Suchfeld in derselben Zeile wie «Luftbild | Karte», Vorschläge darunter über die ganze Breite */
@media (max-width: 600px) {
  #osr { max-width: none; }
  #oq { min-height: 46px; font-size: 16px; }
  #ores { width: calc(100vw - 24px); }
  #lsw button { padding: 6px 12px; }
}

#lsw {
  position: absolute; z-index: 1600;
  top: calc(var(--top-ui) + 12px); right: 12px;
  display: flex; padding: 4px; gap: 4px;
  border-radius: 12px; background: var(--chip); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
#lsw button {
  width: auto; min-height: 36px; margin: 0; padding: 6px 14px;
  border: 0; border-radius: 8px; background: transparent;
  color: var(--mute); font-size: 14px; font-weight: 600;
}
#lsw button.on { background: var(--acc); color: var(--acc-ink); }
#mbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 1500;
  background: rgba(19, 48, 61, .96);
  padding: 10px 12px calc(var(--safe-bottom) + 10px);
}
#mbar .b { display: flex; gap: 12px; }
#mbar button { margin-top: 12px; }
#mh, #mbar .note { font-size: var(--fs-small); color: var(--mute); }
#mh.dot::after { content: none; }
/* Grosse Bildschirme: Info links (eine Zeile, vertikal mittig zu den Buttons), Buttons kleiner und rechtsbündig.
   Handy (bis 600 px) bleibt unverändert. */
@media (min-width: 601px) {
  #mbar { display: flex; align-items: center; gap: 16px; padding-top: 10px; }
  /* Leerraum unter den Buttons (wie Screenshot: ca. 35 px), auch als App mit Home-Balken */
  #mbar, html.standalone #mbar { padding-bottom: max(34px, calc(var(--safe-bottom) + 14px)); }
  #mbar .inf { flex: 1 1 auto; min-width: 0; text-align: left; }
  #mh, #mbar .note { display: inline; }
  #mh:not(:empty) { margin-right: .3em; }
  #mh.dot::after { content: '.'; }
  #mbar .b { flex: none; gap: 8px; }
  #mbar .b button { width: auto; min-height: 40px; margin: 0; padding: 8px 22px; font-size: var(--fs-base); }
}

/* ---------- Elemente über der 3D-Ansicht ---------- */
/* Fadenkreuz (feste Pixelgrösse) */
#xh {
  position: fixed;
  z-index: 5;
  display: none;
  width: 49px;
  height: 49px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* Tiefenanzeige über dem Fadenkreuz */
#tip {
  position: fixed;
  display: none;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 16px));   /* knapp über der Kugel */
  background: rgba(12, 26, 34, .92);
  padding: 3px 8px;
  border-radius: var(--radius);
  font-size: var(--fs-small);
  white-space: nowrap;
}

/* Distanz zum Ufer (Beschriftung über der gelben Linie auf der Wasseroberfläche) */
#sdl {
  /* gleich wie die Tiefenanzeige (#tip) */
  position: fixed;
  display: none;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 8px));
  background: rgba(12, 26, 34, .92);
  padding: 3px 8px;
  border-radius: var(--radius);
  font-size: var(--fs-small);
  white-space: nowrap;
}

/* Beschriftung der Tiefenebenen */
.lvl {
  position: fixed;
  z-index: 4;
  transform: translate(8px, -50%);
  font-size: var(--fs-tiny);
  line-height: 1.3;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--chip);
  color: var(--mute);
  border: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
}
.lvl:hover { color: var(--ink); }
.lvl.on { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); font-weight: 600; }

/* Pfeiltasten: 50 m dem Ufer entlang */
.nav {
  position: fixed;
  z-index: 6;
  bottom: calc(var(--src-top, 30px) + 8px);   /* über der Quellenangabe */
  width: 56px;
  height: 56px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  background: rgba(12, 26, 34, .35);
  border: 1px solid rgba(143, 177, 184, .45);
  color: var(--ink);
  display: none;
  align-items: center;
  justify-content: center;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.nav:hover { background: rgba(12, 26, 34, .6); }
.nav:disabled { opacity: .35; }
.nav svg { width: 22px; height: 22px; }
#navL { left: 14px; }
#navR { right: 14px; }
/* Messen: runder Knopf über dem rechten Pfeil; aktiv in der Akzentfarbe */
#ms { right: 14px; bottom: calc(var(--src-top, 30px) + 76px); }
html.standalone #ms { bottom: calc(var(--src-top, 30px) + 74px); }
#ms.on { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); }
#ms svg { width: 24px; height: 24px; }
/* Distanz zwischen den Messpunkten (über der Mitte der orangen Linie), gleich gestylt wie #tip */
#msl {
  position: fixed;
  z-index: 5;
  display: none;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 8px));
  background: rgba(12, 26, 34, .92);
  padding: 3px 8px 4px;
  border-radius: var(--radius);
  font-size: var(--fs-small);
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
}
#msl b { display: block; font-weight: 600; color: #ffb27a; }
#msl span { display: block; font-size: var(--fs-micro); color: var(--mute); }
/* Hinweis im Mess-Modus (unten Mitte, über der Radius-Leiste, schmaler als der Platz zwischen den runden Knöpfen) */
#msh {
  position: fixed;
  z-index: 6;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--src-top, 30px) + 80px);
  max-width: calc(100vw - 180px);
  display: none;
  padding: 4px 10px;
  border-radius: var(--radius);
  background: var(--chip);
  color: var(--ink);
  font-size: var(--fs-tiny);
  text-align: center;
  pointer-events: none;
}

#nvh {
  position: fixed;
  z-index: 6;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--src-top, 30px) + 74px);
  font-size: var(--fs-tiny);
  color: var(--mute);
  pointer-events: none;
  display: none;
  white-space: nowrap;
}

/* Lade-Anzeige während ein Modell aufgebaut wird */
#spin {
  position: fixed; z-index: 11; left: 50%; top: 50%; transform: translate(-50%, -50%);   /* auch über dem offenen Menü sichtbar */
  display: none; flex-direction: column; align-items: center; gap: 12px; pointer-events: none;
}
#spin.on { display: flex; }
#spin .ring {
  width: 48px; height: 48px; border-radius: 50%;
  border: 3px solid rgba(127, 209, 196, .22); border-top-color: var(--acc);
  animation: spin .9s linear infinite;
}
#spin .t {
  max-width: 80vw; padding: 5px 12px; border-radius: var(--radius);
  background: var(--chip); color: var(--ink); font-size: var(--fs-small); text-align: center;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Hinweis «Luftbild wird geladen …» */
#aer {
  position: fixed;
  z-index: 6;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--src-top, 30px) + 102px);
  display: none;
  padding: 4px 10px;
  border-radius: var(--radius);
  background: var(--chip);
  font-size: var(--fs-tiny);
  color: var(--mute);
  pointer-events: none;
  white-space: nowrap;
}

/* Kompass: Platzhalter oben rechts – der 3D-Kompass wird genau in diese Fläche gezeichnet */
#cmp {
  position: fixed;
  z-index: 1;
  top: calc(var(--top-ui) + 54px);
  right: 8px;
  width: 132px;
  height: 132px;
  display: none;
  pointer-events: none;
}

/* Ausschnitt vergrössern/verkleinern (unten Mitte) */
#zbar {
  position: fixed;
  z-index: 6;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--src-top, 30px) + 8px);   /* über der Quellenangabe */
  display: none;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 32px;
  background: rgba(12, 26, 34, .35);
  border: 1px solid rgba(143, 177, 184, .45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
#zbar .zb {
  width: 46px;
  height: 46px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}
#zbar .zb:hover { background: rgba(12, 26, 34, .5); }
#zbar .zb:disabled { opacity: .3; }
#zbar .zb svg { width: 20px; height: 20px; }
#zv {
  min-width: 112px;
  text-align: center;
  font-family: var(--font-num);
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* Überhöhung, sichtbar bei eingeklapptem Menü */
#exb {
  position: fixed;
  z-index: 6;
  top: calc(var(--top-ui) + 14px);
  right: 12px;
  width: auto;
  display: none;
  font-family: var(--font-num);
  font-size: var(--fs-small);
  line-height: 1.3;
  padding: 5px 30px 5px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--chip) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238fb1b8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
#exb:disabled { opacity: .5; }
#exb option { background: var(--bg); color: var(--ink); }

/* Quellenangabe unten links */
#src {
  position: fixed;
  z-index: 8;                         /* vor dem 3D-Modell und den Tiefen-Beschriftungen */
  left: 0;
  right: 0;
  bottom: 0;
  padding: 6px 14px calc(var(--safe-bottom) + 10px);   /* seitlich bündig mit den Pfeil-Buttons */
  font-size: var(--fs-micro);
  line-height: 1.4;
  color: var(--mute);
  background: linear-gradient(rgba(12, 26, 34, 0), rgba(12, 26, 34, .85) 35%);
  pointer-events: none;
}
