:root {
  --line: rgba(255, 255, 255, 0.1);
  --ink: #f4efdf;
  --muted: #a8c0b1;
  --gold: #e8b84a;
  --gold-2: #f7d47c;
  --danger: #ea5a54;
  --good: #63d391;
  --warn: #ff9f3d;
  --card-face: #fffdf6;
  --card-ink: #1c1d22;
  --card-red: #c4162d;
  --cw: 80px;
  --ch: 114px;
  --fw: 36px;          /* opponents' card backs */
  --fh: 51px;
  --seat-pad: 84px;    /* keeps seats from hanging off the sides */
  color-scheme: dark;
}

/* ---------- table themes (any player can switch them) ---------- */
body, body[data-bg="green"], [data-theme="green"] {
  --felt-1: #1f8a55; --felt-2: #12623c; --felt-3: #0a4128;
  --room-1: #17402c; --room-2: #06140d;
  --rim-1: #7a4d27; --rim-2: #3d2412;
}
body[data-bg="blue"], [data-theme="blue"] {
  --felt-1: #2f76d0; --felt-2: #1c4f99; --felt-3: #0f2f61;
  --room-1: #172a48; --room-2: #070d1a;
  --rim-1: #7a4d27; --rim-2: #3d2412;
}
body[data-bg="red"], [data-theme="red"] {
  --felt-1: #bf3640; --felt-2: #8a2028; --felt-3: #561217;
  --room-1: #351618; --room-2: #120607;
  --rim-1: #7a4d27; --rim-2: #3d2412;
}
body[data-bg="purple"], [data-theme="purple"] {
  --felt-1: #8146c0; --felt-2: #582c8b; --felt-3: #351955;
  --room-1: #2a1838; --room-2: #0d0713;
  --rim-1: #7a4d27; --rim-2: #3d2412;
}
body[data-bg="teal"], [data-theme="teal"] {
  --felt-1: #1db0a7; --felt-2: #107a73; --felt-3: #084a46;
  --room-1: #123433; --room-2: #051212;
  --rim-1: #7a4d27; --rim-2: #3d2412;
}
body[data-bg="charcoal"], [data-theme="charcoal"] {
  --felt-1: #555b64; --felt-2: #383c43; --felt-3: #202327;
  --room-1: #222428; --room-2: #0a0b0c;
  --rim-1: #34302c; --rim-2: #141210;
}
body[data-bg="wood"], [data-theme="wood"] {
  --felt-1: #b07a45; --felt-2: #85582c; --felt-3: #573817;
  --room-1: #33241a; --room-2: #110b06;
  --rim-1: #3e2814; --rim-2: #1b1108;
}
body[data-bg="night"], [data-theme="night"] {
  --felt-1: #2c3870; --felt-2: #1a2147; --felt-3: #0b0f24;
  --room-1: #121838; --room-2: #03040b;
  --rim-1: #4b4f6e; --rim-2: #1d1f33;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(120% 90% at 50% 40%, var(--room-1) 0%, var(--room-2) 100%) fixed, var(--room-2);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  transition: background-color 0.4s;
}
body[data-bg="night"] {
  background:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 72% 12%, #fff9 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 88% 64%, #fff7 50%, transparent 51%),
    radial-gradient(1px 1px at 32% 82%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 55% 40%, #fff6 50%, transparent 51%),
    radial-gradient(120% 90% at 50% 40%, var(--room-1) 0%, var(--room-2) 100%) fixed;
  background-size: 260px 260px, 330px 330px, 290px 290px, 370px 370px, 210px 210px, auto;
}
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

/* ---------- buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer; font-weight: 600; white-space: nowrap;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.14); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  border-color: #b98a22; color: #2a1d02;
}
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #ffe39b, #efc35b); }
.btn.ghost { background: transparent; }
.btn.danger { background: rgba(234, 90, 84, 0.16); border-color: rgba(234, 90, 84, 0.55); color: #ffd2cf; }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.sm { min-height: 32px; padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn.big { min-height: 50px; font-size: 17px; }
.home-links { display: flex; justify-content: center; gap: 18px; }
.link-btn {
  background: none; border: none; color: var(--gold-2); cursor: pointer;
  padding: 6px 4px; text-decoration: underline; text-underline-offset: 3px;
}
.icon-btn {
  background: none; border: 1px solid transparent; border-radius: 8px; cursor: pointer;
  color: var(--muted); width: 32px; height: 32px; font-size: 16px;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line); }
input {
  width: 100%; min-height: 46px; padding: 10px 14px;
  background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 10px;
  outline: none;
}
input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232, 184, 74, 0.25); }
.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }

.panel {
  background: linear-gradient(180deg, rgba(24, 36, 30, 0.97), rgba(12, 18, 15, 0.98));
  border: 1px solid rgba(232, 184, 74, 0.28);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

/* ---------- views ---------- */
.view { min-height: 100dvh; }
.center-view { display: grid; place-items: center; padding: 24px 16px; }
.spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.15); border-top-color: var(--gold);
  animation: spin 0.9s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* home */
