/* Sportsfreunde – Apple-Kalender-Anmutung in den Farben des Logos */
:root {
  --hg: #F4EEE3;
  --hg-verlauf: #EADBC4;
  --flaeche: #FFFDF9;
  --flaeche-2: #F7F1E8;
  --text: #2B2420;
  --text-2: #85766B;
  --text-3: #B4A79C;
  --linie: rgba(80, 55, 30, 0.12);
  --akzent: #D38F6F;
  --akzent-stark: #BF7553;
  --akzent-zart: #F4DED2;
  --braun: #B3826E;
  --gruen: #5E9B6A;
  --rot: #C9533F;
  --schatten: 0 1px 2px rgba(80, 55, 30, 0.06), 0 8px 24px rgba(80, 55, 30, 0.07);
  --glas: rgba(250, 245, 237, 0.72);
  --radius: 16px;
  --feder: cubic-bezier(0.32, 0.72, 0, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --hg: #191512;
    --hg-verlauf: #241D18;
    --flaeche: #26201C;
    --flaeche-2: #2F2823;
    --text: #F5EEE4;
    --text-2: #AD9E91;
    --text-3: #6E6158;
    --linie: rgba(255, 235, 215, 0.1);
    --akzent: #E29B79;
    --akzent-stark: #EDAA88;
    --akzent-zart: #4A3226;
    --braun: #C99883;
    --gruen: #7DBB89;
    --rot: #E8735E;
    --schatten: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    --glas: rgba(30, 25, 21, 0.72);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  color: var(--text);
  background: var(--hg);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
a { color: var(--akzent-stark); text-decoration: none; }
[hidden] { display: none !important; }

#seite {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px calc(120px + env(safe-area-inset-bottom));
}

/* ---------- Navigationsleiste (Glas) ---------- */
.navleiste {
  position: sticky; top: 0; z-index: 20;
  margin: 0 -16px;
  padding: calc(env(safe-area-inset-top) + 8px) 16px 8px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 44px;
  background: var(--glas);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  transition: box-shadow 0.2s;
}
.navleiste.gescrollt { box-shadow: 0 0.5px 0 var(--linie); }
.navleiste .links { justify-self: start; }
.navleiste .rechts { justify-self: end; display: flex; gap: 8px; }
.navleiste .mitte { font-weight: 600; font-size: 17px; opacity: 0; transition: opacity 0.2s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55vw; }
.navleiste.gescrollt .mitte { opacity: 1; }
.nav-text { background: none; border: 0; padding: 8px 4px; color: var(--akzent-stark); font-size: 17px; display: inline-flex; align-items: center; gap: 2px; }
.nav-text svg { width: 22px; height: 22px; }
.nav-rund {
  width: 36px; height: 36px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--akzent-zart); color: var(--akzent-stark); font-weight: 600; font-size: 15px;
}
.nav-rund svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2.4; fill: none; stroke-linecap: round; }
.nav-rund.voll { background: var(--akzent); color: #fff; }

.grosser-titel {
  font-size: 34px; line-height: 1.12; font-weight: 700; letter-spacing: -0.022em;
  margin: 4px 0 4px;
}
.untertitel { color: var(--text-2); margin: 0 0 20px; font-size: 15px; }

/* ---------- Gruppierte Listen (iOS inset grouped) ---------- */
.abschnitt { margin: 28px 0 0; }
.abschnitt > h2 {
  font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-2); margin: 0 16px 8px;
}
.abschnitt > .fuss { font-size: 13px; color: var(--text-2); margin: 8px 16px 0; }
.gruppe-liste {
  background: var(--flaeche); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--schatten);
}
.zeile {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 52px;
  position: relative; color: var(--text); width: 100%; background: none; border: 0; text-align: left;
  transition: background-color 0.15s;
}
.zeile + .zeile::before {
  content: ""; position: absolute; top: 0; right: 0; left: 16px; height: 0.5px; background: var(--linie);
}
.zeile.mit-icon + .zeile.mit-icon::before { left: 68px; }
a.zeile:active, button.zeile:active { background: var(--flaeche-2); }
.zeile .inhalt { flex: 1; min-width: 0; }
.zeile .titel { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zeile .info { font-size: 14px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zeile .wert { color: var(--text-2); font-size: 15px; }
.chevron { width: 8px; height: 13px; flex: none; stroke: var(--text-3); stroke-width: 2; fill: none; }
.emoji-kachel {
  width: 40px; height: 40px; border-radius: 10px; flex: none; display: grid; place-items: center;
  font-size: 22px; background: var(--flaeche-2);
}
.marke {
  font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; white-space: nowrap;
  background: var(--akzent); color: #fff;
}
.marke.leise { background: var(--flaeche-2); color: var(--text-2); }
.marke.gruen { background: color-mix(in srgb, var(--gruen) 18%, transparent); color: var(--gruen); }
.marke.rot { background: color-mix(in srgb, var(--rot) 15%, transparent); color: var(--rot); }

.leer {
  text-align: center; padding: 40px 24px; color: var(--text-2);
  background: var(--flaeche); border-radius: var(--radius); box-shadow: var(--schatten);
}
.leer .gross { font-size: 44px; margin-bottom: 8px; }
.leer strong { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }

/* ---------- Knöpfe ---------- */
.knopf {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: 52px; padding: 14px 20px; border: 0; border-radius: 14px;
  background: var(--akzent); color: #fff; font-weight: 600; font-size: 17px;
  transition: transform 0.12s ease-out, opacity 0.2s, background-color 0.2s;
}
.knopf:active { transform: scale(0.97); }
.knopf:disabled { background: var(--flaeche-2); color: var(--text-3); box-shadow: none; }
.knopf.hell { background: var(--akzent-zart); color: var(--akzent-stark); }
.knopf.neutral { background: var(--flaeche); color: var(--text); box-shadow: var(--schatten); }
.knopf.gefahr { background: none; color: var(--rot); box-shadow: none; }
.knopf.klein { min-height: 36px; padding: 6px 14px; width: auto; font-size: 15px; border-radius: 999px; }
.knopf svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.unten-fest {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--hg) 60%, transparent);
}
.unten-fest > * { max-width: 608px; margin: 0 auto; }

