:root {
  --brand: #0b3a6e;          /* Vereinsfarbe – hier anpassen */
  --brand-2: #e8eef6;
  --bg: #f3f5f8;
  --card: #ffffff;
  --text: #14181f;
  --muted: #5d6675;
  --line: #e3e7ee;
  --win: #157f3b;
  --loss: #c2292e;
  --draw: #8a6d00;
  --radius: 14px;
  --tabbar: 64px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand-2: #1b2a3d;
    --bg: #0e1116;
    --card: #181c23;
    --text: #e9edf3;
    --muted: #9aa4b3;
    --line: #2a303a;
    --win: #3ec46d;
    --loss: #ff6b6b;
    --draw: #e0bf3a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 8px);
}
body > * { max-width: 560px; margin-inline: auto; }
button { font: inherit; color: inherit; }
a { color: inherit; }

/* Kopfzeile */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px;
  background: var(--brand); color: #fff;
  max-width: none;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .2px; }
.brand img { border-radius: 8px; }
.team-btn {
  display: flex; align-items: center; gap: 6px;
  max-width: 60%;
  border: 0; border-radius: 999px; padding: 7px 12px;
  background: rgba(255,255,255,.16); color: #fff; font-weight: 600; font-size: 14px;
}
.team-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main { padding: 14px 12px 4px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); margin: 20px 4px 8px; font-weight: 700; }
h2:first-child { margin-top: 4px; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,0,0,.05); overflow: hidden; }
.card + .card { margin-top: 10px; }

/* Nächstes Spiel */
.hero { padding: 16px; background: linear-gradient(160deg, var(--brand), #14549a); color: #fff; }
.hero .label { font-size: 12px; text-transform: uppercase; letter-spacing: .8px; opacity: .85; font-weight: 700; }
.hero .when { font-size: 22px; font-weight: 800; margin: 4px 0 2px; }
.hero .rel { font-size: 14px; opacity: .9; }
.hero .match { margin-top: 12px; display: grid; gap: 4px; font-size: 17px; }
.hero .match .hsg { font-weight: 800; }
.hero .meta { margin-top: 12px; font-size: 14px; opacity: .92; display: flex; flex-wrap: wrap; gap: 6px 12px; }
.hero .actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; border-radius: 10px; padding: 9px 12px; font-size: 14px; font-weight: 600;
  background: var(--brand-2); color: var(--text); text-decoration: none;
}
.hero .btn { background: rgba(255,255,255,.18); color: #fff; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--brand-2); color: var(--muted); }
.hero .pill { background: rgba(255,255,255,.2); color: #fff; }

/* Segment-Umschalter */
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--line); border-radius: 11px; padding: 3px; margin: 18px 0 4px; }
.seg button { border: 0; background: transparent; border-radius: 9px; padding: 8px; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.1); }

