:root {
  --red: #D4011D;
  --red-dark: #8F0011;
  --red-light: #E4293A;
  --ink: #161616;
  --paper: #F6F2F1;
  --white: #fff;
  --muted: rgba(22, 22, 22, .62);
  --line: rgba(22, 22, 22, .08);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); min-height: 100%; }
body { overscroll-behavior-y: none; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
.ms { font-family: "Material Symbols Rounded"; font-weight: normal; font-style: normal; font-size: 24px; line-height: 1;
  letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap; direction: ltr;
  -webkit-font-smoothing: antialiased; font-variation-settings: "FILL" 1, "wght" 500; user-select: none; }

.splash { position: fixed; inset: 0; background: var(--red); display: grid; place-items: center; }
.splash img { width: 55%; max-width: 280px; }

/* ---------- Spielfeld-Hintergrund ---------- */
.pitch-bg {
  min-height: 100dvh;
  background:
    linear-gradient(135deg, rgba(255,255,255,.08) 0 45%, transparent 45%),
    linear-gradient(180deg, var(--red-light), var(--red) 45%, var(--red-dark));
  color: var(--white);
  padding: calc(var(--safe-top) + 14px) 14px calc(var(--safe-bottom) + 14px);
  display: flex; flex-direction: column;
}
.brand { text-align: center; }
.brand h1 { margin: 0; font-size: 30px; font-weight: 900; letter-spacing: 4px; }
.brand p { margin: 2px 0 0; opacity: .85; }

.scoreboard { display: block; width: 100%; margin-top: 12px; padding: 9px 12px; border: 0; border-radius: 8px;
  background: rgba(22,22,22,.55); color: var(--white); text-align: center; }
.scoreboard small { display: block; font-size: 10px; font-weight: 900; letter-spacing: 1px; opacity: .75; text-transform: uppercase; }
.scoreboard strong { display: block; font-size: 17px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scoreboard span { font-size: 13px; }

.field {
  position: relative; flex: 1; min-height: 560px; margin-top: 12px; border-radius: 4px;
  background: repeating-linear-gradient(180deg, rgba(255,255,255,.055) 0 10%, transparent 10% 20%);
}
.field svg.lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.field .logo { position: absolute; left: 50%; top: 25%; width: 36%; max-width: 170px; transform: translate(-50%, -50%);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.25)); pointer-events: none; }
.player { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center;
  border: 0; background: none; padding: 2px; color: var(--red); text-decoration: none; }
.player:active { transform: translate(-50%, -50%) scale(.94); }
.jersey { position: relative; width: 58px; height: 52px; }
.jersey svg { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 2px 2px rgba(0,0,0,.25)); }
.jersey .ms { position: absolute; left: 50%; top: 56%; transform: translate(-50%, -50%); font-size: 22px; }
.player.keeper { color: var(--white); }
.badge { position: absolute; right: -4px; top: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--ink); color: var(--white); border: 2px solid var(--white); font-size: 11px; font-weight: 900;
  display: grid; place-items: center; line-height: 1; }
.badge[hidden] { display: none; }
.label { display: inline-block; margin-top: 3px; padding: 4px 8px; border-radius: 4px; background: var(--white); color: var(--ink);
  font-size: 10.5px; font-weight: 900; letter-spacing: .5px; text-transform: uppercase; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,.2); }

/* ---------- Seiten mit roter Kopfzeile ---------- */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 4px;
  background: var(--red); color: var(--white); padding: calc(var(--safe-top) + 6px) 6px 6px; min-height: 56px; }
.topbar h2 { flex: 1; margin: 0 0 0 4px; font-size: 20px; font-weight: 900; letter-spacing: .5px; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iconbtn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: none; color: inherit; }
.iconbtn:disabled { opacity: .35; }
.iconbtn:active { background: rgba(255,255,255,.15); }
.page { padding: 14px 14px calc(var(--safe-bottom) + 90px); max-width: 720px; margin: 0 auto; }
.page.flush { padding-left: 0; padding-right: 0; }

