:root {
  --bg: #f2f4f7;
  --card: #ffffff;
  --ink: #1a2230;
  --muted: #6b7688;
  --line: #e2e6ec;
  --brand: #17554a;
  --brand-ink: #ffffff;
  --pos: #1a7f4b;
  --neg: #c23b3b;
  --danger: #c23b3b;
  --stern-hoch: #16a34a;               /* 8-10 Sterne */
  --stern-mittel: #d97706;             /* 4-7  Sterne */
  --stern-niedrig: #6b7280;            /* 0-3  Sterne */
  --park: #2563eb;
  --radius: 14px;
  --tabbar-h: 62px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141c;
    --card: #1a2230;
    --ink: #eef1f6;
    --muted: #93a0b4;
    --line: #2a3444;
    --brand: #3f9481;
    --pos: #4fc584;
    --neg: #f0736f;
    --danger: #f0736f;
    --stern-hoch: #4fc584;
    --stern-mittel: #eab35a;
    --stern-niedrig: #93a0b4;
    --park: #6ea8fe;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
}

.content {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
}

a { color: var(--brand); text-decoration: none; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  z-index: 1000;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 12px;
  color: var(--muted);
}
.tab.active { color: var(--brand); font-weight: 600; }
.tab-ico { font-size: 21px; }

/* ---------- Kopfzeile ---------- */
.pagehead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}
.pagehead h1 { margin: 0; flex: 1; min-width: 0; }
.navbtn {
  min-width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 12px;
  font-size: 15px; line-height: 1;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; color: var(--ink);
  white-space: nowrap;
}

/* ---------- Karten (Container) & Formulare ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.card-title { margin: 0; font-size: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; min-width: 0; }
label { font-size: 13px; color: var(--muted); }
input[type=text], input[type=number], input[type=password], input[type=search],
input[type=date], input[type=file], select, textarea {
  width: 100%;
  font-size: 18px;              /* >=16px verhindert das Zoomen auf iOS */
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.45; }
input[type=file] { font-size: 15px; padding: 10px; }

/* ---------- Bewertung ---------- */
.sterne-anzeige {
  margin: 0 0 6px; font-size: 20px; line-height: 1.2;
  color: var(--stern-mittel); letter-spacing: 1px;
}
.sterne-zahl { margin-left: 8px; font-size: 15px; color: var(--muted); letter-spacing: 0; }
/* Der Regler traegt das Touch-Ziel: 44 px hoch, damit er sich am Wasser mit
   klammen Fingern treffen laesst. */
input[type=range] { width: 100%; height: 44px; accent-color: var(--brand); }
input[type=range]:disabled { opacity: .4; }
.check { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 16px; }
.check input { width: 22px; height: 22px; }

