/* OKKIE. — mobile-first. Donker als standaard (goed leesbaar bij het dartbord), licht als optie.
   Kleurregel: limoen = interactie en je eigen score; goud = records en badges; rood = bust, triple en fouten.
   Mintgroen alleen als spelerskleur. Vlakken zijn rustig: weinig randen, één radius-schaal. */
:root, [data-theme="dark"] {
  --bg: #07120d;
  --bg2: #0a1811;
  --surface: #0e1f16;
  --surface2: #14291e;
  --line: #1d3628;
  --line-strong: #2b4d3a;
  --text: #f3eedf;
  --muted: #93a99c;
  --accent: #b8ff3c;
  --accent-ink: #0b1a06;
  --primary: #b8ff3c;
  --primary-ink: #0b1a06;
  --lime: #b8ff3c;
  --mint: #3ddc84;
  --red: #ff5a52;
  --gold: #ffc53d;
  --key: #11251a;
  --key-hi: #1a3626;
  --shadow: 0 10px 30px #0008;
  --board-dark: #18241d;
  --board-light: #3a463b;
  --board-red: #5a2326;
  --board-green: #1e4a32;
  --board-rim: #050a07;
  --board-wire: #8a9a8f55;
  --logo-text: #f3eedf;
  --logo-ring: #b8ff3c;
  --logo-dart: #f3eedf;
  --logo-knock: var(--bg);
  --r-lg: 18px;
  --r-md: 14px;
  --r-sm: 10px;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f6f1e7;
  --bg2: #efe8da;
  --surface: #ffffff;
  --surface2: #f3eee3;
  --line: #e6dece;
  --line-strong: #d3c8b2;
  --text: #10241a;
  --muted: #5d7066;
  --accent: #3b7a00;
  --accent-ink: #ffffff;
  --primary: #b8ff3c;
  --primary-ink: #10241a;
  --lime: #3b7a00;
  --mint: #12924f;
  --red: #d7263d;
  --gold: #8f5c0e;
  --key: #ffffff;
  --key-hi: #eef5e6;
  --shadow: 0 10px 30px #2a20101a;
  --board-dark: #2b3a31;
  --board-light: #e9e0c9;
  --board-red: #b9473f;
  --board-green: #2f7a50;
  --board-rim: #1b2520;
  --board-wire: #c9c1ad88;
  --logo-text: #10241a;
  --logo-ring: #4c9400;
  --logo-dart: #10241a;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(900px 480px at 50% -12%, color-mix(in srgb, var(--mint) 9%, transparent), transparent 70%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  overscroll-behavior-y: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; touch-action: manipulation; }
a { color: inherit; }
a:not(.btn):not(.action):not(.maker) { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; }
h3 { font-size: 1.06rem; font-weight: 750; margin-bottom: 6px; letter-spacing: -.005em; }
h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 16px 0 8px; font-weight: 700; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small, small { font-size: .82rem; }
[hidden] { display: none !important; }
.ico { display: block; flex: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Kop en navigatie ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.top h1 { font-size: 1.12rem; font-weight: 800; letter-spacing: -.01em; }
.top-logo { display: flex; }
.logo { display: block; width: auto; }
.player-chip {
  display: inline-flex; align-items: center; gap: 8px; max-width: 44vw; min-height: 38px;
  padding: 6px 13px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  font-weight: 700; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); font-size: 1.1rem; color: var(--text);
}
.icon-btn.small { width: 34px; height: 34px; font-size: .95rem; border-radius: 10px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 4px 6px calc(env(safe-area-inset-bottom) + 4px);
  background: color-mix(in srgb, var(--bg2) 94%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar button { position: relative; display: grid; justify-items: center; gap: 3px; padding: 8px 0 6px; font-size: .7rem; font-weight: 650; color: var(--muted); transition: color .15s; }
.tabbar button span { display: grid; place-items: center; height: 24px; }
.tabbar button.active { color: var(--text); }
.tabbar button.active span { color: var(--accent); }
.tabbar button::before { content: ''; position: absolute; top: -5px; left: 50%; width: 22px; height: 3px; margin-left: -11px; border-radius: 0 0 3px 3px; background: var(--accent); transform: scaleX(0); transition: transform .2s ease; }
.tabbar button.active::before { transform: scaleX(1); }

.page { padding: 4px 16px calc(96px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; display: grid; gap: 12px; animation: page-in .22s ease both; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- Kaarten, tegels ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.card-head h3 { margin: 0; }
.card.empty { text-align: center; padding: 26px 16px; }
.note { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: var(--r-sm); font-size: .9rem; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles.mini { margin: 10px 0; }
@media (min-width: 560px) { .tiles:not(.mini):not(.three) { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { background: var(--surface); border-radius: var(--r-md); padding: 11px 13px; display: grid; gap: 1px; min-width: 0; }
.card .tile { background: var(--surface2); }
.tile span { font-size: .76rem; color: var(--muted); font-weight: 600; }
.tile strong { font-size: 1.35rem; font-weight: 800; letter-spacing: -.01em; overflow-wrap: anywhere; }
.tile.hl { grid-column: 1 / -1; background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 13%, var(--surface)), var(--surface) 70%); }
.tile.hl strong { font-size: 2.2rem; color: var(--lime); line-height: 1.05; }

/* ---------- Knoppen ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px; border-radius: var(--r-md); font-weight: 750; letter-spacing: .005em; border: 1px solid transparent; text-decoration: none; transition: transform .08s ease, background-color .15s, border-color .15s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.secondary { background: var(--surface2); border-color: var(--line); }
.btn.ghost { background: transparent; border-color: var(--line-strong); }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger.ghost { background: transparent; color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, transparent); }
.btn.big { width: 100%; min-height: 54px; font-size: 1.04rem; margin-top: 8px; }
.btn.small { min-height: 38px; padding: 6px 14px; font-size: .88rem; }
.btn.file { cursor: pointer; }
.btn .ico { width: 19px; height: 19px; }
@media (hover: hover) { .btn.primary:hover { filter: brightness(1.06); } .btn.secondary:hover, .btn.ghost:hover { border-color: var(--line-strong); background: var(--surface2); } }
.link { color: var(--accent); font-weight: 700; padding: 4px; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.row-actions .btn.big { flex: 1 1 160px; }
/* Knoppen die een link zijn: altijd de knopkleur, nooit browser-linkpaars */
a.btn, a.btn:visited { color: var(--text); text-decoration: none; }
a.btn.primary, a.btn.primary:visited { color: var(--primary-ink); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.small .chip { padding: 6px 12px; font-size: .84rem; }
.chip { padding: 8px 14px; border-radius: 999px; background: var(--surface2); border: 1px solid var(--line); font-weight: 700; white-space: nowrap; transition: background-color .15s, border-color .15s; }
.chip.on { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }

input:not([type=checkbox]):not([type=file]) {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--bg2); border: 1px solid var(--line-strong); outline: none; font-size: 1.05rem;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
label { font-weight: 700; display: block; margin-bottom: 6px; }
label.inline { display: flex; align-items: center; gap: 10px; margin: 12px 0 0; }
label.inline input { width: 110px; }
.guest { display: flex; gap: 8px; margin-top: 10px; }
.guest input { flex: 1; min-width: 0; }
.guest .btn { flex: none; }

/* ---------- Welkom ---------- */
.welcome { min-height: 100dvh; display: grid; align-content: center; gap: 14px; padding: calc(env(safe-area-inset-top) + 20px) 20px calc(20px + env(safe-area-inset-bottom)); max-width: 460px; margin: 0 auto; text-align: center; }
.welcome-logo { display: flex; justify-content: center; margin-bottom: 4px; }
.welcome-logo .logo { max-width: 100%; }
.welcome .lead { font-size: 1.12rem; line-height: 1.4; color: var(--muted); margin: 0 0 6px; }
.welcome .card { text-align: left; display: grid; gap: 8px; }
.welcome label { font-size: 1.08rem; }
.welcome-guide { display: flex; margin: 2px auto 0; max-width: 350px; }
.fineprint { color: var(--muted); font-size: .88rem; }

/* ---------- Home ---------- */
.hero {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 18px 20px; border-radius: var(--r-lg); position: relative; overflow: hidden;
  background: radial-gradient(260px 180px at 100% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%), var(--surface);
  border: 1px solid var(--line);
}
.hero-text { display: grid; align-content: center; gap: 2px; min-width: 0; }
.hero-text small { color: var(--muted); font-weight: 600; }
.hero h2 { font-size: 1.9rem; font-weight: 900; font-style: italic; letter-spacing: -.02em; overflow-wrap: anywhere; }
.streak { display: inline-block; margin-top: 4px; font-weight: 700; font-size: .86rem; color: var(--muted); }
.hero-avg { display: grid; justify-items: end; align-content: center; text-align: right; }
.hero-avg strong { font-size: 2.9rem; font-weight: 900; line-height: 1; letter-spacing: -.03em; color: var(--lime); }
.hero-avg .label { font-size: .74rem; color: var(--muted); font-weight: 600; }

.resume { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line)); }
.resume div { display: grid; min-width: 0; }
.resume small { color: var(--accent); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: .7rem; }
.resume span { color: var(--muted); font-size: .88rem; }

.actions { display: grid; gap: 8px; }
.action { display: flex; align-items: center; gap: 14px; text-align: left; padding: 13px 14px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; transition: transform .08s, border-color .15s; }
.action:active { transform: scale(.985); }
.action b { display: block; font-size: 1.06rem; }
.action small { color: var(--muted); }
.action > span:last-child { min-width: 0; flex: 1; }
.a-icon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; flex: none; color: var(--accent); background: color-mix(in srgb, var(--accent) 11%, transparent); }
.action.train { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); padding: 16px 14px; }
.action.train .a-icon { background: var(--primary); color: var(--primary-ink); }
.action.train b { font-size: 1.18rem; }
@media (hover: hover) { .action:hover { border-color: var(--line-strong); } .action.train:hover { border-color: var(--accent); } }

.next-badge { display: flex; align-items: center; gap: 14px; }
.next-badge div { flex: 1; min-width: 0; }
.next-badge small { color: var(--muted); font-weight: 700; }
.next-badge b { display: block; }
.next-badge p { margin: 0; font-size: .85rem; color: var(--muted); }
.badge-count { font-weight: 800; color: var(--gold); }

/* Delen: algemene uitnodiging (iets anders dan een groepsuitnodiging in Mijn vrienden) */
.invite-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-lg); border: 1px dashed var(--line-strong); background: transparent; color: var(--text); text-align: left; width: 100%; }
.invite-row .a-icon { width: 38px; height: 38px; border-radius: 11px; }
.invite-row b { display: block; }
.invite-row small { color: var(--muted); }
.invite-row > span:last-child { flex: 1; min-width: 0; }
.invite-preview { background: var(--surface2); border-radius: var(--r-md) var(--r-md) var(--r-md) 4px; padding: 12px 14px; margin: 10px 0 4px; font-size: .95rem; }
.invite-preview a { white-space: nowrap; }

/* ---------- Training kiezen ---------- */
.choices { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.choice { padding: 12px 2px 10px; border-radius: var(--r-md); background: var(--surface2); border: 2px solid transparent; display: grid; justify-items: center; gap: 2px; transition: border-color .15s, background-color .15s; }
.choice b { font-size: 1.45rem; font-weight: 900; line-height: 1.05; }
.choice small { color: var(--muted); font-size: .7rem; text-align: center; line-height: 1.2; }
.choice.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface2)); }
.choice-info { margin: 10px 2px 0; font-size: .86rem; color: var(--muted); }
.who { margin: 18px 0 6px; font-size: 1rem; }
.who small { font-weight: 600; color: var(--muted); }

