/* Klaverkroeg – bruin café: houten lambrisering, Perzisch tafelkleed, papieren scoreblok. */
:root {
  --wood-1: #2a1a10;
  --wood-2: #352114;
  --wood-3: #43291a;
  --rug: #7d1d22;
  --rug-deep: #561216;
  --rug-blue: #1d2f52;
  --brass: #c9a24a;
  --brass-hi: #ecd28b;
  --brass-lo: #8a6a26;
  --ivory: #f3ead2;
  --paper: #f2f1e6;
  --paper-line: #b9c8dc;
  --ink: #23283f;
  --pencil: #3a3f52;
  --card: #fdfbf5;
  --card-edge: #d9d2bf;
  --suit-red: #be1e2d;
  --suit-black: #1c1d26;
  --glow: #ffd36b;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --hand: "Bradley Hand", "Segoe Print", "Comic Neue", "Chalkboard SE", "Marker Felt", cursive;
  --cw-base: clamp(50px, min(10.5vw, 10vh), 100px);
  --cw: var(--cw-base);
  --ch: calc(var(--cw) * 1.42);
  --radius-card: calc(var(--cw) * 0.09);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ivory);
  background-color: var(--wood-1);
  background-image:
    radial-gradient(ellipse 70% 55% at 50% 0%, rgba(255, 196, 110, 0.18), transparent 70%),
    repeating-linear-gradient(90deg, var(--wood-1) 0 3px, var(--wood-2) 3px 118px, var(--wood-3) 118px 120px, var(--wood-2) 120px 236px);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; }
:focus-visible { outline: 3px solid var(--glow); outline-offset: 2px; }

.screen { min-height: 100dvh; }

