:root {
  --grund: #f5f2ea;
  --flaeche: #ffffff;
  --text: #1f2a22;
  --leise: #5d6b61;
  --linie: #e2ddd0;
  --gruen: #2f7d4f;
  --gruen-hell: #e3f1e7;
  --gelb: #a8730a;
  --gelb-hell: #fbf0d6;
  --rot: #a64545;
  --rot-hell: #f6e4e2;
  --schatten: 0 1px 2px rgba(31, 42, 34, .06), 0 4px 14px rgba(31, 42, 34, .06);
  --rund: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #141a16;
    --flaeche: #1d2520;
    --text: #e8eee9;
    --leise: #9fb0a5;
    --linie: #2e3a33;
    --gruen: #5cc28a;
    --gruen-hell: #1f3a2a;
    --gelb: #e6b54a;
    --gelb-hell: #3a3020;
    --rot: #e08b8b;
    --rot-hell: #3d2424;
    --schatten: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--gruen); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: .4rem 0 .8rem; }

.kopf {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--grund);
  border-bottom: 1px solid var(--linie);
}
.marke { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.2rem; }
.marke img { border-radius: 8px; }
.kopf-knopf { font-size: 1.4rem; text-decoration: none; color: var(--text); padding: 4px 10px; border-radius: 10px; }

main { max-width: 640px; margin: 0 auto; padding: 16px; }
.laden { color: var(--leise); text-align: center; margin-top: 3rem; }

.karte {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--rund);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--schatten);
}
.karte > :last-child { margin-bottom: 0; }
.leise { color: var(--leise); font-size: .93rem; }
.zeile { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.zeile.ende { justify-content: flex-end; }
.zurueck { display: inline-block; margin-bottom: 12px; text-decoration: none; }

/* Die drei großen Knöpfe */
.wahl { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 12px 0 4px; }
@media (min-width: 420px) { .wahl { grid-template-columns: repeat(3, 1fr); } }
.wahl button {
  font: inherit; font-weight: 650; font-size: 1.05rem;
  min-height: 64px; padding: 10px;
  border-radius: 14px; border: 2px solid var(--linie);
  background: var(--flaeche); color: var(--text);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; touch-action: manipulation;
}
.wahl button .sym { font-size: 1.4rem; }
.wahl button[data-s="da"][aria-pressed="true"] { background: var(--gruen-hell); border-color: var(--gruen); }
.wahl button[data-s="spaeter"][aria-pressed="true"] { background: var(--gelb-hell); border-color: var(--gelb); }
.wahl button[data-s="nicht"][aria-pressed="true"] { background: var(--rot-hell); border-color: var(--rot); }
.wahl button:active { transform: scale(.98); }

.zusatz { margin-top: 12px; display: grid; gap: 10px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font: inherit; font-size: .95rem; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--linie); background: var(--flaeche); color: var(--text); cursor: pointer;
}
.chip[aria-pressed="true"] { border-color: var(--gelb); background: var(--gelb-hell); }

button.knopf, a.knopf {
  font: inherit; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 10px 18px;
  border-radius: 12px; border: 1px solid var(--gruen);
  background: var(--gruen); color: #fff; text-decoration: none; cursor: pointer;
}
@media (prefers-color-scheme: dark) { button.knopf, a.knopf { color: #0f1a13; } }
button.knopf.zweit, a.knopf.zweit { background: transparent; color: var(--gruen); }
button.knopf.gefahr { background: transparent; color: var(--rot); border-color: var(--rot); }
button.knopf.klein { min-height: 38px; padding: 6px 12px; font-size: .92rem; }
button:disabled { opacity: .5; cursor: default; }
button.knopf.breit, a.knopf.breit { width: 100%; }

label { display: block; font-weight: 600; margin: 10px 0 4px; }
input[type=text], input[type=time], select {
  font: inherit; width: 100%; padding: 12px; min-height: 48px;
  border: 1px solid var(--linie); border-radius: 12px;
  background: var(--flaeche); color: var(--text);
}
input:focus-visible, button:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid var(--gruen); outline-offset: 2px;
}
.schalter { display: flex; align-items: center; gap: 10px; font-weight: 500; margin: 10px 0; }
.schalter input { width: 22px; height: 22px; accent-color: var(--gruen); }
fieldset { border: 0; padding: 0; margin: 10px 0; }
legend { font-weight: 600; margin-bottom: 6px; }
.tage { display: flex; gap: 6px; flex-wrap: wrap; }
.tage label { margin: 0; font-weight: 500; }
.tage input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tage span {
  display: inline-block; min-width: 38px; text-align: center; padding: 8px 4px;
  border-radius: 10px; border: 1px solid var(--linie); cursor: pointer;
}
.tage input:checked + span { background: var(--gruen-hell); border-color: var(--gruen); }
.tage input:focus-visible + span { outline: 3px solid var(--gruen); outline-offset: 2px; }

/* Mitgliederliste */
.liste { list-style: none; margin: 0; padding: 0; }
.liste li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--linie); }
.liste li:first-child { border-top: 0; }
.punkt {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.15rem;
  background: var(--grund); border: 2px solid var(--linie);
}
.punkt.da { background: var(--gruen-hell); border-color: var(--gruen); }
.punkt.spaeter { background: var(--gelb-hell); border-color: var(--gelb); }
.punkt.nicht { background: var(--rot-hell); border-color: var(--rot); }
.wer { flex: 1; min-width: 0; }
.wer b { font-weight: 650; }
.wer .leise { display: block; overflow-wrap: anywhere; }
.marke-klein { font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--gruen-hell); color: var(--gruen); }
.jetzt { color: var(--gruen); font-weight: 650; }

.zahlen { display: flex; gap: 14px; flex-wrap: wrap; font-size: .95rem; color: var(--leise); }
.gruppe-link { display: block; text-decoration: none; color: inherit; }

/* Auslastung */
.wabe { display: grid; grid-template-columns: 2.2em repeat(var(--spalten), 1fr); gap: 2px; font-size: .72rem; }
.wabe .t { color: var(--leise); align-self: center; }
.wabe .z { aspect-ratio: 1 / 1.6; border-radius: 3px; background: var(--grund); }
.wabe .k { color: var(--leise); text-align: left; white-space: nowrap; overflow: visible; }
.legende { display: flex; gap: 6px; align-items: center; font-size: .8rem; color: var(--leise); margin-top: 8px; }
.legende i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; }

.code {
  font: 700 1.8rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .12em; text-align: center; padding: 12px; border-radius: 12px;
  background: var(--grund); border: 1px dashed var(--linie); user-select: all;
}
.linkfeld { font: .9rem ui-monospace, Menlo, monospace; overflow-wrap: anywhere; padding: 10px; background: var(--grund); border-radius: 10px; user-select: all; }
.schritte { padding-left: 1.3em; }
.schritte li { margin: .35rem 0; }
.fehler { color: var(--rot); font-weight: 600; }

#meldung {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px;
  background: var(--text); color: var(--grund); font-weight: 600; z-index: 20;
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
}