/* ---------- Speelscherm ---------- */
body.playing { background: var(--bg); }
.play {
  height: 100dvh; display: flex; flex-direction: column; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 8px) 10px calc(env(safe-area-inset-bottom) + 8px);
  max-width: 560px; margin: 0 auto; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
}
.play-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.play-title { text-align: center; display: grid; min-width: 0; }
.play-title b { font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.play-title small { color: var(--muted); }
.progress { height: 4px; background: var(--surface2); border-radius: 9px; overflow: hidden; flex: none; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 9px; transition: width .25s; }

.scoreboard { display: grid; grid-template-columns: 1.1fr 1fr; gap: 6px; flex: none; }
.sb-main { background: var(--surface); border-radius: 16px; padding: 10px 14px; display: grid; align-content: center; }
.sb-main span { font-size: .7rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.sb-main strong { font-size: clamp(2.2rem, 11vw, 3.4rem); font-weight: 900; line-height: 1; color: var(--lime); letter-spacing: -.03em; }
.sb-side { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sb-side div { background: var(--surface); border-radius: 12px; padding: 5px 9px; display: grid; }
.sb-side span { font-size: .64rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.sb-side b { font-size: 1.1rem; }
.scoreboard.clock .sb-side { grid-template-columns: 1fr; }
.target-num { color: var(--lime) !important; }

.clock-track { display: flex; gap: 3px; flex: none; }
.clock-track span { flex: 1; text-align: center; font-size: .62rem; font-weight: 800; padding: 3px 0; border-radius: 5px; background: var(--surface); color: var(--muted); }
.clock-track span.done { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); color: var(--text); }
.clock-track span.now { background: var(--accent); color: var(--accent-ink); }

.turn-row { display: grid; grid-template-columns: 1fr auto; gap: 6px; flex: none; }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.slot { background: var(--surface); border: 2px dashed var(--line-strong); border-radius: 14px; padding: 4px 6px; display: grid; justify-items: center; min-height: 64px; align-content: center; }
.slot small { font-size: .6rem; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.slot b { font-size: 1.35rem; font-weight: 900; min-height: 1.6rem; }
.slot span { font-size: .72rem; color: var(--muted); }
.slot.filled { border-style: solid; border-color: transparent; background: var(--surface2); }
.slot.current { border-color: var(--accent); border-style: solid; }
.slot.new b { animation: dart-in .28s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes dart-in { from { transform: scale(.6); opacity: .2; } }
.turn-total { min-width: 92px; background: var(--surface); border-radius: 14px; display: grid; justify-items: center; align-content: center; padding: 4px 10px; }
.turn-total small { font-size: .6rem; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.turn-total strong { font-size: 1.9rem; font-weight: 900; line-height: 1.05; }
.turn-total strong.tip { font-size: .8rem; text-align: center; font-weight: 700; color: var(--muted); max-width: 90px; }
.turn-total .last { font-size: .68rem; color: var(--muted); }

.typebox { display: flex; gap: 8px; flex: none; }
.typebox input { min-height: 44px; text-transform: uppercase; }

.keypad { flex: 1 1 auto; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.mods { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; flex: 0 0 auto; }
.mod { min-height: 46px; border-radius: 14px; font-weight: 900; letter-spacing: .12em; background: var(--key); border: 2px solid var(--line-strong); font-size: .95rem; transition: background-color .1s, border-color .1s; }
.mod[data-arg="2"].on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.mod[data-arg="3"].on { background: var(--red); border-color: var(--red); color: #fff; }
/* Cijfertoetsen krimpen mee met de schermhoogte (minimaal 34 px) en overlappen nooit de knoppen eronder. */
.nums { flex: 1 1 auto; display: grid; grid-template-columns: repeat(5, 1fr); grid-auto-rows: minmax(0, 1fr); gap: 6px; min-height: 154px; }
.nums .key { min-height: 0; }
.specials { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; flex: 0 0 auto; }
.key {
  min-height: 44px; border-radius: 14px; background: var(--key); border: 1px solid var(--line);
  font-size: clamp(1.15rem, 5.4vw, 1.6rem); font-weight: 800; transition: transform .06s, background-color .1s;
  box-shadow: 0 2px 0 var(--line);
}
.specials .key { min-height: 52px; font-size: 1.05rem; display: grid; place-items: center; }
.key:active { transform: scale(.94); background: var(--key-hi); }
.keypad.mod-2 .nums .key { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); color: var(--accent); }
.keypad.mod-3 .nums .key { border-color: color-mix(in srgb, var(--red) 50%, var(--line)); color: var(--red); }
.key.bull { color: var(--red); }
.key.miss { color: var(--muted); }
.key.undo { background: var(--surface2); }
.key.target { background: color-mix(in srgb, var(--accent) 20%, var(--key)); border-color: var(--accent); }
.play-actions { display: flex; justify-content: center; flex: none; }

/* X01 */
.x01 { display: grid; gap: 6px; flex: none; }
.x01.n2, .x01.n3, .x01.n4 { grid-template-columns: 1fr 1fr; }
.x01-player { background: var(--surface); border: 2px solid transparent; border-radius: 16px; padding: 8px 12px; display: grid; opacity: .62; transition: opacity .2s, border-color .2s; min-width: 0; }
.x01-player.up { opacity: 1; border-color: var(--accent); }
.x01-name { display: flex; align-items: center; gap: 6px; font-weight: 800; white-space: nowrap; overflow: hidden; }
.x01-name .legs { margin-left: auto; background: var(--surface2); border-radius: 8px; padding: 0 8px; font-size: .9rem; }
.throw-dot { width: 9px; height: 9px; background: var(--accent); border-radius: 50%; flex: none; animation: pulse 1.2s infinite; }
.x01-rest { font-size: clamp(2.4rem, 13vw, 3.6rem); font-weight: 900; line-height: 1; letter-spacing: -.03em; }
.x01.n1 .x01-rest { font-size: 4rem; }
.x01-player small { color: var(--muted); }
.x01.n3 .x01-rest, .x01.n4 .x01-rest { font-size: 2rem; }
.checkout { flex: none; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--accent); font-weight: 800; padding: 4px 10px; }
.checkout span { color: var(--muted); font-weight: 700; font-size: .85rem; }
.checkout b { background: var(--accent); color: var(--accent-ink); border-radius: 8px; padding: 2px 9px; }
.checkout.none { background: var(--surface); }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- Viering: compacte banner bovenin, blokkeert nooit de knoppen ---------- */
.celebrate { position: fixed; left: 0; right: 0; top: 0; z-index: 50; pointer-events: none; display: flex; justify-content: center; padding: calc(env(safe-area-inset-top) + 64px) 16px 0; opacity: 0; transition: opacity .25s; }
.celebrate.show { opacity: 1; }
.cel-inner { display: flex; align-items: baseline; gap: 12px; padding: 10px 22px; border-radius: 999px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 2px solid var(--accent); box-shadow: var(--shadow); max-width: 100%; }
.celebrate.show .cel-inner { animation: cel-in 1.5s cubic-bezier(.2, 1.4, .4, 1) both; }
.cel-big { font-size: 2.4rem; font-weight: 900; font-style: italic; line-height: 1; color: var(--lime); letter-spacing: -.03em; }
.cel-small { font-weight: 900; letter-spacing: .1em; font-size: 1rem; white-space: nowrap; }
.cel-inner.max { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 14%, var(--bg)); }
.cel-inner.max .cel-big { color: var(--gold); font-size: 3rem; }
.cel-inner.max .cel-small { color: var(--gold); font-size: .95rem; }
.celebrate.show .cel-inner.max { animation: cel-in 2.2s cubic-bezier(.2, 1.4, .4, 1) both, shimmer 2.2s linear; }
.cel-inner.bust { border-color: var(--red); }
.cel-inner.bust .cel-big { color: var(--red); }
.cel-inner.win { flex-direction: column; align-items: center; gap: 2px; border-radius: 22px; text-align: center; }
.cel-inner.win .cel-big { color: var(--gold); font-size: 2.2rem; }
.cel-inner.win .cel-small { white-space: normal; font-size: .9rem; }
@keyframes cel-in { 0% { transform: translateY(-20px) scale(.9); opacity: 0; } 12% { transform: translateY(0) scale(1); opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; transform: translateY(-6px); } }
@keyframes shimmer { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--gold) 50%, transparent); } 50% { box-shadow: 0 0 32px 4px color-mix(in srgb, var(--gold) 45%, transparent); } }
.confetti { position: absolute; top: -12px; width: 8px; height: 13px; border-radius: 2px; animation: fall 1.6s ease-in forwards; }
@keyframes fall { to { top: 60vh; transform: translateX(40px) rotate(720deg); opacity: 0; } }

/* ---------- Uitslag ---------- */
.result-hero { text-align: center; padding: 24px 16px; border-radius: var(--r-lg); background: radial-gradient(380px 180px at 50% 0, color-mix(in srgb, var(--accent) 16%, transparent), transparent), var(--surface); border: 1px solid var(--line); display: grid; gap: 4px; }
.result-hero small { color: var(--muted); font-weight: 700; }
.result-hero strong { font-size: 4rem; font-weight: 900; line-height: 1; color: var(--lime); letter-spacing: -.03em; overflow-wrap: anywhere; animation: score-pop .45s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes score-pop { from { transform: scale(.85); opacity: 0; } }
.result-hero.win strong { color: var(--gold); font-size: 2.6rem; font-style: italic; }
.result-hero em { font-style: normal; font-weight: 800; font-size: .9rem; }
.up { color: var(--accent); }
.down { color: var(--red); }
.records-banner { padding: 12px 16px; border-radius: var(--r-md); background: color-mix(in srgb, var(--gold) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent); }
.badge-banner { display: grid; gap: 8px; }
.badge-banner > div { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--r-md); background: color-mix(in srgb, var(--gold) 10%, var(--surface2)); }
.badge-banner small { color: var(--gold); font-weight: 800; }
.badge-banner b { display: block; }

.bars { display: flex; align-items: flex-end; gap: 3px; height: 130px; padding-top: 16px; overflow-x: auto; }
.bar { flex: 1 0 14px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.bar i { width: 100%; background: color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 4px 4px 2px 2px; min-height: 2px; }
.bar.ton i { background: var(--accent); }
.bar span { font-size: .58rem; color: var(--muted); margin-top: 3px; }

.mtable { width: 100%; border-collapse: collapse; }
.mtable th, .mtable td { padding: 8px 6px; text-align: right; border-bottom: 1px solid var(--line); }
.mtable tr:last-child th, .mtable tr:last-child td { border-bottom: 0; }
.mtable th:first-child { text-align: left; color: var(--muted); font-weight: 600; }
.mtable thead th { color: var(--text); font-weight: 800; overflow-wrap: anywhere; }

/* ---------- Statistieken ---------- */
.explain { margin: -2px 4px 0; }
.compare .delta { font-weight: 800; }
.chart { position: relative; margin-top: 10px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-weight: 600; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .trend { stroke: var(--text); stroke-opacity: .45; stroke-width: 1.5; stroke-dasharray: 5 5; }
.chart .dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.chart .hit { fill: transparent; }
.chart .pt.on .dot, .chart .pt.last .dot { fill: var(--accent); }
.chart-tip { position: absolute; top: -6px; right: 0; background: var(--surface2); border: 1px solid var(--line-strong); border-radius: 12px; padding: 6px 10px; display: grid; font-size: .85rem; box-shadow: var(--shadow); }
.chart-tip b { font-size: 1.15rem; color: var(--lime); }
.chart-tip small { color: var(--muted); }
.empty-chart { padding: 24px; text-align: center; color: var(--muted); }
.chart-legend { display: flex; gap: 14px; margin-top: 6px; font-size: .78rem; color: var(--muted); }
.chart-legend i { display: inline-block; width: 16px; height: 0; border-top: 2.5px solid var(--accent); vertical-align: middle; margin-right: 6px; }
.chart-legend i.t { border-top: 1.5px dashed var(--text); opacity: .6; }

.board-wrap { max-width: 340px; margin: 10px auto 4px; }
.board { width: 100%; height: auto; display: block; }
.board-num { fill: var(--text); font-size: 17px; font-weight: 800; text-anchor: middle; dominant-baseline: central; }
.heat-legend { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); }
.heat-legend div { display: flex; }
.heat-legend span { width: 22px; height: 10px; }
.heat-legend span:first-child { border-radius: 5px 0 0 5px; }
.heat-legend span:last-child { border-radius: 0 5px 5px 0; }
.splitbar { display: flex; height: 12px; border-radius: 8px; overflow: hidden; margin-top: 12px; background: var(--surface2); gap: 2px; }
.splitlegend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: .82rem; color: var(--muted); }
.splitlegend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.s-S { background: #6c8a7a; } .s-D { background: var(--accent); } .s-T { background: var(--red); } .s-B { background: var(--gold); } .s-M { background: #4a504c; }
.top-nums { display: flex; flex-wrap: wrap; gap: 8px; }
.top-nums span { background: var(--surface2); border-radius: 10px; padding: 6px 12px; color: var(--muted); font-size: .88rem; }
.top-nums b { color: var(--text); font-size: 1.1rem; margin-right: 6px; }

.records { list-style: none; padding: 0; margin: 0; }
.records li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.records li:last-child { border: 0; }
.records b { color: var(--gold); }

.badges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.badge { display: grid; justify-items: center; align-content: start; text-align: center; gap: 3px; padding: 10px 6px; border-radius: var(--r-md); background: var(--surface2); }
.badge b { font-size: .76rem; line-height: 1.2; overflow-wrap: anywhere; }
.badge small { font-size: .64rem; color: var(--muted); line-height: 1.25; }
.badge-icon { font-size: 1.5rem; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--gold) 16%, transparent); flex: none; }
.badge.locked { opacity: .5; }
.badge.locked .badge-icon, .badge-icon.locked { filter: grayscale(1); background: var(--surface); }
@media (min-width: 560px) { .badges { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); } }

