/* Toepen - mobile-first PWA styling */

:root {
  --felt: #0f3d26;
  --felt-light: #16543a;
  --felt-line: #1e6b4a;
  --card-bg: #fcfaf2;
  --card-red: #ce2029;
  --card-black: #1c1c24;
  --gold: #e8b84b;
  --text: #f2f0e6;
  --text-dim: #9db8a8;
  --danger: #e0564b;
  --ok: #58b368;
  --ok-bright: #63e08c; /* fellere groen dat op het groene laken opvalt (meegaan-animatie) */
  --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overscroll-behavior: none;
  /* Schakel dubbel-tik-zoom uit (die een dubbeltik als "scroll een stukje"
     liet aanvoelen); gewoon scrollen en pinch-zoom blijven werken. */
  touch-action: manipulation;
}

html {
  background: var(--felt);
}

body {
  min-height: 100%;
  min-height: 100dvh; /* vult óók de ruimte achter de iOS-swipebalk onderaan */
  position: relative;
  overflow-x: hidden;
  -webkit-user-select: none;
  user-select: none;
  background: var(--felt);
}

input, textarea { -webkit-user-select: text; user-select: text; }

#app {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  min-height: 100dvh; /* laat het laken tot achter de swipebalk doorlopen */
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-top) + 12px) 14px calc(var(--safe-bottom) + 16px);
}

button {
  font: inherit;
  border: none;
  border-radius: var(--radius);
  padding: 13px 18px;
  background: var(--felt-light);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.06s, opacity 0.2s;
}
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.4; pointer-events: none; }
/* Laad-indicator: terwijl een actie onderweg is (trage verbinding) draait er
   een spinnetje in de knop en is-ie niet nog eens aan te tikken. Werkt op elk
   element met .loading — ook op een kaart die je net gespeeld hebt. */
button.loading, .loading { pointer-events: none; position: relative; color: transparent !important; }
.loading > * { opacity: 0.15; }
.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.card.loading::after { border-color: rgba(0, 0, 0, 0.25); border-top-color: rgba(0, 0, 0, 0.7); }
button.primary { background: var(--gold); color: #2a2108; }
button.danger { background: var(--danger); color: #fff; }
button.ghost { background: transparent; border: 1.5px solid var(--felt-line); }
button.small { padding: 8px 14px; font-size: 0.85rem; border-radius: 10px; }

input {
  font: inherit;
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius);
  border: 1.5px solid var(--felt-line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  outline: none;
}
input:focus { border-color: var(--gold); }
input::placeholder { color: var(--text-dim); }

h1 { font-size: 1.5rem; }
h2 { font-size: 1.05rem; color: var(--text-dim); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------- auth ---------- */
.auth {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding-bottom: 15vh;
}
.auth .logo { text-align: center; margin-bottom: 18px; }
.auth .logo img { width: 96px; border-radius: 22px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4); }
.auth .logo h1 { margin-top: 12px; letter-spacing: 0.02em; }
.auth .switch { text-align: center; color: var(--text-dim); font-size: 0.9rem; margin-top: 8px; }
.auth .switch a { color: var(--gold); text-decoration: none; font-weight: 600; }
.error-msg { color: var(--danger); font-size: 0.9rem; text-align: center; min-height: 1.2em; }

/* ---------- home ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.topbar .user { color: var(--text-dim); font-size: 0.9rem; }

/* ---------- avatars ---------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--felt-light);
  border: 2px solid var(--felt-line);
  color: var(--text);
  font-weight: 800;
  overflow: hidden;
  flex: none;
}
.avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-btn { background: transparent; border: none; padding: 0; line-height: 0; cursor: pointer; }
.avatar-btn:active { transform: scale(0.94); }
.avatar-sm { width: 42px; height: 42px; font-size: 1.05rem; }
.avatar-md { width: 60px; height: 60px; font-size: 1.5rem; }
.avatar-lg { width: 108px; height: 108px; font-size: 2.6rem; border-width: 3px; }
.settings-avatar { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 12px 0 22px; }
.settings-name { font-weight: 700; font-size: 1.1rem; }
.presence-inline { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- topbar acties + leaderboard ---------- */
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--felt-light);
  border: 2px solid var(--felt-line);
  color: var(--text);
  font-size: 1.25rem;
  line-height: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 22px; height: 22px; flex: none; display: block; }

.leaderboard-row { text-align: left; cursor: pointer; }
.leaderboard-row .rank {
  flex: none;
  width: 30px;
  text-align: center;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text-dim);
}
.leaderboard-row .winpct { flex: none; font-weight: 800; font-size: 1.1rem; color: var(--gold); }
.leaderboard-row .elo-score { flex: none; font-weight: 800; font-size: 1.2rem; color: var(--gold); }
.leaderboard-row .elo-score.none { color: var(--text-dim); font-size: 0.95rem; font-weight: 700; }
.leaderboard-row.unranked { opacity: 0.72; }
.leaderboard-row.me { border-color: var(--gold); }
.names .you, .profile-name .you { color: var(--text-dim); font-weight: 400; font-size: 0.82em; }

/* ---------- eigen profielkaart op het startscherm ---------- */
.my-profile-card { align-items: center; }
.my-profile-card .names { font-size: 1.05rem; }
.my-profile-score { flex: none; display: flex; flex-direction: column; align-items: flex-end; line-height: 1; }
.my-profile-elo { font-weight: 800; font-size: 1.7rem; color: var(--gold); }
.my-profile-elo-label { font-size: 0.62rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 3px; }
.my-profile-elo.none { font-weight: 700; font-size: 0.95rem; color: var(--text-dim); text-align: right; }

