:root {
  --bg: #140834;
  --bg-dark: #0E0526;
  --card: #1F0F4D;
  --card-2: #2C1A63;
  --line: #3B2A78;
  --text: #F4F0FF;
  --soft: #E9E3FF;
  --muted: #CFC6F2;
  --faint: #8F84B8;
  --lime: #C6FF3D;
  --lime-shadow: #7FA81F;
  --cyan: #3DE8FF;
  --pink: #FF4FB3;
  --pink-text: #FF7CC6;
  --bar-off: #5A4A99;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Rubik, system-ui, sans-serif;
  font-size: 17px;
  overflow-x: hidden;
}

a { color: var(--soft); }
a:hover { color: var(--lime); }
button, input { font-family: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--lime); outline-offset: 3px; }
input:focus { outline: 3px solid var(--lime); outline-offset: 2px; }
input::placeholder { color: var(--faint); }

.display { font-family: Bungee, sans-serif; font-weight: 400; }
.lime { color: var(--lime); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Header ---------- */
.site-header { background: var(--bg-dark); border-bottom: 3px solid var(--lime); }
.site-header .wrap { max-width: 1200px; margin: 0 auto; padding: 16px 24px; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; }
.logo span { font-family: Bungee, sans-serif; font-size: 26px; letter-spacing: 1px; }
.nav { display: flex; gap: 8px; flex-wrap: wrap; }
.nav a { padding: 12px 20px; border-radius: 999px; border: 2px solid var(--line); text-decoration: none; font-weight: 800; font-size: 15px; text-transform: uppercase; }
.nav a[aria-current="page"] { background: var(--lime); border-color: var(--lime); color: var(--bg); }

main { max-width: 1200px; margin: 0 auto; padding: 48px 24px 80px; display: flex; flex-direction: column; gap: 36px; }

/* ---------- Hero ---------- */
.hero { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.sticker { display: inline-block; transform: rotate(-3deg); background: var(--pink); color: #fff; font-weight: 900; font-size: 15px; letter-spacing: 2px; padding: 8px 16px; border-radius: 8px; text-transform: uppercase; }
.hero h1, .page-title h1 { margin: 0; font-family: Bungee, sans-serif; font-weight: 400; font-size: clamp(40px, 7vw, 72px); line-height: 0.95; letter-spacing: 1px; }
.hero p { margin: 0; color: var(--muted); font-size: 19px; max-width: 640px; line-height: 1.5; }

/* ---------- Spelers invullen ---------- */
.players { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; position: relative; }
.player-input { background: var(--card); border-radius: 24px; padding: 24px; display: flex; flex-direction: column; gap: 10px; border: 3px solid var(--cyan); box-shadow: 0 0 0 6px rgba(61,232,255,0.15), 0 18px 40px rgba(61,232,255,0.25); }
.player-input.b { border-color: var(--pink); box-shadow: 0 0 0 6px rgba(255,79,179,0.15), 0 18px 40px rgba(255,79,179,0.25); }
.player-input label { font-family: Bungee, sans-serif; font-size: 18px; color: var(--cyan); }
.player-input.b label { color: var(--pink-text); }
.text-input { height: 60px; padding: 0 18px; border-radius: 14px; border: 2px solid var(--line); background: var(--bg); color: #fff; font-size: 22px; font-weight: 700; width: 100%; }
.vs { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-8deg); width: 92px; height: 92px; border-radius: 50%; background: var(--lime); color: var(--bg); display: flex; align-items: center; justify-content: center; font-family: Bungee, sans-serif; font-size: 34px; border: 6px solid var(--bg); pointer-events: none; }
@media (max-width: 640px) {
  .vs { width: 64px; height: 64px; font-size: 22px; border-width: 4px; }
}

.controls { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.big-btn { min-height: 72px; padding: 0 56px; border: 0; border-radius: 18px; background: var(--lime); color: var(--bg); font-family: Bungee, sans-serif; font-size: 30px; box-shadow: 0 8px 0 var(--lime-shadow); transition: transform .08s, box-shadow .08s; }
.big-btn:active { transform: translateY(6px); box-shadow: 0 2px 0 var(--lime-shadow); }
.big-btn[disabled] { opacity: .6; cursor: wait; }
.seg-row { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.seg { display: flex; gap: 4px; padding: 5px; background: var(--card); border-radius: 999px; flex-wrap: wrap; justify-content: center; }
.seg button { min-height: 46px; padding: 0 20px; border: 0; border-radius: 999px; font-weight: 800; font-size: 15px; text-transform: uppercase; background: transparent; color: var(--soft); }
.seg button[aria-pressed="true"] { background: var(--lime); color: var(--bg); }
.hint { margin: 0; font-size: 15px; color: var(--muted); text-align: center; max-width: 620px; line-height: 1.5; }

#result, #board { display: flex; flex-direction: column; gap: 28px; }
#result:empty, #board:empty { display: none; }

/* ---------- Meldingen ---------- */
.notice { display: flex; gap: 14px; align-items: flex-start; background: var(--card); border: 2px dashed var(--line); border-radius: 20px; padding: 18px 20px; }
.notice.error { border: 2px solid var(--pink); }
.notice strong { display: block; font-size: 17px; margin-bottom: 4px; }
.notice p { margin: 0; font-size: 16px; color: var(--muted); line-height: 1.5; }
.notice svg { flex: 0 0 auto; }

.loading { text-align: center; font-family: Bungee, sans-serif; font-size: 24px; color: var(--lime); animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: .4; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .loading { animation: none; } html { scroll-behavior: auto; } }

/* ---------- Winnaar ---------- */
.winner { background: var(--lime); color: var(--bg); border-radius: 28px; padding: 32px; display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between; transform: rotate(-1deg); }
.winner .who { display: flex; align-items: center; gap: 18px; }
.winner .label { font-weight: 900; font-size: 15px; letter-spacing: 2px; text-transform: uppercase; }
.winner .name { font-family: Bungee, sans-serif; font-size: clamp(30px, 5vw, 48px); line-height: 1; overflow-wrap: anywhere; }
.winner .score { font-family: Bungee, sans-serif; font-size: clamp(28px, 4vw, 40px); line-height: 1; }

/* ---------- Spelerkaarten ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.pcard { background: var(--card); border-radius: 24px; padding: 26px; display: flex; flex-direction: column; gap: 16px; }
.pcard .top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pcard .id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.pcard .num { width: 60px; height: 60px; flex: 0 0 auto; border-radius: 18px; background: var(--cyan); color: var(--bg); display: flex; align-items: center; justify-content: center; font-family: Bungee, sans-serif; font-size: 28px; }
.pcard.b .num { background: var(--pink); }
.pcard .pname { font-family: Bungee, sans-serif; font-size: 26px; color: #fff; overflow-wrap: anywhere; }
.pcard .meta { font-size: 15px; color: var(--muted); }
.pcard .pscore { font-family: Bungee, sans-serif; font-size: 52px; color: var(--cyan); }
.pcard.b .pscore { color: var(--pink-text); }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { display: inline-flex; padding: 8px 14px; border-radius: 999px; background: var(--cyan); color: var(--bg); font-weight: 800; font-size: 14px; text-transform: uppercase; }
.pcard.b .badge { background: var(--pink); }

/* ---------- Stat-rijen ---------- */
.section-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.section-head h2, .explain h2 { margin: 0; font-family: Bungee, sans-serif; font-weight: 400; font-size: 34px; }
.pill-btn { min-height: 46px; padding: 0 20px; border: 2px solid var(--lime); border-radius: 999px; background: transparent; color: var(--lime); font-weight: 800; font-size: 15px; text-transform: uppercase; }
.pill-btn[aria-pressed="true"] { background: var(--lime); color: var(--bg); }
.rows { display: flex; flex-direction: column; gap: 14px; }
.row { background: var(--card); border-radius: 20px; padding: 18px 22px; display: flex; flex-direction: column; gap: 12px; }
.row .grid { display: grid; grid-template-columns: minmax(0, 1fr) 190px minmax(0, 1fr); gap: 16px; align-items: center; }
.row .side { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.row .side.a { align-items: flex-end; }
.row .side.b { align-items: flex-start; }
.row .val { font-family: Bungee, sans-serif; font-size: 30px; color: var(--soft); }
.row .val.win-a { color: var(--cyan); }
.row .val.win-b { color: var(--pink-text); }
.track { width: 100%; height: 14px; border-radius: 999px; background: var(--card-2); display: flex; }
.side.a .track { justify-content: flex-end; }
.bar { height: 14px; border-radius: 999px; background: var(--bar-off); transition: width .5s ease; }
.bar.neutral { background: var(--faint); }
.bar.win-a { background: var(--cyan); }
.bar.win-b { background: var(--pink); }
.row .mid { display: flex; align-items: center; justify-content: center; gap: 8px; }
.row .mid span { font-weight: 800; font-size: 16px; color: #fff; text-align: center; text-transform: uppercase; }
.q { width: 32px; height: 32px; flex: 0 0 auto; border-radius: 50%; border: 2px solid var(--lime); background: transparent; color: var(--lime); font-family: Bungee, sans-serif; font-size: 16px; padding: 0; }
.q[aria-expanded="true"] { background: var(--lime); color: var(--bg); }
.help { display: flex; gap: 12px; align-items: flex-start; background: var(--card-2); border-radius: 14px; padding: 14px 16px; }
.help p { margin: 0; font-size: 16px; line-height: 1.55; }
.help[hidden] { display: none; }
.footnote { margin: 0; font-size: 14px; color: var(--muted); }
@media (max-width: 640px) {
  .row .grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .row .mid { grid-column: 1 / -1; order: -1; }
  .row .val { font-size: 22px; }
}

/* ---------- Uitlegkaarten ---------- */
.explain { display: flex; flex-direction: column; gap: 18px; }
.tips { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.tip { color: var(--bg); border-radius: 24px; padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.tip h3 { margin: 0; font-family: Bungee, sans-serif; font-weight: 400; font-size: 22px; }
.tip p { margin: 0; font-size: 16px; line-height: 1.5; font-weight: 500; }
.tip.c { background: var(--cyan); transform: rotate(-1.5deg); }
.tip.p { background: var(--pink); transform: rotate(1deg); }
.tip.l { background: var(--lime); transform: rotate(-0.5deg); }

.disclaimer { margin: 0; font-size: 13px; color: var(--faint); text-align: center; }

/* ---------- Ranglijst ---------- */
.page-title { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; align-items: flex-end; }
.page-title .left { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.page-title p { margin: 0; color: var(--muted); font-size: 18px; }
.add-form { display: flex; flex-wrap: wrap; gap: 12px; background: var(--card); border-radius: 24px; padding: 20px; align-items: flex-end; }
.add-form .field { flex: 1 1 260px; display: flex; flex-direction: column; gap: 8px; }
.add-form label { font-family: Bungee, sans-serif; font-size: 16px; color: var(--lime); }
.mid-btn { min-height: 60px; padding: 0 28px; border: 0; border-radius: 16px; background: var(--lime); color: var(--bg); font-family: Bungee, sans-serif; font-size: 20px; box-shadow: 0 6px 0 var(--lime-shadow); display: inline-flex; align-items: center; gap: 10px; }
.ghost-btn { min-height: 48px; padding: 0 20px; border: 2px solid var(--line); border-radius: 999px; background: transparent; color: var(--soft); font-weight: 800; font-size: 15px; text-transform: uppercase; display: inline-flex; align-items: center; gap: 8px; }
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: end; max-width: 900px; width: 100%; margin: 0 auto; }
.podium .spot { display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 0; }
.podium .pn { font-family: Bungee, sans-serif; font-size: clamp(15px, 2.4vw, 22px); color: #fff; text-align: center; overflow-wrap: anywhere; }
.podium .pv { font-weight: 800; font-size: 17px; }
.podium .block { width: 100%; border-radius: 22px 22px 8px 8px; color: var(--bg); display: flex; justify-content: center; padding-top: 18px; font-family: Bungee, sans-serif; font-size: 56px; }
.lb { display: flex; flex-direction: column; gap: 12px; }
.lb-row { background: var(--card); border-radius: 20px; padding: 16px 22px; display: grid; grid-template-columns: 56px minmax(0, 2fr) repeat(4, minmax(0, 1fr)) 48px; gap: 12px; align-items: center; border: 3px solid var(--card); }
.lb-row .rank { font-family: Bungee, sans-serif; font-size: 32px; color: var(--faint); }
.lb-row .n { font-weight: 800; font-size: 19px; color: #fff; overflow-wrap: anywhere; }
.lb-row .m { font-size: 14px; color: var(--muted); }
.lb-row .cell { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.lb-row .cell small { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.lb-row .cell b { font-family: Bungee, sans-serif; font-weight: 400; font-size: 22px; color: var(--soft); }
.lb-row .cell b.on { color: var(--lime); }
.lb-row .err { grid-column: 3 / 7; color: var(--pink-text); font-weight: 600; font-size: 15px; }
.remove { width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--line); background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.remove:hover { border-color: var(--pink); color: var(--pink-text); }
@media (max-width: 760px) {
  .lb-row { grid-template-columns: 44px minmax(0, 1fr) 44px; }
  .lb-row .cell { grid-column: span 1; }
  .lb-row .stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .lb-row .err { grid-column: 1 / -1; }
  .lb-row .remove { grid-column: 3; grid-row: 1; }
  .podium .block { font-size: 36px; }
}
@media (min-width: 761px) {
  .lb-row .stats { display: contents; }
}
