/* Bundesliga-Tipps – Rasengrün, Kreide, Gelb für das Modell */
:root {
  --bg: #f3f6f2;
  --karte: #ffffff;
  --karte2: #eaf0e8;
  --text: #17201b;
  --muted: #65706a;
  --linie: #dbe3d8;
  --akzent: #13643f;
  --akzent-text: #fff;
  --ich: #13643f;
  --du: #c2416c;
  --modell: #b98a00;
  --heim: #13643f;
  --remis: #9aa49d;
  --gast: #2f5fb3;
  --gut: #1e8a4c;
  --schlecht: #c8372d;
  --z-cl: #1e8a4c;
  --z-eu: #6fb58a;
  --z-rel: #e2953e;
  --z-ab: #c8372d;
  --schatten: 0 1px 2px rgba(10, 40, 20, .06), 0 4px 14px rgba(10, 40, 20, .06);
  --r: 16px;
  --unten: calc(64px + env(safe-area-inset-bottom));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121614;
    --karte: #1b211e;
    --karte2: #232b27;
    --text: #e8efe9;
    --muted: #9ea9a2;
    --linie: #2f3833;
    --akzent: #4cc386;
    --akzent-text: #0d1a12;
    --ich: #4cc386;
    --du: #f07ba0;
    --modell: #f2c94c;
    --heim: #3fae74;
    --remis: #6c7570;
    --gast: #6f9cf0;
    --schatten: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh; padding-bottom: var(--unten);
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--akzent); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.klein { font-size: .86rem; }
.zahl { font-variant-numeric: tabular-nums; }

/* ---------- Kopf ---------- */
.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--linie);
}
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.brand h1 { font-size: 1.15rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { border: 0; background: transparent; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--text); font-size: 1.1rem; flex: none; }
.icon-btn:active { background: var(--karte2); }
.sync { display: flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); }
.sync .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--remis); }
.sync[data-state="live"] .dot { background: var(--gut); }
.sync[data-state="off"] .dot { background: var(--schlecht); }
.sync[data-state="demo"] .dot { background: var(--modell); }

.banner { margin: 10px 16px 0; padding: 10px 14px; border-radius: 12px; font-size: .9rem; }
.banner.demo { background: color-mix(in srgb, var(--modell) 22%, var(--karte)); }
.hinweis { background: color-mix(in srgb, var(--modell) 14%, var(--karte)); border-radius: 12px; padding: 10px 12px; font-size: .88rem; margin: 10px 0; }

main { max-width: 640px; margin: 0 auto; padding: 8px 14px 24px; }
.ansicht h2 { font-size: 1.05rem; margin: 18px 4px 8px; }
.ansicht h3 { font-size: .95rem; margin: 14px 4px 6px; }