.card { position: relative; display: block; background: var(--white); border-radius: 6px; padding: 14px 14px 14px 18px;
  margin-bottom: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.08); text-decoration: none; overflow: hidden; }
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--red); }
.card.hl { outline: 2px solid var(--red); }
.card h3 { margin: 0 0 4px; font-size: 16px; font-weight: 800; }
.card p { margin: 4px 0 0; }
.card .img { display: block; margin: -14px -14px 10px -18px; width: calc(100% + 32px); aspect-ratio: 24/9; object-fit: cover; background: #ddd; }
.kicker { color: var(--red); font-size: 11px; font-weight: 900; letter-spacing: .6px; text-transform: uppercase; }
.muted { color: var(--muted); font-size: 13px; }
.listhead { margin: 18px 2px 8px; color: var(--red); font-size: 12px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; }
.banner { background: var(--white); border-left: 4px solid var(--ink); border-radius: 6px; padding: 12px 14px; margin-bottom: 12px; font-size: 14px; }
.banner.red { background: var(--red); color: var(--white); border-left-color: var(--red-dark); }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.foot { color: var(--muted); font-size: 12px; margin-top: 16px; }
.spinner { width: 34px; height: 34px; margin: 40px auto; border: 4px solid rgba(212,1,29,.2); border-top-color: var(--red);
  border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Formulare ---------- */
.field-row { margin-bottom: 12px; }
.field-row label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.field-row .hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 12px; border: 1px solid rgba(22,22,22,.25); border-radius: 6px; background: var(--white);
  font-size: 16px; /* verhindert Zoom auf dem iPhone */ }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--red); border-color: transparent; }
textarea { min-height: 90px; resize: vertical; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: 13px 16px;
  border: 0; border-radius: 6px; background: var(--red); color: var(--white); font-weight: 900; letter-spacing: .5px;
  text-transform: uppercase; font-size: 14px; text-decoration: none; }
.btn:disabled { opacity: .5; }
.btn.ghost { background: transparent; color: var(--red); border: 2px solid var(--red); }
.btn.dark { background: var(--ink); }
.btn.small { width: auto; padding: 8px 12px; font-size: 12px; }
.btn + .btn { margin-top: 8px; }
.linkbtn { border: 0; background: none; color: var(--red); font-weight: 700; padding: 8px 0; text-decoration: underline; }

.tabs { display: flex; background: rgba(255,255,255,.15); border-radius: 8px; padding: 4px; margin-bottom: 14px; }
.tabs button { flex: 1; border: 0; background: none; color: var(--white); padding: 10px 4px; border-radius: 6px;
  font-weight: 900; font-size: 12px; letter-spacing: .5px; text-transform: uppercase; }
.tabs button.on { background: var(--white); color: var(--red); }
.authbox { background: var(--white); color: var(--ink); border-radius: 10px; padding: 16px; }

.chips { display: flex; gap: 6px; overflow-x: auto; margin: 4px 0 10px; padding-bottom: 2px; }
.chip { flex: none; border: 1px solid rgba(22,22,22,.25); background: var(--white); border-radius: 8px; padding: 7px 12px;
  font-size: 14px; font-weight: 600; }
.chip.on { background: var(--red); border-color: var(--red); color: var(--white); }

.fab { position: fixed; right: 18px; bottom: calc(var(--safe-bottom) + 18px); z-index: 6; display: flex; align-items: center; gap: 6px;
  border: 0; border-radius: 16px; padding: 15px 18px; background: var(--red); color: var(--white); font-weight: 900;
  box-shadow: 0 4px 12px rgba(0,0,0,.25); }

/* ---------- Dialog ---------- */
.sheet-bg { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto; background: var(--paper); border-radius: 14px 14px 0 0;
  padding: 18px 16px calc(var(--safe-bottom) + 18px); }
.sheet h3 { margin: 0 0 14px; font-size: 18px; font-weight: 900; text-transform: uppercase; }
.sheet .actions { display: flex; gap: 8px; margin-top: 8px; }
.sheet .actions .btn { margin: 0; }

#toast { position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 24px); transform: translate(-50%, 30px); z-index: 30;
  max-width: 90vw; background: var(--ink); color: var(--white); padding: 12px 16px; border-radius: 8px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .25s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Umschalter (Angebote / Gesuche) ---------- */