/* ELO-badge in het spelersprofiel (bottom-sheet) */
.profile-elo { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.profile-elo-num { font-weight: 800; font-size: 2.2rem; color: var(--gold); line-height: 1; }
.profile-elo-label { font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.profile-elo.none .profile-elo-num { color: var(--text-dim); }
.profile-elo.none .profile-elo-label { text-transform: none; letter-spacing: 0; }

/* ---------- spelersprofiel (bottom-sheet) ---------- */
.seat .avatar-wrap { cursor: pointer; }
.profile-sheet { display: flex; flex-direction: column; gap: 20px; }
.profile-head { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.profile-name { font-weight: 800; font-size: 1.2rem; }
.profile-body { display: flex; flex-direction: column; gap: 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat {
  background: rgba(0, 0, 0, 0.18);
  border-radius: var(--radius);
  padding: 12px 6px;
  text-align: center;
}
.stat-num { font-weight: 800; font-size: 1.3rem; }
.stat-label { color: var(--text-dim); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }
.stat-sub { color: var(--text-dim); font-size: 0.85rem; text-align: center; }
.nemesis-title { font-size: 0.95rem; }
.nemesis { display: flex; align-items: center; gap: 12px; }
.nemesis > div { display: flex; flex-direction: column; gap: 4px; }
.nemesis .names { font-weight: 700; }
.nemesis .meta { color: var(--text-dim); font-size: 0.82rem; }

.home-refresh {
  height: 0;
  opacity: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 0.78rem;
  transition: height 0.18s ease, opacity 0.18s ease;
}
.home-refresh.loading { height: 32px; opacity: 1; }
.home-refresh.pulling { transition: none; }
.home-refresh-icon {
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  flex: 0 0 15px;
}
.home-refresh-icon::before { content: '↓'; font-size: 0.9rem; }
.home-refresh.ready .home-refresh-icon::before { content: '↻'; color: var(--gold); }
.home-refresh.loading .home-refresh-icon {
  border: 2px solid rgba(232, 184, 75, 0.25);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: loading-spin 0.75s linear infinite;
}
.home-refresh.loading .home-refresh-icon::before { content: ''; }
@keyframes loading-spin { to { transform: rotate(360deg); } }

.home-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }

.section { margin-bottom: 20px; }
.section h2 { margin-bottom: 8px; }

/* Inline-SVG grafiek (statistieken). */
.chart {
  background: var(--felt-light);
  border-radius: var(--radius);
  padding: 12px 10px 6px;
}
.chart svg { display: block; }
.empty { color: var(--text-dim); font-size: 0.92rem; padding: 14px 4px; }

.game-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--felt-light);
  border-radius: var(--radius);
  padding: 13px 14px;
  margin-bottom: 8px;
  text-align: left;
  font-weight: 500;
}

/* swipe-naar-links om een potje te verlaten/verwijderen */
.swipe-wrap { position: relative; overflow: hidden; border-radius: var(--radius); margin-bottom: 8px; }
.swipe-wrap .game-card {
  margin-bottom: 0;
  position: relative;
  z-index: 1;
  touch-action: pan-y;
  will-change: transform;
}
.swipe-wrap .game-card:active {
  transform: none;
}
.swipe-action {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 88px;
  border: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--danger);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
}
.game-card .info { flex: 1; min-width: 0; }
.game-card .names { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-card .meta { color: var(--text-dim); font-size: 0.82rem; margin-top: 3px; }
.game-card .game-card-players { font-size: 0.78rem; }
.game-card .badge {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-dim);
}
.game-card .badge.turn {
  background: var(--gold);
  color: #2a2108;
  animation: pulse-badge 1.8s ease-out infinite;
}
@keyframes pulse-badge {
  0% { box-shadow: 0 0 0 0 rgba(232, 184, 75, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(232, 184, 75, 0); }
  100% { box-shadow: 0 0 0 0 rgba(232, 184, 75, 0); }
}
.game-card .badge.wait { background: rgba(0, 0, 0, 0.25); }
.game-card .badge.won { background: var(--ok); color: #fff; }
.game-chat-unread {
  flex-shrink: 0;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.3);
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 0.75rem;
  font-weight: 800;
}

/* ---------- modal ---------- */
.modal-back {
  position: fixed;
  inset: 0;
  /* Reikt tot de échte onderrand (achter de iOS-swipebalk), net als het laken.
     Zonder dit stopt bottom:0 op iOS bij 100vh en zie je een strook laken onder
     het venster. min-height groeit alleen als top/bottom te kort uitkomen, dus
     de bottom-sheet wordt nooit voorbij de zichtbare onderrand geduwd. */
  min-height: 100dvh;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}
/* Alleen als het toetsenbord echt openstaat pinnen we de backdrop op de
   visual viewport (boven het toetsenbord). Staat het dicht, dan blijft de
   chat een gewone bottom-sheet met inset:0 uit .modal-back — dus altijd tot
   de echte onderrand, zonder strook bij de home-indicator en zonder sprong.
   (height:100dvh op een fixed element valt op iOS net iets te kort.) */
.modal-back.chat-modal-back.kb-open {
  top: var(--chat-vv-top, 0px);
  bottom: auto;
  height: var(--chat-vvh, 100dvh);
  min-height: 0; /* boven het toetsenbord: niet naar 100dvh oprekken */
}
.modal {
  background: #123;
  background: var(--felt-light);
  width: 100%;
  max-width: 480px;
  border-radius: 22px 22px 0 0;
  padding: 22px 18px calc(var(--safe-bottom) + 22px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* Nooit helemaal tot boven: zo blijft er altijd wat backdrop over om ernaast
     te tikken, én past een grote inhoud (8 spelers) met interne scroll. */
  max-height: 90dvh;
  overflow-y: auto;
  position: relative;
  animation: slideup 0.18s ease-out;
}
/* Sluitknop rechtsboven in een venster (bv. de slag-geschiedenis), zodat je
   ook bij een schermvullend venster altijd een knop hebt om te sluiten. */
.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
}
@keyframes slideup { from { transform: translateY(40px); opacity: 0.6; } }
.modal h3 { font-size: 1.15rem; }
.modal .row { display: flex; gap: 10px; align-items: center; }
.modal label { color: var(--text-dim); font-size: 0.88rem; flex: 1; }
.chat-modal { max-height: min(calc(var(--chat-vvh, 100dvh) - 12px), 620px); }
.chat-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.chat-title span { color: var(--text-dim); font-size: 0.72rem; }
.chat-messages {
  flex: 1;
  min-height: 180px;
  max-height: min(42vh, calc(var(--chat-vvh, 100dvh) - 190px));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 4px 2px;
  overscroll-behavior: contain;
}
.chat-loading {
  margin: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-dim);
  font-size: 0.9rem;
}
.chat-loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(232, 184, 75, 0.25);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: loading-spin 0.75s linear infinite;
}
.chat-empty { margin: auto; color: var(--text-dim); font-size: 0.9rem; text-align: center; }
.chat-message { align-self: flex-start; max-width: 82%; }
.chat-message.mine { align-self: flex-end; }
.chat-meta { color: var(--text-dim); font-size: 0.68rem; margin: 0 6px 3px; }
.chat-message.mine .chat-meta { text-align: right; }
.chat-bubble { background: rgba(0,0,0,0.3); border-radius: 14px 14px 14px 4px; padding: 9px 12px; user-select: text; }
.chat-message.mine .chat-bubble { background: var(--gold); color: #2a2108; border-radius: 14px 14px 4px 14px; }
/* Berichten in dezelfde groep (zelfde afzender + minuut) dichter op elkaar. */
.chat-message.grouped { margin-top: -6px; }
.chat-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 18px;
  padding: 0 6px;
  color: var(--text-dim);
  font-size: 0.8rem;
  font-style: italic;
}
.chat-typing[hidden] { display: none; }
.chat-typing-dots { display: inline-flex; gap: 3px; }
.chat-typing-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-dim);
  animation: typing-bounce 1.2s infinite ease-in-out;
}
.chat-typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.chat-typing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}
.chat-compose { display: grid; grid-template-columns: 1fr 48px; gap: 8px; }
.chat-compose button { padding: 0; font-size: 1.15rem; }
.emote-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.emote-choice {
  min-width: 0;
  padding: 14px 6px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid var(--felt-line);
  font-size: 0.78rem;
}
.emote-choice-icon { font-size: 1.8rem; line-height: 1; }
.emote-choice-wrap {
  min-width: 0;
  position: relative;
}
.emote-choice-wrap .emote-choice {
  width: 100%;
  height: 100%;
}
.emote-choice-custom {
  border-style: dashed;
  background: rgba(232, 184, 75, 0.1);
}
.emote-choice-custom.saved {
  border-style: solid;
  padding-right: 22px;
}
.emote-edit {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 23px;
  height: 23px;
  min-width: 23px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid rgba(232, 184, 75, 0.55);
  color: var(--gold);
  font-size: 0.72rem;
  line-height: 1;
}
.custom-emote-form {
  display: grid;
  grid-template-columns: 0.72fr 1fr;
  gap: 10px;
}
.custom-emote-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.custom-emote-field span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.custom-emote-field small { color: var(--text-dim); font-size: 0.72rem; }
.custom-emote-field input { text-align: center; }
#custom-emote-icon { font-size: 1.6rem; padding-left: 8px; padding-right: 8px; }
.custom-emote-preview {
  align-self: center;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
  border: 1px solid rgba(232, 184, 75, 0.65);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.26);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.22);
}
.custom-emote-preview span { font-size: 1.3rem; line-height: 1; }
.custom-emote-preview strong { font-size: 0.82rem; }
.custom-emote-actions { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 10px; }
.custom-emote-actions.three { grid-template-columns: 0.72fr 0.9fr 1.15fr; }
/* Bewerken van een bestaand slot heeft vier knoppen (Terug/Leegmaken/Opslaan/
   Verstuur): 2×2 zodat de langere labels niet botsen op smalle schermen. */