/* ---------- Eingaben ---------- */
.feld, .feld-text {
  width: 100%; border: 0; background: transparent; padding: 14px 16px; font-size: 17px; outline: none;
  min-height: 52px;
}
.feld::placeholder, .feld-text::placeholder { color: var(--text-3); }
.feld-text { resize: none; min-height: 88px; }
.feld-karte { background: var(--flaeche); border-radius: var(--radius); box-shadow: var(--schatten); overflow: hidden; }
.feld-karte .feld + .feld { border-top: 0.5px solid var(--linie); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 4px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  border: 0; border-radius: 999px; padding: 8px 14px; min-height: 36px; font-size: 15px; font-weight: 500;
  background: var(--flaeche); color: var(--text); box-shadow: var(--schatten); white-space: nowrap;
  transition: transform 0.12s ease-out, background-color 0.2s, color 0.2s;
}
.chip:active { transform: scale(0.95); }
.chip[aria-pressed="true"] { background: var(--akzent); color: #fff; }
.chip.emoji { font-size: 24px; padding: 6px; width: 48px; height: 48px; border-radius: 14px; }
.chip.emoji[aria-pressed="true"] { background: var(--akzent-zart); box-shadow: inset 0 0 0 2px var(--akzent); }

.segment {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 2px;
  background: color-mix(in srgb, var(--text) 8%, transparent); border-radius: 10px; position: relative;
}
.segment button {
  border: 0; background: none; border-radius: 8px; padding: 7px 6px; font-size: 14px; font-weight: 500;
  color: var(--text); min-height: 34px; transition: background-color 0.2s, box-shadow 0.2s;
}
.segment button[aria-pressed="true"] { background: var(--flaeche); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); font-weight: 600; }
@media (prefers-color-scheme: dark) { .segment button[aria-pressed="true"] { background: #5A4D44; } }
.segment.klein button { font-size: 13px; padding: 5px 4px; min-height: 30px; }

.wochentage { display: flex; justify-content: space-between; gap: 6px; padding: 12px 16px; }
.wochentage button {
  width: 40px; height: 40px; border-radius: 50%; border: 0; font-weight: 600; font-size: 14px;
  background: var(--flaeche-2); color: var(--text-2); transition: transform 0.12s, background-color 0.2s, color 0.2s;
}
.wochentage button:active { transform: scale(0.92); }
.wochentage button[aria-pressed="true"] { background: var(--akzent); color: #fff; }

.formular-block { padding: 12px 16px; display: grid; gap: 12px; }
.formular-block + .formular-block { border-top: 0.5px solid var(--linie); }
.beschriftung { font-size: 15px; color: var(--text-2); }
.vorschau-text { font-size: 14px; color: var(--text-2); padding: 0 16px 12px; }

.schalter { position: relative; width: 51px; height: 31px; flex: none; }
.schalter input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.schalter span {
  position: absolute; inset: 0; border-radius: 999px; background: color-mix(in srgb, var(--text) 16%, transparent);
  transition: background-color 0.25s;
}
.schalter span::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); transition: transform 0.3s var(--feder);
}
.schalter input:checked + span { background: var(--gruen); }
.schalter input:checked + span::after { transform: translateX(20px); }

/* ---------- Kalender ---------- */
.monat { padding: 8px 8px 12px; }
.monat + .monat { border-top: 0.5px solid var(--linie); }
.monat h3 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; margin: 8px 8px 8px; }
.monat h3 span { color: var(--akzent-stark); }
.wt-kopf, .tage { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.wt-kopf div { text-align: center; font-size: 12px; font-weight: 600; color: var(--text-3); padding: 4px 0; }
.tag {
  position: relative; aspect-ratio: 1 / 1.08; border: 0; background: none; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.tag .zahl {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-size: 18px; font-weight: 500; transition: transform 0.25s var(--feder), background-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.tag:disabled { cursor: default; }
.tag:disabled .zahl { color: var(--text-3); opacity: 0.55; font-weight: 400; }
.tag.leer { visibility: hidden; }
.tag.heute .zahl { color: var(--akzent-stark); font-weight: 700; }
.tag:not(:disabled):active .zahl { transform: scale(0.88); }
.tag.ja .zahl { background: var(--akzent); color: #fff; font-weight: 600; }
.tag.vielleicht .zahl {
  background: var(--akzent-zart); color: var(--akzent-stark); font-weight: 600;
  box-shadow: inset 0 0 0 2px var(--akzent);
  background-image: repeating-linear-gradient(135deg, transparent 0 5px, color-mix(in srgb, var(--akzent) 22%, transparent) 5px 7px);
}
.tag.fest .zahl { background: var(--gruen); color: #fff; font-weight: 700; }
.tag .punkte { height: 5px; display: flex; gap: 2px; }
.tag .punkte i { width: 5px; height: 5px; border-radius: 50%; background: var(--akzent); }
.tag .punkte i.v { background: none; box-shadow: inset 0 0 0 1.5px var(--akzent); }
/* Heatmap: Hintergrund nach Anteil */
.tag.heat .zahl { background: color-mix(in srgb, var(--akzent) calc(var(--anteil) * 100%), var(--flaeche-2)); }
.tag.heat.stark .zahl { color: #fff; font-weight: 600; }
.tag.gewaehlt .zahl { box-shadow: 0 0 0 2px var(--flaeche), 0 0 0 4px var(--text); }
.tag .anzahl { font-size: 10px; font-weight: 600; color: var(--text-2); height: 12px; line-height: 12px; }

.legende { display: flex; gap: 16px; justify-content: center; font-size: 13px; color: var(--text-2); padding: 4px 0 12px; flex-wrap: wrap; }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.legende i { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.legende .ja { background: var(--akzent); }
.legende .vielleicht { background: var(--akzent-zart); box-shadow: inset 0 0 0 1.5px var(--akzent); }

/* ---------- Treffen-Kopf ---------- */
.treffen-kopf { text-align: center; padding: 8px 0 4px; }
.treffen-kopf .emoji-gross {
  width: 76px; height: 76px; border-radius: 22px; margin: 0 auto 12px; display: grid; place-items: center;
  font-size: 42px; background: var(--flaeche); box-shadow: var(--schatten);
}
.treffen-kopf h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 4px; line-height: 1.15; }
.treffen-kopf p { margin: 0; color: var(--text-2); font-size: 15px; }
.treffen-kopf .ort { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 15px; }

.termin-karte {
  margin-top: 20px; border-radius: 20px; overflow: hidden; box-shadow: var(--schatten); background: var(--flaeche);
  text-align: center;
}
.termin-karte .kopf { background: var(--akzent); color: #fff; padding: 10px; font-weight: 600; font-size: 15px; letter-spacing: 0.02em; }
.termin-karte .tag-gross { font-size: 64px; font-weight: 700; line-height: 1; padding: 18px 0 4px; letter-spacing: -0.03em; }
.termin-karte .datum-text { color: var(--text-2); padding-bottom: 18px; }
.termin-karte .aktionen { padding: 0 16px 16px; display: grid; gap: 8px; }

.hinweis-karte {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; margin-top: 16px;
  background: var(--akzent-zart); border-radius: var(--radius); color: var(--text); font-size: 15px;
}
.hinweis-karte .symbol { font-size: 22px; line-height: 1; }
.hinweis-karte strong { display: block; }
.hinweis-karte a, .hinweis-karte button.link { color: var(--akzent-stark); font-weight: 600; background: none; border: 0; padding: 0; }

.fortschritt { height: 6px; border-radius: 3px; background: var(--flaeche-2); overflow: hidden; margin-top: 8px; }
.fortschritt i { display: block; height: 100%; background: var(--akzent); border-radius: 3px; transition: width 0.6s var(--feder); }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-size: 14px; font-weight: 600; color: #fff; background: var(--braun);
}
.mitbring-knopf { flex: none; }

/* ---------- Blatt (Bottom Sheet) ---------- */
.blatt-hg {
  position: fixed; inset: 0; z-index: 40; background: rgba(30, 20, 10, 0.32);
  opacity: 0; transition: opacity 0.3s;
}
.blatt-hg.offen { opacity: 1; }
.blatt {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-width: 640px; margin: 0 auto;
  background: var(--hg); border-radius: 14px 14px 0 0; padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform 0.42s var(--feder); max-height: 85dvh; overflow-y: auto;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.18);
}
.blatt.offen { transform: none; }
.blatt .griff { width: 36px; height: 5px; border-radius: 3px; background: var(--text-3); margin: 0 auto 12px; opacity: 0.6; }
.blatt h2 { font-size: 20px; margin: 4px 0 12px; }

/* ---------- Anmeldung ---------- */
.auth { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 40px 0; gap: 20px; }
.auth-marke { text-align: center; }
.auth-marke img { width: 96px; height: 96px; border-radius: 22px; box-shadow: var(--schatten); }
.auth-marke .marke-name { display: block; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 12px; }
.auth-marke p { color: var(--text-2); margin: 4px 0 0; }
.formular { display: grid; gap: 16px; }
.formular h1 { display: none; }
.gruppe { display: grid; gap: 6px; }
.gruppe label { font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; margin-left: 16px; }
.gruppe .feld, .gruppe .feld-zeile { background: var(--flaeche); border-radius: 12px; box-shadow: var(--schatten); }
.gruppe .hilfe { font-size: 13px; color: var(--text-2); margin-left: 16px; }
.feld-zeile { display: flex; align-items: center; }
.feld-zeile .feld { box-shadow: none; background: none; }
.zeigen { border: 0; background: none; color: var(--akzent-stark); padding: 0 16px; font-size: 15px; }
.meldung { color: var(--rot); margin: 0; font-size: 15px; text-align: center; }
.meldung-ok { color: var(--gruen); }
.leise { color: var(--text-2); font-size: 14px; text-align: center; }

/* ---------- Hinweise (Toast) ---------- */
#hinweise {
  position: fixed; left: 0; right: 0; top: calc(env(safe-area-inset-top) + 8px); z-index: 60;
  display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px;
}
.hinweis {
  background: var(--text); color: var(--hg); padding: 12px 18px; border-radius: 999px; font-size: 15px; font-weight: 500;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2); transform: translateY(-20px) scale(0.96); opacity: 0;
  transition: transform 0.4s var(--feder), opacity 0.3s; max-width: 100%;
}
.hinweis.sichtbar { transform: none; opacity: 1; }
.hinweis-fehler { background: var(--rot); color: #fff; }
.offline-banner { text-align: center; font-size: 14px; padding: 8px; background: var(--akzent-zart); }

/* ---------- Einblenden ---------- */
@keyframes rein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.rein { animation: rein 0.45s var(--feder) both; }
.rein-2 { animation-delay: 0.05s; }
.rein-3 { animation-delay: 0.1s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .navleiste { background: var(--hg); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
.zeile.ausgegraut .titel, .zeile.ausgegraut .avatar { opacity: 0.4; }
.formular-block .feld { padding: 0; min-height: 0; }
input[type="date"].feld { color: var(--akzent-stark); font-weight: 500; -webkit-appearance: none; appearance: none; text-align: left; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; }
svg path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.treffen-kopf .ort svg { width: 17px; height: 17px; flex: none; }
.treffen-kopf .ort { max-width: 100%; }
.chevron path { stroke: var(--text-3); }
.tag { min-width: 0; }
@media (max-width: 360px) { .tag .zahl { width: 34px; height: 34px; font-size: 16px; } }
/* Anzahl als kleines Abzeichen oben rechts am Kreis statt Text darunter */
.tag .anzahl { height: 0; }
.tag .anzahl:not(:empty) {
  position: absolute; top: 2px; left: calc(50% + 10px); height: 18px; min-width: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--text); color: var(--hg); font-size: 11px; line-height: 18px; text-align: center;
}