/* Spielliste */
.row {
  display: grid; grid-template-columns: 50px 1fr auto; gap: 10px; align-items: center;
  width: 100%; padding: 11px 14px; border: 0; background: none; text-align: left;
  border-top: 1px solid var(--line);
}
.row:first-child { border-top: 0; }
.row:active { background: var(--brand-2); }
.row .time { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1.25; }
.row .time b { display: block; color: var(--text); font-size: 14px; }
.row .teams { min-width: 0; }
.row .team-name { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .vs { font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.row .vs .hsg { font-weight: 700; }
.row .vs span { white-space: nowrap; }
.row .note { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 16px; text-align: right; min-width: 56px; }
.score small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
.res { display: inline-block; min-width: 54px; text-align: center; padding: 3px 7px; border-radius: 8px; color: #fff; }
.res.sieg { background: var(--win); }
.res.niederlage { background: var(--loss); }
.res.unentschieden { background: var(--draw); }
.res.offen { background: var(--line); color: var(--muted); font-size: 13px; }
.tag { font-size: 11px; font-weight: 700; color: var(--loss); text-transform: uppercase; }
.ha { font-size: 11px; font-weight: 700; color: var(--muted); }

.empty { padding: 26px 16px; text-align: center; color: var(--muted); }
.more { display: block; width: 100%; margin-top: 10px; padding: 12px; border: 0; border-radius: 12px; background: var(--card); color: var(--brand); font-weight: 700; }
@media (prefers-color-scheme: dark) { .more { color: #8fbfff; } }

/* Tabelle */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
th, td { padding: 9px 6px; text-align: right; }
th { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; border-bottom: 1px solid var(--line); }
td { border-top: 1px solid var(--line); }
tr:first-child td { border-top: 0; }
th:first-child, td:first-child { padding-left: 12px; width: 30px; }
th:last-child, td:last-child { padding-right: 12px; }
td.t, th.t { text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 0; width: 100%; }
td.pkt { font-weight: 800; }
tr.me td { background: var(--brand-2); font-weight: 700; }
.foot { font-size: 12px; color: var(--muted); padding: 8px 6px 0; }
.hide-s { display: none; }
@media (min-width: 400px) { .hide-s { display: table-cell; } }

/* Mannschaftsübersicht */
.list-btn { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 13px 14px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; }
.list-btn:first-child { border-top: 0; }
.list-btn .sub { font-size: 12px; color: var(--muted); }
.list-btn .right { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.list-btn[aria-current="true"] { color: var(--brand); font-weight: 700; }
@media (prefers-color-scheme: dark) { .list-btn[aria-current="true"] { color: #8fbfff; } }

/* Torschützen */
.scorer { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); }
.scorer:first-child { border-top: 0; }
.scorer .rank { color: var(--muted); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.scorer .name { font-weight: 600; }
.scorer .sub { font-size: 12px; color: var(--muted); }
.scorer .goals { font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; text-align: right; }
.scorer .goals small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }

/* Fußzeile mit Datenstand */
.stand { font-size: 12px; color: var(--muted); text-align: center; margin: 14px auto 4px; padding: 0 12px; }

/* Tab-Leiste */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; max-width: none;
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line);
}
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; font-size: 12px; font-weight: 600; color: var(--muted); }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabs a[aria-current="page"] { color: var(--brand); }
@media (prefers-color-scheme: dark) { .tabs a[aria-current="page"] { color: #8fbfff; } }

/* Bottom-Sheet */
.sheet { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px; max-height: 88dvh; border-radius: 20px 20px 0 0; background: var(--card); color: var(--text); }
.sheet::backdrop { background: rgba(0,0,0,.45); }
.sheet[open] { animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
.sheet-inner { padding: 8px 16px calc(18px + env(safe-area-inset-bottom)); }
.grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 2px auto 12px; }
.sheet h3 { margin: 0 0 2px; font-size: 19px; }
.sheet .sub { color: var(--muted); font-size: 14px; }
.detail-score { text-align: center; margin: 16px 0 6px; }
.detail-score .big { font-size: 38px; font-weight: 800; font-variant-numeric: tabular-nums; }
.detail-teams { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; text-align: center; margin: 14px 0; font-size: 16px; }
.detail-teams .hsg { font-weight: 800; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 15px; margin: 14px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.sheet .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sheet .close { width: 100%; margin-top: 14px; padding: 12px; border: 0; border-radius: 12px; background: var(--brand-2); font-weight: 700; }

.skeleton { height: 70px; border-radius: var(--radius); margin-bottom: 10px; background: linear-gradient(90deg, var(--card), var(--line), var(--card)); background-size: 200% 100%; animation: sh 1.2s infinite linear; }
.skeleton.short { height: 40px; width: 60%; }
@keyframes sh { to { background-position: -200% 0; } }

.offline { background: #fff3cd; color: #5b4500; font-size: 13px; padding: 8px 12px; border-radius: 10px; margin-bottom: 10px; }

/* Desktop: Hinweis, dass die Seite fürs Handy gedacht ist */
.desk-hint { display: none; }
@media (min-width: 900px) and (hover: hover) {
  .desk-hint { display: block; position: fixed; left: 24px; top: 90px; width: 220px; font-size: 14px; color: var(--muted); max-width: none; }
}