/* ---------- Ligen ---------- */
.ligen { display: flex; gap: 6px; overflow-x: auto; padding: 6px 0 4px; scrollbar-width: none; position: sticky; top: calc(57px + env(safe-area-inset-top)); z-index: 5; background: var(--bg); }
.ligen::-webkit-scrollbar { display: none; }
.chip { border: 1px solid var(--linie); background: var(--karte); border-radius: 99px; padding: 6px 12px; font-size: .88rem; white-space: nowrap; flex: none; }
.chip[aria-selected="true"], .chip.an { background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Karten, Knöpfe ---------- */
.karte { background: var(--karte); border-radius: var(--r); box-shadow: var(--schatten); padding: 14px; margin: 10px 0; }
.btn { border: 1px solid var(--linie); background: var(--karte); border-radius: 12px; padding: 9px 14px; font-weight: 600; }
.btn.primaer { background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); }
.btn.gefahr { color: var(--schlecht); }
.btn.klein { padding: 5px 10px; font-size: .85rem; }
.btn:disabled { opacity: .5; }
.knoepfe { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.seg { display: flex; background: var(--karte2); border-radius: 12px; padding: 3px; margin: 10px 0; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 9px; padding: 7px 8px; font-size: .9rem; }
.seg button[aria-pressed="true"] { background: var(--karte); box-shadow: var(--schatten); font-weight: 600; }

/* ---------- Spieltag ---------- */
.st-kopf { display: flex; align-items: center; gap: 6px; margin: 8px 0 2px; }
.st-kopf h2 { flex: 1; text-align: center; margin: 0; }
.st-kopf .icon-btn:disabled { opacity: .3; }
.tag { font-size: .8rem; color: var(--muted); margin: 14px 6px 4px; text-transform: none; font-weight: 600; }
.spiel { background: var(--karte); border-radius: 14px; box-shadow: var(--schatten); padding: 10px 12px; margin: 6px 0; cursor: pointer; }
.spiel .zeile { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.team { display: flex; align-items: center; gap: 7px; min-width: 0; font-weight: 600; }
.team.gast { justify-content: flex-end; text-align: right; }
.team span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wappen { width: 24px; height: 24px; flex: none; object-fit: contain; }
.wappen.ersatz { display: inline-grid; place-items: center; border-radius: 50%; background: var(--karte2); font-size: .62rem; font-weight: 700; color: var(--muted); }
.mitte { text-align: center; min-width: 58px; }
.ergebnis { font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.zeit { font-size: .85rem; color: var(--muted); }
.balken { display: flex; height: 22px; border-radius: 7px; overflow: hidden; margin-top: 8px; font-size: .74rem; font-weight: 700; color: #fff; }
.balken > div { display: grid; place-items: center; min-width: 0; overflow: hidden; white-space: nowrap; }
.balken .h { background: var(--heim); } .balken .x { background: var(--remis); } .balken .a { background: var(--gast); }
.balken .richtig { box-shadow: inset 0 0 0 2px var(--modell); }
.unterzeile { display: flex; justify-content: space-between; gap: 8px; font-size: .78rem; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.mtipp { color: var(--modell); font-weight: 700; }
.tippzeile { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--linie); font-size: .88rem; flex-wrap: wrap; }
.tippzeile .eingabe { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.tippzeile input { width: 42px; text-align: center; padding: 6px 2px; border: 1px solid var(--linie); border-radius: 9px; background: var(--bg); font-weight: 700; font-size: 1rem; }
.pkt { display: inline-block; min-width: 24px; text-align: center; border-radius: 7px; padding: 1px 6px; font-weight: 700; font-size: .8rem; background: var(--karte2); }
.pkt.p4 { background: var(--gut); color: #fff; } .pkt.p3 { background: #5aa572; color: #fff; } .pkt.p2 { background: #a5c9ae; color: #123; }
.wer { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.wer.ich { background: var(--ich); } .wer.du { background: var(--du); } .wer.mo { background: var(--modell); }
.live { color: var(--schlecht); font-weight: 700; }

/* ---------- Tabelle ---------- */
table.tab { width: 100%; border-collapse: collapse; font-size: .86rem; font-variant-numeric: tabular-nums; }
.tab th { font-size: .72rem; color: var(--muted); font-weight: 600; text-align: right; padding: 6px 4px; }
.tab td { padding: 7px 4px; border-top: 1px solid var(--linie); text-align: right; }
.tab td.t, .tab th.t { text-align: left; }
.tab td.t { max-width: 1px; width: 100%; }
.tab td.t div { display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; }
.tab td.t span { overflow: hidden; text-overflow: ellipsis; }
.tab tr { cursor: pointer; }
.tab .pl { width: 26px; text-align: center; font-weight: 700; border-left: 4px solid transparent; }
.tab tr.z-cl .pl { border-left-color: var(--z-cl); } .tab tr.z-eu .pl { border-left-color: var(--z-eu); }
.tab tr.z-rel .pl { border-left-color: var(--z-rel); } .tab tr.z-ab .pl { border-left-color: var(--z-ab); }
.prozent { display: inline-block; min-width: 38px; border-radius: 6px; padding: 1px 4px; text-align: center; }
.form { display: inline-flex; gap: 2px; }
.form i { width: 7px; height: 7px; border-radius: 2px; background: var(--remis); }
.form i.S { background: var(--gut); } .form i.N { background: var(--schlecht); }
.legende { display: flex; flex-wrap: wrap; gap: 10px; font-size: .75rem; color: var(--muted); margin: 8px 4px; }
.legende i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

/* ---------- Detail ---------- */
.matrix { display: grid; grid-template-columns: 26px repeat(6, 1fr); gap: 3px; font-size: .74rem; font-variant-numeric: tabular-nums; }
.matrix div { text-align: center; padding: 6px 0; border-radius: 6px; }
.matrix .kopf { color: var(--muted); font-weight: 700; background: none; }
.kennzahlen { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.kennzahl { background: var(--karte2); border-radius: 12px; padding: 8px 10px; }
.kennzahl b { display: block; font-size: 1.15rem; }
.kennzahl span { font-size: .76rem; color: var(--muted); }
.vergleich { display: grid; grid-template-columns: 1fr auto 1fr; gap: 4px 10px; font-size: .86rem; align-items: center; }
.vergleich .m { color: var(--muted); font-size: .76rem; text-align: center; }
.vergleich .r { text-align: right; }
.liste { list-style: none; margin: 0; padding: 0; font-size: .86rem; }
.liste li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 2px; border-top: 1px solid var(--linie); }
.verteilung { display: flex; align-items: flex-end; gap: 2px; height: 110px; margin: 10px 0 2px; }
.verteilung div { flex: 1; background: var(--akzent); border-radius: 3px 3px 0 0; min-height: 1px; }
.verteilung-achse { display: flex; gap: 2px; font-size: .64rem; color: var(--muted); }
.verteilung-achse span { flex: 1; text-align: center; }

/* ---------- Modell ---------- */
.guete { width: 100%; border-collapse: collapse; font-size: .86rem; font-variant-numeric: tabular-nums; }
.guete th, .guete td { padding: 6px 4px; border-top: 1px solid var(--linie); text-align: right; }
.guete th:first-child, .guete td:first-child { text-align: left; }
.guete thead th { border-top: 0; font-size: .74rem; color: var(--muted); }
.besser { color: var(--gut); font-weight: 700; }
.kalib { width: 100%; height: auto; display: block; }
.text p, .text li { font-size: .92rem; }
.text h3 { margin-top: 18px; }

/* ---------- Tippspiel ---------- */
.stand { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stand > div { background: var(--karte); border-radius: 14px; box-shadow: var(--schatten); padding: 10px; text-align: center; }
.stand b { display: block; font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.stand .fuehrt { outline: 2px solid var(--modell); }

/* ---------- Anmeldung ---------- */
.login { max-width: 400px; margin: 40px auto; padding: 0 16px; }
.login form { display: flex; flex-direction: column; gap: 12px; text-align: center; align-items: stretch; }
.login img { align-self: center; }
.login h2 { margin: 4px 0 0; }
.login label { display: flex; flex-direction: column; gap: 4px; text-align: left; font-size: .9rem; }
input[type=email], input[type=password], input[type=text], select { padding: 10px 12px; border: 1px solid var(--linie); border-radius: 12px; background: var(--bg); width: 100%; }
.fehler { color: var(--schlecht); font-size: .9rem; margin: 0; }

/* ---------- Unten ---------- */
nav.unten {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex;
  background: color-mix(in srgb, var(--karte) 94%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--linie); padding-bottom: env(safe-area-inset-bottom);
}
nav.unten button { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; font-size: .72rem; color: var(--muted); }
nav.unten svg { width: 24px; height: 24px; }
nav.unten button[aria-current="page"] { color: var(--akzent); font-weight: 700; }

/* ---------- Dialoge ---------- */
dialog.sheet { border: 0; padding: 0 16px calc(18px + env(safe-area-inset-bottom)); margin: auto auto 0; width: 100%; max-width: 640px; max-height: 92vh; border-radius: 20px 20px 0 0; background: var(--karte); color: var(--text); box-shadow: 0 -8px 30px rgba(0,0,0,.2); }
dialog.sheet::backdrop { background: rgba(0, 0, 0, .4); }
.sheet-kopf { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--karte); padding: 14px 0 6px; z-index: 2; }
.sheet-kopf h2 { margin: 0; font-size: 1.1rem; }
.block { border-top: 1px solid var(--linie); padding: 10px 0; }
.block h3 { margin: 4px 0 6px; font-size: .95rem; }
.schalter { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.status { margin: 4px 0; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--unten) + 12px); z-index: 30; background: #222a25; color: #fff; padding: 10px 14px; border-radius: 12px; display: flex; gap: 12px; align-items: center; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.25); font-size: .9rem; }
.toast button { border: 0; background: none; color: #9fe3bd; font-weight: 700; }
.leer { text-align: center; color: var(--muted); padding: 30px 10px; }
.guete td .muted { font-weight: 400; color: var(--muted); white-space: nowrap; font-size: .76rem; }
.guete thead th { white-space: nowrap; }
