:root {
  --bg: #16110b;
  --surface: #221a11;
  --surface-2: #2e2418;
  --border: #3b2f20;
  --text: #f6ecdc;
  --muted: #b09c80;
  --accent: #f5a524;
  --accent-ink: #1d1406;
  --high: #f87171;
  --ok: #4ade80;
  --radius: 16px;
  --photo-ratio: 4 / 5; /* vast fotoformaat, gelijk aan PHOTO_RATIO in app.js */
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.4;
  min-height: 100dvh;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
a { color: inherit; text-decoration: none; }
h1 { font-size: 1.6rem; margin: 8px 0 16px; }
h2 { font-size: 1.1rem; margin: 20px 0 10px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 800; font-size: 1.2rem; }
.badge { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; background: var(--surface-2); color: var(--accent); padding: 2px 8px; border-radius: 99px; }

.page { max-width: 560px; margin: 0 auto; padding: 16px; }

/* nav */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 10px; font-size: .72rem; color: var(--muted); }
.nav a span { font-size: 1.35rem; filter: grayscale(1); opacity: .7; }
.nav a.active { color: var(--accent); }
.nav a.active span { filter: none; opacity: 1; }
.nav a span { position: relative; }

/* rood bolletje met een aantal */
.bolletje {
  position: absolute; top: -2px; right: -8px; min-width: 18px; height: 18px; padding: 0 4px;
  display: grid; place-items: center; font-style: normal; font-size: .68rem; font-weight: 800;
  background: var(--high); color: #fff; border-radius: 99px; line-height: 1; filter: none; opacity: 1;
}
.btn .bolletje { position: static; display: inline-grid; vertical-align: middle; margin-left: 4px; }

/* forms & buttons */
.form { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-size: .85rem; color: var(--muted); }
input, select {
  width: 100%; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px;
}
input:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }
/* Onzichtbaar, maar niet display:none — anders opent de camera niet in elke mobiele browser. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; opacity: 0; pointer-events: none;
}
.check { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: .9rem; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.counter { font-variant-numeric: tabular-nums; }
.counter.near { color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn { font: inherit; font-weight: 700; border: 0; border-radius: 14px; padding: 14px 18px; cursor: pointer; width: 100%; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:disabled { opacity: .4; cursor: not-allowed; }
.btn.ghost { background: var(--surface-2); color: var(--text); margin-top: 24px; }
.btn.link { background: none; color: var(--accent); font-weight: 600; margin-top: 8px; }
.big-btn { margin-top: 20px; font-size: 1.1rem; padding: 18px; }
.icon-btn { background: none; border: 0; font-size: 1.1rem; cursor: pointer; padding: 6px; }
.error { color: var(--high); margin: 0; }

/* auth */
.auth { padding-top: 32px; }
.hero { font-size: 4rem; text-align: center; }
.auth h1 { text-align: center; margin-bottom: 4px; }
.auth > p { text-align: center; margin: 0 0 24px; }

/* check-in */
.status {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px;
}
.status div { display: grid; }
.status b { font-size: 1.3rem; }

.photo-frame {
  position: relative; overflow: hidden;
  aspect-ratio: var(--photo-ratio); border-radius: var(--radius);
  border: 2px dashed var(--border); background: var(--surface); color: var(--text);
}
.photo-frame.has-photo { border-style: solid; border-color: var(--accent); }
.photo-empty {
  position: absolute; inset: 0; width: 100%; cursor: pointer;
  display: grid; place-content: center; justify-items: center; gap: 4px; text-align: center;
  background: none; border: 0; color: var(--text); font: inherit;
}
.photo-empty .big { font-size: 3rem; }
.photo-empty small { color: var(--muted); }
.photo-frame video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000;
}
/* Zoeker gelijk aan de uiteindelijke foto bij de selfiecamera. */
.photo-frame video.gespiegeld { transform: scaleX(-1); }
.shutter {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  width: 62px; height: 62px; border-radius: 50%; cursor: pointer;
  background: #fff; border: 4px solid rgba(0,0,0,.35); box-shadow: 0 0 0 3px rgba(255,255,255,.5);
}
.shutter:active { transform: translateX(-50%) scale(.92); }
.shutter:disabled { opacity: .45; cursor: wait; }
.flip, .flits-knop {
  position: absolute; top: 10px; width: 40px; height: 40px; border-radius: 50%;
  border: 0; cursor: pointer; font-size: 1.1rem; background: rgba(0,0,0,.65); color: #fff;
}
.flip { right: 10px; }
.flits-knop { right: 58px; }
.flits-knop.aan { background: var(--accent); color: var(--accent-ink); }