.custom-emote-actions.four { grid-template-columns: 1fr 1fr; }
.custom-emote-actions .emote-clear { color: #e79b93; }
/* Lege pack-slots: gestippeld en gedimd, tikbaar om te vullen. */
.emote-choice-empty { border-style: dashed; background: rgba(0, 0, 0, 0.14); color: var(--text-dim); }
.emote-choice-empty .emote-choice-icon { color: var(--text-dim); }
.emote-picker-hint { margin-top: 12px; text-align: center; color: var(--text-dim); font-size: 0.78rem; }
.seg { display: flex; gap: 6px; }
.seg button { padding: 9px 14px; border-radius: 10px; background: rgba(0,0,0,0.25); font-size: 0.9rem; }
.seg button.sel { background: var(--gold); color: #2a2108; }

/* ---------- game ---------- */
.game-screen { flex: 1; display: flex; flex-direction: column; }

.game-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; min-width: 0; }
/* Vastgezette kop met terug-chevron: blijft bovenaan staan tijdens scrollen.
   Trekt door tot de randen van #app en tot achter de safe-area, met een
   laken-achtergrond zodat de inhoud er netjes onderdoor schuift. */
.game-top--sticky {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: calc(-1 * (var(--safe-top) + 12px)) -14px 10px;
  padding: calc(var(--safe-top) + 12px) 14px 10px;
  background: var(--felt);
}
.game-top .back { background: transparent; padding: 6px 10px 6px 0; font-size: 1.4rem; line-height: 1; }
.game-top .code { font-weight: 800; letter-spacing: 0.12em; }
.game-top-name {
  min-width: 0;
  max-width: clamp(72px, 30vw, 150px);
  flex: 0 1 auto;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(0, 0, 0, 0.16);
  color: rgba(242, 240, 230, 0.92);
  font-size: 0.82rem;
  font-weight: 800;
}
button.game-top-name {
  border: 1px solid rgba(232, 184, 75, 0.2);
  cursor: pointer;
}
.game-top-name.empty {
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.1);
}
.screen-label {
  flex: 0 0 auto;
  color: var(--text-dim);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}
.screen-label { color: var(--text); }
.screen-label.muted {
  color: var(--text-dim);
  font-size: 0.78rem;
}
.game-top .lead-suit {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 1.2rem;
  line-height: 1;
  font-weight: 800;
}
.game-top .lead-suit .red { color: var(--card-red); }
.game-top .lead-suit .none { color: var(--text-dim); font-size: 0.95rem; }
.game-top .stake {
  background: rgba(0, 0, 0, 0.3);
  border: 1.5px solid var(--gold);
  color: var(--gold);
  font-weight: 800;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.9rem;
}
.game-top .chat-button {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  padding: 0;
  border-radius: 50%;
  position: relative;
  background: rgba(0, 0, 0, 0.3);
}
.chat-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--danger);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 800;
  border: 2px solid var(--felt);
}
.chat-badge[hidden] { display: none; }

/* open kaarten (betrapt op valse vuile was) */
.open-hands { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 6px 0; }
.open-hand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: rgba(224, 86, 75, 0.12);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 8px 10px;
}
.open-hand .oh-name { font-size: 0.82rem; font-weight: 700; color: var(--danger); text-align: center; }
.open-hand .oh-cards { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }

.opponents { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin: 6px 0 4px; }
.opp {
  text-align: center;
  width: 76px;
  height: 100px;
  position: relative;
  opacity: 1;
  transition: opacity 0.3s;
}
.opp.inactive { opacity: 0.38; }
.avatar-wrap {
  width: 52px;
  height: 52px;
  position: relative;
  margin: 0 auto 3px;
}
/* Emote-overlay: op vaste positie boven de avatar (zie showPlayerEmote), buiten
   $app zodat een re-render de opstijgende emote niet halverwege afkapt.
   Het anker (left/top) staat op het midden van de avatar; --kd = diameter. */
.emote-overlay {
  position: fixed;
  width: 0;
  height: 0;
  z-index: 48;
  pointer-events: none;
}
.avatar-emote {
  position: absolute;
  left: 0;
  bottom: calc(var(--kd, 52px) / 2 + 8px);
  z-index: 30;
  pointer-events: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border: 1px solid rgba(232, 184, 75, 0.65);
  border-radius: 999px;
  background: rgba(20, 29, 24, 0.94);
  color: var(--text);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.35);
  animation: avatar-emote-rise 2.4s ease-out forwards;
}
.avatar-emote span { font-size: 1.15rem; line-height: 1; }
.avatar-emote strong { font-size: 0.72rem; }
@keyframes avatar-emote-rise {
  0% { opacity: 0; transform: translate(-50%, 12px) scale(0.72); }
  12% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  72% { opacity: 1; transform: translate(-50%, -50px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -82px) scale(1.05); }
}
@keyframes avatar-emote-fade {
  0%, 100% { opacity: 0; transform: translate(-50%, 0); }
  12%, 78% { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- klop-animatie (iemand klopt op tafel) ---------- */
/* Overlay op vaste positie boven de avatar van de klopper (zie showPlayerKlop):
   een vuist klopt twee keer, met een gouden ring die bij elke tik uitdijt.
   --kd = avatardiameter; het overlay-anker (left/top) staat op het midden van
   de avatar. */
.klop-overlay {
  position: fixed;
  width: 0;
  height: 0;
  z-index: 48;
  pointer-events: none;
}
.klop-fist {
  position: absolute;
  left: 0;
  bottom: calc(var(--kd, 52px) / 2 - 4px);
  font-size: 2rem;
  line-height: 1;
  transform: translate(-50%, 0) scale(0.5);
  opacity: 0;
  filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.45));
  animation: klop-fist-knock 1.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.klop-shout {
  position: absolute;
  left: 0;
  bottom: calc(var(--kd, 52px) / 2 + 30px);
  transform: translate(-50%, 6px) scale(0.6);
  opacity: 0;
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: var(--gold);
  text-shadow: 0 2px 0 #7a5410, 0 0 18px rgba(232, 184, 75, 0.6);
  white-space: nowrap;
  animation: klop-shout-pop 1.15s ease-out forwards;
}
.klop-ring {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--kd, 52px);
  height: var(--kd, 52px);
  margin-left: calc(var(--kd, 52px) / -2);
  margin-top: calc(var(--kd, 52px) / -2);
  border: 3px solid var(--gold);
  border-radius: 50%;
  transform: scale(0.45);
  opacity: 0;
  animation: klop-ring-hit 1s ease-out forwards;
}
.klop-ring.r2 { animation-delay: 0.22s; }

@keyframes klop-fist-knock {
  0%   { opacity: 0; transform: translate(-50%, 2px) scale(0.5) rotate(-10deg); }
  12%  { opacity: 1; transform: translate(-50%, -30px) scale(1) rotate(-6deg); }   /* achterover */
  26%  { transform: translate(-50%, 2px) scale(1.02) rotate(2deg); }               /* tik 1 */
  38%  { transform: translate(-50%, -26px) scale(1) rotate(-5deg); }               /* omhoog */
  50%  { transform: translate(-50%, 2px) scale(1.02) rotate(2deg); }               /* tik 2 */
  64%  { transform: translate(-50%, -22px) scale(1) rotate(-3deg); }
  100% { opacity: 0; transform: translate(-50%, -40px) scale(0.9) rotate(0deg); }
}
@keyframes klop-shout-pop {
  0%   { opacity: 0; transform: translate(-50%, 8px) scale(0.6); }
  26%  { opacity: 1; transform: translate(-50%, -6px) scale(1.12); }               /* punt op tik 1 */
  40%  { transform: translate(-50%, -4px) scale(1); }
  78%  { opacity: 1; transform: translate(-50%, -14px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -30px) scale(1); }
}
@keyframes klop-ring-hit {
  0%   { opacity: 0; transform: scale(0.45); border-width: 4px; }
  18%  { opacity: 0; transform: scale(0.45); }
  26%  { opacity: 0.9; transform: scale(0.6); border-width: 4px; }
  100% { opacity: 0; transform: scale(2); border-width: 1px; }
}

