:root {
  --bg: #f4f6f5; --surface: #fff; --text: #17201d; --muted: #66726e; --line: #dde3e0;
  --accent: #0b5d4b; --accent-soft: #e2f0ec; --para: #6b3fa0; --para-soft: #efe7f8; --live: #d9480f;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101513; --surface: #1a211e; --text: #e6ece9; --muted: #95a29d; --line: #2b3531;
    --accent: #4fc3a1; --accent-soft: #1d3a32; --para: #b892e6; --para-soft: #2e2440; --live: #ff8a50;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text);
  padding-bottom: env(safe-area-inset-bottom); }
header { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--accent); color: #fff; }
header h1 { margin: 0; font-size: 18px; }
button, select, input, .btn { font: inherit; color: inherit; }
.icon { background: none; border: 0; font-size: 20px; cursor: pointer; color: inherit; padding: 4px 8px; }

.filters { padding: 12px 16px 4px; display: grid; gap: 8px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 8px 0; border-radius: 8px; cursor: pointer; }
.seg button.active { background: var(--accent); color: #fff; font-weight: 600; }
.row { display: flex; gap: 8px; align-items: center; }
.row select { flex: 1; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.row .small { margin-left: auto; }
.small { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.muted { color: var(--muted); }
.center { text-align: center; padding: 24px 0; }
.banner { margin: 8px 16px 0; padding: 8px 12px; border-radius: 8px; background: var(--accent-soft); font-size: 13px; }

main { padding: 8px 16px 24px; display: grid; gap: 8px; }
.card { display: grid; gap: 4px; text-align: left; width: 100%; padding: 12px 14px; border: 1px solid var(--line);
  border-left: 4px solid var(--accent); border-radius: 10px; background: var(--surface); cursor: pointer; }
.card.live { border-left-color: var(--live); }
.card.live .date::after { content: " · läuft"; color: var(--live); font-weight: 600; }
.date { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.name { font-weight: 600; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.tag { padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--text); font-size: 12px; }
.tag.para { background: var(--para-soft); color: var(--para); }
.tag.badminton { color: var(--accent); }
.tag.warn { background: var(--live); color: #fff; }

dialog { border: 0; padding: 0; border-radius: 14px; background: var(--surface); color: var(--text);
  width: min(640px, calc(100vw - 16px)); max-height: calc(100dvh - 32px); }
dialog::backdrop { background: rgb(0 0 0 / .45); }
.dlg { padding: 16px; display: grid; gap: 10px; }
.dlg-head { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.dlg h2 { margin: 0; font-size: 18px; }
.dlg h3 { margin: 8px 0 0; font-size: 15px; }
.dlg h4 { margin: 12px 0 4px; font-size: 13px; color: var(--muted); }
dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 14px; }
dt { color: var(--muted); }
dd { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:disabled { opacity: .45; cursor: default; }
label { display: grid; gap: 4px; font-size: 14px; }
label.check { display: flex; align-items: center; gap: 8px; }
input[type=url] { padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }

.match { display: grid; grid-template-columns: 76px 1fr auto; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.mt { font-variant-numeric: tabular-nums; }
.mt small { color: var(--muted); }
.ms { display: grid; }
.ms .win { font-weight: 600; }
.mr { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); max-width: 96px; font-size: 12px; }