.home-card { width: min(420px, 100%); padding: 28px 24px 18px; display: grid; gap: 16px; text-align: center; }
.logo h1 {
  margin: 4px 0 0; font: 700 52px/1 Georgia, "Times New Roman", serif; letter-spacing: 0.04em;
  color: var(--gold-2); text-shadow: 0 2px 0 #6b4a0b, 0 8px 24px rgba(0, 0, 0, 0.4);
}
.tagline { margin: 8px 0 0; color: var(--muted); }
.logo-fan { position: relative; height: 112px; display: flex; justify-content: center; align-items: flex-end; }
.logo-fan .card { --cw: 62px; --ch: 88px; margin: 0 -10px; transform: rotate(var(--rot)); transform-origin: 50% 120%; }
.home-card .field { text-align: left; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.join-row { display: flex; gap: 8px; }
.join-row input { text-transform: uppercase; letter-spacing: 0.3em; text-align: center; font-weight: 700; }
.join-row .btn { min-width: 88px; }

/* lobby */
.lobby-card { width: min(520px, 100%); padding: 24px; display: grid; gap: 14px; }
.lobby-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.room-code { font: 700 44px/1.05 Georgia, serif; letter-spacing: 0.18em; color: var(--gold-2); }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.hint code { color: var(--ink); background: rgba(0, 0, 0, 0.3); padding: 1px 6px; border-radius: 6px; user-select: all; }
/* chat: docked in the table's bottom-left corner, growing with its messages */
.chat {
  position: absolute; left: 10px; bottom: 8px; z-index: 4;
  width: clamp(190px, 24vw, 270px); max-height: 46%;
  display: flex; flex-direction: column; gap: 5px; padding: 6px;
  background: rgba(6, 10, 8, 0.6); border: 1px solid var(--line); border-radius: 12px;
  backdrop-filter: blur(2px);
}
.chat-log {
  list-style: none; margin: 0; padding: 2px 4px; flex: 0 1 auto; min-height: 0; overflow-y: auto;
  font-size: 13px; display: flex; flex-direction: column; gap: 3px;
}
.chat-log li { line-height: 1.3; overflow-wrap: anywhere; }
.chat-log li b { margin-right: 5px; }
.chat-log li.mine b { color: var(--gold-2) !important; }
.chat-log .empty { color: var(--muted); font-style: italic; }
/* After a while without messages the table chat fades to just its input bar.
   Hovering it, typing, or a new message brings the messages back. */
.chat { transition: background-color 0.8s, border-color 0.8s, backdrop-filter 0.8s; }
.chat .chat-log { transition: opacity 0.2s; }
.chat.quiet { background-color: transparent; border-color: transparent; backdrop-filter: blur(0); pointer-events: none; }
.chat.quiet .chat-log { opacity: 0; visibility: hidden; transition: opacity 0.8s, visibility 0s linear 0.8s; }
.chat.quiet .chat-form { pointer-events: auto; }
.chat.quiet:hover, .chat.quiet:focus-within {
  background-color: rgba(6, 10, 8, 0.6); border-color: var(--line); backdrop-filter: blur(2px);
  pointer-events: auto; transition-duration: 0.2s;
}
.chat.quiet:hover .chat-log, .chat.quiet:focus-within .chat-log { opacity: 1; visibility: visible; transition: opacity 0.2s; }
.chat-form { display: flex; gap: 5px; }
.chat-form input { min-height: 30px; padding: 4px 8px; font-size: 13px; border-radius: 8px; }
.chat-form .btn.sm { min-height: 30px; padding: 2px 10px; }
.lobby-chat { display: grid; gap: 6px; }
.lobby-chat .chat-log {
  min-height: 44px; max-height: 150px; padding: 6px 8px; background: rgba(0, 0, 0, 0.25); border-radius: 10px;
}
.bubble.talk { font-weight: 600; font-size: 13px; line-height: 1.3; white-space: normal; text-align: center; overflow-wrap: anywhere; }
.bubble.suit { font-size: 17px; }
.bubble.suit.red { color: var(--card-red); }

/* music */
.music-ctl { position: relative; display: flex; align-items: center; gap: 2px; }
.music-ctl input[type="range"] {
  width: 84px; min-height: 0; height: 20px; padding: 0; margin: 0 4px 0 0;
  background: transparent; border: none; box-shadow: none; accent-color: var(--gold); cursor: pointer;
}
.music-ctl input[type="range"]:focus { box-shadow: none; }
.music-ctl.muted .ico { opacity: 0.5; }
.music-fab {
  position: fixed; top: 12px; right: 12px; z-index: 40; padding: 3px 6px 3px 3px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(255, 255, 255, 0.2);
}
.music-fab button {
  width: 34px; height: 34px; border-radius: 50%; border: none; background: none; cursor: pointer; font-size: 17px; padding: 0;
}

/* card art */
.deck-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.card .sg { display: block; fill: currentColor; flex: none; }
.card .ix .sg { width: calc(var(--cw) * 0.2); height: calc(var(--cw) * 0.2); margin-top: calc(var(--cw) * 0.015); }
/* Picture cards: the corner index (rank and suit) sits over the picture frame on a patch of the card's own
   face, so the suit is never hidden behind the art, even when only the card's corner shows in your hand. */
.card.pic-card .ix {
  z-index: 2; background: inherit; padding: calc(var(--cw) * 0.025) calc(var(--cw) * 0.03) calc(var(--cw) * 0.04);
  margin: calc(var(--cw) * -0.025) calc(var(--cw) * -0.03) 0; border-radius: calc(var(--cw) * 0.06);
}
.card.pic-card .fx { left: 6%; transform: none; font-size: calc(var(--cw) * 0.095); letter-spacing: 0; padding: 2px 4px; }
.card.mini.pic-card .ix:not(.br) { display: flex; top: 2px; left: 2px; font-size: 10px; padding: 1px 2px 2px; margin: 0; }
.card.mini.pic-card .ix .sg { width: 10px; height: 10px; margin-top: 1px; }
.card .mid .sg { width: calc(var(--cw) * 0.3); height: calc(var(--cw) * 0.3); margin-top: calc(var(--cw) * 0.04); }
.card .mid.ace .sg { width: calc(var(--cw) * 0.62); height: calc(var(--cw) * 0.62); margin: 0; }
.card .mid.pic { inset: 17% 14%; display: block; border-radius: calc(var(--cw) * 0.05); overflow: hidden; }
.card .mid.pic svg { display: block; width: 100%; height: 100%; }
.card.mini .mid .sg { width: 14px; height: 14px; }
.card .mid.ace b { display: none; }
/* mini cards have no corner index, so an ace shows its "A" like the number cards do */
.card.mini .mid.ace b { display: block; }
.card.mini .mid.ace .sg { width: 14px; height: 14px; margin-top: calc(var(--cw) * 0.04); }
.card.mini .mid.pic { inset: 7%; }
.lp-deck { --cw: 18px; --ch: 26px; border-width: 1.5px !important; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
.settings { display: grid; gap: 6px; }
.setting { display: grid; gap: 6px; padding: 8px 10px; border-radius: 10px; background: rgba(0, 0, 0, 0.2); }
.setting > label { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.setting input[type="checkbox"] { flex: none; width: 18px; height: 18px; min-height: 0; padding: 0; margin: 2px 0 0; accent-color: var(--gold); cursor: pointer; }
.setting input:disabled, .setting select:disabled { cursor: not-allowed; }
.setting > label > span { display: grid; gap: 1px; }
.setting small { color: var(--muted); font-size: 12px; }
.setting.off { opacity: 0.5; }
.setting-num { display: flex; align-items: center; gap: 6px; margin-left: 28px; font-size: 13px; color: var(--muted); }
.setting-num.off { opacity: 0.5; }
.setting-num select { width: auto; min-height: 28px; padding: 2px 8px; font-size: 13px; border-radius: 8px; }
.settings-group { margin-top: 6px; }
.modal-panel .settings { margin-top: 10px; }
.modal-panel .settings > .eyebrow:first-child { display: none; }
.lobby-deck { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.lobby-deck b { color: var(--ink); }
.lobby-deck .btn { margin-left: auto; }
.deck-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 14px; }
.deck-tile {
  display: grid; gap: 6px; justify-items: center; padding: 8px 8px 10px; border-radius: 14px; cursor: pointer;
  background: rgba(255, 255, 255, 0.05); border: 2px solid transparent; font-weight: 700; font-size: 14px;
}
.deck-tile:hover { border-color: rgba(255, 255, 255, 0.3); }
.deck-tile.current { border-color: var(--gold-2); background: rgba(247, 212, 124, 0.1); }
.deck-preview { display: flex; justify-content: center; padding: 10px 0 4px; }
.deck-preview .card { --cw: 46px; --ch: 66px; margin: 0 -7px; transform-origin: 50% 120%; }
.deck-preview .card:nth-child(1) { transform: rotate(-14deg); }
.deck-preview .card:nth-child(2) { transform: rotate(-7deg); }
.deck-preview .card:nth-child(4) { transform: rotate(7deg); }
.deck-preview .card:nth-child(5) { transform: rotate(14deg); }
.deck-preview .card .fx { display: none; }
.suit-pick button .sg { display: block; width: 52px; height: 52px; fill: currentColor; }

.invite-note { margin: 0; padding: 10px 12px; border-radius: 12px; background: rgba(232, 184, 74, 0.14); color: var(--gold-2); font-weight: 600; }
.home-card.invited #create-btn, .home-card.invited .or { display: none; }
.lobby-sub { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.lobby-players { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lp { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(0, 0, 0, 0.2); }
.lp-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-name em { font-weight: 400; color: var(--muted); font-style: normal; }
.lobby-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.lobby-actions .btn { flex: 1; }
.lobby-actions .waiting { flex: 1; text-align: center; color: var(--muted); padding: 10px; }
.lobby-foot { display: flex; justify-content: space-between; }

.avatar {
  --hue: 140;
  position: relative; flex: none;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700;
  background: hsl(var(--hue) 45% 38%); border: 2px solid hsl(var(--hue) 60% 62%);
  color: #fff; text-transform: uppercase;
}
.tag {
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 1px 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); color: var(--muted); white-space: nowrap;
}
.tag.host { background: rgba(232, 184, 74, 0.18); color: var(--gold-2); }
.tag.bot { background: rgba(120, 170, 255, 0.16); color: #a9c6ff; }
.tag.off { background: rgba(234, 90, 84, 0.18); color: #ffb0ab; }
/* the dealer button: a "D" puck on the felt that slides to the next dealer each round */
.dealer-btn {
  position: absolute; left: 0; top: 0; z-index: 3; width: 30px; height: 30px; margin: -15px 0 0 -15px;
  border-radius: 50%; display: grid; place-items: center; pointer-events: auto; cursor: default;
  font: 800 15px/1 Georgia, serif; color: #2b1d0e;
  background: radial-gradient(circle at 35% 30%, #ffffff, #f3e9cc 55%, #d9c690);
  border: 2px solid #b8963e; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45), inset 0 0 0 3px rgba(255, 255, 255, 0.55);
}
/* cards flying out during the deal */
.card.flying-card { position: fixed; left: 0; top: 0; z-index: 45; pointer-events: none; margin: 0; }
.card.flying-card.small { --cw: var(--fw); --ch: var(--fh); }

/* ---------- game layout ---------- */
#game { height: 100dvh; display: grid; grid-template-rows: auto 1fr; grid-template-columns: minmax(0, 1fr) auto; }
#game .topbar { grid-column: 1 / -1; }
@media (min-width: 1100px) {
  #game { grid-template-columns: minmax(0, 1fr) auto 280px; }
}
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 8px 16px;
  background: rgba(0, 0, 0, 0.3); border-bottom: 1px solid var(--line);
}
.brand { font: 700 22px/1 Georgia, serif; color: var(--gold-2); letter-spacing: 0.04em; }
.top-meta { flex: 1; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-meta b { color: var(--ink); letter-spacing: 0.1em; }
.sep { margin: 0 6px; }
.top-actions { display: flex; gap: 4px; }
.top-actions .ico { font-size: 15px; line-height: 1; }

.board { position: relative; display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }

/* the table: an oval of felt with everyone seated around the rim */
.table-wrap { position: relative; flex: 1; min-height: 330px; }
.felt {
  position: absolute; left: 6%; right: 6%; top: 11%; bottom: 3%;
  border-radius: 50%; padding: 12px;
  background: linear-gradient(160deg, var(--rim-1), var(--rim-2));
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.55), inset 0 2px 1px rgba(255, 255, 255, 0.18), inset 0 -3px 6px rgba(0, 0, 0, 0.4);
}
.felt-inner {
  width: 100%; height: 100%; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 42%, var(--felt-1) 0%, var(--felt-2) 58%, var(--felt-3) 100%);
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.5), inset 0 0 0 2px rgba(255, 255, 255, 0.06);
  transition: background 0.4s;
}
body[data-bg="wood"] .felt-inner {
  background:
    repeating-linear-gradient(92deg, rgba(0, 0, 0, 0.07) 0 3px, transparent 3px 11px, rgba(255, 255, 255, 0.04) 11px 13px, transparent 13px 24px),
    radial-gradient(ellipse at 50% 42%, var(--felt-1) 0%, var(--felt-2) 58%, var(--felt-3) 100%);
}

.seats { position: absolute; inset: 0; pointer-events: none; }
.seat-spot { position: absolute; width: 0; height: 0; pointer-events: none; }
.seat-spot > * { pointer-events: auto; }
/* --fs shrinks the fans a little when the table is crowded (set in renderSeats) */
.fan { position: absolute; left: 0; top: 0; width: calc(var(--fw) * var(--fs, 1)); height: calc(var(--fh) * var(--fs, 1)); pointer-events: none; }
.fan .card {
  --cw: calc(var(--fw) * var(--fs, 1)); --ch: calc(var(--fh) * var(--fs, 1));
  position: absolute; left: 0; top: 0; border-width: 2px;
  transform: rotate(var(--a)); transform-origin: 50% -70%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  transition: transform 0.25s;
}
.plate {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); z-index: 2;
  display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px;
  border-radius: 999px; background: rgba(8, 12, 10, 0.78); border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  white-space: nowrap; transition: border-color 0.2s, box-shadow 0.2s;
}
.plate.turn { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232, 184, 74, 0.25), 0 0 26px rgba(232, 184, 74, 0.45); }
.plate.offline { opacity: 0.6; }
.plate-body { display: grid; gap: 1px; min-width: 0; }
.plate-name { display: flex; align-items: center; gap: 5px; font-weight: 700; font-size: 14px; }
.plate-name .nm { overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.plate-meta { font-size: 12px; color: var(--muted); }
.plate-meta b { color: var(--ink); }
.plate .btn.sm { min-height: 24px; font-size: 11px; padding: 2px 8px; }
.kick-btn {
  position: absolute; top: -8px; left: -8px; width: 20px; height: 20px; border-radius: 50%; padding: 0; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(20, 20, 20, 0.9); color: #ffb0ab; font-size: 10px; line-height: 1;
  opacity: 0.55; transition: opacity 0.15s, background 0.15s;
}
.kick-btn:hover { opacity: 1; background: var(--danger); color: #fff; }
.call-badge {
  position: absolute; top: -9px; right: -6px; font-size: 10px; font-weight: 800; letter-spacing: 0.04em;
  text-transform: uppercase; padding: 1px 6px; border-radius: 999px; background: var(--warn); color: #2a1300;
}
.bubble {
  position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  /* sized to the text (not squeezed to the width of the seat), wrapping only past max-width */
  width: max-content; max-width: min(230px, 70vw);
  background: #fff; color: #1b1b1b; font-weight: 900; font-size: 16px; padding: 5px 12px; border-radius: 14px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4); white-space: nowrap; z-index: 5;
  animation: bubble-in 0.3s cubic-bezier(0.2, 1.6, 0.4, 1) backwards;
}
.bubble::after {
  content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 7px solid transparent; border-top-color: #fff;
}
.bubble.alarm { background: var(--warn); color: #2a1300; }
.bubble.alarm::after { border-top-color: var(--warn); }
.bubble.settled { animation: none; }
@keyframes bubble-in { from { transform: translateX(-50%) scale(0.3); opacity: 0; } }
.seat-actions {
  position: absolute; left: 50%; top: calc(100% + 5px); transform: translateX(-50%); z-index: 3;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.callout-btn, .tvekan-btn {
  border: 2px solid #fff; border-radius: 999px; padding: 3px 10px; cursor: pointer;
  background: var(--danger); color: #fff; font-weight: 800; font-size: 12px; white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); animation: pulse-s 0.8s ease-in-out infinite;
}
.callout-btn.quiet { animation: none; background: rgba(20, 20, 20, 0.85); border-color: rgba(255, 255, 255, 0.4); color: #ffb0ab; }
.callout-btn.quiet:hover { background: var(--danger); color: #fff; }
.tvekan-btn { background: #6a4bd8; animation-duration: 0.6s; }
@keyframes pulse-s { 50% { transform: scale(1.12); } }

.center {
  position: absolute; left: 50%; top: 55%; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: clamp(14px, 3.5vw, 40px); z-index: 1;
}
.pile { position: relative; width: var(--cw); height: var(--ch); background: none; border: none; padding: 0; }
.pile-slot { position: absolute; inset: 0; border-radius: calc(var(--cw) * 0.1); border: 2px dashed rgba(255, 255, 255, 0.2); }
.draw-pile { cursor: default; }
.draw-pile .card { position: absolute; left: 0; top: 0; }
.draw-pile .card:nth-child(2) { transform: translate(-2px, -2px); }
.draw-pile .card:nth-child(3) { transform: translate(-4px, -4px); }
.draw-pile.active { cursor: pointer; }
.draw-pile.active .card:last-of-type { box-shadow: 0 0 0 3px var(--gold), 0 8px 22px rgba(0, 0, 0, 0.45); }
.draw-pile.active:hover .card:last-of-type { transform: translate(-4px, -8px); }
.pile-label {
  position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  font-size: 12px; color: rgba(255, 255, 255, 0.75); white-space: nowrap; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
.draw-pile.active .pile-label { color: var(--gold-2); font-weight: 700; font-size: 13px; }
.discard-pile .card { position: absolute; left: 0; top: 0; transform: rotate(var(--rot, 0deg)); }
.discard-pile .card.under { filter: brightness(0.9); }
.discard-pile .card.fresh { animation: drop 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
@keyframes drop {
  from { transform: translateY(-50px) scale(1.18) rotate(calc(var(--rot, 0deg) - 12deg)); opacity: 0; }
  to { transform: rotate(var(--rot, 0deg)); opacity: 1; }
}
.pending-badge {
  position: absolute; top: -14px; right: -18px; z-index: 5;
  background: var(--danger); color: #fff; font-weight: 800; font-size: 18px;
  padding: 4px 10px; border-radius: 999px; border: 2px solid #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(1.12); } }

.table-info { display: grid; gap: 8px; justify-items: center; min-width: 64px; }
.suit-ind {
  width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center;
  background: var(--card-face); color: var(--card-ink); font-size: 34px; line-height: 1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35), inset 0 0 0 3px rgba(0, 0, 0, 0.08);
}
.suit-ind.red { color: var(--card-red); }
.suit-ind.changed { box-shadow: 0 0 0 4px var(--gold), 0 4px 18px rgba(232, 184, 74, 0.5); }
.info-label { font-size: 12px; color: rgba(255, 255, 255, 0.75); text-align: center; line-height: 1.25; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.dir-pill { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.3); color: rgba(255, 255, 255, 0.8); white-space: nowrap; }
.dir-pill b { font-size: 15px; display: inline-block; animation: spin 2.4s linear infinite; }
.dir-pill.ccw b { animation-direction: reverse; }

/* turn-order chevrons flowing round the felt */
.flow { position: absolute; pointer-events: none; overflow: visible; opacity: 0; transition: opacity 0.9s ease-out; }
.flow.show { opacity: 1; transition-duration: 0.3s; }
.flow.show .chev { opacity: 0.9; }

/* the turn passing from one player to the next */
.pass { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 1; }
.pass .head { fill: #fff3c4; filter: drop-shadow(0 0 6px #ffd23f) drop-shadow(0 0 12px #ffb347); }
.pass .tail { fill: #ffd23f; }
.pass .ping { fill: none; stroke: #ffe14d; stroke-width: 3; animation: ping 0.6s ease-out forwards; transform-box: fill-box; transform-origin: center; }
@keyframes ping { from { transform: scale(0.4); opacity: 1; } to { transform: scale(3); opacity: 0; } }
.flow-track { fill: none; stroke: rgba(255, 255, 255, 0.07); stroke-width: 2; stroke-dasharray: 2 10; stroke-linecap: round; }
.flow .chev {
  fill: none; stroke: var(--gold-2); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0.5;
  filter: drop-shadow(0 0 3px rgba(247, 212, 124, 0.7));
}
.flow.show { animation: flow-pop 0.6s ease-out; }
@keyframes flow-pop { 0% { transform: scale(0.94); } 40% { transform: scale(1.03); } 100% { transform: none; } }

.banner-wrap {
  position: absolute; left: 0; right: 0; top: calc(55% - var(--ch) / 2 - 56px);
  display: flex; justify-content: center; pointer-events: none; z-index: 20;
}
.banner {
  opacity: 0; transform: translateY(-8px) scale(0.96);
  background: rgba(8, 14, 11, 0.92); border: 1px solid rgba(232, 184, 74, 0.5);
  padding: 7px 16px; border-radius: 999px; font-weight: 700; font-size: 15px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4); transition: opacity 0.2s, transform 0.2s;
}
.banner.show { opacity: 1; transform: none; }
.banner.bad { border-color: var(--danger); color: #ffd2cf; }
.banner.good { border-color: var(--good); color: #d4ffe4; }
.banner.warn { border-color: var(--warn); color: #ffe1c2; }

.status { text-align: center; min-height: 24px; padding: 2px 16px; color: var(--muted); font-size: 15px; }
.status.mine { color: var(--ink); }
.status b { color: var(--gold-2); }
.status .warn-text { color: var(--warn); }

.me-bar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  width: 100%; max-width: 980px; margin: 2px auto 0; padding: 4px 16px;
}
.me-info { position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; justify-self: start; padding: 4px 10px 4px 4px; border-radius: 999px; }
.me-info .plate-meta { font-size: 13px; }
.me-info.turn .avatar { box-shadow: 0 0 0 3px var(--gold), 0 0 18px rgba(232, 184, 74, 0.6); }
.me-info .bubble { left: 0; transform: none; animation-name: bubble-in-left; }
.me-info .bubble::after { left: 18px; }
@keyframes bubble-in-left { from { transform: scale(0.3); opacity: 0; } }
.me-tools { justify-self: end; }
.calls { display: flex; align-items: center; gap: 10px; }
.call-btn {
  min-height: 40px; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  font: 800 15px/1 system-ui, sans-serif; letter-spacing: 0.02em;
  color: #2a1300; background: linear-gradient(180deg, #ffc27a, var(--warn));
  border: 2px solid #ffe0b8; box-shadow: 0 4px 0 #9a4f06, 0 6px 14px rgba(0, 0, 0, 0.35);
  transition: transform 0.08s, box-shadow 0.08s, filter 0.2s;
}
.call-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #9a4f06; }
.call-btn:disabled { filter: grayscale(0.9) brightness(0.55); cursor: not-allowed; box-shadow: 0 2px 0 #333; }
.call-btn.urgent { animation: call-glow 0.7s ease-in-out infinite; }
.call-btn.done { filter: none; background: rgba(99, 211, 145, 0.18); color: #c8f5d9; border-color: rgba(99, 211, 145, 0.6); box-shadow: none; }
@keyframes call-glow { 50% { box-shadow: 0 4px 0 #9a4f06, 0 0 0 5px rgba(255, 159, 61, 0.45), 0 0 26px rgba(255, 159, 61, 0.9); } }
.gabon-btn {
  min-width: 150px; height: 54px; padding: 0 24px; border-radius: 999px; cursor: pointer;
  font: 800 22px/1 Georgia, serif; letter-spacing: 0.06em; text-transform: uppercase;
  color: #fff; background: radial-gradient(circle at 50% 30%, #ff6b5e, #c11f2c 70%);
  border: 3px solid var(--gold-2);
  box-shadow: 0 6px 0 #7b0f18, 0 10px 24px rgba(0, 0, 0, 0.45);
  transition: transform 0.08s, box-shadow 0.08s, filter 0.2s;
}
.gabon-btn:not(:disabled) { animation: gabon-glow 0.9s ease-in-out infinite; }
@keyframes gabon-glow {
  50% { box-shadow: 0 6px 0 #7b0f18, 0 0 0 6px rgba(247, 212, 124, 0.45), 0 0 36px rgba(255, 107, 94, 0.85); }
}
.gabon-btn:hover:not(:disabled) { filter: brightness(1.08); }
.gabon-btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 #7b0f18, 0 6px 14px rgba(0, 0, 0, 0.4); }
.gabon-btn:disabled { filter: grayscale(0.9) brightness(0.6); cursor: not-allowed; box-shadow: 0 3px 0 #333; }
.gabon-btn.hard { animation: none; } /* hardcore: always pressable, so it mustn't glow */

.hand {
  position: relative; display: flex; justify-content: center; align-items: flex-end;
  padding: 20px 8px calc(14px + env(safe-area-inset-bottom));
  min-height: calc(var(--ch) + 36px);
}
.hand .card { transition: transform 0.15s, filter 0.15s, box-shadow 0.15s; animation: deal 0.3s ease-out backwards; animation-delay: calc(var(--i, 0) * 40ms); }
.hand .card:not(.new) { animation: none; }
.hand .card.undealt { visibility: hidden; }
.hand .card + .card { margin-left: var(--step, 6px); }
.hand-note { margin: 0 0 30px; color: var(--muted); font-size: 15px; }
.hand.my-turn .card.playable { cursor: pointer; transform: translateY(-10px); box-shadow: 0 0 0 2px var(--gold), 0 10px 22px rgba(0, 0, 0, 0.45); }
.hand.my-turn .card.playable:hover, .hand.my-turn .card.playable:focus-visible { transform: translateY(-22px); outline: none; z-index: 2; }
.hand.my-turn .card.dim { filter: brightness(0.62) saturate(0.7); }
/* mellanlägg: a card you could throw in out of turn */
.hand .card.throwable { cursor: pointer; transform: translateY(-6px); box-shadow: 0 0 0 2px #b9a4ff, 0 0 16px rgba(160, 130, 255, 0.7); }
.hand .card.throwable:hover, .hand .card.throwable:focus-visible { transform: translateY(-18px); outline: none; z-index: 2; }
.hand.no-hints .card { cursor: pointer; }
.hand.no-hints .card:hover { transform: translateY(-8px); }
@keyframes deal { from { transform: translateY(40px) scale(0.9); opacity: 0; } }

/* side panel */
.side { display: none; }
@media (min-width: 1100px) {
  .side {
    display: flex; flex-direction: column; min-height: 0; padding: 12px 14px;
    background: rgba(0, 0, 0, 0.25); border-left: 1px solid var(--line);
  }
}
.side h3 { margin: 6px 0 8px; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.score-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 6px 0; font-size: 14px; }
.score-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-row .pts { font-weight: 700; font-variant-numeric: tabular-nums; }
.bar { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--good), var(--gold), var(--danger)); background-size: 280px 100%; }
.log { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; font-size: 13px; }
.log li { padding: 5px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); color: var(--muted); }
.log li b { color: var(--ink); }
.log li.hl { color: var(--gold-2); }

/* ---------- sticker tray ---------- */
.stickers {
  display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 0;
  width: 104px; padding: 8px 6px; background: rgba(0, 0, 0, 0.25); border-left: 1px solid var(--line);
}
.stickers.closed { width: 44px; }
.stickers.closed .sticker-grid, .stickers.closed .sticker-hint, .stickers.closed .sticker-count, .stickers.closed .lbl { display: none; }
.sticker-toggle {
  display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%;
  background: none; border: 1px solid transparent; border-radius: 10px; padding: 4px 2px; cursor: pointer;
  font-size: 11px; color: var(--muted);
}
.sticker-toggle:hover { border-color: var(--line); color: var(--ink); }
.sticker-toggle .ico { font-size: 22px; line-height: 1; }
.sticker-grid {
  display: grid; grid-template-columns: repeat(2, 42px); gap: 4px; overflow-y: auto; min-height: 0; padding: 2px;
}
.sticker-btn {
  width: 42px; height: 42px; border-radius: 10px; border: 2px solid transparent; cursor: pointer;
  background: rgba(255, 255, 255, 0.06); font-size: 24px; line-height: 1; padding: 0;
  display: grid; place-items: center; transition: transform 0.1s, background 0.15s;
}
.sticker-btn:hover { transform: scale(1.12) rotate(-6deg); background: rgba(255, 255, 255, 0.12); }
.sticker-btn.word { font: 900 13px/1 system-ui, sans-serif; color: #2a2200; background: #ffe14d; }
.sticker-btn.sel { border-color: var(--gold-2); background: rgba(247, 212, 124, 0.22); }
.sticker-btn.peel { grid-column: 1 / -1; width: auto; font-size: 13px; font-weight: 700; gap: 4px; display: flex; justify-content: center; }
.sticker-hint { margin: 0; font-size: 11px; color: var(--muted); text-align: center; line-height: 1.3; }
.sticker-count {
  margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 10px;
  font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.sticker-count b { color: var(--ink); }

body.sticking, body.sticking * { cursor: var(--sticker-cursor, copy) !important; }
.sticker {
  position: absolute; z-index: 6; pointer-events: none; user-select: none;
  transform: translate(-50%, -50%) rotate(var(--r, 0deg));
  font-size: 30px; line-height: 1; white-space: nowrap;
  filter: drop-shadow(1.5px 0 0 #fff) drop-shadow(-1.5px 0 0 #fff) drop-shadow(0 1.5px 0 #fff) drop-shadow(0 -1.5px 0 #fff) drop-shadow(0 3px 4px rgba(0, 0, 0, 0.45));
}
.sticker.word {
  font: 900 16px/1 system-ui, sans-serif; color: #2a2200; background: #ffe14d; padding: 3px 8px; border-radius: 8px;
}
.card .sticker { font-size: calc(var(--cw) * 0.42); }
.card .sticker.word { font-size: calc(var(--cw) * 0.18); }
.table-wrap > .sticker { font-size: 46px; z-index: 0; }
.table-wrap > .sticker.word { font-size: 22px; }
.plate .sticker, .me-info .sticker { font-size: 24px; }
.sticker.slap { animation: slap 0.4s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes slap { from { transform: translate(-50%, -50%) rotate(var(--r, 0deg)) scale(2.8); opacity: 0; } }
body.gunning, body.gunning * { cursor: crosshair !important; }
body.gunning { touch-action: none; user-select: none; -webkit-user-select: none; }
.muzzle {
  position: fixed; z-index: 99; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%; pointer-events: none;
  border: 3px solid #ffe14d; box-shadow: 0 0 12px #ffb347; animation: muzzle 0.3s ease-out forwards;
}
@keyframes muzzle { from { transform: scale(0.2); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
body.peeling .sticker { pointer-events: auto; cursor: pointer; }
body.peeling .sticker:hover { opacity: 0.6; }

/* ---------- cards ---------- */
.card {
  position: relative; flex: none;
  width: var(--cw); height: var(--ch);
  border-radius: calc(var(--cw) * 0.1);
  background: linear-gradient(160deg, #ffffff, var(--card-face) 55%, #f1ead7);
  color: var(--card-ink);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.14);
  font-family: Georgia, "Times New Roman", serif;
  user-select: none;
}
.card.red { color: var(--card-red); }
.card .ix {
  position: absolute; top: 5%; left: 7%;
  display: flex; flex-direction: column; align-items: center;
  font-size: calc(var(--cw) * 0.2); line-height: 0.95; font-weight: 700;
}
.card .ix i, .card .mid i { font-style: normal; }
.card .ix i { font-size: 0.85em; }
.card .ix.br { top: auto; left: auto; bottom: 5%; right: 7%; transform: rotate(180deg); }
.card .mid {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  line-height: 0.9;
}
.card .mid b { font-size: calc(var(--cw) * 0.46); letter-spacing: -0.04em; }
.card .mid i { font-size: calc(var(--cw) * 0.28); }
.card .mid.ace { font-size: calc(var(--cw) * 0.62); }
.card .mid.face {
  inset: 20% 22%; border: 1.5px solid currentColor; border-radius: calc(var(--cw) * 0.06);
  background: repeating-linear-gradient(135deg, rgba(0, 0, 0, 0.035) 0 4px, transparent 4px 8px);
}
.card .mid.face b { font-size: calc(var(--cw) * 0.36); }
.card .mid.face i { font-size: calc(var(--cw) * 0.2); }
.card .fx {
  position: absolute; left: 50%; bottom: 7%; transform: translateX(-50%);
  font: 700 calc(var(--cw) * 0.11)/1 system-ui, sans-serif; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 5px; border-radius: 999px; background: rgba(0, 0, 0, 0.07); white-space: nowrap;
}
.card.back {
  background:
    radial-gradient(circle at 50% 50%, rgba(247, 212, 124, 0.35) 0 18%, transparent 19%),
    repeating-linear-gradient(45deg, #8a1a2a 0 5px, #a2263b 5px 10px);
  border: calc(var(--cw) * 0.05) solid #fbf3df;
}
.card.mini { --cw: 36px; --ch: 50px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); }
.card.mini .ix, .card.mini .fx { display: none; }
.card.mini .mid b { font-size: 17px; }
.card.mini .mid i { font-size: 15px; }
.card.mini .mid.face { inset: 12%; }
.card.mini .mid.ace { font-size: 22px; }
.card.mini.moved { box-shadow: 0 0 0 2px var(--gold), 0 1px 3px rgba(0, 0, 0, 0.35); }

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(3, 8, 6, 0.72); backdrop-filter: blur(3px);
  animation: fade 0.2s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.modal-panel, .result-panel { width: min(720px, 100%); max-height: calc(100dvh - 32px); overflow: auto; padding: 22px 22px 18px; }
.modal-panel h2, .result-panel h2 { margin: 0 0 6px; font: 700 26px/1.2 Georgia, serif; color: var(--gold-2); }
.result-panel h2 { font-size: 32px; }
.modal-panel h3 { margin: 18px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.modal-panel ul { margin: 0; padding-left: 20px; display: grid; gap: 5px; }
.modal-panel p { margin: 0 0 8px; }
.modal-panel a { color: var(--gold-2); text-underline-offset: 3px; }
.modal-close { position: sticky; top: 0; float: right; margin: -8px -8px 0 0; }
.modal-panel .actions, .result-panel .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }

.suit-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.suit-pick button {
  aspect-ratio: 1; border-radius: 16px; border: 2px solid transparent; cursor: pointer;
  background: var(--card-face); color: var(--card-ink); font-size: 44px; line-height: 1;
  display: grid; place-items: center; gap: 2px; padding: 8px;
  transition: transform 0.1s, border-color 0.15s;
}
.suit-pick button small { font: 600 12px/1 system-ui, sans-serif; color: #555; }
.suit-pick button.red { color: var(--card-red); }
.suit-pick button:hover { transform: translateY(-3px); border-color: var(--gold); }
.suit-pick button.suggest { border-color: var(--gold); }

.bg-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 14px; }
.bg-pick button {
  display: grid; gap: 8px; padding: 8px; border-radius: 14px; cursor: pointer; text-align: center;
  background: rgba(255, 255, 255, 0.05); border: 2px solid transparent; font-weight: 600; font-size: 13px;
}
.bg-pick button:hover { border-color: rgba(255, 255, 255, 0.3); }
.bg-pick button.current { border-color: var(--gold-2); }
.bg-swatch {
  height: 64px; border-radius: 50%; padding: 6px;
  background: linear-gradient(160deg, var(--rim-1), var(--rim-2));
}
.bg-swatch i {
  display: block; height: 100%; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 42%, var(--felt-1), var(--felt-2) 58%, var(--felt-3));
}

/* results with a chat beside them (below them on narrow screens) */
.result-panel { width: min(1000px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 18px; align-items: start; }
.result-body { min-width: 0; }
.result-chat {
  position: sticky; top: 0; display: flex; flex-direction: column; gap: 6px;
  padding: 10px; border-radius: 12px; background: rgba(0, 0, 0, 0.22);
}
.result-chat .chat-log { min-height: 120px; max-height: min(420px, calc(100dvh - 160px)); }
@media (max-width: 900px) {
  .result-panel { width: min(720px, 100%); grid-template-columns: minmax(0, 1fr); }
  .result-chat { position: static; }
  .result-chat .chat-log { min-height: 50px; max-height: 140px; }
}
.result-sub { margin: 0 0 14px; color: var(--muted); }
.result-sub .card.mini { vertical-align: middle; display: inline-block; margin: 0 1px; }
.result-sub .card.mini:first-of-type { margin-left: 6px; }
.res-rows { display: grid; gap: 8px; }
.res-row {
  display: grid; grid-template-columns: minmax(110px, 1fr) minmax(0, 2.2fr) auto; gap: 12px; align-items: center;
  padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.22);
}
.res-row.win { background: rgba(99, 211, 145, 0.13); }
.res-row.hit { background: rgba(234, 90, 84, 0.13); }
.res-who { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; }
.res-who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-hand { display: flex; flex-wrap: wrap; gap: 3px; min-height: 48px; align-items: center; }
.res-hand .empty { color: var(--good); font-weight: 700; }
.res-pts { text-align: right; font-variant-numeric: tabular-nums; }
.res-pts .calc { font-size: 12px; color: var(--muted); }
.res-pts .total { font-size: 18px; font-weight: 800; }
.halved { display: inline-block; font-size: 11px; font-weight: 800; color: #1d1402; background: var(--gold-2); padding: 1px 6px; border-radius: 999px; margin-left: 4px; }
.ready-note { margin-right: auto; align-self: center; color: var(--muted); font-size: 14px; }
.standings { display: grid; gap: 6px; margin: 4px 0 6px; }
.standing { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.22); font-size: 16px; }
.standing .place { width: 26px; text-align: center; font-weight: 800; color: var(--muted); }
.standing.first { background: rgba(232, 184, 74, 0.16); border: 1px solid rgba(232, 184, 74, 0.5); }
.standing.first .place { color: var(--gold-2); }
.standing .name { flex: 1; font-weight: 600; }
.standing .pts { font-weight: 800; font-variant-numeric: tabular-nums; }
.result-panel h3 { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }

.scores-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
.scores-wrap { overflow-x: auto; }
.scores-table th, .scores-table td { padding: 7px 8px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.scores-table th:first-child, .scores-table td:first-child { text-align: left; color: var(--muted); }
.scores-table th { font-size: 13px; }
.scores-table td small { color: var(--muted); margin-left: 4px; }
.scores-table tfoot td { font-weight: 800; border-bottom: none; }

.floating { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 40; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); }

.big-flash {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; pointer-events: none;
  background: radial-gradient(circle, rgba(193, 31, 44, 0.55), rgba(3, 8, 6, 0.75) 70%);
  animation: fade 0.15s ease-out;
}
.big-flash.trubd { background: radial-gradient(circle, rgba(40, 150, 90, 0.55), rgba(3, 8, 6, 0.75) 70%); }
.big-flash .big {
  font: 900 clamp(64px, 16vw, 168px)/1 Georgia, serif; color: var(--gold-2); text-transform: uppercase; text-align: center;
  text-shadow: 0 6px 0 #6b0d16, 0 14px 40px rgba(0, 0, 0, 0.6);
  animation: slam 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.big-flash.trubd .big { text-shadow: 0 6px 0 #0d4a2a, 0 14px 40px rgba(0, 0, 0, 0.6); }
.big-flash .who { text-align: center; font-size: clamp(18px, 3.4vw, 28px); font-weight: 800; margin-top: 10px; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7); }
@keyframes slam { from { transform: scale(2.4) rotate(-8deg); opacity: 0; } }

.toasts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; width: min(420px, calc(100% - 32px)); pointer-events: none; }
.toast {
  background: rgba(10, 16, 13, 0.96); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); text-align: center;
  animation: toast-in 0.2s ease-out;
}
.toast.error { border-color: var(--danger); color: #ffd2cf; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
.conn {
  position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); z-index: 95;
  background: var(--danger); color: #fff; font-weight: 700; padding: 6px 14px; border-radius: 999px; font-size: 13px;
}

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .top-actions .lbl { display: none; }
}
@media (max-width: 700px) {
  :root { --cw: 58px; --ch: 83px; --fw: 21px; --fh: 31px; --seat-pad: 60px; }
  .center { gap: 24px; }
  .pile-label { font-size: 11px; }
  .draw-pile.active .pile-label { font-size: 11px; }
  .topbar { padding: 6px 8px; gap: 6px; }
  .brand { font-size: 18px; }
  .top-meta { font-size: 12px; }
  .room-word { display: none; }
  .top-actions { gap: 0; }
  .top-actions .btn.sm { padding: 4px 6px; min-height: 30px; }
  .table-wrap { min-height: 300px; }
  .felt { left: 3%; right: 3%; top: 12%; padding: 8px; }
  .plate { padding: 3px 8px 3px 3px; gap: 5px; }
  .plate .avatar { width: 24px; height: 24px; font-size: 12px; border-width: 1.5px; }
  .dealer-btn { width: 24px; height: 24px; margin: -12px 0 0 -12px; font-size: 12px; }
  .plate-name { font-size: 12px; }
  .plate-name .nm { max-width: 62px; }
  .plate-name .tag { display: none; }
  .plate-meta { font-size: 10.5px; }
  .bubble { font-size: 13px; padding: 4px 9px; }
  .callout-btn, .tvekan-btn { font-size: 11px; padding: 2px 8px; }
  .suit-ind { width: 44px; height: 44px; font-size: 26px; }
  .info-label { font-size: 11px; }
  .me-bar { grid-template-columns: minmax(0, 1fr) auto; gap: 6px; padding: 2px 8px; }
  .me-info { padding: 2px 6px 2px 2px; gap: 6px; }
  .me-info .avatar { width: 30px; height: 30px; }
  .me-info .plate-name { font-size: 13px; }
  .me-info .plate-meta { font-size: 11px; }
  .me-tools { display: none; }
  .calls { display: grid; grid-template-areas: "v g" "l g"; gap: 4px 6px; }
  #varning-btn { grid-area: v; }
  #lappen-btn { grid-area: l; }
  #gabon-btn { grid-area: g; }
  .call-btn { min-height: 24px; padding: 3px 9px; font-size: 12px; box-shadow: 0 2px 0 #9a4f06; }
  .gabon-btn { min-width: 112px; height: 50px; font-size: 18px; padding: 0 14px; }
  .hand { padding-top: 16px; min-height: calc(var(--ch) + 30px); }
  .res-row { grid-template-columns: 1fr auto; }
  .res-hand { grid-column: 1 / -1; grid-row: 2; }

  /* phones: the top bar has no room, so the music slider pops up under the 🎵 button */
  .topbar .music-ctl input[type="range"] {
    display: none; position: absolute; top: calc(100% + 8px); right: -60px; z-index: 60; width: 160px; height: 36px;
    margin: 0; padding: 0 12px; border-radius: 12px; background: rgba(8, 12, 10, 0.95); border: 1px solid var(--line);
  }
  .topbar .music-ctl.open input[type="range"] { display: block; }
  .chat { left: 6px; bottom: 4px; width: 56%; max-height: 32%; padding: 4px; }
  .chat-log { font-size: 12px; }
  .chat-form input, .chat-form .btn.sm { min-height: 26px; font-size: 12px; }
  .deck-pick { grid-template-columns: repeat(2, 1fr); }
  .deck-preview .card { --cw: 34px; --ch: 49px; margin: 0 -6px; }

  /* stickers become a drawer on the right edge */
  .stickers {
    position: fixed; right: 0; top: 50%; transform: translateY(-50%); z-index: 30; width: 102px;
    max-height: 72dvh; border: 1px solid var(--line); border-right: none; border-radius: 14px 0 0 14px;
    background: rgba(8, 12, 10, 0.92); box-shadow: -6px 0 20px rgba(0, 0, 0, 0.4);
  }
  .stickers.closed { width: 40px; padding: 6px 2px; }
}
@media (max-height: 700px) and (min-width: 701px) {
  :root { --cw: 64px; --ch: 92px; }
}

.deck-setting { margin-top: 14px; }