.seg { display: flex; background: var(--white); border-radius: 8px; padding: 4px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg button { flex: 1; border: 0; background: none; padding: 10px 4px; border-radius: 6px; font-weight: 900; font-size: 13px;
  letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.seg button.on { background: var(--red); color: var(--white); }

/* ---------- Beiträge ---------- */
.post dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 8px 0 0; font-size: 14px; }
.post dt { color: var(--muted); }
.post dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.post .who { display: flex; justify-content: space-between; gap: 8px; }
.post .row { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.post .row .spacer { flex: 1; }
.participants { margin-top: 8px; font-size: 13px; color: var(--muted); }

/* ---------- Spielplan ---------- */
.match { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; text-align: center; }
.match .team { font-weight: 700; font-size: 14px; }
.match .score { font-size: 20px; font-weight: 900; min-width: 64px; }
.match .score.open { font-size: 14px; color: var(--muted); font-weight: 700; }
.match-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 8px; }

/* ---------- Liederbuch ---------- */
.song-row { display: flex; align-items: center; gap: 12px; }
.nr { flex: none; min-width: 40px; padding: 6px 4px; border-radius: 4px; background: var(--red); color: var(--white);
  font-weight: 900; text-align: center; font-size: 14px; }
.lyrics { white-space: pre-wrap; line-height: 1.55; }

/* ---------- Historie ---------- */
.summary { background: var(--red); color: var(--white); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; }
.summary small { font-size: 11px; font-weight: 900; letter-spacing: .8px; opacity: .8; }
.summary .vals { display: flex; justify-content: space-between; margin-top: 8px; text-align: center; }
.summary b { display: block; font-size: 24px; font-weight: 900; }
.summary span { font-size: 11px; opacity: .85; }
.season { display: flex; align-items: center; gap: 14px; }
.place { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 4px; background: var(--red);
  color: var(--white); font-size: 20px; font-weight: 900; }
.place.first { background: var(--ink); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { background: var(--ink); color: var(--white); font-size: 12px; padding: 7px 4px; text-align: right; }
.table td { padding: 8px 4px; text-align: right; border-bottom: 1px solid var(--line); }
.table tr:nth-child(even) td { background: rgba(0,0,0,.04); }
.table th:nth-child(2), .table td:nth-child(2) { text-align: left; max-width: 0; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table th:first-child, .table td:first-child { padding-left: 12px; font-weight: 700; }
.table th:last-child, .table td:last-child { padding-right: 12px; font-weight: 700; }
.table tr.union td { background: var(--red); color: var(--white); font-weight: 900; }

/* ---------- Fotos ---------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.grid button { border: 0; padding: 0; aspect-ratio: 1; background: #ddd; overflow: hidden; }
.grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.viewer { position: fixed; inset: 0; z-index: 25; background: #000; color: #fff; display: flex; flex-direction: column;
  padding: calc(var(--safe-top) + 6px) 8px calc(var(--safe-bottom) + 10px); }
.viewer img { flex: 1; min-height: 0; object-fit: contain; width: 100%; }
.viewer .bar { display: flex; align-items: center; gap: 8px; }
.viewer .bar .grow { flex: 1; }

@media (min-width: 600px) {
  .field { max-width: 520px; width: 100%; margin-left: auto; margin-right: auto; }
  .brand, .scoreboard { max-width: 520px; margin-left: auto; margin-right: auto; }
}

/* Historie: Pokal und Aufstiegsrunden */
.cupline { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cupline.won { color: var(--red); font-weight: 700; }
.subhead { padding: 22px 16px 8px; }
.cup { padding: 8px 0 12px; border-bottom: 1px solid var(--line); }
.cuphead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chip { background: rgba(0,0,0,.08); border-radius: 4px; padding: 3px 8px; font-size: 12px; font-weight: 700; }
.chip.won { background: var(--red); color: var(--white); }
.matches { margin-top: 4px; }
.mround { font-size: 12px; color: var(--muted); margin: 8px 0 2px; }
.mline { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 14px; }
.mline .res { width: 20px; height: 20px; border-radius: 3px; display: inline-flex; align-items: center; justify-content: center; color: var(--white); font-size: 11px; font-weight: 900; flex: none; }
.res.w { background: var(--red); } .res.d { background: rgba(0,0,0,.45); } .res.l { background: var(--ink); } .res.x { background: rgba(0,0,0,.2); }
.mline .venue { width: 24px; font-size: 12px; color: var(--muted); flex: none; }
.mline .opp { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mline .score { font-weight: 700; text-align: right; white-space: nowrap; }

/* Private Treffen */
.private { display: flex; align-items: center; gap: 4px; color: var(--red); font-size: 13px; font-weight: 700; margin-top: 4px; }
.private .ms, .seg .ms { font-size: 16px; vertical-align: -3px; }
.plist { max-height: 240px; overflow-y: auto; margin-top: 6px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 8px 2px; font-size: 15px; }
.pick input { width: 20px; height: 20px; accent-color: var(--red); }
