:root {
  --papier: #f7f3ea;
  --flaeche: #ffffff;
  --flaeche-2: #fbf8f1;
  --tinte: #26332a;
  --leise: #5f6b5d;
  --linie: #e5dccb;
  --gruen: #3f7d4e;
  --gruen-dunkel: #2d5e3a;
  --gruen-hell: #e6f1e3;
  --orange: #d9772e;
  --orange-hell: #fbeadb;
  --schatten: 0 1px 2px rgba(60, 50, 30, .06), 0 6px 18px rgba(60, 50, 30, .08);
  --rund: 20px;
  --schrift: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--papier);
  color: var(--tinte);
  font-family: var(--schrift);
  font-size: 18px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

/* ---------- Kopf ---------- */
.kopf {
  position: sticky; top: 0; z-index: 20;
  background: rgba(247, 243, 234, .94);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--linie);
  padding: calc(10px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
}
.kopf-innen, .fortschritt, .reiter, main { max-width: 1180px; margin-inline: auto; }
.kopf-innen { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.titel { display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo { width: 52px; height: 52px; }
h1 { margin: 0; font-size: 28px; line-height: 1.1; letter-spacing: -.01em; }
.heute { margin: 2px 0 0; color: var(--leise); font-size: 16px; }

.knopf-leise {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 0 18px;
  border: 1px solid var(--linie); border-radius: 999px;
  background: var(--flaeche); color: var(--tinte); font-weight: 600;
}
.knopf-leise svg { width: 20px; height: 20px; fill: currentColor; }

.fortschritt { display: flex; align-items: center; gap: 14px; margin-top: 12px; font-size: 16px; color: var(--leise); }
.fortschritt strong { color: var(--tinte); }
.balken { flex: 1; height: 10px; border-radius: 99px; background: #e9e2d2; overflow: hidden; max-width: 360px; }
.balken span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #5a9a63, var(--gruen)); transition: width .4s ease; }

.reiter { display: flex; gap: 6px; margin-top: 12px; }
.reiter button {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 54px; padding: 0 26px;
  border: 0; border-bottom: 4px solid transparent;
  background: none; color: var(--leise); font-size: 19px; font-weight: 700;
}
.reiter button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.reiter button[aria-selected="true"] { color: var(--gruen-dunkel); border-bottom-color: var(--gruen); }

main { padding: 20px max(20px, env(safe-area-inset-right)) 120px max(20px, env(safe-area-inset-left)); }

/* ---------- Filter ---------- */
.filter { display: grid; gap: 12px; }
.suche {
  display: flex; align-items: center; gap: 12px;
  min-height: 60px; padding: 0 8px 0 18px;
  background: var(--flaeche); border: 2px solid var(--linie); border-radius: 16px;
}
.suche:focus-within { border-color: var(--gruen); }
.suche svg { width: 24px; height: 24px; fill: none; stroke: var(--leise); stroke-width: 2.2; stroke-linecap: round; }
.suche input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 19px; padding: 14px 0; }
.suche input::-webkit-search-cancel-button { display: none; }
.suche-leeren { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--flaeche-2); color: var(--leise); font-size: 18px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 46px; padding: 0 18px;
  border: 1.5px solid var(--linie); border-radius: 999px;
  background: var(--flaeche); color: var(--tinte); font-size: 17px; font-weight: 600;
}
.chip[aria-pressed="true"] { background: var(--gruen); border-color: var(--gruen); color: #fff; }
.chips-klein .chip { min-height: 42px; font-size: 16px; }
.chips-klein .chip-label { align-self: center; color: var(--leise); font-size: 16px; margin-right: 4px; }

.treffer { margin: 18px 2px 12px; color: var(--leise); font-size: 16px; }

/* ---------- Vogelkarten ---------- */
.raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.karte {
  display: flex; flex-direction: column;
  background: var(--flaeche); border-radius: var(--rund); box-shadow: var(--schatten);
  border: 2px solid transparent; overflow: hidden;
  transition: border-color .2s, transform .15s;
}
.karte.heute-gesehen { border-color: var(--gruen); }
.karte-oeffnen { display: block; padding: 0; border: 0; background: none; text-align: left; }
.karte-oeffnen:active { transform: scale(.99); }
.bild { position: relative; aspect-ratio: 4 / 3; background: #ece6d8; overflow: hidden; }
.bild img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stempel {
  position: absolute; left: 10px; top: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px 5px 8px; border-radius: 999px;
  background: rgba(255, 255, 255, .94); color: var(--gruen-dunkel);
  font-size: 15px; font-weight: 700; box-shadow: 0 1px 4px rgba(0, 0, 0, .15);
}
.stempel svg { width: 18px; height: 18px; }
.gast {
  position: absolute; right: 10px; top: 10px;
  padding: 4px 11px; border-radius: 999px;
  background: rgba(38, 51, 42, .78); color: #fff; font-size: 14px; font-weight: 600;
}
.karte-text { padding: 14px 16px 6px; }
.karte-text h3 { margin: 0; font-size: 22px; line-height: 1.2; }
.aka { color: var(--leise); font-weight: 500; font-size: 17px; }
.karte-text p { margin: 6px 0 0; color: var(--leise); font-size: 16px; line-height: 1.35; }

.gesehen-knopf {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: auto 14px 14px; margin-top: 12px; min-height: 58px;
  border: 2px solid var(--gruen); border-radius: 14px;
  background: var(--flaeche); color: var(--gruen-dunkel);
  font-size: 18px; font-weight: 700;
}
.kaestchen {
  display: grid; place-items: center; width: 28px; height: 28px;
  border: 2.5px solid currentColor; border-radius: 8px;
}
.kaestchen svg { width: 18px; height: 18px; opacity: 0; }
.gesehen-knopf[aria-pressed="true"] { background: var(--gruen); color: #fff; }
.gesehen-knopf[aria-pressed="true"] .kaestchen { background: #fff; border-color: #fff; color: var(--gruen); }
.gesehen-knopf[aria-pressed="true"] .kaestchen svg { opacity: 1; }
.gesehen-knopf.ploppt .kaestchen { animation: plopp .35s ease; }
@keyframes plopp { 40% { transform: scale(1.3); } }

.leer { text-align: center; padding: 40px 20px; color: var(--leise); }
.leer strong { display: block; color: var(--tinte); font-size: 21px; margin-bottom: 6px; }

/* ---------- Überlagerungen ---------- */
.schicht {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(30, 36, 28, .45);
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(20px + env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom));
  animation: einblenden .18s ease;
}
@keyframes einblenden { from { opacity: 0; } }
.blatt {
  position: relative; width: 100%; max-width: 1040px;
  background: var(--papier); border-radius: 26px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  animation: hoch .22s ease;
}
.blatt:focus { outline: none; }
.blatt-schmal { max-width: 640px; }
@keyframes hoch { from { transform: translateY(24px); opacity: .6; } }
.schliessen {
  position: absolute; right: 14px; top: 14px; z-index: 2;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 50px; padding: 0 18px 0 14px;
  border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, .95); color: var(--tinte);
  font-size: 17px; font-weight: 700; box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
}
.schliessen svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.blatt-inhalt { padding: 28px; }
.blatt-schmal .blatt-inhalt { padding-top: 80px; }
.blatt-inhalt h2 { margin: 0; font-size: 32px; line-height: 1.15; }
.blatt-inhalt h3 { margin: 28px 0 10px; font-size: 21px; }

/* Steckbrief */
.sb { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
.sb-bild { margin: -28px 0 0 -28px; }
.sb-bild img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; border-radius: 26px 0 26px 0; background: #e9e3d4; }
.nachweis { margin: 8px 0 0 28px; font-size: 13px; color: var(--leise); line-height: 1.35; }
.nachweis a { color: inherit; }
.sb-kopf { padding-top: 56px; }
.sb-kopf .aka { display: block; margin-top: 4px; font-size: 19px; }
.etiketten { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.etikett { padding: 6px 13px; border-radius: 999px; background: var(--flaeche); border: 1px solid var(--linie); font-size: 15px; font-weight: 600; color: var(--leise); }
.etikett-sommer { background: #fff4d6; border-color: #f0dca0; color: #7a5b0e; }
.etikett-winter { background: #e3eef7; border-color: #bcd3e6; color: #2f5877; }

.merkmale { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.merkmale li { display: flex; gap: 12px; align-items: flex-start; font-size: 18px; }
.merkmale li::before {
  content: ""; flex: none; width: 10px; height: 10px; margin-top: 9px;
  border-radius: 50%; background: var(--orange);
}

.sb-unten { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
.kasten { background: var(--flaeche); border-radius: 18px; padding: 20px; box-shadow: var(--schatten); }
.kasten h3 { margin-top: 0; }
.verwechslung { display: grid; gap: 10px; }
.verw {
  display: flex; gap: 14px; align-items: center; width: 100%;
  padding: 10px; border: 1.5px solid var(--linie); border-radius: 16px;
  background: var(--flaeche-2); text-align: left;
}
button.verw:active { background: var(--gruen-hell); }
.verw img, .verw .verw-platz { width: 84px; height: 64px; border-radius: 10px; object-fit: cover; flex: none; }
.verw .verw-platz { display: grid; place-items: center; background: #ece6d8; color: var(--leise); font-size: 13px; text-align: center; line-height: 1.1; }
.verw strong { display: block; font-size: 18px; }
.verw span { display: block; font-size: 16px; color: var(--leise); line-height: 1.35; }
.verw .pfeil { width: 22px; height: 22px; fill: none; stroke: var(--leise); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.eindeutig { margin: 0; color: var(--leise); }

.gesehen-gross { margin: 0 0 14px; min-height: 64px; width: 100%; font-size: 20px; }
.anderer-tag { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.anderer-tag label { font-size: 16px; color: var(--leise); width: 100%; }
.anderer-tag input[type="date"] {
  flex: 1; min-width: 170px; min-height: 52px; padding: 0 14px;
  border: 2px solid var(--linie); border-radius: 12px; background: var(--flaeche); font-size: 18px;
}
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px;
  border: 0; border-radius: 12px;
  background: var(--gruen); color: #fff; font-size: 18px; font-weight: 700;
}
.knopf-zweit { background: var(--flaeche); color: var(--gruen-dunkel); border: 2px solid var(--gruen); cursor: pointer; }
.knopfreihe { display: flex; flex-wrap: wrap; gap: 12px; margin: 18px 0 6px; }
.daten { list-style: none; margin: 16px 0 0; padding: 0; }
.daten li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--linie); }
.daten button { min-height: 44px; padding: 0 14px; border: 0; border-radius: 10px; background: none; color: var(--leise); font-size: 15px; text-decoration: underline; }
.bilanz { margin: 0 0 10px; color: var(--leise); }
.klein { font-size: 15px; color: var(--leise); }
.meldung { min-height: 1.4em; color: var(--gruen-dunkel); font-weight: 600; }
.nachweise { padding-left: 20px; font-size: 14px; color: var(--leise); display: grid; gap: 4px; }
.nachweise a { color: inherit; }

/* ---------- Tagebuch ---------- */
.jahre { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 14px; margin-bottom: 28px; }
.kachel { background: var(--flaeche); border-radius: 18px; padding: 18px 20px; box-shadow: var(--schatten); }
.kachel b { display: block; font-size: 36px; line-height: 1.1; color: var(--gruen-dunkel); }
.kachel span { color: var(--leise); font-size: 16px; }
.kachel-gast b { font-size: 24px; margin-top: 6px; }
.tag { margin-bottom: 22px; }
.tag h3 { margin: 0 0 10px; font-size: 19px; }
.tag h3 small { color: var(--leise); font-weight: 500; font-size: 16px; }
.tag-voegel { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-vogel {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 16px 6px 6px; border: 0; border-radius: 999px;
  background: var(--flaeche); box-shadow: var(--schatten); font-size: 17px; font-weight: 600;
}
.tag-vogel img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; }
.noch-offen { margin-top: 34px; }
.noch-offen p { color: var(--leise); margin: 0 0 10px; }

/* ---------- Hinweisleiste ---------- */
.hinweis {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 80;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 18px;
  max-width: calc(100% - 32px); padding: 10px 10px 10px 22px;
  background: var(--tinte); color: #fff; border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3); font-size: 17px;
  animation: hoch .2s ease;
}
.hinweis button { min-height: 48px; padding: 0 18px; border: 0; border-radius: 12px; background: #fff; color: var(--tinte); font-weight: 700; }

/* ---------- Hochformat / schmal ---------- */
@media (max-width: 820px) {
  .sb, .sb-unten { grid-template-columns: 1fr; }
  .sb-bild { margin: -28px -28px 0; }
  .sb-bild img { border-radius: 26px 26px 0 0; }
  .sb-kopf { padding-top: 0; }
  .raster { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}
@media (max-width: 520px) {
  body { font-size: 17px; }
  h1 { font-size: 23px; }
  .logo { width: 42px; height: 42px; }
  .knopf-leise { padding: 0 14px; }
  .reiter button { padding: 0 16px; flex: 1; justify-content: center; }
  .raster { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .karte-text h3 { font-size: 19px; }
  .karte-text p { display: none; }
  .gesehen-knopf { font-size: 16px; min-height: 52px; margin-inline: 10px; }
  .blatt-inhalt { padding: 20px; }
  .sb-bild { margin: -20px -20px 0; }
  .blatt-inhalt h2 { font-size: 27px; }
  .schicht { padding: 0; }
  .blatt { border-radius: 0; min-height: 100%; }
  .sb-bild img { border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
