:root {
  --bg: #f4f4f5; --karte: #ffffff; --text: #18181b; --leise: #71717a;
  --rand: #e4e4e7; --gruen: #16a34a; --rot: #dc2626; --blau: #2563eb;
  --gelb: #ca8a04; --schatten: 0 1px 3px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.06);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #18181b; --karte: #27272a; --text: #fafafa; --leise: #a1a1aa;
          --rand: #3f3f46; --schatten: 0 1px 3px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
.mitte { display: grid; place-content: center; gap: 12px; min-height: 70vh; text-align: center; padding: 24px; }
.gross { font-size: 20px; font-weight: 600; }
.leise { color: var(--leise); font-size: 14px; }
.fehler { color: var(--rot); font-size: 14px; min-height: 20px; }

input[type=password], textarea {
  width: 100%; padding: 12px; border: 1px solid var(--rand); border-radius: 10px;
  background: var(--karte); color: var(--text); font: inherit; font-size: 16px;
}
button { font: inherit; cursor: pointer; border: 0; border-radius: 10px; padding: 12px 16px; }
#loginForm { display: grid; gap: 10px; width: min(320px, 90vw); }
#loginForm button { background: var(--text); color: var(--bg); font-weight: 600; }

header { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 10px 12px 6px; }
.reiter { display: flex; gap: 6px; }
.reiter button {
  flex: 1; padding: 9px 6px; font-size: 14px; background: transparent;
  color: var(--leise); border: 1px solid transparent; border-radius: 10px;
}
.reiter button.aktiv { background: var(--karte); color: var(--text); border-color: var(--rand); font-weight: 600; }
.reiter span { opacity: .6; font-variant-numeric: tabular-nums; }

main { padding: 8px 12px 32px; max-width: 720px; margin: 0 auto; }

.karte {
  background: var(--karte); border: 1px solid var(--rand); border-radius: 16px;
  box-shadow: var(--schatten); margin-bottom: 14px; overflow: hidden;
  touch-action: pan-y; transition: transform .18s ease, opacity .18s ease;
}
.karte.weg-rechts { transform: translateX(120%) rotate(8deg); opacity: 0; }
.karte.weg-links  { transform: translateX(-120%) rotate(-8deg); opacity: 0; }

.kopf { padding: 12px 14px 0; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.autor { font-weight: 600; }
.marke { font-size: 11px; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--rand); color: var(--leise); }
.marke.niedrig { color: var(--rot); border-color: var(--rot); }
.marke.mittel { color: var(--gelb); border-color: var(--gelb); }
.video { padding: 2px 14px 0; font-size: 12px; color: var(--leise); }
.kommentar { padding: 10px 14px; white-space: pre-wrap; }
.thread { margin: 0 14px 10px; padding: 8px 10px; border-left: 3px solid var(--rand); font-size: 14px; color: var(--leise); }

.antwort {
  margin: 0 14px 12px; padding: 12px; border-radius: 12px;
  background: color-mix(in srgb, var(--blau) 7%, transparent);
  border: 1px solid color-mix(in srgb, var(--blau) 22%, transparent);
  white-space: pre-wrap;
}
.antwort a { color: var(--blau); }
.hinweis { margin: 0 14px 12px; padding: 10px 12px; border-radius: 10px; font-size: 14px;
  background: color-mix(in srgb, var(--gelb) 12%, transparent); }
.laeuft { margin: 0 14px 12px; padding: 12px; text-align: center; color: var(--leise); font-size: 14px; }

.aktionen { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--rand); border-top: 1px solid var(--rand); }
.aktionen button { background: var(--karte); border-radius: 0; padding: 14px 4px; font-size: 13px; color: var(--text); }
.aktionen button:active { background: var(--bg); }
.aktionen .senden { color: var(--gruen); font-weight: 600; }

.wisch-hinweis { text-align: center; font-size: 12px; color: var(--leise); padding: 4px 0 12px; }

dialog { border: 0; border-radius: 16px; padding: 18px; max-width: min(560px, 92vw); width: 100%;
  background: var(--karte); color: var(--text); box-shadow: var(--schatten); }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog h2 { margin: 0 0 10px; font-size: 17px; }
.dlgAktionen { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.primaer { background: var(--text); color: var(--bg); font-weight: 600; }
.sekundaer { background: var(--bg); color: var(--text); border: 1px solid var(--rand); }
.ankreuz { display: flex; gap: 8px; align-items: center; font-size: 14px; margin-top: 10px; color: var(--leise); }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(80px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px;
  font-size: 14px; transition: transform .25s ease; z-index: 50; pointer-events: none; }
#toast.zeigen { transform: translateX(-50%) translateY(0); }

/* Muss nach den Layout-Regeln stehen: "display: grid" auf .mitte hat sonst
   Vorrang vor dem hidden-Attribut, und der Login blieb nach dem Anmelden
   sichtbar. */
[hidden] { display: none !important; }

.gruppe { margin-bottom: 26px; }
.gruppe-kopf {
  display: flex; gap: 12px; align-items: center; margin: 0 2px 10px;
  position: sticky; top: 52px; z-index: 4; background: var(--bg);
  padding: 6px 0;
}
.gruppe-kopf img { width: 96px; border-radius: 8px; display: block; aspect-ratio: 16/9; object-fit: cover; }
.gruppe-titel { font-weight: 600; font-size: 14px; line-height: 1.35; }
.gruppe-anzahl { font-size: 12px; color: var(--leise); }