/* ---------- Geschiedenis ---------- */
.history { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.history .day { color: var(--muted); font-size: .8rem; font-weight: 700; text-transform: capitalize; margin-top: 10px; }
.h-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); text-align: left; }
.h-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.h-icon .ico { width: 19px; height: 19px; }
.h-main { flex: 1; min-width: 0; display: grid; }
.h-main b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-main small { color: var(--muted); }
.h-item strong { font-size: 1.2rem; color: var(--lime); }
.turnlist { list-style: none; padding: 0; margin: 8px 0; max-height: 40vh; overflow: auto; }
.turnlist li { display: grid; grid-template-columns: minmax(28px, auto) 1fr auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.turnlist li > span:first-child { color: var(--muted); font-size: .85rem; }
.turnlist .darts { display: flex; gap: 4px; flex-wrap: wrap; }
.turnlist .darts i { font-style: normal; background: var(--surface2); border-radius: 7px; padding: 1px 7px; font-weight: 700; font-size: .88rem; }
.turnlist small { color: var(--muted); font-weight: 400; }

/* ---------- Meer ---------- */
.players { list-style: none; padding: 0; margin: 0; }
.players li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.players li b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.steps { padding-left: 20px; margin: 8px 0; }
.steps li { margin: 4px 0; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-weight: 600; margin: 0; }
.setting:last-child { border: 0; }
.switch { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 999px; background: var(--surface2); border: 1px solid var(--line-strong); position: relative; cursor: pointer; transition: background .15s; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--text); transition: transform .15s; }
.switch:checked { background: var(--accent); border-color: var(--accent); }
.switch:checked::after { transform: translateX(20px); background: var(--accent-ink); }
.about { display: grid; justify-items: center; text-align: center; gap: 4px; }
.credit { font-size: .85rem; color: var(--muted); letter-spacing: .02em; }
.credit b { color: var(--text); }
.ok-line { display: flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 700; }