/* ---------- Knoppen & velden ---------- */
.btn {
  appearance: none;
  border: 1px solid rgba(236, 210, 139, 0.45);
  background: linear-gradient(#4d3020, #3a2316);
  color: var(--ivory);
  padding: 0.7em 1.15em;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  font-weight: 600;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  transition: transform 0.08s, filter 0.15s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-brass {
  background: linear-gradient(var(--brass-hi), var(--brass) 55%, var(--brass-lo));
  color: #2b1b0b;
  border-color: #6e521b;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn-ghost { background: transparent; }
.link-btn { background: none; border: 0; color: var(--brass-hi); text-decoration: underline; cursor: pointer; padding: 0.4em 0; }
.icon-btn {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(236, 210, 139, 0.3);
  color: var(--ivory);
  border-radius: 8px;
  padding: 0.35em 0.7em;
  cursor: pointer;
  font-size: 0.85rem;
}
.icon-btn:hover { background: rgba(0, 0, 0, 0.4); }

.panel {
  background: linear-gradient(rgba(20, 11, 6, 0.72), rgba(20, 11, 6, 0.82));
  border: 1px solid rgba(201, 162, 74, 0.35);
  border-radius: 14px;
  padding: 1.4rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.panel h2 { font-family: var(--serif); font-weight: 600; font-size: 1.5rem; margin: 0 0 1rem; color: var(--brass-hi); }
.field { display: block; margin: 0 0 1rem; border: 0; padding: 0; }
.field > span, .field legend { display: block; font-size: 0.9rem; margin-bottom: 0.35rem; color: #e6d9b8; }
.field em { font-style: normal; opacity: 0.65; }
input, select {
  width: 100%;
  background: #1b100a;
  color: var(--ivory);
  border: 1px solid rgba(201, 162, 74, 0.4);
  border-radius: 8px;
  padding: 0.6em 0.75em;
}
input::placeholder { color: rgba(243, 234, 210, 0.35); }
.hint { font-size: 0.88rem; color: rgba(243, 234, 210, 0.72); margin: 0.4rem 0 0; line-height: 1.45; }
.error { color: #ffb4a8; min-height: 1.2em; margin: 0.6rem 0 0; font-size: 0.9rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }

.seg { display: inline-flex; border: 1px solid rgba(201, 162, 74, 0.45); border-radius: 999px; overflow: hidden; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: block; padding: 0.45em 1.3em; font-weight: 700; font-family: var(--serif); font-size: 1.15rem; }
.seg input:checked + span { background: var(--brass); color: #2b1b0b; }
.seg input:focus-visible + span { outline: 3px solid var(--glow); outline-offset: -3px; }
.radio-row { display: flex; gap: 0.6rem; align-items: flex-start; margin: 0.25rem 0 0.55rem; cursor: pointer; font-size: 0.92rem; line-height: 1.4; }
.radio-row input { width: auto; margin-top: 0.25rem; accent-color: var(--brass); }
.radio-row b { display: block; color: var(--brass-hi); }

/* ---------- Lobby ---------- */
#lobby { padding: clamp(1rem, 4vw, 3rem) 1rem 3rem; max-width: 1040px; margin: 0 auto; }
.sign {
  text-align: center;
  margin: 0 auto 2rem;
  padding: 1.2rem 2.2rem 1.1rem;
  width: fit-content;
  max-width: 100%;
  background: linear-gradient(#1c3a2a, #11261b);
  border: 3px solid var(--brass);
  border-radius: 12px;
  box-shadow: 0 0 0 6px #241409, 0 22px 50px rgba(0, 0, 0, 0.55), inset 0 0 30px rgba(0, 0, 0, 0.5);
}
.sign h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2.4rem, 7vw, 4.4rem);
  letter-spacing: 0.02em;
  margin: 0;
  line-height: 1;
  background: linear-gradient(var(--brass-hi), var(--brass) 60%, var(--brass-lo));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.6));
}
.sign-clover { width: 42px; height: 42px; fill: var(--brass); margin-bottom: 0.3rem; }
.sign-sub { margin: 0.5rem 0 0; font-family: var(--serif); font-style: italic; color: #cfe2c9; }
.lobby-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.4rem; align-items: start; }
.lobby-side { display: grid; gap: 1.4rem; }
.join-row { display: flex; gap: 0.6rem; }
#in-code { text-transform: uppercase; letter-spacing: 0.3em; font-family: var(--serif); font-size: 1.3rem; text-align: center; }
@media (max-width: 760px) { .lobby-grid { grid-template-columns: 1fr; } }

.board { --hg-accent: var(--brass); --hg-bg: transparent; --hg-fg: var(--ivory); --hg-border: rgba(201, 162, 74, 0.35); --hg-input: #1b100a; }

/* ---------- Wachtkamer ---------- */
#wait { display: grid; place-items: center; padding: 1.5rem 1rem; }
.wait-panel { max-width: 560px; width: 100%; text-align: center; }
.wait-panel .actions { justify-content: center; }
.plate {
  margin: 1.2rem auto 0.4rem;
  display: inline-block;
  padding: 0.35em 0.9em;
  font-family: var(--serif);
  font-size: clamp(2.2rem, 9vw, 3.4rem);
  letter-spacing: 0.32em;
  font-weight: 700;
  color: #2b1b0b;
  background: linear-gradient(135deg, var(--brass-hi), var(--brass) 45%, var(--brass-lo) 80%, var(--brass));
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 6px 18px rgba(0, 0, 0, 0.5);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}
.plate span { margin-right: -0.32em; }
.seats { list-style: none; padding: 0; margin: 1.3rem 0 0.4rem; display: grid; gap: 0.5rem; text-align: left; }
.seats li {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.55rem 0.8rem; border-radius: 10px;
  background: rgba(255, 255, 255, 0.04); border: 1px dashed rgba(201, 162, 74, 0.3);
}
.seats li.taken { border-style: solid; background: rgba(201, 162, 74, 0.1); }
.seats .chair { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; background: #1b100a; font-family: var(--serif); font-weight: 700; color: var(--brass-hi); }
.seats .who { flex: 1; }
.seats .team { font-size: 0.8rem; opacity: 0.7; }

/* ---------- Speltafel ---------- */
#game { display: grid; grid-template-rows: auto 1fr auto; height: 100dvh; overflow: hidden; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.45rem 0.8rem; background: rgba(0, 0, 0, 0.35); border-bottom: 1px solid rgba(201, 162, 74, 0.25); }
.bar-left, .bar-right { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.bar-mid { font-family: var(--serif); font-style: italic; opacity: 0.85; white-space: nowrap; }
.brand-mini { font-family: var(--serif); font-weight: 700; color: var(--brass-hi); display: inline-flex; align-items: center; gap: 0.35rem; }
.brand-mini svg { width: 20px; height: 20px; fill: var(--brass); }
.trump-badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.2rem 0.65rem 0.2rem 0.3rem; border-radius: 999px;
  background: var(--card); color: var(--ink); font-weight: 700; font-size: 0.85rem;
  box-shadow: 0 0 0 2px var(--brass);
}
.trump-badge .suit-tile { width: 26px; height: 26px; border-radius: 50%; box-shadow: none; }
.trump-badge .suit-tile svg { width: 17px; height: 17px; }
@media (max-width: 640px) {
  .brand-mini { display: none; }
  .bar-mid { font-size: 0.8rem; }
  .icon-btn { padding: 0.3em 0.5em; font-size: 0.75rem; }
}

.table-wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.8rem; padding: 0.7rem 0.8rem 0; min-height: 0; }

.rug {
  position: relative;
  min-height: 0;
  border-radius: 22px;
  background-color: var(--rug);
  background-image:
    radial-gradient(ellipse 60% 50% at 50% 50%, rgba(255, 210, 140, 0.16), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Crect width='96' height='96' fill='%237d1d22'/%3E%3Cpath d='M48 5L91 48L48 91L5 48Z' fill='none' stroke='%23c9a24a' stroke-width='1.6' opacity='.5'/%3E%3Cpath d='M48 14L82 48L48 82L14 48Z' fill='none' stroke='%23f3ead2' stroke-width='.8' stroke-dasharray='2 3' opacity='.35'/%3E%3Cpath d='M48 27L69 48L48 69L27 48Z' fill='%231d2f52' opacity='.6'/%3E%3Cpath d='M48 37L59 48L48 59L37 48Z' fill='%23c9a24a' opacity='.75'/%3E%3Ccircle cx='48' cy='48' r='3' fill='%237d1d22'/%3E%3Cg fill='%231d2f52' opacity='.6'%3E%3Ccircle cx='0' cy='0' r='9'/%3E%3Ccircle cx='96' cy='0' r='9'/%3E%3Ccircle cx='0' cy='96' r='9'/%3E%3Ccircle cx='96' cy='96' r='9'/%3E%3C/g%3E%3Cg fill='%23c9a24a' opacity='.7'%3E%3Ccircle cx='0' cy='0' r='3'/%3E%3Ccircle cx='96' cy='0' r='3'/%3E%3Ccircle cx='0' cy='96' r='3'/%3E%3Ccircle cx='96' cy='96' r='3'/%3E%3C/g%3E%3Cg fill='%23f3ead2' opacity='.4'%3E%3Ccircle cx='48' cy='2' r='1.5'/%3E%3Ccircle cx='48' cy='94' r='1.5'/%3E%3Ccircle cx='2' cy='48' r='1.5'/%3E%3Ccircle cx='94' cy='48' r='1.5'/%3E%3C/g%3E%3C/svg%3E");
  background-position: center;
  box-shadow:
    inset 0 0 0 9px var(--rug-deep),
    inset 0 0 0 11px var(--brass),
    inset 0 0 0 19px var(--rug-blue),
    inset 0 0 0 21px var(--brass),
    inset 0 0 0 26px var(--rug-deep),
    inset 0 0 90px 30px rgba(0, 0, 0, 0.55),
    0 20px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
#seats-layer { position: absolute; inset: 0; pointer-events: none; }
#seats-layer > * { pointer-events: auto; }

/* Spelers rond het kleed */
.opp { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 0.35rem; }
.opp.pos-top { top: 32px; left: 50%; transform: translateX(-50%); flex-direction: row; align-items: flex-start; }
.opp.pos-left { left: 34px; top: 50%; transform: translateY(-50%); }
.opp.pos-right { right: 34px; top: 50%; transform: translateY(-50%); }
.n2 .opp .backs { display: none; }
.n2 .trick { top: 60%; }
.n2 .opp.pos-top { flex-direction: column; align-items: center; }
.n3 .opp.pos-left { top: 32%; }
.n3 .opp.pos-right { top: 32%; }

.backs { display: flex; height: calc(var(--ch) * 0.5); }
.backs .card { --cw: calc(var(--cw-base) * 0.5); margin-left: calc(var(--cw) * -0.72); }
.backs .card:first-child { margin-left: 0; }
.pos-left .backs, .pos-right .backs { transform: rotate(90deg); margin: calc(var(--ch) * 0.22) 0; }

.plate-name {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.25rem 0.75rem 0.25rem 0.3rem;
  background: rgba(20, 11, 6, 0.82);
  border: 1px solid rgba(201, 162, 74, 0.45);
  border-radius: 999px;
  font-size: 0.85rem;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: box-shadow 0.25s, border-color 0.25s;
}
.plate-name .ava {
  width: 1.7rem; height: 1.7rem; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--serif); font-weight: 700; color: #2b1b0b;
  background: var(--brass);
}
.plate-name.team-b .ava { background: #8fb3d9; }
.plate-name .tags { display: inline-flex; gap: 0.25rem; }
.chip { font-size: 0.68rem; padding: 0.05rem 0.4rem; border-radius: 999px; background: rgba(255, 255, 255, 0.12); color: var(--ivory); }
.chip.gaat { background: var(--brass); color: #2b1b0b; font-weight: 700; }
.chip.gever { background: var(--ivory); color: var(--ink); }
.chip.off { background: #6d2b2b; }
.plate-name .tricks { font-family: var(--serif); opacity: 0.8; }
.plate-name.turn { border-color: var(--glow); box-shadow: 0 0 0 3px rgba(255, 211, 107, 0.35), 0 0 22px rgba(255, 211, 107, 0.55); }
.plate-name.turn .ava { animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.12); } }
.takeover { font-size: 0.72rem; padding: 0.25rem 0.6rem; }

/* Tafelkaarten bij 2 spelers */
.table-cards { display: flex; gap: calc(var(--cw) * 0.18); justify-content: center; }
.slot { position: relative; width: var(--cw); height: calc(var(--ch) + 10px); }
.slot .card { position: absolute; left: 0; }
.slot .card.under { top: 0; }
.slot .card.over { top: 10px; }
.opp .table-cards { --cw: calc(var(--cw-base) * 0.72); }
.opp .table-cards .slot .card.over { top: 0; }
.opp .table-cards .slot .card.under { top: 10px; }
.me-zone .table-cards { margin-bottom: 0.4rem; }

/* ---------- Kaarten ---------- */
.card {
  position: relative;
  flex: none;
  width: var(--cw);
  height: var(--ch);
  border-radius: var(--radius-card);
  background: var(--card);
  border: 1px solid var(--card-edge);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 3px 8px rgba(0, 0, 0, 0.35);
  color: var(--suit-black);
  font-family: var(--serif);
  user-select: none;
  padding: 0;
}
.card.red { color: var(--suit-red); }
.card svg { fill: currentColor; display: block; }
.card .corner {
  position: absolute;
  display: flex; flex-direction: column; align-items: center;
  line-height: 1;
  font-weight: 700;
  font-size: calc(var(--cw) * 0.2);
  width: calc(var(--cw) * 0.2);
}
.card .corner svg { width: calc(var(--cw) * 0.17); height: calc(var(--cw) * 0.17); margin-top: 2px; }
.card .corner.tl { top: calc(var(--cw) * 0.06); left: calc(var(--cw) * 0.04); }
.card .corner.br { bottom: calc(var(--cw) * 0.06); right: calc(var(--cw) * 0.04); transform: rotate(180deg); }
.card .corner .r10 { letter-spacing: -0.08em; }
.card .pips { position: absolute; inset: 17% 29% 17% 29%; }
.card .pip { position: absolute; width: calc(var(--cw) * 0.19); height: calc(var(--cw) * 0.19); transform: translate(-50%, -50%); }
.card .pip.flip { transform: translate(-50%, -50%) rotate(180deg); }
.card .ace { position: absolute; inset: 0; display: grid; place-items: center; }
.card .ace svg { width: calc(var(--cw) * 0.5); height: calc(var(--cw) * 0.5); filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.15)); }
.card .court {
  position: absolute;
  inset: 13% 23%;
  border-radius: calc(var(--cw) * 0.05);
  border: 1.5px solid currentColor;
  background:
    linear-gradient(180deg, rgba(201, 162, 74, 0.28), rgba(201, 162, 74, 0.06) 50%, rgba(29, 47, 82, 0.14));
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  place-items: center;
  overflow: hidden;
}
.card .court .hat { width: 64%; height: auto; fill: var(--brass-lo); }
.card .court .letter { font-size: calc(var(--cw) * 0.34); font-weight: 700; line-height: 1; }
.card .court .csuit { width: calc(var(--cw) * 0.2); height: calc(var(--cw) * 0.2); align-self: start; }
.card.back {
  background-color: #7a1820;
  background-image:
    repeating-linear-gradient(45deg, rgba(201, 162, 74, 0.35) 0 1.5px, transparent 1.5px 7px),
    repeating-linear-gradient(-45deg, rgba(201, 162, 74, 0.35) 0 1.5px, transparent 1.5px 7px);
  box-shadow: inset 0 0 0 calc(var(--cw) * 0.05) var(--card), inset 0 0 0 calc(var(--cw) * 0.07) var(--brass), 0 3px 8px rgba(0, 0, 0, 0.35);
  border-color: #c9bfa6;
}
.card.back::after {
  content: "";
  position: absolute; inset: 34% 26%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--brass-hi), var(--brass) 55%, transparent 58%);
  opacity: 0.85;
}

/* Hand */
.me-zone { position: relative; display: flex; flex-direction: column; align-items: center; padding: 0.5rem 0.6rem calc(0.6rem + env(safe-area-inset-bottom)); }
.hand { display: flex; justify-content: center; align-items: flex-end; min-height: calc(var(--ch) + 18px); padding-top: 18px; }
.hand .card { margin-left: var(--overlap, -12px); transform: translateY(0) rotate(var(--rot, 0deg)); transform-origin: 50% 140%; transition: transform 0.18s ease, filter 0.2s, opacity 0.2s; }
.hand .card:first-child { margin-left: 0; }
button.card { cursor: pointer; }
.hand button.card.legal:focus-visible { transform: translateY(-16px) rotate(var(--rot, 0deg)); }
@media (hover: hover) { .hand button.card.legal:hover { transform: translateY(-16px) rotate(var(--rot, 0deg)); } }
button, .card { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.myturn .card.illegal, .myturn .slot .card.over.illegal { filter: brightness(0.62) saturate(0.6); }
.card.legal.glow { box-shadow: 0 0 0 2px var(--glow), 0 6px 18px rgba(255, 211, 107, 0.4); }
#me-plate { margin-top: 0.35rem; }

/* Delen: het ene georkestreerde moment */
.dealing .hand .card, .dealing .backs .card, .dealing .table-cards .card {
  animation: deal 0.5s cubic-bezier(.2, .8, .25, 1) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}
@keyframes deal {
  from { opacity: 0; transform: translate(var(--dx, 0), var(--dy, -40vh)) rotate(-25deg) scale(0.7); }
}

/* Slag in het midden */
.trick { position: absolute; left: 50%; top: 52%; width: 0; height: 0; }
.trick .card { position: absolute; left: calc(var(--cw) / -2); top: calc(var(--ch) / -2); transition: transform 0.45s ease, opacity 0.45s ease; }
.trick .t-bottom { transform: translate(0, calc(var(--ch) * 0.3)) rotate(-3deg); }
.trick .t-top { transform: translate(0, calc(var(--ch) * -0.3)) rotate(4deg); }
.trick .t-left { transform: translate(calc(var(--cw) * -0.66), 0) rotate(-9deg); }
.trick .t-right { transform: translate(calc(var(--cw) * 0.66), 0) rotate(8deg); }
.n3 .trick .t-left { transform: translate(calc(var(--cw) * -0.6), calc(var(--ch) * -0.2)) rotate(-9deg); }
.n3 .trick .t-right { transform: translate(calc(var(--cw) * 0.6), calc(var(--ch) * -0.2)) rotate(8deg); }
.trick .card.enter { animation: fly-in 0.38s cubic-bezier(.2, .8, .3, 1) both; }
@keyframes fly-in { from { translate: var(--fx, 0) var(--fy, 0); opacity: 0.4; } }
.trick .card.win { box-shadow: 0 0 0 3px var(--glow), 0 0 26px rgba(255, 211, 107, 0.7); z-index: 5; }
.trick.sweep .card { opacity: 0; }
.trick.sweep-bottom .card { translate: 0 40vh; }
.trick.sweep-top .card { translate: 0 -40vh; }
.trick.sweep-left .card { translate: -45vw 0; }
.trick.sweep-right .card { translate: 45vw 0; }
.trick.sweep .card { transition: translate 0.55s ease-in, opacity 0.55s ease-in; }

/* Bieden */
.center-panel {
  position: absolute; left: 50%; top: 47%; transform: translate(-50%, -50%);
  z-index: 10;
  width: min(360px, calc(100% - 3rem));
  text-align: center;
  padding: 1.1rem 1.2rem 1.2rem;
  border-radius: 16px;
  background: rgba(20, 11, 6, 0.9);
  border: 1px solid var(--brass);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}
.center-panel h3 { margin: 0 0 0.6rem; font-family: var(--serif); font-weight: 600; color: var(--brass-hi); font-size: 1.15rem; }
.proposed { display: flex; align-items: center; justify-content: center; gap: 0.7rem; margin: 0.3rem 0 0.8rem; font-family: var(--serif); font-size: 1.4rem; }
.suit-tile { width: 64px; height: 64px; border-radius: 12px; background: var(--card); display: grid; place-items: center; box-shadow: 0 0 0 2px var(--brass), 0 6px 16px rgba(0, 0, 0, 0.4); }
.suit-tile svg { width: 40px; height: 40px; }
.suit-tile.red { color: var(--suit-red); fill: var(--suit-red); }
.suit-tile.black { color: var(--suit-black); fill: var(--suit-black); }
.suit-choice { display: flex; gap: 0.6rem; justify-content: center; margin-top: 0.4rem; }
.suit-choice button { border: 0; padding: 0; cursor: pointer; background: none; }
.suit-choice button:hover .suit-tile { transform: translateY(-3px); }
.suit-choice .suit-tile { transition: transform 0.12s; }
.bidlog { font-size: 0.85rem; opacity: 0.75; margin-top: 0.6rem; min-height: 1.2em; }

.status {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  font-family: var(--serif); font-style: italic;
  background: rgba(20, 11, 6, 0.7); padding: 0.25rem 0.9rem; border-radius: 999px;
  white-space: nowrap; font-size: 0.95rem; max-width: calc(100% - 60px); overflow: hidden; text-overflow: ellipsis;
}
.status:empty { display: none; }
.status.mine { color: var(--glow); }

.toast {
  position: absolute; left: 50%; top: 18%; transform: translate(-50%, -10px);
  background: linear-gradient(var(--brass-hi), var(--brass));
  color: #2b1b0b;
  font-family: var(--serif); font-weight: 700; font-size: 1.15rem;
  padding: 0.45rem 1.1rem; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  opacity: 0; pointer-events: none; transition: opacity 0.3s, transform 0.3s;
  z-index: 20; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Scoreblok ---------- */
.scorepad {
  position: relative;
  width: 200px;
  align-self: start;
  max-height: 100%;
  overflow: auto;
  background:
    repeating-linear-gradient(transparent 0 23px, var(--paper-line) 23px 24px),
    var(--paper);
  background-position: 0 46px;
  color: var(--pencil);
  border-radius: 4px 4px 10px 10px;
  padding: 1.6rem 0.8rem 0.9rem;
  transform: rotate(1.2deg);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.5), 0 2px 0 #d8d5c4;
}
.pad-holes { position: absolute; top: 6px; left: 12px; right: 12px; height: 10px; background: radial-gradient(circle, #6d5a43 3px, transparent 3.5px) 0 0 / 18px 10px repeat-x; opacity: 0.6; }
.scorepad h3 { margin: 0 0 0.3rem; font-family: var(--hand); font-weight: 400; font-size: 1.1rem; color: var(--ink); text-align: center; }
.scorepad table { width: 100%; border-collapse: collapse; font-family: var(--hand); font-size: 1rem; }
.scorepad th { font-weight: 400; color: var(--ink); border-bottom: 2px solid #b03a3a; padding: 2px; height: 24px; }
.scorepad td { text-align: center; height: 24px; padding: 0 2px; }
.scorepad td + td, .scorepad th + th { border-left: 2px solid #b03a3a; }
.scorepad .nat { color: #b03a3a; }
.scorepad .mark { font-size: 0.7rem; vertical-align: super; color: #b03a3a; }
.scorepad .live td { color: #8a8f9e; font-style: italic; }
.scorepad tfoot td { border-top: 2px solid var(--ink); font-weight: 700; color: var(--ink); font-size: 1.15rem; }
.scorepad .me-col { background: rgba(201, 162, 74, 0.13); }
@media (max-width: 900px) {
  .table-wrap { grid-template-columns: 1fr; }
  .scorepad { position: fixed; right: 10px; top: 52px; z-index: 40; transform: none; display: none; max-height: 70dvh; }
  .scorepad.open { display: block; }
}
@media (min-width: 901px) { #btn-score { display: none; } }

/* ---------- Dialogen ---------- */
.dlg {
  border: 1px solid var(--brass);
  border-radius: 16px;
  padding: 0;
  max-width: min(620px, calc(100vw - 2rem));
  width: 100%;
  background: #1f130b;
  color: var(--ivory);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
}
.dlg::backdrop { background: rgba(10, 5, 2, 0.6); backdrop-filter: blur(2px); }
.dlg-body { padding: 1.4rem 1.5rem 0.4rem; max-height: 70dvh; overflow: auto; }
.dlg-actions { display: flex; gap: 0.6rem; justify-content: flex-end; align-items: center; padding: 1rem 1.5rem 1.3rem; flex-wrap: wrap; }
.dlg-actions .hint { margin: 0 auto 0 0; }
.dlg h2 { font-family: var(--serif); color: var(--brass-hi); margin: 0 0 0.8rem; font-weight: 600; }
.prose { line-height: 1.55; font-size: 0.95rem; }
.prose h3 { font-family: var(--serif); color: var(--brass-hi); font-weight: 600; margin: 1.2rem 0 0.3rem; font-size: 1.1rem; }
.prose p, .prose ul { margin: 0.3rem 0; max-width: 68ch; }
.prose li { margin: 0.2rem 0; }
.mini { border-collapse: collapse; font-size: 0.88rem; margin: 0.5rem 0; }
.mini th, .mini td { border-bottom: 1px solid rgba(201, 162, 74, 0.3); padding: 0.3rem 0.6rem; text-align: left; }

.dlg-paper { background: var(--paper); color: var(--ink); border-color: #b9ad8a; }
.dlg-paper h2 { color: var(--ink); }
.dlg-paper .hint { color: #5a5e70; }
.dlg-paper .btn-ghost { color: var(--ink); border-color: #a99d7c; }
.result-head { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 0.8rem; }
.result-head .suit-tile { width: 52px; height: 52px; }
.result-head .suit-tile svg { width: 32px; height: 32px; }
.verdict { font-family: var(--serif); font-size: 1.6rem; font-weight: 700; margin: 0; }
.verdict.nat { color: #b03a3a; }
.verdict.pit { color: #8a6a26; }
.result-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; margin: 0.4rem 0 0.6rem; }
.result-table th, .result-table td { padding: 0.45rem 0.5rem; border-bottom: 1px solid #d9d4c0; text-align: right; }
.result-table th:first-child, .result-table td:first-child { text-align: left; }
.result-table .award { font-family: var(--hand); font-size: 1.25rem; color: var(--ink); }
.result-table tr.mine td { background: rgba(201, 162, 74, 0.18); }
.end-score { font-family: var(--hand); font-size: 1.6rem; }
#end-board { padding: 0 1.5rem; --hg-accent: #8a6a26; --hg-bg: transparent; --hg-fg: var(--ink); --hg-border: #d0c7a8; --hg-input: #fff; }

.last-trick { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; margin: 0.5rem 0; }
.last-trick figure { margin: 0; text-align: center; font-size: 0.8rem; }
.last-trick figure.win figcaption { color: var(--glow); font-weight: 700; }
.last-trick figcaption { margin-top: 0.3rem; }

/* Chat */
.chat-drawer {
  position: fixed; right: 0; top: 0; bottom: 0; width: min(360px, 92vw);
  z-index: 60; background: #1f130b; border-left: 1px solid var(--brass);
  display: flex; flex-direction: column; box-shadow: -20px 0 50px rgba(0, 0, 0, 0.5);
}
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 0.7rem 0.9rem; font-family: var(--serif); color: var(--brass-hi); border-bottom: 1px solid rgba(201, 162, 74, 0.3); }
.chat-box { flex: 1; min-height: 0; padding: 0.6rem; --hg-accent: var(--brass); --hg-bg: transparent; --hg-fg: var(--ivory); --hg-border: rgba(201, 162, 74, 0.35); --hg-input: #1b100a; }

/* Klein scherm */
@media (max-width: 640px) {
  :root { --cw-base: clamp(44px, 14.5vw, 66px); }
  .trump-badge .who { display: none; }
  .rug { border-radius: 14px; box-shadow: inset 0 0 0 5px var(--rug-deep), inset 0 0 0 7px var(--brass), inset 0 0 0 11px var(--rug-blue), inset 0 0 0 12px var(--brass), inset 0 0 60px 20px rgba(0, 0, 0, 0.55); }
  .opp.pos-top { top: 16px; }
  .opp.pos-left { left: 14px; }
  .opp.pos-right { right: 14px; }
  .pos-left .backs, .pos-right .backs { display: none; }
  .plate-name { font-size: 0.75rem; padding-right: 0.5rem; }
  .plate-name .ava { width: 1.4rem; height: 1.4rem; }
  .pos-left .plate-name, .pos-right .plate-name { flex-direction: column; border-radius: 12px; padding: 0.35rem; gap: 0.2rem; }
  .table-wrap { padding: 0.4rem 0.4rem 0; }
}
@media (max-height: 560px) and (orientation: landscape) {
  /* Liggende telefoon: alles plat, spelers in de hoeken, naam naast de hand. */
  :root { --cw-base: clamp(36px, 13.5vh, 58px); }
  .bar { padding: 0.25rem 0.6rem; }
  .brand-mini { display: none; }
  .table-wrap { padding: 0.35rem 0.5rem 0; grid-template-columns: 1fr; }
  .scorepad { position: fixed; right: 10px; top: 44px; z-index: 40; transform: none; display: none; max-height: 80dvh; }
  .scorepad.open { display: block; }
  #btn-score { display: inline-block !important; }
  .rug { border-radius: 12px; box-shadow: inset 0 0 0 4px var(--rug-deep), inset 0 0 0 6px var(--brass), inset 0 0 0 9px var(--rug-blue), inset 0 0 0 10px var(--brass), inset 0 0 50px 16px rgba(0, 0, 0, 0.55); }
  .opp .backs { display: none; }
  .opp.pos-top { top: 12px; flex-direction: column; align-items: center; }
  .opp.pos-left, .n3 .opp.pos-left { left: 14px; top: 12px; transform: none; }
  .opp.pos-right, .n3 .opp.pos-right { right: 14px; left: auto; top: 12px; transform: none; }
  .plate-name { font-size: 0.75rem; }
  .plate-name .ava { width: 1.35rem; height: 1.35rem; }
  .trick, .n2 .trick { top: 56%; }
  .n2 .trick { top: 72%; }
  .opp .table-cards { --cw: calc(var(--cw-base) * 0.6); }
  .status { bottom: 8px; font-size: 0.8rem; }
  .center-panel { top: 54%; padding: 0.6rem 0.9rem 0.7rem; width: min(330px, calc(100% - 2rem)); }
  .center-panel h3 { font-size: 1rem; margin-bottom: 0.3rem; }
  .proposed { margin: 0.1rem 0 0.3rem; font-size: 1.1rem; }
  .center-panel .suit-tile { width: 44px; height: 44px; }
  .center-panel .suit-tile svg { width: 28px; height: 28px; }
  .center-panel .actions { margin-top: 0.4rem; }
  .bidlog { margin-top: 0.3rem; }
  .me-zone { flex-direction: row; justify-content: center; gap: 0.8rem; padding: 0.3rem 0.6rem calc(0.3rem + env(safe-area-inset-bottom)); }
  .me-zone .table-cards { margin: 0; }
  .hand { padding-top: 12px; min-height: calc(var(--ch) + 12px); }
  #me-plate { order: -1; margin: 0; }
  #me-plate .tags .chip:not(.gaat) { display: none; }
  .dlg-body { max-height: 60dvh; padding: 0.9rem 1.1rem 0.2rem; }
  .dlg-actions { padding: 0.6rem 1.1rem 0.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
}