/* Schermflits voor toestellen zonder echte flitser */
.flits-laag {
  position: fixed; inset: 0; z-index: 30; background: #fff; pointer-events: none;
}
.photo-frame img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  cursor: grab; touch-action: none; user-select: none; -webkit-user-drag: none;
}
.photo-frame img:active { cursor: grabbing; }
.photo-hint, .retake {
  position: absolute; bottom: 10px; background: rgba(0,0,0,.65); color: #fff;
  padding: 6px 12px; border-radius: 99px; font-size: .8rem;
}
.photo-hint { left: 10px; pointer-events: none; }
.retake { right: 10px; cursor: pointer; border: 0; font: inherit; }
.photo-frame .source { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,.65); }
.gallery-link {
  display: block; text-align: center; margin-top: 10px; padding: 6px;
  color: var(--muted); font-size: .85rem; text-decoration: underline; cursor: pointer;
}

.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.chip {
  font: inherit; font-size: .85rem; color: var(--text); cursor: pointer;
  display: grid; justify-items: center; gap: 2px; padding: 10px 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
}
.chip span { font-size: 1.6rem; }
.chip.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }

/* feed cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.card.nieuw { border-color: var(--accent); }
.nieuw-stip { color: var(--accent); font-weight: 700; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; }
.source {
  flex: none; margin-left: auto; font-size: .72rem; white-space: nowrap;
  background: var(--surface-2); color: var(--muted); padding: 4px 9px; border-radius: 99px;
}
.source.live { color: var(--accent); }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who > span:last-child { display: grid; min-width: 0; }
.who small { color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-weight: 800;
}
.avatar.xl { width: 84px; height: 84px; font-size: 2.2rem; }
img.avatar { object-fit: cover; }
.avatar-edit { display: grid; justify-items: center; gap: 12px; margin: 8px 0 20px; }
.small-btn { width: auto; padding: 10px 16px; font-size: .9rem; display: inline-block; text-align: center; }
.bio { margin: 8px 0 0; text-align: center; overflow-wrap: anywhere; }
.profile-head .small-btn { margin-top: 14px; }
.profile-acties { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* statistieken op het profiel */
.stats-open { margin-bottom: 16px; }
.stats-open summary {
  list-style: none; cursor: pointer; text-align: center; font-weight: 700; user-select: none;
  background: var(--surface-2); color: var(--text); border-radius: 14px; padding: 12px;
}
.stats-open summary::-webkit-details-marker { display: none; }
.stats-open[open] summary { margin-bottom: 12px; }
.stats-open .totals { margin-top: 10px; }
.stats-open .disclaimer { margin-top: 10px; }
.stats { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.stats th, .stats td { padding: 10px 12px; text-align: right; font-size: .9rem; }
.stats th:first-child, .stats td:first-child { text-align: left; }
.stats thead th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.stats tbody tr { border-top: 1px solid var(--border); }
.stats tbody td b { font-size: 1.05rem; }
.stats tr.totaal { background: var(--surface-2); }

/* beheerpagina */
.admin-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.admin-list li {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 8px 10px;
}
.admin-list li > img { width: 44px; height: 56px; border-radius: 8px; object-fit: cover; flex: none; }
.admin-info { display: grid; gap: 2px; min-width: 0; flex: 1; }
.admin-info small { color: var(--muted); font-size: .78rem; overflow-wrap: anywhere; }
.admin-acties { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.chip-btn {
  font: inherit; font-size: .75rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 99px; padding: 5px 10px;
}
textarea {
  width: 100%; font: inherit; color: var(--text); resize: vertical;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px;
}
textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.photo { display: block; width: 100%; aspect-ratio: var(--photo-ratio); object-fit: cover; background: var(--surface-2); }
.card-body { padding: 10px 14px 14px; }
.card-body p { margin: 6px 0 0; }
/* Ook een bijschrift of dranknaam zonder spaties moet netjes afbreken. */
.card-body p, .drink, .who b, .ranking small { overflow-wrap: anywhere; }
.drink { display: flex; flex-wrap: wrap; gap: 0 6px; align-items: baseline; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* sterren en serveertype */
.sterren { display: flex; align-items: center; gap: 4px; margin-bottom: 12px; }
.ster { font-size: 1.9rem; line-height: 1; background: none; border: 0; padding: 0 2px; cursor: pointer; color: var(--border); }
.ster.aan { color: var(--accent); }
.ster-waarde { margin-left: 8px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.sterren .chip-btn { margin-left: auto; }
.chips.serveer { grid-template-columns: repeat(4, 1fr); }
.chips.serveer .chip span { font-size: 1.3rem; }
.beoordeling { display: flex; align-items: center; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.sterren-tekst { color: var(--accent); letter-spacing: 2px; }
.serveer-label { color: var(--muted); font-size: .85rem; }

/* proosten en reacties */
.sociaal { border-top: 1px solid var(--border); }
.sociaal-knoppen { display: grid; grid-template-columns: 1fr 1fr; }
.sociaal-knop {
  font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; padding: 12px 8px;
  background: none; border: 0; color: var(--muted);
}
.sociaal-knop + .sociaal-knop { border-left: 1px solid var(--border); }
.sociaal-knop.aan { color: var(--accent); }
.reacties { list-style: none; margin: 0; padding: 0 14px 12px; display: grid; gap: 8px; }
.reacties li { font-size: .9rem; overflow-wrap: anywhere; }
.reacties small { margin-left: 6px; font-size: .75rem; }

/* ranking */
.seg { display: flex; gap: 6px; background: var(--surface); padding: 4px; border-radius: 12px; margin-bottom: 14px; }
.seg button { flex: 1; font: inherit; font-weight: 600; color: var(--muted); background: none; border: 0; border-radius: 9px; padding: 8px; cursor: pointer; }
.seg button.active { background: var(--surface-2); color: var(--text); }
.seg.small { background: none; padding: 0; align-items: center; font-size: .85rem; }
.seg.small .muted { margin-right: 4px; }
.seg.small button { flex: none; padding: 6px 12px; border: 1px solid var(--border); }
.seg.small button.active { border-color: var(--accent); }

.totals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.totals.three { grid-template-columns: repeat(3, 1fr); }
.totals div { display: grid; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px; text-align: center; }
.totals b { font-size: 1.4rem; }
.totals small { color: var(--muted); font-size: .78rem; }

/* wereld / vrienden / eigen lijsten */
.scopes { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: none; }
.scopes::-webkit-scrollbar { display: none; }
.scope {
  flex: none; font: inherit; font-size: .85rem; font-weight: 600; white-space: nowrap; cursor: pointer;
  background: var(--surface); color: var(--muted); border: 1px solid var(--border);
  border-radius: 99px; padding: 8px 14px; text-decoration: none;
}
.scope.active { border-color: var(--accent); color: var(--text); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.scope.nieuw { color: var(--accent); border-style: dashed; }
.looptijd { text-align: center; color: var(--muted); font-size: .85rem; margin: 0 0 14px; }
.lijst-balk {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 10px 12px; margin-bottom: 14px;
}
.lijst-balk > span:first-child { display: grid; }
.lijst-balk .code { font-size: 1.2rem; }
.lijst-balk a.chip-btn { text-decoration: none; display: inline-block; }

/* keuzemenu achter het plusje */
.keuze-dialoog { width: min(420px, calc(100% - 32px)); padding: 20px; }
.keuze-dialoog h2 { margin: 0 0 16px; text-align: center; }
.of { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; margin: 18px 0; }
.of::before, .of::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.code { letter-spacing: .12em; color: var(--accent); }

/* jouw eigen regel boven de lijst */
.mijzelf {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  background: var(--surface); border: 1px solid var(--accent); border-radius: 14px; padding: 10px 12px;
}
.mijn-info { display: grid; gap: 2px; flex: 1; min-width: 0; }
.mijn-info small { color: var(--muted); font-size: .8rem; }
.mijn-plek { display: grid; justify-items: end; gap: 2px; text-align: right; }
.mijn-plek b { font-size: 1.3rem; }
.mijn-plek small { font-size: .75rem; white-space: nowrap; }
.omhoog { color: var(--ok, #4ade80); font-weight: 700; }
.omlaag { color: var(--high); font-weight: 700; }
.gelijk { color: var(--muted); }

/* toplijstjes op de wereldpagina */
.top-lijst { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.top-lijst li {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px;
}
.top-lijst .pos { width: 22px; }
.top-lijst .sterren-tekst { white-space: nowrap; font-size: .85rem; }

.ranking { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ranking li {
  display: grid; grid-template-columns: 32px 1fr auto auto; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px;
}
.ranking li .icon-btn { color: var(--muted); font-size: 1rem; }
.ranking li.me { border-color: var(--accent); }
/* lege lijst: tekst over de volle breedte in plaats van in een kolom */
.ranking li.muted, .admin-list li.muted { display: block; text-align: center; padding: 20px 12px; }
.ranking li.dim { opacity: .5; }
.pos { font-size: 1.25rem; text-align: center; font-weight: 700; }
.nums { display: grid; justify-items: end; gap: 2px; min-width: 70px; }
.nums > b { font-size: 1.3rem; }
.bar { width: 70px; height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }

.pct { color: var(--accent); font-weight: 700; }
.pct.small { font-size: .85rem; }

.disclaimer { font-size: .75rem; color: var(--muted); margin-top: 18px; }

/* profile */
.profile-head { display: grid; justify-items: center; gap: 4px; margin: 8px 0 16px; }
.profile-head h1 { margin: 6px 0 0; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; border-radius: 12px; overflow: hidden; }
.thumb { position: relative; padding: 0; border: 0; cursor: pointer; aspect-ratio: var(--photo-ratio); background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb span { position: absolute; right: 4px; bottom: 2px; font-size: 1.1rem; text-shadow: 0 1px 3px #000; }

/* barcodescanner */
.scan-dialoog { width: min(460px, calc(100% - 32px)); }
.scan-kader {
  position: relative; overflow: hidden; border-radius: var(--radius);
  aspect-ratio: 4 / 3; background: #000;
}
.scan-kader video { width: 100%; height: 100%; object-fit: cover; }
.scan-lijn {
  position: absolute; left: 8%; right: 8%; top: 50%; height: 3px;
  background: var(--high); box-shadow: 0 0 12px var(--high); border-radius: 2px;
}
.scan-tekst { text-align: center; margin: 12px 0 0; font-size: .9rem; }
.label-row h2 { margin: 20px 0 10px; }
.stap {
  display: inline-grid; place-items: center; width: 24px; height: 24px; margin-right: 6px;
  background: var(--accent); color: var(--accent-ink); border-radius: 50%; font-size: .85rem; font-weight: 800;
}
.caption-veld { margin-top: 16px; }
.zichtbaarheid { margin-top: 18px; }
.zichtbaarheid .label-row { margin-bottom: 8px; font-size: .9rem; }
.zichtbaarheid .seg button { font-size: .85rem; }
.nieuw-product {
  margin: 0; padding: 12px 14px; border-radius: 12px; font-size: .85rem; line-height: 1.45;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  border: 1px solid var(--accent); color: var(--text);
}
.nieuw-product span { font-variant-numeric: tabular-nums; color: var(--muted); }

/* modal & toast */
dialog { width: min(520px, calc(100% - 32px)); background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
dialog::backdrop { background: rgba(0,0,0,.7); }
dialog .card { margin-bottom: 0; }
dialog .btn.ghost { margin-top: 12px; }

.toast {
  /* left/right + auto-marges: zo mag de balk de volle schermbreedte gebruiken.
     Met left:50% zou hij maar de helft van het scherm krijgen en de tekst onnodig afbreken. */
  position: fixed; left: 16px; right: 16px; bottom: calc(90px + env(safe-area-inset-bottom)); z-index: 20;
  margin-inline: auto; width: fit-content;
  background: var(--text); color: var(--bg); font-weight: 600; padding: 12px 18px;
  /* Ronding past zich aan: pil bij één regel, nette hoeken bij een langere tekst. */
  border-radius: 18px; text-align: center; text-wrap: balance;
  max-width: min(420px, calc(100% - 32px)); box-shadow: 0 6px 20px rgba(0,0,0,.4);
}