/* ---------- Segmented control ---------- */
.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.segmented.cols-3 { grid-template-columns: repeat(3, 1fr); }
.seg { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span {
  display: flex; align-items: center; justify-content: center;
  padding: 10px 4px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  text-align: center;
  min-height: 44px;
}
.seg input:checked + span {
  background: var(--brand);
  color: var(--brand-ink);
  border-color: var(--brand);
  font-weight: 600;
}

/* ---------- Knöpfe ---------- */
.btn {
  display: block;
  width: 100%;
  padding: 14px;
  font-size: 17px;
  font-weight: 600;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  font-family: inherit;
}
.btn-primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-small { padding: 10px; font-size: 15px; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }
.linkbtn {
  background: none; border: none; padding: 4px 0;
  color: var(--muted); font-size: 14px; cursor: pointer;
  text-decoration: underline; font-family: inherit;
}

/* ---------- Liste der Angelstellen ---------- */
.spotlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.spotlist-item a {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  color: var(--ink);
}
.sl-thumb {
  width: 72px; height: 72px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: var(--muted);
}
.sl-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sl-name { font-weight: 600; font-size: 17px; }
.sl-meta { font-size: 13px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.sl-tags { display: flex; gap: 6px; flex-wrap: wrap; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: var(--brand); color: var(--brand-ink); font-size: 12px; white-space: nowrap;
}
.badge-muted { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.badge-stern-hoch { background: var(--stern-hoch); color: #fff; }
.badge-stern-mittel { background: var(--stern-mittel); color: #fff; }
.badge-stern-niedrig { background: var(--stern-niedrig); color: #fff; }

/* ---------- Karte ---------- */
.map {
  height: 320px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg);
  z-index: 0;                  /* bleibt unter der Tab-Leiste */
}
.map-full { height: calc(100vh - var(--tabbar-h) - env(safe-area-inset-bottom) - 150px); min-height: 320px; }
.map-note { font-size: 12px; color: var(--muted); }

/* Marker als divIcon – so braucht Leaflet keine eigenen Bilddateien. */
.pin {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: var(--stern-niedrig);
  box-shadow: 0 1px 4px rgba(0,0,0,.45);
}
.pin-stern-hoch { background: var(--stern-hoch); }
.pin-stern-mittel { background: var(--stern-mittel); }
.pin-stern-niedrig { background: var(--stern-niedrig); }
/* Noch nicht bewertet: hohl statt gefuellt - sonst saehe es aus wie 0 Sterne. */
.pin-stern-keine { background: var(--card); border-color: var(--stern-niedrig); }
.pin-park {
  border-radius: 5px;
  background: var(--park);
  color: #fff;
  font-size: 12px; font-weight: 700; line-height: 12px;
  text-align: center;
}
.pin-drag { background: var(--brand); width: 22px; height: 22px; cursor: grab; }
.leaflet-container { font: inherit; background: var(--bg); }
.leaflet-popup-content { margin: 10px 12px; font-size: 14px; }
.leaflet-popup-content b { display: block; font-size: 15px; }

/* ---------- Fotogalerie ---------- */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gallery figure { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.gallery img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line); display: block;
}
.gallery figcaption { font-size: 11px; color: var(--muted); text-align: center; }
.foto-datum { display: block; font-variant-numeric: tabular-nums; color: var(--ink); }
.titel-abzeichen {
  display: block; margin-top: 4px; text-align: center;
  font-size: 10px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--brand); font-weight: 600;
}

/* ---------- Bilder verwalten ---------- */
.verwaltungszeile {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.verwaltungszeile > img {
  width: 56px; height: 56px; flex: none;
  border-radius: 8px; object-fit: cover;
}
.verwaltungszeile .field { flex: 1; min-width: 0; }
.sortierzeile { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sortierzeile form { display: inline; }
.sortbtn {
  /* 44px Touch-Ziel nach Apples Vorgabe - Pfeile werden sonst zum Glücksspiel. */
  min-width: 44px; min-height: 44px;
  font-size: 18px; line-height: 1;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink);
  cursor: pointer; font-family: inherit;
}
.sortbtn:disabled { opacity: .35; cursor: default; }
.photo-hero img {
  width: 100%; max-height: 300px; object-fit: cover;
  border-radius: var(--radius); border: 1px solid var(--line); display: block;
}
.photo-actions { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.photo-actions form { display: inline; }

/* ---------- Detailangaben ---------- */
.facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 15px; }
.facts dt { color: var(--muted); font-size: 13px; align-self: center; }
.facts dd { margin: 0; }
.coord { font-variant-numeric: tabular-nums; font-size: 14px; }
.notiz { white-space: pre-wrap; line-height: 1.5; margin: 0; }

/* ---------- Meldungen & Login ---------- */
.login-wrap { max-width: 360px; margin: 12vh auto 0; padding: 0 4px; }
.login-title { text-align: center; margin-bottom: 20px; }
.notice {
  background: color-mix(in srgb, var(--brand) 12%, var(--card));
  border: 1px solid var(--line);
  padding: 12px; border-radius: 10px; font-size: 14px; margin-bottom: 16px;
}
.notice.ok { background: color-mix(in srgb, var(--pos) 18%, var(--card)); }
.notice.bad { background: color-mix(in srgb, var(--neg) 15%, var(--card)); }
.notice.small { font-size: 13px; margin-bottom: 0; }
.error { color: var(--neg); font-weight: 600; text-align: center; }
.hint { font-size: 13px; color: var(--muted); margin: -4px 0 0; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
code { background: color-mix(in srgb, var(--muted) 18%, transparent); padding: 2px 6px; border-radius: 6px; font-size: 14px; }
.logout-row { text-align: center; margin-top: 8px; }
.logout-row a { color: var(--muted); font-size: 14px; }