/* Lichte schud van het hele scherm op de eerste tik. #app is stabiel bij een
   re-render, dus de schud blijft staan. */
#app.klop-shake { animation: klop-screen-shake 0.36s ease-out; }
@keyframes klop-screen-shake {
  0%, 100% { transform: translate(0, 0); }
  15% { transform: translate(-2px, 2px); }
  35% { transform: translate(3px, -1px); }
  55% { transform: translate(-2px, -2px); }
  75% { transform: translate(1px, 2px); }
}

/* ---------- meegaan-animatie (speler gaat mee met de klop) ---------- */
/* Zelfde overlay-aanpak als de klop (zie showPlayerMeegaan), maar rustiger: een
   groene duim die één keer zelfverzekerd opveert. --kd = avatardiameter. */
.meegaan-overlay {
  position: fixed;
  width: 0;
  height: 0;
  z-index: 48;
  pointer-events: none;
}
.meegaan-thumb {
  position: absolute;
  left: 0;
  bottom: calc(var(--kd, 52px) / 2 - 4px);
  font-size: 2rem;
  line-height: 1;
  transform: translate(-50%, 10px) scale(0.4) rotate(-16deg);
  opacity: 0;
  filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.45));
  animation: meegaan-thumb-in 1.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.meegaan-shout {
  position: absolute;
  left: 0;
  bottom: calc(var(--kd, 52px) / 2 + 34px);
  transform: translate(-50%, 8px) scale(0.6);
  opacity: 0;
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  color: var(--ok-bright);
  text-shadow: 0 2px 0 #1c5c33, 0 0 18px rgba(99, 224, 140, 0.6);
  white-space: nowrap;
  animation: meegaan-shout-pop 1.3s ease-out forwards;
}
.meegaan-ring {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--kd, 52px);
  height: var(--kd, 52px);
  margin-left: calc(var(--kd, 52px) / -2);
  margin-top: calc(var(--kd, 52px) / -2);
  border: 3px solid var(--ok-bright);
  border-radius: 50%;
  transform: scale(0.45);
  opacity: 0;
  animation: klop-ring-hit 1s ease-out forwards; /* zelfde ring-keyframe als de klop */
}
.meegaan-ring.r2 { animation-delay: 0.18s; }

@keyframes meegaan-thumb-in {
  0%   { opacity: 0; transform: translate(-50%, 10px) scale(0.4) rotate(-16deg); }
  18%  { opacity: 1; transform: translate(-50%, -34px) scale(1.18) rotate(4deg); }  /* opveren */
  32%  { transform: translate(-50%, -28px) scale(0.94) rotate(-2deg); }             /* settelen */
  46%  { transform: translate(-50%, -32px) scale(1.04) rotate(1deg); }
  70%  { opacity: 1; transform: translate(-50%, -34px) scale(1) rotate(0deg); }     /* vasthouden */
  100% { opacity: 0; transform: translate(-50%, -58px) scale(0.95) rotate(0deg); }
}
@keyframes meegaan-shout-pop {
  0%   { opacity: 0; transform: translate(-50%, 8px) scale(0.6); }
  22%  { opacity: 1; transform: translate(-50%, -6px) scale(1.14); }
  36%  { transform: translate(-50%, -4px) scale(1); }
  72%  { opacity: 1; transform: translate(-50%, -14px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -32px) scale(1); }
}

/* Passen-animatie: rode duim omlaag + rode "PASS!" boven wie plooit. Rood i.p.v.
   groen, en de duim zakt omlaag i.p.v. op te veren. Geen scherm-effect. */
.passen-overlay {
  position: fixed;
  width: 0;
  height: 0;
  z-index: 48;
  pointer-events: none;
}
.passen-thumb {
  position: absolute;
  left: 0;
  bottom: calc(var(--kd, 52px) / 2 - 4px);
  font-size: 2rem;
  line-height: 1;
  transform: translate(-50%, -46px) scale(0.4) rotate(16deg);
  opacity: 0;
  filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.45));
  animation: passen-thumb-in 1.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.passen-shout {
  position: absolute;
  left: 0;
  bottom: calc(var(--kd, 52px) / 2 + 34px);
  transform: translate(-50%, 8px) scale(0.6);
  opacity: 0;
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  color: #ff6b5e;
  text-shadow: 0 2px 0 #6b1f19, 0 0 18px rgba(224, 86, 75, 0.6);
  white-space: nowrap;
  animation: meegaan-shout-pop 1.3s ease-out forwards; /* zelfde pop als meegaan */
}
.passen-ring {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--kd, 52px);
  height: var(--kd, 52px);
  margin-left: calc(var(--kd, 52px) / -2);
  margin-top: calc(var(--kd, 52px) / -2);
  border: 3px solid var(--danger);
  border-radius: 50%;
  transform: scale(0.45);
  opacity: 0;
  animation: klop-ring-hit 1s ease-out forwards; /* zelfde ring-keyframe als de klop */
}
.passen-ring.r2 { animation-delay: 0.18s; }

@keyframes passen-thumb-in {
  0%   { opacity: 0; transform: translate(-50%, -46px) scale(0.4) rotate(16deg); }
  18%  { opacity: 1; transform: translate(-50%, -30px) scale(1.18) rotate(-4deg); }  /* invallen */
  32%  { transform: translate(-50%, -36px) scale(0.94) rotate(2deg); }               /* settelen */
  46%  { transform: translate(-50%, -32px) scale(1.04) rotate(-1deg); }
  70%  { opacity: 1; transform: translate(-50%, -34px) scale(1) rotate(0deg); }      /* vasthouden */
  100% { opacity: 0; transform: translate(-50%, -12px) scale(0.95) rotate(0deg); }   /* wegzakken */
}

/* ---------- betrapt-op-bluf-animatie (valse vuile was gecontroleerd) ---------- */
/* Midden-op-het-scherm overlay met ogen + "BETRAPT!" in dezelfde letters/stijl
   als KLOP!/MEE!/PASS!, plus wie er controleerde. De naam van de betrapte
   speler staat rood. Kort (~1,5s). */
