:root {
  --bg: #f6f1ea;
  --flaeche: #fffdf9;
  --flaeche-2: #efe8df;
  --tinte: #1f1b18;
  --leise: #6b625b;
  --linie: #e2d9ce;
  --akzent: #a3584a;
  --akzent-text: #ffffff;
  --akzent-zart: #f3e2dc;
  --fehler: #a8321f;
  --schatten: 0 1px 2px rgb(31 27 24 / 6%), 0 8px 24px rgb(31 27 24 / 8%);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171513;
    --flaeche: #221f1c;
    --flaeche-2: #2c2825;
    --tinte: #f3ede6;
    --leise: #b3a89d;
    --linie: #3a3531;
    --akzent: #e0907e;
    --akzent-text: #171513;
    --akzent-zart: #3a2a25;
    --fehler: #f08a78;
    --schatten: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 30%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--tinte);
  font: 17px/1.45 var(--sans);
  min-height: 100dvh;
  padding: env(safe-area-inset-top) 0 calc(76px + env(safe-area-inset-bottom));
}
body.ohne-tabs { padding-bottom: env(safe-area-inset-bottom); }
main { max-width: 560px; margin: 0 auto; padding: 20px 16px 24px; }
h1, h2 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; margin: 0 0 6px; }
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 22px; }
p { margin: 0 0 12px; }
.leise { color: var(--leise); }
.klein { font-size: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
img { display: block; max-width: 100%; }

/* Bedienelemente: mindestens 44 px hoch */
.knopf, .knopf-zweit, .knopf-text {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 999px;
  font: 600 16px/1 var(--sans); cursor: pointer; text-decoration: none;
  border: 1px solid transparent; -webkit-tap-highlight-color: transparent;
}
.knopf { background: var(--akzent); color: var(--akzent-text); }
.knopf-zweit { background: var(--flaeche); color: var(--tinte); border-color: var(--linie); }
.knopf-text { background: none; color: var(--akzent); padding: 0 8px; }
.knopf:active, .knopf-zweit:active { transform: scale(0.98); }
.knopf[disabled], .knopf-zweit[disabled] { opacity: 0.5; cursor: default; }
.breit { width: 100%; }
:focus-visible { outline: 3px solid var(--akzent); outline-offset: 2px; }
.reihe { display: flex; gap: 10px; flex-wrap: wrap; }
.reihe > * { flex: 1 1 0; min-width: 140px; }
.stapel { display: grid; gap: 10px; }

.karte {
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: 20px;
  padding: 18px; box-shadow: var(--schatten); margin-bottom: 16px;
}
.kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.mini-profil { width: 48px; height: 64px; border-radius: 12px; object-fit: cover; background: var(--flaeche-2); }

input[type="text"] {
  width: 100%; min-height: 52px; padding: 0 16px; border-radius: 14px;
  border: 1px solid var(--linie); background: var(--flaeche); color: var(--tinte);
  font: 600 20px/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; text-align: center;
}
label.feld { display: block; font-weight: 600; margin-bottom: 8px; }
.datei { position: relative; overflow: hidden; }
.datei input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }

.meldung { border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; background: var(--akzent-zart); }
.meldung.fehler { color: var(--fehler); }

/* Anmeldung */
.willkommen { min-height: calc(100dvh - 80px); display: grid; align-content: center; gap: 22px; text-align: center; }
.willkommen .logo { width: 84px; height: 84px; border-radius: 22px; margin: 0 auto; box-shadow: var(--schatten); }

/* Fotos */
.bildrahmen { position: relative; border-radius: 20px; overflow: hidden; background: var(--flaeche-2); box-shadow: var(--schatten); }
.bildrahmen img { width: 100%; height: auto; }
.vorschau { max-height: 46vh; width: auto; margin: 0 auto; border-radius: 16px; }
.schimmer::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgb(255 255 255 / 35%) 50%, transparent 80%);
  animation: schimmer 1.6s ease-in-out infinite; transform: translateX(-100%);
}
@keyframes schimmer { to { transform: translateX(100%); } }
.marke {
  position: absolute; left: 12px; top: 12px; padding: 4px 10px; border-radius: 999px;
  background: rgb(0 0 0 / 55%); color: #fff; font-size: 13px; font-weight: 600;
}
.hinweis { font-size: 14px; color: var(--leise); text-align: center; margin: 12px 4px 0; }

.raster { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kachel {
  position: relative; aspect-ratio: 3 / 4; border-radius: 16px; overflow: hidden; padding: 0;
  background: var(--flaeche-2); border: 2px solid transparent; cursor: pointer;
}
.kachel img { width: 100%; height: 100%; object-fit: cover; }
.kachel.aktiv { border-color: var(--akzent); }
.kachel .herz { position: absolute; right: 8px; top: 6px; font-size: 20px; color: #fff; text-shadow: 0 1px 3px rgb(0 0 0 / 50%); }
.kachel .status { position: absolute; inset: 0; display: grid; place-items: center; font-size: 14px; color: var(--leise); padding: 8px; text-align: center; }
.filter { display: flex; gap: 8px; margin-bottom: 14px; }
.filter button { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--linie); background: var(--flaeche); color: var(--tinte); font: 600 15px var(--sans); }
.filter button[aria-pressed="true"] { background: var(--tinte); color: var(--bg); border-color: var(--tinte); }

/* Überlagerung für Details */
.overlay { position: fixed; inset: 0; z-index: 20; background: var(--bg); overflow-y: auto; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.overlay main { padding-top: 12px; }

/* Ladekreis */
.laden { min-height: 60dvh; display: grid; place-items: center; }
.kreis { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--linie); border-top-color: var(--akzent); animation: dreh 0.9s linear infinite; }
@keyframes dreh { to { transform: rotate(360deg); } }

/* Tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center; gap: 4px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--linie);
}
.tabs[hidden] { display: none; }
.tabs button {
  flex: 0 1 160px; min-height: 56px; display: grid; justify-items: center; gap: 2px;
  background: none; border: 0; color: var(--leise); font: 600 12px var(--sans); cursor: pointer;
}
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tabs button[aria-current="page"] { color: var(--akzent); }

@media (prefers-reduced-motion: reduce) {
  .schimmer::after, .kreis { animation: none; }
}
