:root {
  --ink: #fff7e8;
  --muted: rgba(255, 247, 232, 0.68);
  --panel: rgba(30, 14, 52, 0.86);
  --line: rgba(255, 255, 255, 0.14);
  --green: #6fd36a;
  --red: #ff5a5a;
  --purple: #c77dff;
  --gold: #ffd166;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", "Trebuchet MS", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #1b0d2e; color: var(--ink);
  font-family: var(--font);
  overscroll-behavior: none;
}
body.playing { touch-action: none; -webkit-user-select: none; user-select: none; }
[hidden] { display: none !important; }

#game { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; }
#safeProbe { position: fixed; top: 0; left: 0; width: 0; padding-top: env(safe-area-inset-top); visibility: hidden; pointer-events: none; }

/* ---------- overlay & panelen ---------- */
#ui {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: radial-gradient(ellipse at center, rgba(20, 6, 36, 0.25), rgba(20, 6, 36, 0.6));
}
.panel {
  width: 100%; max-width: 420px; margin: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 26px 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  text-align: center;
}
.panel.wide { max-width: 520px; }
.panel.small { max-width: 340px; padding: 20px; }

.logo {
  margin: 0; font-size: clamp(38px, 11vw, 54px); font-weight: 900; letter-spacing: -1px; line-height: 1;
  background: linear-gradient(90deg, #ffd166, #ff8fab, #c77dff, #72ddf7, #b9fbc0, #ffd166);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 8s linear infinite;
}
.logo span { display: block; font-size: 0.82em; }
@keyframes shimmer { to { background-position: 300% 0; } }
.tag { margin: 8px 0 22px; color: var(--muted); font-weight: 700; }
h2 { margin: 0 0 10px; font-size: 26px; font-weight: 900; }
h3 { margin: 22px 0 10px; font-size: 17px; font-weight: 800; text-align: left; }
p { line-height: 1.45; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ---------- knoppen ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer;
  font: inherit; font-weight: 800; font-size: 16px;
  color: var(--ink);
  padding: 13px 18px; border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  transition: transform 0.08s ease, filter 0.15s ease, background 0.15s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn.primary { background: linear-gradient(180deg, #7ee26f, #3fae4a); color: #10300f; box-shadow: 0 4px 0 #2b7d33; }
.btn.secondary { background: linear-gradient(180deg, #c98bff, #8f4ee0); box-shadow: 0 4px 0 #5f2ea3; }
.btn.ghost { background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); }
.btn.danger { background: linear-gradient(180deg, #ff7676, #d93a3a); box-shadow: 0 3px 0 #8f1f1f; }
.btn.wa { background: linear-gradient(180deg, #3ee07f, #1fa855); color: #06311a; box-shadow: 0 3px 0 #13703a; }
.btn.big { font-size: 20px; padding: 16px 20px; }
.btn.small { font-size: 14px; padding: 10px 14px; margin-top: 18px; }
.btn.tiny { font-size: 13px; padding: 7px 11px; border-radius: 11px; }

/* ---------- formulieren ---------- */
label { display: flex; flex-direction: column; gap: 6px; text-align: left; font-weight: 700; font-size: 14px; color: var(--muted); }
input {
  font: inherit; font-size: 17px; font-weight: 700;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px;
}
input::placeholder { color: rgba(255, 247, 232, 0.35); }

/* ---------- startscherm ---------- */
.recent { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.recent .label { width: 100%; font-size: 13px; color: var(--muted); font-weight: 700; }
.recent .btn { margin: 0; }
.howto { margin-top: 18px; text-align: left; background: rgba(255, 255, 255, 0.05); border-radius: 14px; padding: 10px 14px; }
.howto summary { cursor: pointer; font-weight: 800; }
.howto ul { margin: 10px 0 4px; padding-left: 18px; font-size: 14px; line-height: 1.5; }
.howto b.g { color: var(--green); } .howto b.r { color: var(--red); } .howto b.p { color: var(--purple); }
.toggles { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.warn { font-size: 12px; color: var(--muted); margin: 14px 0 0; }

/* ---------- groep ---------- */
.groupHead h2 { word-break: break-word; }
.joinBox { margin: 14px 0 4px; padding: 14px; border-radius: 16px; background: rgba(255, 255, 255, 0.06); }
.playRow { margin: 14px 0 0; }
.playRow .btn { width: 100%; }
.playRow p { margin: 8px 0 0; }
.board { list-style: none; margin: 0; padding: 0; text-align: left; }
.board li {
  display: grid; grid-template-columns: 34px 1fr auto auto; align-items: center; gap: 8px;
  padding: 10px 12px; margin-bottom: 6px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  font-weight: 800;
}
.board li.me { background: rgba(126, 226, 111, 0.18); outline: 1px solid rgba(126, 226, 111, 0.45); }
.board li .rank { text-align: center; font-size: 18px; }
.board li .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board li .lvl { font-size: 12px; color: var(--muted); font-weight: 700; }
.board li .score { color: var(--gold); font-size: 18px; min-width: 52px; text-align: right; }
.board li.empty, .board li.waiting { display: block; color: var(--muted); font-weight: 700; font-size: 14px; }
.share { margin-top: 6px; }
.linkLine { margin: 0 0 10px; text-align: left; font-weight: 700; word-break: break-all; color: var(--gold); }
.shareBtns { display: flex; flex-wrap: wrap; gap: 8px; }
.shareBtns .btn { flex: 1 1 auto; }
.qrWrap { margin-top: 14px; }
.qr { width: min(240px, 70vw); margin: 0 auto; background: #fff; border-radius: 16px; padding: 8px; }
.qr svg { display: block; width: 100%; height: auto; }
.admin { margin-top: 10px; padding: 4px 14px 12px; border-radius: 16px; background: rgba(255, 90, 90, 0.08); border: 1px dashed rgba(255, 120, 120, 0.35); }
.admin h3 { margin-top: 12px; }
.adminRow { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.adminRow .name { flex: 1; text-align: left; font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin .shareBtns { margin-top: 12px; }

/* ---------- einde ---------- */
.bigScore { margin: 6px 0 10px; }
.bigScore span { display: block; font-size: 64px; font-weight: 900; color: var(--gold); line-height: 1; text-shadow: 0 4px 0 rgba(0, 0, 0, 0.3); }
.bigScore small { color: var(--muted); font-weight: 800; }
.details { list-style: none; padding: 0; margin: 0 0 8px; color: var(--muted); font-weight: 700; line-height: 1.6; }
.status { min-height: 1.4em; font-weight: 800; color: #b9fbc0; }

/* ---------- in het spel ---------- */
.pauseBtn {
  position: fixed; z-index: 5;
  top: calc(10px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right));
  width: 46px; height: 46px; border-radius: 14px; border: 0;
  background: rgba(30, 14, 52, 0.55); color: #fff; font-size: 15px; letter-spacing: -2px; cursor: pointer;
}
#touch { position: fixed; inset: auto 0 0 0; z-index: 4; pointer-events: none;
  padding: 0 calc(14px + env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left));
  display: flex; justify-content: space-between; align-items: flex-end; }
.tLeftGroup { display: flex; gap: 12px; }
.tBtn {
  pointer-events: auto; touch-action: none; -webkit-user-select: none; user-select: none;
  width: 74px; height: 74px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(30, 14, 52, 0.42); color: rgba(255, 255, 255, 0.9);
  font-size: 26px; display: flex; align-items: center; justify-content: center; flex-direction: column;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.tBtn.jump { width: 96px; height: 96px; font-size: 30px; background: rgba(126, 226, 111, 0.32); border-color: rgba(185, 251, 192, 0.6); }
.tBtn.jump span { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; margin-top: -2px; }
.tBtn.down { background: rgba(255, 255, 255, 0.35); transform: scale(0.94); }
@media (max-height: 420px) {
  .tBtn { width: 64px; height: 64px; }
  .tBtn.jump { width: 82px; height: 82px; }
}

.pill {
  position: fixed; z-index: 6; left: 50%; transform: translateX(-50%);
  top: calc(64px + env(safe-area-inset-top));
  background: rgba(30, 14, 52, 0.85); padding: 8px 14px; border-radius: 99px; font-weight: 800; font-size: 13px; white-space: nowrap;
}
.modal { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(10, 4, 20, 0.6); }
.modal p { font-weight: 700; margin-top: 0; }
.toast {
  position: fixed; z-index: 30; left: 50%; transform: translateX(-50%);
  bottom: calc(24px + env(safe-area-inset-bottom));
  max-width: min(92vw, 420px); text-align: center;
  background: #fff7e8; color: #2a1446; font-weight: 800;
  padding: 12px 18px; border-radius: 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
@media (prefers-reduced-motion: reduce) { .logo { animation: none; } }
.homeShare { margin-top: 18px; text-align: left; }
.homeShare h3 { margin-top: 0; }
