:root {
  --felt: #1f6b45;
  --felt-dark: #134a2f;
  --wood: #5a3a22;
  --ink: #1d1d1f;
  --paper: #fffdf7;
  --red: #c62828;
  --gold: #f2c14e;
  --text: #f4f1e8;
  --muted: #b9c8bd;
  --good: #3fbf6f;
  --bad: #e5534b;
  --panel: #fbf8f0;
  --panel-ink: #2a2a2a;
  --card-w: clamp(52px, 7.2vw, 84px);
  --card-h: calc(var(--card-w) * 1.42);
  --mid: 42%;          /* hoogte van het midden van de tafel */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #0d2a1c;
  color: var(--text);
}

button { font: inherit; }

.hidden { display: none !important; }

/* ---------- Knoppen & panelen ---------- */
.btn {
  border: 1px solid rgba(0,0,0,.2);
  background: #ece6d6;
  color: var(--panel-ink);
  padding: .6em 1.2em;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: transform .08s, background .15s;
}
.btn:hover { background: #fff; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--gold); border-color: #c99a2a; }
.btn.primary:hover { background: #ffd56b; }
.btn.small { padding: .35em .8em; font-size: .85rem; }
.btn:disabled { opacity: .35; cursor: not-allowed; }

.overlay {
  position: fixed; inset: 0;
  background: rgba(5, 20, 12, .72);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  padding: 16px;
}
.panel {
  background: var(--panel);
  color: var(--panel-ink);
  border-radius: 14px;
  padding: 24px 28px;
  max-width: 560px; width: 100%;
  max-height: 90vh; overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.panel h2 { margin-top: 0; }
.panel h3 { margin-bottom: .3em; }
.btn-row { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }

.start-panel { text-align: center; max-width: 400px; }
.start-panel h1 { font-size: 2.4rem; margin: 0; color: var(--felt-dark); letter-spacing: .5px; }
.subtitle { margin-top: 4px; color: #666; }
.start-panel label { display: block; text-align: left; margin: 14px 0 0; font-weight: 600; font-size: .9rem; }
.start-panel input, .start-panel select {
  display: block; width: 100%; margin-top: 4px;
  padding: .55em .7em; font: inherit; border-radius: 8px; border: 1px solid #ccc; background: #fff;
}

.opponent-info {
  text-align: left; margin-top: 8px; padding: 8px 10px;
  background: #f1ecdf; border-radius: 8px; font-size: .82rem;
}
.opp-intro { color: #666; margin-bottom: 4px; }
.opp { margin: 3px 0; }
.opp-desc { color: #666; }

.lvl {
  display: inline-block; font-size: .65rem; font-weight: 800; text-transform: uppercase; letter-spacing: .4px;
  border-radius: 99px; padding: 1px 7px; vertical-align: middle;
}
.lvl-beginner { background: #cfe8d6; color: #1f6b45; }
.lvl-amateur { background: #fde7b0; color: #7a5200; }
.lvl-prof { background: #f6c6c2; color: #8e1d16; }
.nameplate .lvl { margin: 2px 0; }

/* ---------- Topbalk ---------- */
#app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 16px;
  background: #0d2a1c;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-wrap: wrap;
}
.brand { font-weight: 800; font-size: 1.15rem; color: var(--gold); }
.info { display: flex; gap: 14px; align-items: center; font-size: .95rem; }
.trump-chip { background: rgba(255,255,255,.1); padding: 3px 10px; border-radius: 99px; }
.trump-chip .red { color: #ff8a80; }
.top-actions { display: flex; gap: 6px; }

/* ---------- Layout ---------- */
.layout { flex: 1; display: flex; min-height: 0; }
.table {
  flex: 1; position: relative; min-width: 0;
  background: radial-gradient(ellipse at center, #2a8a59 0%, var(--felt) 45%, var(--felt-dark) 100%);
  border: 10px solid var(--wood);
  border-radius: 24px;
  margin: 10px;
  box-shadow: inset 0 0 60px rgba(0,0,0,.45);
  overflow: hidden;
}

.scoreboard {
  width: 330px; flex-shrink: 0;
  background: #10301f;
  border-left: 1px solid rgba(255,255,255,.08);
  padding: 12px;
  display: flex; flex-direction: column; min-height: 0;
}
.scoreboard h2 { margin: 4px 0 10px; font-size: 1rem; color: var(--gold); }
.score-wrap { overflow: auto; flex: 1; }
#score-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
#score-table th, #score-table td { padding: 4px 4px; text-align: center; border-bottom: 1px solid rgba(255,255,255,.07); white-space: nowrap; }
#score-table th { position: sticky; top: 0; background: #10301f; color: var(--muted); font-weight: 600; }
#score-table tr.current td { background: rgba(242,193,78,.12); }
#score-table td.ok { color: var(--good); }
#score-table td.ko { color: var(--bad); }
#score-table .bid { opacity: .75; font-size: .75rem; margin-right: 3px; }
#score-table tfoot td { font-weight: 800; font-size: .9rem; border-top: 2px solid rgba(255,255,255,.2); }
#score-table .red { color: #ff8a80; }

/* ---------- Spelers ---------- */
.seat {
  position: absolute;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  z-index: 2;
}
.seat-top { top: 12px; left: 50%; transform: translateX(-50%); }
.seat-left { left: 14px; top: var(--mid); transform: translateY(-50%); }
.seat-right { right: 14px; top: var(--mid); transform: translateY(-50%); }
.seat-bottom { bottom: calc(var(--card-h) + 28px); left: 50%; transform: translateX(-50%); }

.nameplate {
  background: rgba(0,0,0,.35);
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 5px 12px;
  text-align: center;
  min-width: 120px;
  transition: border-color .2s, box-shadow .2s;
}
.nameplate.active { border-color: var(--gold); box-shadow: 0 0 16px rgba(242,193,78,.55); }
.nameplate .pname { font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 6px; }
.nameplate .pmeta { font-size: .8rem; color: var(--muted); }
.nameplate .pmeta b { color: var(--text); }
.nameplate .pmeta .hit { color: var(--good); }
.nameplate .pmeta .over { color: var(--bad); }
.plate-row { display: flex; align-items: center; gap: 8px; }
.seat-left .plate-row, .seat-right .plate-row { flex-direction: column; gap: 10px; }
/* Bovenste speler: kaarten naast de naam, zodat er ruimte blijft voor de slag in het midden */
.seat-top { flex-direction: row; align-items: center; gap: 12px; }
.center { z-index: 4; }

/* ---------- Gezichtjes ---------- */
.nameplate.has-face { display: flex; align-items: center; gap: 8px; text-align: left; padding-left: 6px; }
.nameplate.has-face .pinfo { text-align: center; flex: 1; }
.face {
  width: 58px; height: 58px; flex-shrink: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #fff7e0, #d9cdb0);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.15);
  overflow: hidden;
}
.face-svg { width: 100%; height: 100%; display: block; }
.face .lid {
  transform-box: fill-box; transform-origin: top;
  transform: scaleY(var(--lid, 0));
  transition: transform .09s;
}
.face.blink .lid { transform: scaleY(1); }
.face .m { display: none; }
.face[data-mouth="neutral"] .m-neutral,
.face[data-mouth="poker"] .m-poker,
.face[data-mouth="think"] .m-think,
.face[data-mouth="happy"] .m-happy,
.face[data-mouth="sad"] .m-sad,
.face[data-mouth="smirk"] .m-smirk { display: inline; }
.face .brow { transform-box: fill-box; transform-origin: center; transition: transform .25s; }
.face[data-brow="up"] .brow { transform: translateY(-3px); }
.face[data-brow="think"] .brow-r { transform: translateY(-4px) rotate(-6deg); }
.face[data-brow="worried"] .brow-l { transform: rotate(-14deg) translateY(-1px); }
.face[data-brow="worried"] .brow-r { transform: rotate(14deg) translateY(-1px); }
.face .sweat { opacity: 0; transition: opacity .3s; }
.face.sweating .sweat { opacity: 1; animation: sweat 1.2s ease-in infinite; }
@keyframes sweat { from { transform: translateY(-2px); } to { transform: translateY(4px); } }

.start-panel label.check {
  display: flex; align-items: flex-start; gap: 8px; font-weight: 500; font-size: .88rem; cursor: pointer;
}
.start-panel label.check input { width: auto; margin: 2px 0 0; }

/* Wie komt uit */
.nameplate.leads { border-color: #7fd3a0; }
.nameplate.leads.active { border-color: var(--gold); }
.lead-chip {
  margin-top: 4px; font-size: .72rem; font-weight: 800;
  background: #7fd3a0; color: #0d3a22; border-radius: 99px; padding: 1px 8px;
  display: inline-block;
}

/* Stapeltje gehaalde slagen */
.trick-pile {
  position: relative;
  width: 34px; height: 46px;
}
.trick-pile.empty::before {
  content: ''; position: absolute; left: 3px; top: 3px; width: 28px; height: 40px;
  border: 2px dashed rgba(255,255,255,.22); border-radius: 4px;
}
.pile-card {
  position: absolute; left: 3px; top: 3px; width: 28px; height: 40px;
  border-radius: 4px; border: 2px solid #fff;
  background: repeating-linear-gradient(45deg, #7a1f2b 0 3px, #962a38 3px 6px);
  box-shadow: 0 1px 2px rgba(0,0,0,.4);
  transform: translate(calc(var(--k) * 1.5px), calc(var(--k) * -2px)) rotate(calc((var(--k) - 1) * 4deg));
}
.pile-count {
  position: absolute; right: -6px; bottom: -6px; z-index: 1;
  min-width: 20px; height: 20px; border-radius: 99px; padding: 0 5px;
  background: var(--gold); color: #3a2a00; font-weight: 800; font-size: .75rem;
  display: flex; align-items: center; justify-content: center;
}
.trick-pile.empty .pile-count { background: rgba(255,255,255,.2); color: var(--text); }

.dealer-chip {
  background: var(--gold); color: #3a2a00; font-size: .65rem; font-weight: 800;
  border-radius: 99px; padding: 1px 6px;
}

.backs { display: flex; }
/* Kaartjes zijn 0,62 x een gewone kaart; laat van elk kaartje een stukje zien */
.backs .card-back { margin-left: calc(var(--card-w) * (var(--hstep, .18) - .62)); }
.backs .card-back:first-child { margin-left: 0; }
.seat-left .backs, .seat-right .backs { flex-direction: column; }
.seat-left .backs .card-back, .seat-right .backs .card-back { margin-left: 0; margin-top: calc(var(--card-h) * (var(--vstep, .14) - .62)); }
.seat-left .backs .card-back:first-child, .seat-right .backs .card-back:first-child { margin-top: 0; }

.card-back {
  width: calc(var(--card-w) * .62); height: calc(var(--card-h) * .62);
  border-radius: 6px;
  background:
    repeating-linear-gradient(45deg, #7a1f2b 0 4px, #962a38 4px 8px);
  border: 3px solid #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,.4);
}

/* ---------- Kaarten ---------- */
.card {
  width: var(--card-w); height: var(--card-h);
  background: var(--paper);
  border-radius: 8px;
  color: var(--ink);
  position: relative;
  box-shadow: 0 3px 8px rgba(0,0,0,.35);
  user-select: none;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,.15);
}
.card.red { color: var(--red); }
.card .corner {
  position: absolute; line-height: 1; text-align: center;
  font-weight: 700; font-size: calc(var(--card-w) * .2);
}
.card .corner small { display: block; font-size: 1em; }
.card .tl { top: 5px; left: 5px; }
.card .br { bottom: 5px; right: 5px; transform: rotate(180deg); }
.card .pip {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--card-w) * .5);
}
.card .pip.court {
  font-size: calc(var(--card-w) * .42); font-weight: 800;
}
.card.trump-glow { box-shadow: 0 0 0 2px var(--gold), 0 3px 8px rgba(0,0,0,.35); }

/* Hand van de speler */
.hand {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  display: flex; justify-content: center;
  z-index: 3;
  max-width: calc(100% - 20px);
}
.hand .card { margin-left: var(--hand-overlap, calc(var(--card-w) * -0.28)); transition: transform .15s, opacity .15s; }
.hand .card:first-child { margin-left: 0; }
.hand .card.playable { cursor: pointer; }
.hand .card.playable:hover { transform: translateY(-14px); }
.hand .card.unplayable { filter: brightness(.6); }

/* ---------- Midden ---------- */
.center {
  position: absolute; left: 50%; top: var(--mid);
  transform: translate(-50%, -50%);
  width: calc(var(--card-w) * 3.6); height: calc(var(--card-h) * 2.3);
}
.trick { position: absolute; inset: 0; }
.slot { position: absolute; }
.slot-0 { bottom: 0; left: 50%; transform: translateX(-50%); }
.slot-2 { top: 0; left: 50%; transform: translateX(-50%); }
.slot-1 { left: 0; top: 50%; transform: translateY(-50%) rotate(-6deg); }
.slot-3 { right: 0; top: 50%; transform: translateY(-50%) rotate(6deg); }
.slot .card { animation: drop .25s ease-out; }
.slot .card.winner { box-shadow: 0 0 0 3px var(--gold), 0 0 22px rgba(242,193,78,.8); }
@keyframes drop { from { transform: scale(1.25); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.trump-card {
  position: absolute; left: 14px; top: 12px; z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: .75rem; color: var(--muted);
}
.trump-card .card { transform: scale(.75); transform-origin: top center; margin-bottom: calc(var(--card-h) * -.25); }
.trump-card .none {
  width: calc(var(--card-w) * .75); height: calc(var(--card-h) * .75);
  border: 2px dashed rgba(255,255,255,.3); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 4px;
}

.status {
  position: absolute; left: 50%; top: calc(var(--mid) + var(--card-h) * 1.25 + 8px);
  transform: translateX(-50%);
  background: rgba(0,0,0,.4); padding: 6px 16px; border-radius: 99px;
  font-size: .95rem; white-space: nowrap; z-index: 6;
  display: flex; align-items: center; gap: 12px;
}
.continue-btn { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(242,193,78,.35); } }
.status:empty { display: none; }

/* ---------- Bod-melding ---------- */
.bid-popup {
  position: absolute; left: 50%; top: var(--mid);
  transform: translate(-50%, -50%);
  z-index: 20; cursor: pointer;
  display: flex; align-items: center; gap: 16px;
  padding: 14px 24px 14px 14px;
  background: rgba(10, 30, 20, .94);
  border: 3px solid var(--gold); border-radius: 18px;
  box-shadow: 0 14px 40px rgba(0,0,0,.55);
  animation: mood-in .35s cubic-bezier(.2, 1.4, .4, 1);
}
.bid-popup.leaving { animation: mood-out .2s ease-in forwards; }
.bid-popup .face { width: 84px; height: 84px; }
.me-face {
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem; font-weight: 900; color: #0d3a22;
  background: radial-gradient(circle at 50% 40%, #b8f0cc, #6cc58f) !important;
}
.bp-name { font-size: 1rem; color: var(--muted); }
.bp-bid { font-size: 3rem; font-weight: 900; line-height: 1; color: var(--gold); }
.bp-bid span { font-size: 1.2rem; font-weight: 700; color: var(--text); }
.bp-sum { font-size: .82rem; color: var(--muted); margin-top: 4px; }

/* ---------- Vechten / duiken ---------- */
.mood-chip { padding: 3px 10px; border-radius: 99px; font-weight: 700; font-size: .85rem; }
.mood-chip.fight { background: #8e1d16; color: #ffd9d4; }
.mood-chip.dive { background: #0b5e8e; color: #d4efff; }

.mood-banner {
  position: absolute; left: 50%; top: var(--mid);
  transform: translate(-50%, -50%);
  z-index: 20; cursor: pointer;
  width: min(380px, calc(100% - 32px));
  padding: 14px 18px 18px;
  border-radius: 18px; text-align: center;
  box-shadow: 0 16px 50px rgba(0,0,0,.55);
  animation: mood-in .45s cubic-bezier(.2, 1.4, .4, 1);
}
.mood-banner.fight { background: linear-gradient(160deg, #b3261e, #5e0f0b); border: 3px solid #f2c14e; }
.mood-banner.dive { background: linear-gradient(160deg, #1a8fd0, #0b3d63); border: 3px solid #bfe9ff; }
.mood-banner.leaving { animation: mood-out .25s ease-in forwards; }
.mood-banner svg { width: 100%; max-width: 260px; height: auto; display: block; margin: 0 auto; }
.mood-title { font-size: 2.4rem; font-weight: 900; letter-spacing: 1px; text-shadow: 0 3px 0 rgba(0,0,0,.35); }
.mood-banner.fight .mood-title { color: #ffd54f; }
.mood-banner.dive .mood-title { color: #e1f5fe; }
.mood-text { font-size: 1.05rem; margin-top: 2px; }
.mood-sub { font-size: .85rem; opacity: .75; margin-top: 4px; }

@keyframes mood-in { from { transform: translate(-50%, -50%) scale(.4); opacity: 0; } }
@keyframes mood-out { to { transform: translate(-50%, -50%) scale(.85); opacity: 0; } }

.mv-left { animation: punch-l .5s ease-in-out infinite alternate; }
.mv-right { animation: punch-r .5s ease-in-out infinite alternate; }
.mv-star { transform-origin: 120px 68px; animation: star 0.5s ease-in-out infinite alternate; }
@keyframes punch-l { from { transform: translateX(-10px); } to { transform: translateX(4px); } }
@keyframes punch-r { from { transform: translate(250px, 0) scale(-1, 1); } to { transform: translate(236px, 0) scale(-1, 1); } }
@keyframes star { from { transform: scale(.8) rotate(-6deg); } to { transform: scale(1.08) rotate(6deg); } }

.mv-diver { animation: dive 1.4s ease-in infinite; }
.mv-splash { transform-origin: 135px 92px; animation: splash 1.4s ease-out infinite; }
.mv-wave { animation: wave 2s ease-in-out infinite alternate; }
.mv-wave2 { animation: wave 2.6s ease-in-out infinite alternate-reverse; }
@keyframes dive { 0% { transform: translate(-14px, -18px); } 70%, 100% { transform: translate(0, 0); } }
@keyframes splash { 0%, 55% { transform: scale(0); opacity: 0; } 75% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1.3); opacity: 0; } }
@keyframes wave { from { transform: translateX(-8px); } to { transform: translateX(8px); } }

/* ---------- Bieden ---------- */
.bid-panel {
  position: absolute; left: 50%; bottom: calc(var(--card-h) + 28px);
  transform: translateX(-50%);
  background: rgba(10, 30, 20, .92);
  border: 2px solid var(--gold);
  border-radius: 14px; padding: 12px 16px; z-index: 10;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  max-width: calc(100% - 20px);
}
.bid-title { font-weight: 700; margin-bottom: 8px; }
.bid-buttons { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.bid-buttons .btn { min-width: 44px; }
.bid-hint { margin-top: 8px; font-size: .8rem; color: var(--muted); }

/* ---------- Modal ---------- */
.result-table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.result-table th, .result-table td { padding: 6px 8px; border-bottom: 1px solid #e3dccb; text-align: center; }
.result-table th:first-child, .result-table td:first-child { text-align: left; }
.result-table .ok { color: #1e8a4a; font-weight: 700; }
.result-table .ko { color: #c0392b; font-weight: 700; }
.podium { font-size: 1.1rem; }
.winner-title { text-align: center; font-size: 1.6rem; margin: 0 0 6px; }
.rules-panel ul { padding-left: 1.2em; }

/* ---------- Responsief ---------- */
@media (max-width: 980px) {
  .scoreboard {
    position: fixed; right: 0; top: 0; bottom: 0; z-index: 40;
    transform: translateX(100%); transition: transform .25s;
    box-shadow: -10px 0 30px rgba(0,0,0,.5);
  }
  .scoreboard.open { transform: translateX(0); }
}
@media (min-width: 981px) {
  #btn-scores { display: none; }
}
@media (max-width: 640px) {
  .table { margin: 4px; border-width: 6px; border-radius: 14px; }
  .nameplate { min-width: 0; padding: 4px 8px; font-size: .85rem; }
  .seat-left { left: 4px; }
  .seat-right { right: 4px; }
  .seat-left .backs, .seat-right .backs { display: none; }
  .trump-card { left: 6px; top: 6px; }
  .trump-card .card { transform: scale(.6); margin-bottom: calc(var(--card-h) * -.4); }
  .brand { display: none; }
  .status { font-size: .8rem; }
}

/* Troef: alleen de kleur, de getoonde kaart gaat terug in de stapel */
.trump-card .suit-only {
  width: calc(var(--card-w) * .75); height: calc(var(--card-h) * .75);
  border-radius: 8px; background: rgba(255,253,247,.95); color: #1d1d1f;
  border: 2px solid var(--gold); box-shadow: 0 3px 10px rgba(0,0,0,.35);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  animation: drop .3s ease-out;
}
.trump-card .suit-only .sym { font-size: calc(var(--card-w) * .55); line-height: 1; }
.trump-card .suit-only .nm { font-size: .7rem; font-weight: 700; }
.trump-card .suit-only.red { color: #c62828; }
.trump-card .card.to-deck { transition: transform .5s ease-in, opacity .5s ease-in; transform: scale(.75) translate(60%, 40%) rotate(25deg); opacity: 0; }
@media (max-width: 640px) {
  .trump-card .suit-only { width: calc(var(--card-w) * .6); height: calc(var(--card-h) * .6); }
}

/* Totaalscore boven de namen */
#score-table thead tr.totals th { color: var(--gold); font-size: .95rem; font-weight: 800; border-bottom: 0; padding-bottom: 0; }
#score-table thead tr.totals th.lead { color: #fff; }
#score-table thead tr.names th { top: 1.5rem; }

/* Opgeslagen spel op het startscherm */
.resume-box {
  margin: 16px 0 4px; padding: 12px; border-radius: 10px;
  background: #fff6dc; border: 1px solid #f2c14e; text-align: left; font-size: .85rem; color: #4a3b10;
}
.resume-box .resume-title { font-weight: 800; font-size: .95rem; margin-bottom: 4px; }
.resume-box .btn-row { margin-top: 10px; justify-content: flex-start; }
.start-note { font-size: .75rem; color: #777; margin-top: 10px; }

/* ---------- Telefoon (staand) ----------
   Boven: tegenspeler tegenover je. Daaronder links en rechts de twee andere tegenspelers.
   Midden: de slag. Onder: jouw naambordje op één regel en je kaarten. */
@media (max-width: 640px) {
  :root { --mid: 57%; }
  .topbar { padding: 4px 8px; gap: 6px; }
  .info { gap: 6px; font-size: .8rem; flex-wrap: wrap; }
  .mood-chip { font-size: .75rem; }
  .top-actions .btn.small { padding: 4px 9px; font-size: .78rem; }

  .nameplate { font-size: .78rem; border-width: 2px; }
  .nameplate .pmeta { font-size: .72rem; line-height: 1.25; }
  .nameplate.has-face { gap: 6px; padding: 4px 8px 4px 4px; }
  .nameplate .face { width: 38px; height: 38px; }
  .nameplate .lvl { font-size: .58rem; padding: 0 6px; margin: 1px 0; }
  .lead-chip { font-size: .65rem; margin-top: 2px; padding: 0 6px; }

  /* Stapeltje slagen kleiner, op de hoek van het naambordje */
  .plate-row { position: relative; }
  .trick-pile { transform: scale(.72); }
  .seat-left .plate-row .trick-pile, .seat-right .plate-row .trick-pile, .seat-top .plate-row .trick-pile {
    position: absolute; bottom: -20px; z-index: 1;
  }
  .seat-left .plate-row .trick-pile { right: -18px; }
  .seat-right .plate-row .trick-pile { left: -18px; }
  .seat-top .plate-row .trick-pile { right: -22px; bottom: -8px; }

  .seat-top { top: 6px; gap: 8px; }
  .seat-top .backs { display: none; }
  .seat-left, .seat-right { top: calc(var(--mid) - var(--card-h) * 1.15 - 22px); transform: translateY(-100%); }
  .seat-left { left: 4px; }
  .seat-right { right: 4px; }

  /* Jouw naambordje: alles op één regel */
  .seat-bottom { bottom: calc(var(--card-h) + 22px); }
  .seat-bottom .nameplate { display: flex; align-items: baseline; gap: 8px; padding: 3px 10px; white-space: nowrap; }
  .seat-bottom .nameplate .lead-chip { margin-top: 0; }
  .seat-bottom .plate-row { gap: 2px; }
  .seat-bottom .trick-pile { margin: -10px -4px; }

  .hand { bottom: 10px; }
  .hand .card.playable:hover { transform: none; }
  .hand .card.playable:active { transform: translateY(-10px); }

  /* Bieden in het midden van de tafel, zodat je eigen naambordje zichtbaar blijft */
  .bid-panel { bottom: auto; top: var(--mid); transform: translate(-50%, -50%); padding: 10px 12px; width: max-content; max-width: calc(100% - 24px); }
  .bid-title { margin-bottom: 6px; }
  .bid-buttons { gap: 5px; }
  .bid-buttons .btn { min-width: 38px; padding: 5px 0; }
  .bid-hint { margin-top: 6px; }

  .status { top: calc(var(--mid) + var(--card-h) * 1.15 + 4px); width: max-content; max-width: calc(100% - 16px); white-space: normal; text-align: center; padding: 3px 4px 3px 12px; gap: 8px; }
  .status:not(:has(button)) { padding-right: 12px; }
  .status .continue-btn { padding: 3px 10px; white-space: nowrap; }
  .trump-card .suit-only .nm { display: none; }

  .bid-popup { gap: 10px; padding: 10px 16px 10px 10px; max-width: calc(100% - 24px); }
  .bid-popup .face { width: 60px; height: 60px; }
  .bp-bid { font-size: 2.3rem; }
  .mood-title { font-size: 1.9rem; }
  .mood-text { font-size: .92rem; }
}

/* ---------- Spraak- en denkwolkjes ---------- */
.bubble {
  position: absolute; z-index: 15; pointer-events: none;
  max-width: 190px; width: max-content;
  padding: 7px 12px; border-radius: 16px;
  background: #fff; color: #1d1d1f;
  font-size: .85rem; font-weight: 600; line-height: 1.25;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
  animation: bubble-in .28s cubic-bezier(.2, 1.5, .4, 1);
  --tail-x: 50%;
}
.bubble.leaving { animation: bubble-out .2s ease-in forwards; }
@keyframes bubble-in { from { transform: scale(.4); opacity: 0; } }
@keyframes bubble-out { to { transform: scale(.7); opacity: 0; } }

/* Spraakwolkje: driehoekje dat naar de speler wijst */
.bubble.say::after {
  content: ''; position: absolute; width: 0; height: 0; border: 8px solid transparent;
}
.bubble.say.tail-left::after { left: -14px; top: 12px; border-right-color: #fff; border-right-width: 10px; }
.bubble.say.tail-right::after { right: -14px; top: 12px; border-left-color: #fff; border-left-width: 10px; }
.bubble.say.tail-bottom::after { bottom: -14px; left: calc(var(--tail-x) - 8px); border-top-color: #fff; border-top-width: 10px; }
.bubble.say.tail-top::after { top: -14px; left: calc(var(--tail-x) - 8px); border-bottom-color: #fff; border-bottom-width: 10px; }

/* Denkwolkje: wolkvorm met bolletjes richting de speler */
.bubble.think {
  background: #eef4ff; color: #34405a; font-style: italic; font-weight: 500;
  border-radius: 22px; border: 2px solid #c9d6f0;
}
.bubble.think::before, .bubble.think::after {
  content: ''; position: absolute; border-radius: 50%; background: #eef4ff; border: 2px solid #c9d6f0;
}
.bubble.think::before { width: 12px; height: 12px; }
.bubble.think::after { width: 7px; height: 7px; }
.bubble.think.tail-left::before { left: -14px; top: 14px; }
.bubble.think.tail-left::after { left: -24px; top: 22px; }
.bubble.think.tail-right::before { right: -14px; top: 14px; }
.bubble.think.tail-right::after { right: -24px; top: 22px; }
.bubble.think.tail-bottom::before { bottom: -14px; left: calc(var(--tail-x) - 6px); }
.bubble.think.tail-bottom::after { bottom: -24px; left: calc(var(--tail-x) - 10px); }
.bubble.think.tail-top::before { top: -14px; left: calc(var(--tail-x) - 6px); }
.bubble.think.tail-top::after { top: -24px; left: calc(var(--tail-x) - 10px); }

@media (max-width: 640px) {
  .bubble { max-width: 150px; font-size: .74rem; padding: 5px 9px; }
}

/* ---------- Gezichtjes reageren op wat ze zeggen ---------- */
.face[data-mouth="open"] .m-open { display: inline; }
.face[data-brow="angry"] .brow-l { transform: rotate(16deg) translateY(2px); }
.face[data-brow="angry"] .brow-r { transform: rotate(-16deg) translateY(2px); }
.face .flush { transition: opacity .3s; }
.face.flushed .flush { opacity: .45; }
.face .pupil circle:first-child { transition: r .2s; }
.face.wide .pupil circle:first-child { r: 2.6; }
.face.wide .lid { transform: scaleY(0) !important; }
.face .mouths { transform-box: fill-box; transform-origin: center; }
.face.talking .mouths { animation: talk .16s ease-in-out infinite alternate; }
.face-prof.talking .mouths { animation-name: talk-small; }
@keyframes talk { from { transform: scaleY(.5); } to { transform: scaleY(1.35); } }
@keyframes talk-small { from { transform: scaleY(.7); } to { transform: scaleY(1.1); } }

/* ---------- Scorebord als schuifpaneel: altijd te sluiten ---------- */
.score-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.score-close { display: none; }
.score-backdrop { display: none; }
@media (max-width: 980px) {
  .score-close { display: inline-block; }
  .scoreboard { width: min(330px, 88vw); }
  .score-backdrop.show {
    display: block; position: fixed; inset: 0; z-index: 39;
    background: rgba(0, 0, 0, .45);
  }
}

/* ---------- Telefoon: vaste rijen in plaats van losse posities ----------
   Op een telefoon (zeker binnen een app of met een balk bovenin) is de tafel soms laag.
   Met losse procenten schoven de spelers dan over elkaar. Nu staat alles in rijen onder elkaar:
   tegenover-speler · linker en rechter speler · slag · melding · jij · je kaarten. */
@media (max-width: 640px) {
  .table {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto auto auto;
    grid-template-areas: "top top" "left right" "center center" "status status" "me me" "hand hand";
    row-gap: 6px; padding: 6px 4px 8px;
  }
  .seat, .center, .status, .hand { position: relative; inset: auto; transform: none; }
  .seat-top { grid-area: top; justify-self: center; top: auto; }
  .seat-left { grid-area: left; justify-self: start; align-self: end; top: auto; left: auto; transform: none; }
  .seat-right { grid-area: right; justify-self: end; align-self: end; top: auto; right: auto; transform: none; }
  .center { grid-area: center; justify-self: center; align-self: center; left: auto; top: auto; }
  .status {
    grid-area: status; justify-self: center; top: auto; left: auto;
    min-height: 28px; margin: 0;
  }
  .status:empty { display: flex; visibility: hidden; }
  .seat-bottom { grid-area: me; justify-self: center; bottom: auto; left: auto; }
  .hand { grid-area: hand; justify-self: center; bottom: auto; left: auto; max-width: 100%; }
  .bid-panel { top: 50%; }
  /* Naambordjes van de zijspelers passen altijd in hun helft */
  .seat-left .nameplate, .seat-right .nameplate { max-width: calc(50vw - 30px); }
  .nameplate .pname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* Knoppenbalk: alles op één regel */
  .topbar { flex-wrap: wrap; row-gap: 4px; }
  .top-actions { gap: 4px; flex-wrap: nowrap; }
  .top-actions .btn.small { padding: 4px 8px; font-size: .74rem; white-space: nowrap; }
}
@media (max-width: 640px) {
  .bid-popup { width: max-content; max-width: calc(100% - 24px); top: 50%; }
  .bp-name { white-space: nowrap; }
  .mood-banner { top: 50%; }
}