.reveal-overlay {
  position: fixed;
  left: 0;
  right: 0;
  top: 46%;
  transform: translateY(-50%);
  z-index: 60;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  --rd: 96px; /* ring-diameter */
}
/* Ogen + ringen in een gecentreerd blokje; de ringen liggen er gecentreerd overheen. */
.reveal-eyewrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--rd);
  height: var(--rd);
}
.reveal-eyes {
  font-size: 3.4rem;
  line-height: 1;
  transform: translateY(6px) scale(0.3) rotate(-8deg);
  opacity: 0;
  filter: drop-shadow(0 6px 7px rgba(0, 0, 0, 0.5));
  animation: reveal-eyes-in 1.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.reveal-shout {
  margin-top: 2px;
  font-weight: 900;
  font-size: 1.9rem;
  letter-spacing: 0.05em;
  color: #ff6b5e;
  text-shadow: 0 2px 0 #6b1f19, 0 0 22px rgba(224, 86, 75, 0.75);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(8px) scale(0.6);
  animation: reveal-shout-pop 1.5s ease-out forwards;
}
.reveal-sub {
  margin-top: 4px;
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(6px);
  animation: reveal-sub-in 1.5s ease-out forwards;
}
.reveal-sub b { color: #ff8d83; } /* de betrapte speler (slachtoffer) rood */
.reveal-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--rd);
  height: var(--rd);
  margin-left: calc(var(--rd) / -2);
  margin-top: calc(var(--rd) / -2);
  border: 3px solid var(--danger);
  border-radius: 50%;
  transform: scale(0.4);
  opacity: 0;
  animation: reveal-ring-hit 1.15s ease-out forwards;
}
.reveal-ring.r2 { animation-delay: 0.18s; border-color: #ff8d83; }

@keyframes reveal-eyes-in {
  0%   { opacity: 0; transform: translateY(6px) scale(0.3) rotate(-8deg); }
  16%  { opacity: 1; transform: translateY(0) scale(1.25) rotate(3deg); }   /* opknallen */
  28%  { transform: translateY(0) scale(0.95) rotate(-2deg); }              /* settelen */
  40%  { transform: translateY(0) scale(1.06) rotate(1deg); }
  52%  { transform: translateY(0) scale(1) rotate(0deg); }
  60%  { transform: translateY(0) scale(1) rotate(0deg) translateX(3px); }  /* mini-shimmy */
  72%  { opacity: 1; transform: translateY(0) scale(1); }                   /* vasthouden */
  100% { opacity: 0; transform: translateY(-14px) scale(0.95); }
}
@keyframes reveal-shout-pop {
  0%   { opacity: 0; transform: translateY(8px) scale(0.6); }
  22%  { opacity: 1; transform: translateY(0) scale(1.14); }
  34%  { transform: translateY(0) scale(1); }
  74%  { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-10px) scale(1); }
}
@keyframes reveal-sub-in {
  0%   { opacity: 0; transform: translateY(6px); }
  30%  { opacity: 1; transform: translateY(0); }
  76%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-8px); }
}
@keyframes reveal-ring-hit {
  0%   { opacity: 0; transform: scale(0.4); border-width: 4px; }
  14%  { opacity: 0; transform: scale(0.4); }
  24%  { opacity: 0.85; transform: scale(0.6); border-width: 4px; }
  100% { opacity: 0; transform: scale(2.2); border-width: 1px; }
}

