[hidden] { display: none !important; }
:root {
  --bg: #f3f5f2;
  --surface: #ffffff;
  --surface-2: #e9ede7;
  --ink: #10170f;
  --ink-2: #4a5547;
  --ink-3: #7a8577;
  --line: #d6dcd3;
  --brand: #14532d;
  --brand-ink: #ffffff;
  --pitch: #1f7a3c;
  --us: #15803d;
  --them: #b42318;
  --green-card: #16a34a;
  --yellow: #facc15;
  --red: #dc2626;
  --warn-bg: #fff4d6;
  --radius: 14px;
  --tap: 56px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d120c;
    --surface: #172016;
    --surface-2: #212c1f;
    --ink: #eef3ec;
    --ink-2: #b8c2b4;
    --ink-3: #87927f;
    --line: #2d3a2a;
    --brand: #166534;
    --pitch: #1d6b36;
    --us: #4ade80;
    --them: #f87171;
    --warn-bg: #3a3214;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: var(--ink); }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: var(--brand); color: var(--brand-ink);
}
.topbar h1 { flex: 1; margin: 0; font-size: 18px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: none; border: 0; color: inherit; font-size: 30px; line-height: 1; width: 40px; height: 40px; cursor: pointer; }
.sync { font-size: 13px; opacity: .9; white-space: nowrap; }
.sync.pending { color: #fde68a; }
.sync.offline { color: #fecaca; }

main { max-width: 720px; margin: 0 auto; padding: 12px 16px 120px; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); margin: 20px 0 8px; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.row-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: var(--tap);
  padding: 10px 14px; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.row-btn .grow { flex: 1; min-width: 0; }
.row-btn .title { font-weight: 600; }
.row-btn .sub { font-size: 13px; color: var(--ink-3); }
.badge { font-size: 12px; font-weight: 650; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.live { background: var(--them); color: #fff; }
.badge.done { background: var(--us); color: #fff; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); font-weight: 650; cursor: pointer;
}
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.danger { color: var(--them); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }

label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 4px; }
.input { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
textarea.input { min-height: 160px; resize: vertical; line-height: 1.5; }
.error { background: var(--warn-bg); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }

/* tabs */
.tabs { display: flex; gap: 4px; background: var(--surface-2); border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.tabs button { flex: 1; min-height: 44px; border: 0; border-radius: 9px; background: none; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.tabs button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .12); }

/* scoreboard */
.score {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  background: var(--pitch); color: #fff; border-radius: var(--radius); padding: 12px;
}
.score .team { font-size: 14px; font-weight: 600; text-align: center; overflow-wrap: anywhere; }
.score .nums { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .02em; text-align: center; }
.score .clock { grid-column: 1 / -1; text-align: center; font-variant-numeric: tabular-nums; font-size: 15px; opacity: .92; }
.period-btn { margin-top: 10px; }

/* action grid */
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.act {
  min-height: 72px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-weight: 650; font-size: 14px; cursor: pointer;
}
.act .ico { font-size: 24px; line-height: 1; }
.act.us { border-color: var(--us); box-shadow: inset 0 0 0 1px var(--us); }
.act.them { border-color: var(--them); box-shadow: inset 0 0 0 1px var(--them); }
.card-ico { display: inline-block; width: 14px; height: 19px; border-radius: 2px; vertical-align: -3px; }
.card-ico.g { background: var(--green-card); }
.card-ico.y { background: var(--yellow); }
.card-ico.r { background: var(--red); }

/* players */
.players { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 520px) { .players { grid-template-columns: repeat(3, 1fr); } }
.player {
  display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 8px 10px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); text-align: left; cursor: pointer;
}
.player .nr {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); font-weight: 750; font-variant-numeric: tabular-nums; font-size: 15px;
}
.player .nm { min-width: 0; flex: 1; }
.player .nm b { display: block; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .nm small { color: var(--ink-3); font-size: 12px; }
.player.off { opacity: .55; }
.player.sel { outline: 3px solid var(--brand); outline-offset: -1px; }
.player.none { justify-content: center; font-weight: 600; color: var(--ink-2); }

/* squad editor */
.squad-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.squad-row .nm { flex: 1; min-width: 0; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex: none; }
.seg button { min-width: 54px; min-height: 44px; border: 0; background: var(--surface); font-size: 13px; font-weight: 650; color: var(--ink-2); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on-starter { background: var(--us); color: #fff; }
.seg button.on-bench { background: #2563eb; color: #fff; }
.seg button.on-out { background: var(--ink-3); color: #fff; }
.counter { position: sticky; top: 56px; z-index: 5; background: var(--bg); padding: 8px 0; display: flex; gap: 12px; align-items: center; }

/* timeline */
.timeline { display: flex; flex-direction: column; }
.tl {
  display: grid; grid-template-columns: 48px 26px 1fr; gap: 8px; align-items: center;
  padding: 10px 4px; border-bottom: 1px solid var(--line); background: none; border-left: 0; border-right: 0; border-top: 0;
  text-align: left; width: 100%; cursor: pointer;
}
.tl .min { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.tl .what small { display: block; color: var(--ink-3); font-size: 12px; }
.tl.pending .min::after { content: " •"; color: #d97706; }
.tl.phase { color: var(--ink-3); font-size: 13px; }

/* stats table */
table.stats { width: 100%; border-collapse: collapse; font-size: 14px; }
table.stats th, table.stats td { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
table.stats th:first-child, table.stats td:first-child { text-align: left; }
table.stats th { font-size: 12px; color: var(--ink-3); font-weight: 600; }

/* sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgb(0 0 0 / .45); z-index: 40; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; max-height: 88vh; overflow-y: auto;
  background: var(--bg); border-radius: 18px 18px 0 0; padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  max-width: 720px; margin: 0 auto; box-shadow: 0 -8px 30px rgb(0 0 0 / .25);
}
.sheet h3 { margin: 4px 0 12px; font-size: 18px; }
.sheet .opts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper .val { min-width: 64px; text-align: center; font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; }
.stepper .btn { min-width: 56px; padding: 0; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 60;
  display: flex; align-items: center; gap: 14px; max-width: calc(100% - 32px);
  background: #111827; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: 0 6px 20px rgb(0 0 0 / .3);
}
.toast button { background: none; border: 0; color: #86efac; font-weight: 750; cursor: pointer; min-height: 32px; }
.center { text-align: center; }
.spacer { height: 12px; }
.grow { flex: 1; }
a { color: var(--us); }

/* openbaar */
a.btn, a.row-btn { text-decoration: none; color: inherit; }
a.btn.primary { color: var(--brand-ink); }
.hero { display: flex; align-items: center; gap: 14px; margin: 8px 0 16px; }
.hero img { border-radius: 14px; flex: none; }
.hero b { display: block; font-size: 22px; }
.hero span { color: var(--ink-2); font-size: 14px; }
.match-card .sport { font-size: 24px; flex: none; }
.report { white-space: pre-wrap; line-height: 1.5; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