.match-players { padding-left: 22px; margin: 6px 0; }
.match-players li { padding: 6px 0; display: list-item; }
.match-players li span { display: inline-block; min-width: 50%; font-weight: 700; }
.match-players .icon-btn { display: inline-grid; vertical-align: middle; margin-left: 4px; }
.match-players .dot { margin-right: 4px; }
.add-player { display: grid; gap: 8px; margin-top: 8px; }
.add-player > .chip { justify-self: start; }

/* ---------- Modal & toast ---------- */
.modal { position: fixed; inset: 0; z-index: 40; background: #000a; display: grid; align-items: end; justify-items: center; padding: 0; animation: fade .15s ease; }
.modal-card { width: min(560px, 100%); max-height: 88dvh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 22px 22px 0 0; padding: 20px 18px calc(18px + env(safe-area-inset-bottom)); animation: up .2s ease; }
@media (min-width: 640px) { .modal { align-items: center; } .modal-card { border-radius: 22px; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.modal-actions.col { flex-direction: column; }
.modal-actions.col .btn { width: 100%; }
.pick { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; }
.pick-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: var(--r-md); background: var(--surface2); border: 2px solid transparent; font-weight: 800; font-size: 1.05rem; }
.pick-btn.on { border-color: var(--accent); }

.toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 60; max-width: calc(100% - 32px); width: max-content; padding: 12px 16px; border-radius: var(--r-md); background: var(--text); color: var(--bg); font-weight: 700; font-size: .92rem; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--red); color: #fff; }
body.playing .toast { bottom: calc(16px + env(safe-area-inset-bottom)); }

/* Kleine/lage schermen (iPhone SE, Safari met werkbalken): speelscherm compacter */
@media (max-height: 700px) {
  .slot { min-height: 52px; }
  .slot b { font-size: 1.1rem; }
  .sb-main strong { font-size: 2.2rem; }
  .x01-rest { font-size: 2.4rem; }
  .mods .mod { min-height: 40px; }
  .specials .key { min-height: 44px; }
}
@media (max-height: 620px) {
  .play { gap: 6px; padding-top: calc(env(safe-area-inset-top) + 4px); padding-bottom: calc(env(safe-area-inset-bottom) + 4px); }
  .play-top .icon-btn { width: 36px; height: 36px; }
  .sb-main { padding: 6px 12px; }
  .sb-main strong, .scoreboard.compact .sb-main strong { font-size: 1.9rem; }
  .sb-side div { padding: 2px 8px; }
  .sb-side b { font-size: .98rem; }
  .slot { min-height: 46px; }
  .slot small, .slot span { display: none; }
  .turn-total strong { font-size: 1.5rem; }
  .x01-rest, .x01.n1 .x01-rest { font-size: 2.1rem; }
  .checkout { min-height: 30px; }
  .mods .mod { min-height: 36px; }
  .specials .key { min-height: 40px; }
  .play-actions .btn.small { min-height: 34px; padding: 4px 14px; }
}
@media (min-width: 900px) {
  .page { max-width: 860px; }
  .actions { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Samen trainen ---------- */
.gp { display: grid; gap: 6px; flex: none; }
.gp.n2 { grid-template-columns: 1fr 1fr; }
.gp.n3 { grid-template-columns: repeat(3, 1fr); }
.gp.n4 { grid-template-columns: repeat(4, 1fr); }
.gp-p { background: var(--surface); border: 2px solid transparent; border-radius: 14px; padding: 5px 8px; display: grid; min-width: 0; opacity: .62; transition: opacity .2s, border-color .2s; }
.gp-p.up { opacity: 1; border-color: var(--accent); }
.gp-p b { display: flex; align-items: center; gap: 5px; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gp-p strong { font-size: 1.35rem; font-weight: 900; line-height: 1.1; }
.gp-p small { color: var(--muted); font-size: .7rem; white-space: nowrap; }
.scoreboard.compact .sb-main strong { font-size: clamp(1.8rem, 9vw, 2.6rem); }
.scoreboard.compact .sb-side div { padding: 3px 8px; }
.scoreboard.compact .sb-side b { font-size: .98rem; }
.ranking { list-style: none; margin: 0; padding: 0; }
.ranking li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ranking li:last-child { border: 0; }
.rk { font-size: 1.5rem; width: 36px; text-align: center; }
.rk-name { flex: 1; min-width: 0; display: grid; }
.rk-name small { color: var(--muted); }
.rk-name .rk-rec { color: var(--gold); }
.ranking strong { font-size: 1.5rem; font-weight: 900; color: var(--lime); display: grid; justify-items: end; line-height: 1; }
.ranking strong small { font-size: .62rem; color: var(--muted); font-weight: 700; }
.tagline { margin: -4px 0 0; font-weight: 900; font-style: italic; letter-spacing: .06em; text-transform: uppercase; color: var(--lime); font-size: 1.08rem; }
.summary-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.summary-form label { font-size: .85rem; display: grid; gap: 4px; margin: 0; }
.summary-form .btn { grid-column: 1 / -1; }
@media (max-height: 700px) { .gp-p strong { font-size: 1.1rem; } .gp-p small { display: none; } }
.gp-p.up { animation: turn-in .5s ease; }
@keyframes turn-in { 0% { transform: scale(.95); } 60% { transform: scale(1.02); } 100% { transform: scale(1); } }

/* ---------- Uitslag: uitklapbaar blok, vergelijking ---------- */
details.more > summary { cursor: pointer; font-weight: 800; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: '▾'; color: var(--muted); transition: transform .15s; }
details.more[open] > summary::after { transform: rotate(180deg); }
details.more[open] > summary { margin-bottom: 10px; }
details.more .badge-banner { margin-bottom: 10px; }
.cmp { display: block; margin-top: 8px; font-style: normal; font-weight: 700; font-size: .92rem; }
.rk-name .cmp { font-size: .8rem; margin-top: 2px; }

/* Pijlen corrigeren: ingevulde pijl is een knop */
button.slot { font: inherit; color: inherit; cursor: pointer; }
button.slot:active { transform: scale(.96); }

/* Denckh-signatuur (officieel logo met krul, niet nagetekend). Lichte variant op donker, donkere variant op licht thema. */
.maker { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; line-height: 1; color: inherit; text-decoration: none; }
.maker .maker-role { font-size: .72rem; letter-spacing: .02em; font-weight: 600; color: var(--muted); }
.maker img { display: block; height: 28px; width: auto; }
.maker .on-light { display: none; }
[data-theme="light"] .maker .on-dark { display: none; }
[data-theme="light"] .maker .on-light { display: block; }
.maker:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 6px; }
.maker-line { display: flex; justify-content: center; margin: 14px 0 0; }
