:root {
  --clay: #a8471f;        /* gravel/terracotta: de baan */
  --clay-deep: #8c3a18;
  --night: #24110b;       /* hal bij avond */
  --sand: #f2dcc2;
  --line: #fff7ee;
  --line-soft: rgba(255, 247, 238, 0.24);
  --glass: rgba(255, 247, 238, 0.08);
  --glass-edge: rgba(255, 247, 238, 0.32);
  --ball: #dceb3b;
  --ball-ink: #1b2a05;
  --muted: #f0cfb6;
  --lose: #24110b;
  --radius-lg: 18px;
  --radius-sm: 8px;
  --tabbar: 64px;
  --display: "Saira Condensed", "Arial Narrow", sans-serif;
  --body: "Saira", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
body {
  margin: 0;
  background-color: var(--clay);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .12 0 0 0 0 .03 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--line);
  font: 16px/1.5 var(--body);
  min-height: 100vh;
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--line); text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; line-height: 1.05; margin: 0; letter-spacing: 0.01em; }
h1 { font-size: 2.2rem; }
h2 { font-size: 1.6rem; }
.h-sub { font-size: 1.35rem; margin: 30px 0 10px; }
p { margin: 0 0 0.75rem; }
.muted { color: var(--muted); }
.wrap { max-width: 760px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
:focus-visible { outline: 3px solid var(--ball); outline-offset: 2px; }
button, input, select { font: inherit; color: inherit; }
button { touch-action: manipulation; }

/* ---------- kop ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--night) 94%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; padding-bottom: 10px; transition: padding .2s; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand > span:last-child { display: grid; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 1.35rem; line-height: 1; transition: font-size .2s; }
.brand-sub { font-size: 0.8rem; color: var(--muted); max-height: 1.4em; overflow: hidden; transition: max-height .2s, opacity .2s; }
.top.scrolled .top-inner { padding-top: 6px; padding-bottom: 6px; }
.top.scrolled .brand-sub { max-height: 0; opacity: 0; }
.top.scrolled .brand-name { font-size: 1.15rem; }
.ball {
  width: 26px; height: 26px; border-radius: 50%; background: var(--ball); flex: none;
  background-image:
    radial-gradient(circle at -30% 50%, transparent 58%, var(--night) 60%, var(--night) 66%, transparent 68%),
    radial-gradient(circle at 130% 50%, transparent 58%, var(--night) 60%, var(--night) 66%, transparent 68%);
}
.me-btn {
  border: 1.5px solid var(--line-soft); background: transparent; border-radius: 999px;
  padding: 6px 14px; cursor: pointer; font-weight: 500; white-space: nowrap; min-height: 38px;
}
.me-btn.set { border-color: var(--ball); }

/* ---------- tabbalk onderin ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--night) 96%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 2px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  display: grid; justify-items: center; align-content: center; gap: 2px; height: var(--tabbar);
  text-decoration: none; color: var(--muted); font-size: 0.72rem; font-weight: 500; position: relative;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current="page"] { color: var(--line); }
.tabbar a[aria-current="page"]::before {
  content: ""; position: absolute; top: -2px; left: 22%; right: 22%; height: 3px; background: var(--ball);
}
.tabbar a[aria-current="page"] svg { stroke: var(--ball); }
@media (min-width: 900px) {
  .tabbar { left: 50%; right: auto; transform: translateX(-50%); width: 560px; border: 2px solid var(--line); border-bottom: 0; border-radius: 14px 14px 0 0; }
}

main { padding-top: 20px; padding-bottom: 24px; }
.loading { color: var(--muted); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 16px; flex-wrap: wrap; }
.block-head { margin: 40px 0 12px; }

/* ---------- volgende wedstrijd ---------- */
.next-meta { display: flex; flex-wrap: wrap; gap: 2px 16px; color: var(--muted); margin: 4px 0 4px; }
.next-title { font-size: clamp(2rem, 8.5vw, 3.2rem); }
.countdown { font-family: var(--display); font-size: 1.15rem; color: var(--ball); font-weight: 600; margin: 6px 0 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }

.courts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 22px 0 6px; }
.court-btn { all: unset; cursor: pointer; display: block; }
.court-btn:focus-visible { outline: 3px solid var(--ball); outline-offset: 4px; }
.court {
  position: relative; aspect-ratio: 1 / 1.45; border: 2.5px solid var(--line); background: var(--clay-deep);
  display: grid; grid-template-rows: 1fr 1fr;
}
.court::before {
  content: ""; position: absolute; left: -8px; right: -8px; top: 50%; height: 4px; transform: translateY(-50%);
  background: repeating-linear-gradient(90deg, var(--line) 0 3px, transparent 3px 7px); z-index: 1;
}
.half { position: relative; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 8px; }
.half::after { content: ""; position: absolute; left: 0; right: 0; height: 2px; background: var(--line-soft); }
.half.them::after { bottom: 30%; }
.half.us::after { top: 30%; }
.half.us::before { content: ""; position: absolute; left: 50%; width: 2px; top: 30%; bottom: 0; background: var(--line-soft); }
.half.them::before { content: ""; position: absolute; left: 50%; width: 2px; bottom: 30%; top: 0; background: var(--line-soft); }
.half .who { position: relative; z-index: 2; font-family: var(--display); font-weight: 700; font-size: clamp(1.1rem, 4.6vw, 1.6rem); line-height: 1.1; background: var(--clay-deep); padding: 2px 6px; overflow-wrap: anywhere; }
.half.them .who { color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.who .me { color: var(--ball); }
.court-label { text-align: center; color: var(--muted); font-size: 0.85rem; margin-top: 6px; }

.facts { display: grid; margin: 18px 0; border-top: 1px solid var(--line-soft); }
.fact { display: grid; grid-template-columns: 90px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.fact dt { color: var(--muted); }
.fact dd { margin: 0; min-width: 0; }

/* ---------- meldingen ---------- */
.alert { border: 2px solid var(--ball); background: var(--glass); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border-radius: var(--radius-sm); padding: 12px 14px; margin: 12px 0; }
.alert p:last-child { margin-bottom: 0; }
.invaller { display: grid; grid-template-columns: 1fr; gap: 8px; }
.invaller input[hidden] { display: none; }
@media (min-width: 520px) { .invaller { grid-template-columns: 1fr 1fr auto; } }
.warn { color: var(--ball); }
.tag { font-size: 0.72rem; font-weight: 600; border: 1px solid var(--line-soft); border-radius: 4px; padding: 0 5px; color: var(--muted); vertical-align: 1px; white-space: nowrap; }
.tag.hot { border-color: var(--ball); color: var(--ball); }

/* ---------- knoppen ---------- */
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  border: 1.5px solid var(--line); background: transparent; border-radius: 999px;
  padding: 8px 16px; cursor: pointer; text-decoration: none; font-weight: 500; min-height: 44px;
}
.btn.primary { background: var(--ball); color: var(--ball-ink); border-color: var(--ball); font-weight: 600; }
.btn.ghost { border-color: var(--line-soft); }
.btn.small { padding: 4px 14px; min-height: 38px; font-size: 0.92rem; }
.btn:disabled { opacity: 0.5; cursor: default; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 14px; background: var(--line); color: var(--night);
  cursor: pointer; font-weight: 600; min-height: 42px;
}
.chip[aria-pressed="false"] { background: transparent; color: var(--muted); border-color: var(--line-soft); text-decoration: line-through; }
.chip.me { box-shadow: 0 0 0 2px var(--ball); }
.chip:disabled { cursor: default; opacity: .7; }
.chip.check { display: inline-flex; gap: 8px; align-items: center; background: transparent; color: var(--line); }
.chip.check input { width: 18px; height: 18px; accent-color: var(--ball); }

.pill { font-size: 0.8rem; font-weight: 600; border-radius: 999px; padding: 2px 10px; white-space: nowrap; border: 1.5px solid var(--line-soft); color: var(--muted); }
.pill.plays { background: var(--ball); color: var(--ball-ink); border-color: var(--ball); }
.pill.played { border-color: var(--line); color: var(--line); }
.pill.bench { border-color: var(--line-soft); color: var(--line); }
.pill.absent { text-decoration: line-through; }
.pill.inline { font-family: var(--body); font-size: 0.85rem; }

/* schakelaar kan / kan niet */
.toggle {
  border: 1.5px solid var(--line); background: var(--line); color: var(--night); border-radius: 999px;
  min-width: 92px; min-height: 40px; padding: 4px 12px; font-weight: 600; cursor: pointer; font-size: 0.9rem;
}
.toggle[aria-checked="false"] { background: var(--night); color: var(--sand); border-color: var(--night); text-decoration: line-through; }

/* ---------- jouw seizoen ---------- */
.mylist, .results { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-soft); }
.mylist li { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.mylink, .results a { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: center; text-decoration: none; min-width: 0; }
.results li { border-bottom: 1px solid var(--line-soft); }
.results a { grid-template-columns: 34px 1fr auto; padding: 12px 0; }
.mytitle { font-weight: 600; line-height: 1.25; display: inline-block; }
.rnum { font-family: var(--display); font-weight: 700; font-size: 2.1rem; line-height: 1; text-align: center; }
.rnum.small { font-size: 1.6rem; }
.season-line { display: flex; gap: 28px; flex-wrap: wrap; margin: 6px 0 22px; }
.season-line.compact { gap: 22px; margin-bottom: 14px; }
.stat-num { font-family: var(--display); font-weight: 700; font-size: 2.4rem; line-height: 1; }
.stat-lbl { color: var(--muted); font-size: 0.85rem; }

/* ---------- rondes ---------- */
.round { border-top: 2px solid var(--line); }
.round:last-child { border-bottom: 2px solid var(--line); }
.round > summary {
  list-style: none; cursor: pointer; display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; padding: 14px 0; min-height: 64px;
}
.round > summary::-webkit-details-marker { display: none; }
.round.past .rnum { color: var(--muted); }
.rtitle { font-family: var(--display); font-weight: 600; font-size: 1.2rem; line-height: 1.15; }
.rsub { color: var(--muted); font-size: 0.9rem; }
.score { font-family: var(--display); font-weight: 700; font-size: 1.45rem; padding: 0 10px; border-radius: var(--radius-sm); }
.score.w { background: var(--ball); color: var(--ball-ink); }
.score.l { background: var(--night); color: var(--sand); }
.score.d { border: 1.5px solid var(--line); }
.homeaway { font-family: var(--body); font-size: 0.75rem; font-weight: 600; border: 1.5px solid var(--line-soft); border-radius: 4px; padding: 0 6px; margin-right: 6px; vertical-align: 2px; }
.round-body { padding: 0 0 22px 50px; display: grid; gap: 24px; }
.block h4 { margin: 0 0 8px; font-weight: 600; font-size: 1.05rem; color: var(--muted); }
.lineup-grid { display: grid; gap: 6px; }
.lineup-row { display: grid; grid-template-columns: 80px 1fr; gap: 10px; }
.lineup-row .lbl { color: var(--muted); }
.source { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }

/* partijen */
.glist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-soft); }
.glist li { border-bottom: 1px solid var(--line-soft); }
.grow { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: grid; grid-template-columns: 46px 1fr auto; gap: 10px; padding: 12px 0; align-items: center; min-height: 56px; }
.grow:focus-visible { outline: 3px solid var(--ball); outline-offset: 2px; }
.gnum { font-family: var(--display); font-weight: 700; font-size: 1.3rem; line-height: 1.1; display: grid; }
.gnum .muted { font-family: var(--body); font-weight: 400; font-size: 0.72rem; }
.gmid { display: grid; min-width: 0; }
.gres { display: grid; justify-items: end; text-align: right; }
.sets { font-variant-numeric: tabular-nums; white-space: nowrap; }
.res { font-family: var(--display); font-weight: 700; }
.res.W { color: var(--ball); }
.res.V { color: var(--night); }

