:root {
  --bg: #faf7f0;
  --card: #ffffff;
  --text: #1d1a14;
  --muted: #6b6456;
  --line: #e8e1d2;
  --accent: #d98e04;
  --accent-soft: #fbecc8;
  --bad: #b3261e;
  --bad-soft: #fbe3e1;
  --good: #2e7d32;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14120e;
    --card: #1e1b16;
    --text: #f3eee4;
    --muted: #a59d8c;
    --line: #332e26;
    --accent: #f5b53d;
    --accent-soft: #3a2d12;
    --bad: #f28b82;
    --bad-soft: #3b1d1b;
    --good: #81c995;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: 960px; margin: 0 auto; padding: 20px 16px 48px; }
h1, h2 { line-height: 1.2; margin: 0; }
h2 { font-size: 1.05rem; margin-bottom: 12px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

/* ---- publiek ---- */
.hero { text-align: center; padding: 28px 16px 20px; }
.hero .label { color: var(--muted); font-size: .95rem; letter-spacing: .02em; }
.hero .total {
  font-size: clamp(4.5rem, 22vw, 9rem);
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  margin: 6px 0 2px;
}
.hero .since { font-size: .95rem; margin-top: 6px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.tile { text-align: center; }
.tile .num { font-size: 2.4rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.grid { display: grid; gap: 16px; }
@media (min-width: 760px) { .grid { grid-template-columns: 2fr 3fr; } }

.ranking { list-style: none; margin: 0; padding: 0; }
.ranking li {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.ranking li:last-child { border-bottom: 0; }
.ranking .pos { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.ranking .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking .bar { height: 6px; background: var(--accent-soft); border-radius: 3px; margin-top: 4px; overflow: hidden; }
.ranking .bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.ranking .cnt { font-weight: 700; font-variant-numeric: tabular-nums; }
.ranking li.top1 .pos::after { content: " 🏆"; }
.chart-box { position: relative; height: 280px; }
.footer { text-align: center; margin-top: 20px; }

/* ---- admin ---- */
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.topbar nav { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
button, .btn, select, input {
  font: inherit;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  min-height: 40px;
}
button, .btn { cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
button.primary { background: var(--accent); border-color: var(--accent); color: #1d1a14; font-weight: 650; }
button.danger { color: var(--bad); border-color: var(--bad); }
button.ok { color: var(--good); border-color: var(--good); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filters > * { flex: 1 1 150px; }
.list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.reg { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.reg.afgekeurd { border-color: var(--bad); }
.reg.afgekeurd .thumb img { opacity: .4; filter: grayscale(1); }
.reg .thumb { display: block; aspect-ratio: 4/3; background: var(--line); border: 0; padding: 0; border-radius: 0; width: 100%; }
.reg .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.reg .nophoto { display: flex; align-items: center; justify-content: center; aspect-ratio: 4/3; background: var(--line); color: var(--muted); }
.reg .body { padding: 12px 14px 14px; display: grid; gap: 4px; flex: 1; }
.reg .caption { white-space: pre-wrap; overflow-wrap: anywhere; }
.reg form { margin-top: 8px; }
.reg form button { width: 100%; }
.badge { display: inline-block; font-size: .75rem; padding: 1px 8px; border-radius: 999px; background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 20px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-wrap { overflow-x: auto; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--accent-soft); padding: 1px 6px; border-radius: 6px; }
.notice { background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; }
.error { background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; }

.login { max-width: 380px; margin: 10vh auto 0; }
.login form { display: grid; gap: 12px; }
.login label { display: grid; gap: 4px; font-size: .9rem; color: var(--muted); }

dialog { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; }
dialog::backdrop { background: rgba(0, 0, 0, .85); }
dialog img { max-width: 96vw; max-height: 88vh; display: block; border-radius: 8px; }
dialog .dlg-bar { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; }
dialog .dlg-bar a, dialog .dlg-bar button { background: #222; color: #eee; border-color: #444; }