.opp .avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--felt-light);
  border: 2.5px solid var(--felt-line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.15rem;
  margin: 0;
}
.opp.turn .avatar {
  border-color: var(--gold);
  animation: pulse-ring 1.6s ease-out infinite;
}
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(232, 184, 75, 0.65); }
  70% { box-shadow: 0 0 0 13px rgba(232, 184, 75, 0); }
  100% { box-shadow: 0 0 0 0 rgba(232, 184, 75, 0); }
}
.opp .name { display: block; max-width: 70px; margin: 0 auto; font-size: 0.8rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opp .presence {
  position: absolute;
  right: -4px;
  bottom: -2px;
  width: 13px;
  height: 13px;
  display: grid;
  place-items: center;
}
.presence-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #82958a;
  border: 2px solid var(--felt);
  box-sizing: content-box;
}
.presence-dot.online {
  background: #5de481;
  box-shadow: 0 0 6px rgba(93, 228, 129, 0.7);
}
.points-badge {
  position: absolute;
  top: -5px;
  right: -7px;
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  background: var(--card-bg);
  color: var(--card-black);
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1;
  border-radius: 999px;
  padding: 0 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.points-badge.armoede {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 0 8px rgba(224, 86, 75, 0.55);
}
.mini-cards {
  height: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 3px;
  margin-bottom: 2px;
}
.mini-cards i {
  width: 8px;
  height: 11px;
  margin-left: -3px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 2px;
  background: linear-gradient(135deg, #a42c3a, #681722);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.mini-cards i:first-child { margin-left: 0; }
.dealer-label {
  height: 11px;
  margin-top: 1px;
  font-size: 0.6rem;
  line-height: 1;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.dealer-label.empty { visibility: hidden; }

.table-area {
  flex: 1;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: radial-gradient(ellipse at center, var(--felt-light) 0%, transparent 75%);
  border-radius: 20px;
  margin: 4px 0;
  position: relative;
  padding: 10px 4px;
}
.table-msg { color: var(--text-dim); font-size: 0.95rem; text-align: center; padding: 0 20px; }
.table-msg strong { color: var(--text); }

/* zitplaatsen aan tafel: per speler een stapel gespeelde kaarten */
.seats { display: flex; justify-content: center; align-items: flex-start; gap: 12px; flex-wrap: wrap; width: 100%; }
.seat { width: 78px; display: flex; flex-direction: column; align-items: center; }
.seat .stack {
  position: relative;
  width: 48px;
  height: 118px; /* 64px kaart + 3 x 18px offset */
  margin-top: 8px;
}
.stack .card.small {
  position: absolute;
  left: 2px;
  transition: transform 0.2s;
}
.stack .card.small:nth-child(odd) { rotate: -2.5deg; }
.stack .card.small:nth-child(even) { rotate: 2.5deg; }
.stack .card.small.old { opacity: 0.88; }
.stack .card.small.current { box-shadow: 0 0 0 2px var(--gold), 0 3px 8px rgba(0, 0, 0, 0.45); }
.stack .card.small.won-trick::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 7px;
  box-shadow: inset 0 0 0 1.5px rgba(232, 184, 75, 0.45);
}
.stack .card.small.drop-in { animation: stack-drop 0.4s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes stack-drop {
  0% { transform: translateY(-34px) scale(1.25); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
.seat .stack { cursor: pointer; }

/* rondegeschiedenis: wie speelde wat, per slag */
.history-scroll { overflow-x: auto; overflow-y: auto; max-height: 60vh; }
.history {
  border-collapse: collapse;
  margin: 0 auto;
}
.history th {
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 8px;
}
.history td {
  padding: 6px 8px;
  text-align: center;
  vertical-align: middle;
}
.history td.player-name {
  text-align: left;
  font-weight: 700;
  font-size: 0.9rem;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history .card.small { box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35); }
.history .card.small.won-cell { box-shadow: 0 0 0 2px var(--gold), 0 2px 5px rgba(0, 0, 0, 0.35); }
.history .no-card { color: var(--text-dim); }
.history .won-label { font-size: 0.7rem; color: var(--gold); font-weight: 700; }

/* ---------- ronde-samenvatting (slag voor slag) ---------- */
.summary-foot { margin-top: 16px; }
/* safe center: gecentreerd als het past, maar bij overloop uitlijnen naar het
   begin (i.p.v. links wegklippen). */
.rs-wrap { display: flex; justify-content: safe center; overflow-x: auto; padding: 4px 0 2px; }
.rs-table { border-collapse: separate; border-spacing: 9px 7px; }
.rs-head th.rs-col {
  color: var(--text-dim);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  text-align: center;
  vertical-align: bottom;
}
/* Vaste hoogte boven het slag-label zodat de labels op één lijn blijven, of er
   nu wel of geen klop-badge boven staat. */
.rs-klop-slot { display: flex; align-items: flex-end; justify-content: center; min-height: 30px; margin-bottom: 3px; }
.rs-klop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.rs-klop-fist { font-size: 1rem; line-height: 1; }
.rs-klop-names { font-size: 0.58rem; color: var(--gold); font-weight: 800; white-space: nowrap; letter-spacing: 0; text-transform: none; max-width: 72px; overflow: hidden; text-overflow: ellipsis; }
.rs-klop-ring {
  position: absolute;
  top: -1px;
  width: 20px;
  height: 20px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}
/* De vuist klopt en de ring dijt uit zodra de kolom onthuld wordt. */
.rs-col.show .rs-klop-fist { animation: rs-knock 0.6s ease; }
.rs-col.show .rs-klop-ring { animation: rs-klopring 0.7s ease-out; }
@keyframes rs-knock {
  0%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
  48% { transform: translateY(1px); }
  68% { transform: translateY(-2px); }
}
@keyframes rs-klopring {
  0% { transform: scale(0.35); opacity: 0.85; }
  100% { transform: scale(1.7); opacity: 0; }
}
.rs-name { text-align: left; white-space: nowrap; }
.rs-name-inner {
  position: relative;
  display: inline-block;
  max-width: 118px; /* lange namen niet de tabel laten opblazen */
  padding: 4px 9px;
  font-weight: 700;
  transition: color 0.3s ease;
}
/* Truncatie op een binnenspan, zodat de gouden ring (::after op .rs-name-inner)
   niet wordt weggeknipt door overflow:hidden. */
.rs-name-text { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-cell { text-align: center; vertical-align: middle; }
.rs-empty { display: inline-block; width: 44px; height: 64px; } /* reserveert kaartruimte, houdt kolommen stabiel */
.rs-table .card.small.won-cell { box-shadow: 0 0 0 2px var(--gold), 0 2px 6px rgba(0, 0, 0, 0.4); }

/* Elke slagkolom valt zacht in beeld zodra 'ie onthuld wordt. */
.rs-col { opacity: 0; transform: translateY(11px) scale(0.9); transition: opacity 0.34s ease, transform 0.38s cubic-bezier(0.22, 1, 0.36, 1); }
.rs-col.show { opacity: 1; transform: none; }

/* Gouden cirkel rond de naam van de rondewinnaar. */
.rs-name-inner.win { color: var(--gold); }
.rs-name-inner.ring::after {
  content: '';
  position: absolute;
  inset: -3px -7px;
  border: 2.5px solid var(--gold);
  border-radius: 999px;
  box-shadow: 0 0 13px rgba(232, 184, 75, 0.55);
  animation: rs-ring 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes rs-ring {
  0% { transform: scale(0.5) rotate(-10deg); opacity: 0; }
  55% { transform: scale(1.14); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.rs-caption {
  text-align: center;
  font-weight: 700;
  color: var(--gold);
  min-height: 1.4em;
  margin-top: 14px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.rs-caption.show { opacity: 1; transform: none; }

/* Afsluitend paneel van de terugblik: de huidige stand. */
.rs-endpanel { opacity: 0; transform: translateY(6px); transition: opacity 0.35s ease 0.1s, transform 0.35s ease 0.1s; }
.rs-endpanel.show { opacity: 1; transform: none; }
.rs-situation { margin-top: 12px; background: rgba(0, 0, 0, 0.18); border-radius: var(--radius); padding: 12px 14px; }
.rs-sit-head { color: var(--text-dim); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; margin-bottom: 8px; text-align: center; }
.rs-scores { display: flex; flex-direction: column; gap: 6px; }
.rs-score-row { display: flex; align-items: center; gap: 10px; }
.rs-score-row.me { font-weight: 800; }
.rs-score-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-score-pts { font-weight: 800; color: var(--gold); font-size: 1.05rem; }
.rs-sit-turn { text-align: center; margin-top: 10px; font-weight: 700; color: var(--text); }

/* ---------- puntenverloop-grafiek ---------- */
.pg-wrap { background: var(--felt-light); border-radius: var(--radius); padding: 10px 8px 4px; }
.pg-wrap svg { display: block; overflow: visible; }
.pg-grid { stroke: var(--felt-line); stroke-width: 1; }
.pg-ref { stroke: var(--danger); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.65; }
.pg-ref-label { fill: var(--danger); font-size: 8px; font-weight: 700; }
.pg-axis { fill: var(--text-dim); font-size: 8px; }
.pg-line {
  fill: none;
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: pg-draw 1.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes pg-draw { to { stroke-dashoffset: 0; } }
.pg-mark { opacity: 0; animation: pg-fade 0.4s ease forwards; }
.pg-name { font-size: 9px; font-weight: 800; opacity: 0; animation: pg-fade 0.5s ease forwards; animation-delay: 1.55s; }
@keyframes pg-fade { to { opacity: 1; } }

.seat .empty-slot {
  width: 44px;
  height: 64px;
  border-radius: 7px;
  border: 1.5px dashed rgba(255, 255, 255, 0.14);
  margin-top: 8px;
}

/* speelkaart */
.card {
  width: 58px;
  height: 84px;
  border-radius: 9px;
  background: var(--card-bg);
  color: var(--card-black);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  position: relative;
  border: none;
  padding: 0;
}
.card.red { color: var(--card-red); }
.card .rank { font-size: 1.25rem; line-height: 1; }
.card .suit { font-size: 1.3rem; line-height: 1.1; }
.card .corner { position: absolute; top: 5px; left: 7px; font-size: 0.72rem; line-height: 1; text-align: center; }
.card.small { width: 44px; height: 64px; border-radius: 7px; }
.card.small .rank { font-size: 1rem; }
.card.small .suit { font-size: 1.05rem; }
.card.small .corner { display: none; }

/* klop banner */
.toep-banner {
  background: rgba(0, 0, 0, 0.45);
  border: 1.5px solid var(--gold);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 6px 0;
  animation: banner-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* Al eerder getoonde banner: niet opnieuw laten opspringen bij een re-render. */
.toep-banner.no-pop { animation: none; }
@keyframes banner-pop {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.toep-banner .row { display: flex; gap: 10px; }
.toep-banner .row button { flex: 1; }
.toep-banner strong { color: var(--gold); }
.armoede-banner { border-color: var(--danger); box-shadow: 0 0 24px rgba(224, 86, 75, 0.12); }
/* Meerdere vuile-was-roepen tegelijk: compactere kaartjes onder elkaar, met
   wat kleinere knoppen zodat ze allemaal passen. */
.vuilewas-banner { padding: 10px 12px; gap: 7px; margin: 5px 0; }
.vuilewas-banner .row button { padding: 8px 12px; font-size: 0.85rem; }
.armoede-banner strong { color: #ff8d83; }

/* mijn hand */
.my-area { margin-top: 6px; }
.status-line { text-align: center; color: var(--text-dim); font-size: 0.9rem; min-height: 1.3em; margin-bottom: 8px; }
.status-line.yours { color: var(--gold); font-weight: 700; }
.status-line.yours::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  margin-right: 7px;
  vertical-align: 1px;
  animation: pulse-dot 1.2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.6); opacity: 0.5; }
}
.hand { display: flex; justify-content: center; gap: 8px; padding: 4px 0 10px; flex-wrap: wrap; perspective: 1100px; }
.hand .card { transition: transform 0.15s ease-out, box-shadow 0.15s; }
.hand .card.playable:active { transform: translateY(-10px); }
.hand .card.playable { box-shadow: 0 0 0 2.5px var(--gold), 0 4px 10px rgba(0, 0, 0, 0.4); }
.hand .card.disabled { opacity: 0.55; }
.hand .card.selectable { box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); }
.hand .card.selected {
  transform: translateY(-14px);
  box-shadow: 0 0 0 2.5px var(--gold), 0 10px 16px rgba(0, 0, 0, 0.45);
}
.hand .card.dealt { animation: deal-in calc(0.44s / var(--deal-sf, 1)) cubic-bezier(0.22, 1, 0.36, 1) backwards; transform-style: preserve-3d; }
.hand.dealing { pointer-events: none; }
/* Betrapt op valse vuile was: je eigen hand ligt open voor iedereen. Een
   duidelijke rode rand + gloed maakt voor jezelf zichtbaar dat je open ligt. */
.hand.exposed {
  border: 2.5px solid var(--danger);
  border-radius: var(--radius);
  padding: 10px 8px;
  background: rgba(224, 86, 75, 0.14);
  box-shadow: 0 0 0 3px rgba(224, 86, 75, 0.25), 0 0 18px rgba(224, 86, 75, 0.35);
  animation: exposed-pulse 1.6s ease-in-out infinite;
}
@keyframes exposed-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(224, 86, 75, 0.22), 0 0 14px rgba(224, 86, 75, 0.28); }
  50% { box-shadow: 0 0 0 3px rgba(224, 86, 75, 0.4), 0 0 22px rgba(224, 86, 75, 0.5); }
}
/* Drie tienen in de hand: een échte zilveren rand. Zelfde soort lijn als de
   'betrapt'-rand, maar met een metallic verloop dat langzaam over de rand
   glijdt (de achtergrond ligt achter de kaarten, dus het botst niet met het
   optillen van een kaart). */
.hand.tens-silver {
  border: 2.5px solid #cfd4db;
  border-radius: var(--radius);
  padding: 10px 8px;
  background: linear-gradient(
    115deg,
    rgba(120, 125, 135, 0.16) 0%,
    rgba(232, 236, 242, 0.32) 24%,
    rgba(158, 164, 174, 0.14) 46%,
    rgba(242, 245, 250, 0.34) 62%,
    rgba(120, 125, 135, 0.16) 86%
  );
  background-size: 220% 100%;
  box-shadow: 0 0 0 3px rgba(200, 206, 216, 0.3), 0 0 18px rgba(214, 220, 230, 0.45);
  animation: metal-sheen 3.4s ease-in-out infinite;
}
/* Vier tienen: een gouden rand met een terloopse twinkeling (glans die
   glijdt + een zachte pulserende gloed). */
.hand.tens-gold {
  border: 2.5px solid #eccb63;
  border-radius: var(--radius);
  padding: 10px 8px;
  background: linear-gradient(
    115deg,
    rgba(150, 110, 20, 0.18) 0%,
    rgba(248, 224, 128, 0.36) 24%,
    rgba(200, 158, 48, 0.15) 46%,
    rgba(252, 230, 146, 0.38) 62%,
    rgba(150, 110, 20, 0.18) 86%
  );
  background-size: 220% 100%;
  box-shadow: 0 0 0 3px rgba(232, 184, 75, 0.3), 0 0 18px rgba(242, 202, 92, 0.5);
  animation: metal-sheen 3s ease-in-out infinite, gold-twinkle 1.5s ease-in-out infinite;
}
@keyframes metal-sheen {
  0%, 100% { background-position: 0% 0; }
  50% { background-position: 100% 0; }
}
@keyframes gold-twinkle {
  0%, 100% { box-shadow: 0 0 0 3px rgba(232, 184, 75, 0.26), 0 0 13px rgba(242, 202, 92, 0.38); }
  50% { box-shadow: 0 0 0 3px rgba(255, 226, 132, 0.5), 0 0 26px rgba(255, 216, 112, 0.72); }
}
/* De rand + gloed steken buiten de hand uit; wat extra ruimte eronder zorgt
   dat de lijn niet tegen de gele knop erna botst. */
.hand.exposed, .hand.tens-silver, .hand.tens-gold { margin-bottom: 12px; }
@media (prefers-reduced-motion: reduce) {
  .hand.exposed, .hand.tens-silver, .hand.tens-gold { animation: none; }
}
/* Elke kaart draait zich één voor één om zodra hij bij je aankomt. */
@keyframes deal-in {
  0% { transform: translateY(26px) rotateY(-96deg) scale(0.82); opacity: 0; }
  35% { opacity: 1; }
  70% { transform: translateY(0) rotateY(14deg) scale(1.02); }
  100% { transform: translateY(0) rotateY(0) scale(1); opacity: 1; }
}

/* schudden + kaart voor kaart delen */
.deal-overlay {
  position: fixed;
  inset: 0;
  /* Boven het speelbord, maar onder modals/chat (.modal-back = 50) zodat de
     overlay nooit over de chat of andere vensters valt. */
  z-index: 45;
  pointer-events: none;
  overflow: hidden;
  transition: opacity 0.3s ease-in;
}
.deal-overlay.done { opacity: 0; }
.card-back {
  display: block;
  width: 48px;
  height: 70px;
  box-sizing: border-box;
  border: 3px solid #f5f0df;
  border-radius: 7px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.16) 25%, transparent 25%) 0 0 / 12px 12px,
    linear-gradient(315deg, rgba(255,255,255,0.16) 25%, transparent 25%) 0 0 / 12px 12px,
    linear-gradient(135deg, transparent 75%, rgba(255,255,255,0.16) 75%) 0 0 / 12px 12px,
    linear-gradient(315deg, transparent 75%, rgba(255,255,255,0.16) 75%) 0 0 / 12px 12px,
    #8e2631;
  box-shadow: 0 5px 13px rgba(0, 0, 0, 0.45), inset 0 0 0 2px #b94a55;
}
.shuffle-deck {
  position: fixed;
  width: 48px;
  height: 70px;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 8px 10px rgba(0,0,0,0.35));
  /* Het stapeltje blijft bij de deler liggen terwijl hij kaart voor kaart
     uitdeelt; het vervaagt mee met de overlay als het delen klaar is. */
  animation: deck-pop calc(0.24s / var(--deal-sf, 1)) ease-out both;
}
.shuffle-deck .card-back { position: absolute; inset: 0; }
/* Twee riffles + een korte rust: het husselen duurt langer en bouwt spanning op.
   --deal-sf versnelt het husselen mee (2× normaal, 3× bij 5+ spelers). */
.shuffle-deck .card-back:nth-child(1) { animation: shuffle-left calc(0.72s / var(--deal-sf, 1)) calc(0.22s / var(--deal-sf, 1)) cubic-bezier(0.4, 0, 0.2, 1) 2 both; }
.shuffle-deck .card-back:nth-child(2) { animation: shuffle-right calc(0.72s / var(--deal-sf, 1)) calc(0.26s / var(--deal-sf, 1)) cubic-bezier(0.4, 0, 0.2, 1) 2 both; }
.shuffle-deck .card-back:nth-child(3) { animation: shuffle-left calc(0.66s / var(--deal-sf, 1)) calc(0.30s / var(--deal-sf, 1)) cubic-bezier(0.4, 0, 0.2, 1) reverse 2 both; }
.shuffle-deck .card-back:nth-child(4) { transform: translate(3px, -3px) rotate(2deg); }
@keyframes deck-pop {
  from { opacity: 0; transform: translate(-50%, -35%) scale(0.72); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes shuffle-left {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  32% { transform: translate(-42px, -5px) rotate(-13deg); }
  68% { transform: translate(27px, 3px) rotate(8deg); }
}
@keyframes shuffle-right {
  0%, 100% { transform: translate(2px, -2px) rotate(1deg); }
  34% { transform: translate(40px, -7px) rotate(13deg); }
  70% { transform: translate(-24px, 4px) rotate(-7deg); }
}
.deal-flight {
  position: fixed;
  opacity: 0;
  animation-name: card-distribute;
  animation-timing-function: cubic-bezier(0.2, 0.82, 0.3, 1);
  animation-fill-mode: both;
  will-change: transform, opacity;
}
@keyframes card-distribute {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.96) rotate(0); }
  12% { opacity: 1; }
  82% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--deal-x)), calc(-50% + var(--deal-y))) scale(var(--deal-scale)) rotate(var(--deal-r));
  }
}

@media (prefers-reduced-motion: reduce) {
  .hand .card.dealt, .shuffle-deck, .shuffle-deck .card-back, .deal-flight { animation: none !important; }
  .avatar-emote { animation-name: avatar-emote-fade !important; }
  /* Geen kloppende/schuddende beweging; duur bijna nul zodat de opruim-
     handlers (animationend) nog wél afgaan en de elementen verdwijnen. */
  .klop-fist, .klop-shout, .klop-ring, #app.klop-shake,
  .meegaan-thumb, .meegaan-shout, .meegaan-ring,
  .passen-thumb, .passen-shout, .passen-ring,
  .reveal-eyes, .reveal-shout, .reveal-sub, .reveal-ring { animation-duration: 0.01ms !important; }
}

/* inzet-bump */
.stake.bump { animation: stake-bump 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes stake-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.action-bar { display: flex; gap: 10px; margin-bottom: 8px; }
.action-bar button { flex: 1; }
/* Beslissingsfase: de drie startopties staan onder elkaar zodat ze goed
   raakbaar zijn en niet verward worden met een gewone knoppenrij. */
.decision-bar { flex-direction: column; }
.emote-bar { display: flex; justify-content: center; margin: -1px 0 8px; }
.emote-bar button { padding: 6px 11px; font-size: 0.74rem; }
.poke-bar { justify-content: center; }
.poke-bar button {
  flex: 0 0 auto;
  padding: 6px 11px;
  border-radius: 10px;
  font-size: 0.74rem;
}

/* wachtkamer */
.lobby { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 16px; padding-top: 8vh; }
.game-name-editor {
  width: 100%;
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.16);
  text-align: left;
}
.game-name-editor label {
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.game-name-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.game-name-row input { padding: 10px 12px; }
.game-name-row button { padding: 8px 11px; }
.lobby .code-big {
  font-size: 2.6rem;
  font-weight: 900;
  letter-spacing: 0.35em;
  padding-left: 0.35em;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius);
  padding: 14px 20px 14px calc(20px + 0.35em);
}
.lobby .hint { color: var(--text-dim); text-align: center; font-size: 0.92rem; max-width: 280px; }
.lobby ul { list-style: none; width: 100%; }
.lobby li {
  background: var(--felt-light);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 8px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
}
.lobby li .you { color: var(--text-dim); font-weight: 400; }
.lobby .actions { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: auto; }

/* log */
.log { margin-top: 10px; }
.log summary { color: var(--text-dim); font-size: 0.85rem; cursor: pointer; padding: 6px 0; }
.log .entries { max-height: 180px; overflow-y: auto; font-size: 0.82rem; color: var(--text-dim); padding: 6px 2px; }
.log .entries div { padding: 2px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }

/* game over */
.gameover {
  text-align: center;
  padding: 24px 16px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: var(--radius);
  border: 1.5px solid var(--gold);
  margin: 8px 0;
  animation: banner-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.gameover .trophy { font-size: 3rem; display: inline-block; animation: trophy-bounce 1.2s ease-in-out infinite; }
@keyframes trophy-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}
.gameover h3 { margin: 8px 0 4px; font-size: 1.3rem; }
.gameover-actions { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.gameover-actions .primary { flex: 1; }
.rematch-note { flex: 1; color: var(--text-dim); font-size: 0.82rem; text-align: left; }

/* Rematch-doorverwijzing: korte overgangs-modal. */
.rematch-redirect { text-align: center; padding: 8px 4px; }
.rematch-redirect .rr-spin { font-size: 2.6rem; line-height: 1; display: inline-block; animation: spin 1.1s linear infinite; }
.rematch-redirect h3 { margin: 12px 0 4px; font-size: 1.2rem; }
.rematch-redirect p { color: var(--text-dim); font-size: 0.9rem; }
@media (prefers-reduced-motion: reduce) { .rematch-redirect .rr-spin { animation: none; } }

/* toast */
#toast {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 24px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #24140f;
  color: #ffd9d4;
  border: 1px solid var(--danger);
  padding: 11px 18px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
  max-width: 88vw;
  text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.info { background: #10241a; color: #d2f0dd; border-color: var(--ok); }
.chat-preview {
  position: fixed;
  top: calc(var(--safe-top) + 9px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  width: min(360px, calc(100vw - 28px));
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px;
  align-items: center;
  padding: 8px 11px;
  border-radius: 999px;
  border: 1px solid rgba(232, 184, 75, 0.45);
  background: rgba(13, 39, 27, 0.96);
  color: var(--text);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.34);
  font-size: 0.8rem;
  text-align: left;
  animation: chat-preview-in 0.16s ease-out;
}
.chat-preview span,
.chat-preview strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-preview span { color: var(--gold); font-weight: 800; }
.chat-preview strong { color: var(--text); font-weight: 700; }
@keyframes chat-preview-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
}

/* feestje bij ronde- of spelwinst */
.party-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  pointer-events: none;
  /* Compacte melding bovenaan i.p.v. groot in het midden. */
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: calc(var(--safe-top) + 12px);
  overflow: hidden;
}
.party-card {
  background: rgba(8, 26, 17, 0.94);
  border: 1.5px solid var(--gold);
  border-radius: 14px;
  padding: 10px 16px 10px 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  /* Foto links, tekst rechts. */
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  max-width: min(92vw, 420px);
  animation: party-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.party-text { text-align: left; min-width: 0; }
/* De duur regelt de JS; deze fade speelt af als .fading erbij komt. */
.party-overlay.fading { animation: party-fade 0.32s ease-in forwards; }
@keyframes party-pop {
  0% { transform: translateY(-16px) scale(0.9); opacity: 0; }
  70% { transform: translateY(2px) scale(1.02); }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes party-fade {
  to { opacity: 0; transform: translateY(-10px); }
}
.party-avatar { flex: none; }
.party-avatar .avatar { width: 52px; height: 52px; font-size: 1.3rem; border-color: var(--gold); box-shadow: 0 0 16px rgba(232, 184, 75, 0.4); }
.party-title { font-size: 1.05rem; font-weight: 800; color: var(--gold); line-height: 1.2; }
.party-sub { color: var(--text); font-size: 0.85rem; margin-top: 2px; }
.confetti {
  position: absolute;
  top: -20px;
  width: 9px;
  height: 15px;
  border-radius: 2px;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(112vh) rotate(720deg); }
}

/* notificatie-banner */
.notif-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.88rem;
  color: var(--text-dim);
}
.notif-banner button { flex-shrink: 0; }

/* ---------- De Koekert Race (vriendenweekend-scorebord) ---------- */
.race-track {
  background: var(--felt-light);
  border-radius: var(--radius);
  padding: 14px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.race-lane-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.race-team-name { font-weight: 800; }
.race-team-pts { font-weight: 800; font-size: 1.15rem; color: var(--gold); }
.race-road {
  position: relative;
  height: 34px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  /* wegmarkering */
  background-image: repeating-linear-gradient(90deg, transparent 0 14px, rgba(255, 255, 255, 0.12) 14px 22px);
  background-size: 100% 2px;
  background-position: 0 50%;
  background-repeat: no-repeat, repeat;
}
.race-car {
  position: absolute;
  top: 50%;
  transform: translateY(-52%) scaleX(-1); /* neus richting de finish */
  font-size: 1.35rem;
  transition: left 0.9s cubic-bezier(0.22, 1, 0.36, 1);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
}
.race-finish { position: absolute; right: 4px; top: 50%; transform: translateY(-55%); font-size: 1.05rem; }

.race-log { display: flex; flex-direction: column; gap: 6px; }
.race-log-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--felt-light);
  border-radius: 10px;
  padding: 8px 12px;
}
.race-log-delta { flex: none; font-weight: 800; min-width: 42px; text-align: right; }
.race-log-delta.plus { color: var(--ok); }
.race-log-delta.min { color: var(--danger); }
.race-log-body { flex: 1; min-width: 0; }
.race-log-team { font-weight: 700; }
.race-log-reason { color: var(--text-dim); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.race-log-time { flex: none; color: var(--text-dim); font-size: 0.75rem; }

.race-admin-team {
  background: var(--felt-light);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.race-admin-name { display: flex; gap: 8px; }
.race-admin-name input { flex: 1; padding: 9px 12px; }
.race-admin-score { display: grid; grid-template-columns: 90px 1fr auto; gap: 8px; }
.race-admin-score input { padding: 9px 10px; }
.race-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.race-quick .small { padding: 6px 10px; }
.race-log-del {
  flex: none;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-dim);
  font-size: 0.8rem;
  line-height: 1;
}
.race-log-del:active { color: var(--danger); }