/* rijden */
.stepper { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stepper > span { flex-basis: 100%; color: var(--muted); font-size: 0.9rem; }
.stepper strong { font-family: var(--display); font-size: 1.4rem; min-width: 1.2em; text-align: center; }
.step { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line); background: transparent; cursor: pointer; font-size: 1.3rem; line-height: 1; }
.step:disabled { opacity: .4; }

select, input[type="text"], input[type="number"] {
  background: rgba(36, 17, 11, 0.55); border: 1.5px solid var(--line-soft); border-radius: var(--radius-sm); padding: 8px 10px; min-height: 44px; width: 100%;
  font-size: 16px; /* voorkomt inzoomen op iOS */
}
input[type="number"] { width: 3.6rem; text-align: center; padding: 8px 4px; -moz-appearance: textfield; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
label.field { display: grid; gap: 4px; font-size: 0.9rem; color: var(--muted); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------- tabellen ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table.data { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 10px 6px; border-bottom: 1px solid var(--line-soft); text-align: right; white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data th { color: var(--muted); font-weight: 500; font-size: 0.82rem; }
table.data tr.us td { color: var(--ball); font-weight: 600; }
table.data td.big { font-family: var(--display); font-weight: 700; font-size: 1.2rem; }
table.data input { width: 3.6rem; }
table.data input[type="text"] { width: 100%; min-width: 9rem; }
table.matrix th, table.matrix td { text-align: center; }

/* ---------- log ---------- */
.log { list-style: none; padding: 0; margin: 0; }
.log li { display: grid; grid-template-columns: 88px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.log time { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.log .actor { font-weight: 600; }
.empty { color: var(--muted); padding: 12px 0; }

/* ---------- dialogen ---------- */
dialog {
  background: var(--night); color: var(--line); border: 2px solid var(--line); border-radius: var(--radius-lg);
  padding: 24px; width: min(420px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(5, 15, 30, 0.7); }
dialog h2 { margin-bottom: 8px; }
.me-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0; }
.me-grid button { border: 1.5px solid var(--line); background: transparent; border-radius: var(--radius-sm); padding: 12px; cursor: pointer; font-weight: 600; text-align: left; min-height: 48px; }
.me-grid button.cur { background: var(--ball); color: var(--ball-ink); border-color: var(--ball); }

/* uitslagpaneel: schuift van onderen omhoog */
dialog.sheet {
  margin: auto auto 0; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  border-radius: 20px 20px 0 0; border-bottom: 0; padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
}
dialog.sheet[open] { animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-inner { display: grid; gap: 12px; }
.sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: var(--line-soft); margin: 4px auto 2px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0; }
.sheet .muted { margin: 0; }
.close { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line-soft); background: transparent; font-size: 1.4rem; line-height: 1; cursor: pointer; }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot { border: 1.5px solid var(--line-soft); border-radius: var(--radius-sm); background: transparent; padding: 8px; cursor: pointer; display: grid; gap: 2px; min-height: 60px; }
.slot strong { font-family: var(--display); font-size: 1.5rem; line-height: 1; }
.slot.w strong { color: var(--ball); }
.slot.l strong { color: var(--sand); }
.slot[aria-selected="true"] { border-color: var(--ball); border-width: 2.5px; }
.sheet-lbl { font-size: 0.85rem; color: var(--muted); margin: 2px 0 -4px; }
.quick { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.qs { border: 1.5px solid var(--line-soft); border-radius: var(--radius-sm); background: transparent; min-height: 44px; cursor: pointer; font-variant-numeric: tabular-nums; font-weight: 600; padding: 0; }
.qs.w { border-color: var(--ball); }
.qs.l { color: var(--sand); border-style: dashed; }
.qs:active { background: var(--line-soft); }
.other { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.other .sheet-lbl { margin: 0; flex-basis: 100%; }
.sheet-actions { position: sticky; bottom: -20px; background: var(--night); padding: 10px 0 6px; }
.sheet-actions .btn { flex: 1; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0;
  background: var(--line); color: var(--night); padding: 10px 18px; border-radius: 999px; font-weight: 600;
  transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100vw - 32px); text-align: center; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--night); color: var(--sand); outline: 2px solid var(--ball); }

.foot { color: var(--muted); font-size: 0.85rem; padding-bottom: 24px; }
.explain { color: var(--muted); font-size: 0.92rem; max-width: 62ch; }
.explain ol { padding-left: 1.2rem; margin: 6px 0 0; }

@media (max-width: 520px) {
  .round-body { padding-left: 0; }
  .lineup-row { grid-template-columns: 72px 1fr; }
  .quick { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .toast, .top-inner, .brand-sub, .brand-name { transition: none; }
  dialog.sheet[open] { animation: none; }
}

/* ---------- 3D-podium ---------- */
.stage { position: relative; height: 230svh; margin-top: -2px; --p: 0; }
.stage[hidden] { display: none; }
.stage-sticky { position: sticky; top: 0; height: 100svh; overflow: hidden; background: var(--night); }
.stage-canvas, .stage-canvas canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage-sticky::before { /* leesbaarheid van de titel */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 62%; z-index: 1; pointer-events: none;
  background: linear-gradient(rgba(36, 17, 11, 0.92), rgba(36, 17, 11, 0.55) 55%, transparent);
  opacity: clamp(0, calc(1 - var(--p) * 3), 1);
}
.stage-sticky::after { /* zachte overgang naar de gravelpagina */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 22%;
  background: linear-gradient(transparent, rgba(36, 17, 11, 0.85)); pointer-events: none;
}
.stage-labels { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.plabel {
  position: absolute; left: 0; top: 0; will-change: transform;
  display: grid; justify-items: center; gap: 2px;
}
.plabel > * { translate: -50% -100%; }
.plabel .pname {
  font-family: var(--display); font-weight: 700; font-size: clamp(1.1rem, 5vw, 1.6rem); line-height: 1;
  color: var(--line); background: rgba(36, 17, 11, 0.72); border: 1.5px solid var(--glass-edge);
  padding: 6px 12px 7px; border-radius: 999px; white-space: nowrap; display: block;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.plabel .ptag { font-size: 0.7rem; font-weight: 600; color: var(--sand); text-shadow: 0 1px 4px #000; display: block; margin-top: 4px; }
.plabel.me .pname { background: var(--ball); color: var(--ball-ink); border-color: var(--ball); }
.plabel.opp .pname { font-size: 0.95rem; font-weight: 600; color: var(--sand); }
.stage-labels .plabel > * { opacity: 0; transform: translateY(-48px) scale(0.6); transition: opacity .35s, transform .55s cubic-bezier(.2, 1.6, .4, 1); transition-delay: calc(var(--i) * 90ms); }
.stage-labels.in .plabel > * { opacity: 1; transform: none; }

.stage-copy { position: absolute; left: 0; right: 0; z-index: 3; padding: 0 max(16px, env(safe-area-inset-left)); max-width: 760px; margin: 0 auto; pointer-events: none; }
.stage-copy .btn { pointer-events: auto; }
.copy-a {
  top: calc(env(safe-area-inset-top) + 76px);
  opacity: clamp(0, calc(1 - var(--p) * 3.6), 1);
  transform: translateY(calc(var(--p) * -140px));
}
.kicker { color: var(--sand); font-size: 0.9rem; margin-bottom: 6px; text-shadow: 0 1px 8px #000; }
.stage-title { font-size: clamp(2.3rem, 10vw, 4.2rem); line-height: 0.95; text-shadow: 0 2px 24px rgba(0, 0, 0, 0.6); max-width: 14ch; }
.stage-title .vs { font-style: italic; color: var(--ball); font-weight: 600; }
.stage-sub { color: var(--sand); margin: 10px 0 14px; text-shadow: 0 1px 8px #000; }
.copy-b {
  bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 28px);
  opacity: clamp(0, calc((var(--p) - 0.62) * 4), 1);
  transform: translateY(calc((1 - var(--p)) * 60px));
}
.big-count { font-family: var(--display); font-weight: 700; font-size: clamp(3rem, 15vw, 5.5rem); line-height: 0.9; color: var(--ball); text-shadow: 0 4px 30px rgba(0, 0, 0, 0.7); }
.copy-b p { font-size: 1.1rem; font-weight: 600; text-shadow: 0 1px 10px #000; margin-top: 6px; }
body.has-stage .top { background: color-mix(in srgb, var(--night) 70%, transparent); }
body.has-stage main { padding-top: 28px; }

/* ---------- scorebord-flip ---------- */
[data-flip] { display: inline-block; }
@media (prefers-reduced-motion: no-preference) {
  [data-flip] { opacity: 0; transform: perspective(500px) rotateX(-95deg); transform-origin: 50% 0; }
  [data-flip].in { animation: flip .7s cubic-bezier(.2, 1.4, .4, 1) var(--d, 0ms) both; }
  @keyframes flip { from { opacity: 0; transform: perspective(500px) rotateX(-95deg); } to { opacity: 1; transform: none; } }

  @supports (animation-timeline: view()) {
    .round .rnum, .results .rnum {
      animation: rn linear both; animation-timeline: view(); animation-range: entry 0% cover 28%;
    }
    @keyframes rn { from { opacity: 0; transform: translateX(-24px) scale(0.5) rotate(-14deg); } to { opacity: 1; transform: none; } }
  }
}

/* ---------- ballenregen ---------- */
.burst { position: fixed; left: 50%; bottom: 38%; width: 0; height: 0; z-index: 60; pointer-events: none; }
.burst span {
  position: absolute; width: 18px; height: 18px; margin: -9px; border-radius: 50%; background: var(--ball);
  box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.12);
  animation: pop 1.1s cubic-bezier(.15, .7, .35, 1) forwards;
}
@keyframes pop {
  0% { transform: translate(0, 0) scale(0.2); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(var(--dx), calc(var(--dy) + 160px)) scale(var(--s)); opacity: 0; }
}
