/* ============================================================================
   Blackjack — "Victorian private card room"
   Pure HTML/CSS scene (no image assets): mahogany-railed elliptical card table
   under a warm chandelier, wood-panelled lower walls, damask upper walls, brass
   fittings and engraved brass-plate controls. All shadows are warm-tinted.
   ========================================================================== */

:root {
  /* palette tokens (spec) */
  --felt-green: #1e6b43;
  --mahogany: #5d3a1a;
  --brass: #c9a227;
  --wall-dark: #3a2417;
  --cream: #faf6ec;
  --shadow-warm: rgba(40, 20, 5, 0.6);
  /* derived tones */
  --felt-lit: #2e7d4f;        /* felt centre, lit by the chandelier */
  --felt-edge: #14532d;       /* felt at the rail */
  --mahogany-hi: #8b5a2b;     /* polished mahogany highlight */
  --mahogany-lo: #3f2812;
  --brass-hi: #d4af37;        /* brass-plate gradient top */
  --brass-lo: #a07d20;        /* brass-plate gradient bottom */
  --wall-panel: #4a2f1d;      /* panel face */
  --damask-bg: #4a3415;       /* upper-wall wallpaper ground */
  --damask-fg: #7a5c2e;       /* wallpaper motif, low contrast */
  --card-red: #a93226;        /* suit red on cream stock */
  --ink: #2b1d12;             /* engraved text on brass */
  --win: #d4af37;
  --lose: #d96a55;
  --serif-display: "Cinzel", "Playfair Display", Georgia, "Times New Roman", serif;
  --serif-body: "Playfair Display", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

/* generic hide utility — script.js toggles `hidden` on buttons/CTA/overlay; the
   component-scoped rules below also cover it, this is the robust fallback */
.hidden { display: none !important; }

body {
  margin: 0;
  font-family: var(--serif-body);
  background: var(--wall-dark);
  color: var(--cream);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* chip-flow feedback on settle */
.betspot-chips.win-pulse { animation: chipWin 0.5s ease; }
@keyframes chipWin {
  0% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.35); filter: drop-shadow(0 0 8px var(--brass-hi)); }
  100% { transform: translateX(-50%) scale(1); }
}

/* ---------- Top bar: a dark mahogany cornice with a brass nameplate -------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.55rem 1.1rem;
  background:
    linear-gradient(180deg, rgba(255, 226, 160, 0.07), rgba(0, 0, 0, 0.25)),
    repeating-linear-gradient(88deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 7px),
    linear-gradient(180deg, #2c1a0e, #221308);
  border-bottom: 2px solid rgba(201, 162, 39, 0.55);
  box-shadow: 0 3px 14px var(--shadow-warm);
  z-index: 5;
}
.brand {
  font-family: var(--serif-display);
  font-size: 1.32rem; font-weight: 800; letter-spacing: 0.14em;
  color: var(--brass-hi);
  text-shadow: 0 1px 0 rgba(40, 20, 5, 0.65), 0 0 18px rgba(212, 175, 55, 0.25);
}
.account { display: flex; align-items: center; gap: 0.8rem; font-size: 0.92rem; }
.player-name {
  width: 7.5rem; padding: 0.3rem 0.7rem; border-radius: 999px;
  border: 1px solid rgba(201, 162, 39, 0.45);
  background: rgba(0, 0, 0, 0.3); color: var(--cream); font: inherit;
}
.balance { color: rgba(250, 246, 236, 0.8); }
.balance strong { color: var(--brass-hi); font-variant-numeric: tabular-nums; }
.link-btn {
  background: none; border: none; color: rgba(250, 246, 236, 0.62);
  text-decoration: underline; cursor: pointer; font: inherit;
}
.link-btn:hover { color: var(--brass-hi); }

/* ---------- The room: damask upper walls, panelled lower walls, vignette --- */
.felt {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  overflow: hidden;            /* clip the table when the camera zooms/pivots */
  perspective: 1600px;
  background: var(--damask-bg);
}
/* walls (z 0): damask wallpaper above, wood paneling below a brass chair rail */
.felt::before {
  content: "";
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    /* — wood paneling, lower third — */
    /* panel seams: a highlight + shadow line every 9% */
    repeating-linear-gradient(90deg,
      rgba(255, 214, 150, 0.10) 0 2px, rgba(0, 0, 0, 0.38) 2px 4px,
      transparent 4px 9%) bottom / 100% 32% no-repeat,
    /* panel face shading */
    linear-gradient(180deg,
      rgba(255, 220, 160, 0.10), rgba(0, 0, 0, 0.05) 22%,
      rgba(0, 0, 0, 0.28) 86%, rgba(0, 0, 0, 0.45)) bottom / 100% 32% no-repeat,
    linear-gradient(180deg, var(--wall-panel), var(--wall-dark)) bottom / 100% 32% no-repeat,
    /* — brass chair rail between wallpaper and paneling — */
    linear-gradient(180deg,
      rgba(246, 226, 122, 0.85), var(--brass) 45%, #6e521a) bottom / 100% 7px no-repeat,
    /* — damask wallpaper, upper walls: one CLOSED quatrefoil per tile (four
       petals + a centre boss, all inside the tile so nothing gets cut) — */
    radial-gradient(circle at 50% 36%, rgba(122, 92, 46, 0.30) 7.5%, transparent 9%) top / 58px 58px repeat,
    radial-gradient(circle at 36% 50%, rgba(122, 92, 46, 0.30) 7.5%, transparent 9%) top / 58px 58px repeat,
    radial-gradient(circle at 64% 50%, rgba(122, 92, 46, 0.30) 7.5%, transparent 9%) top / 58px 58px repeat,
    radial-gradient(circle at 50% 64%, rgba(122, 92, 46, 0.30) 7.5%, transparent 9%) top / 58px 58px repeat,
    radial-gradient(circle at 50% 50%, rgba(122, 92, 46, 0.38) 4.5%, transparent 6%) top / 58px 58px repeat,
    linear-gradient(180deg, #57401d, var(--damask-bg) 55%, #3c2a11);
  background-position:
    bottom, bottom, bottom,
    0 calc(68% - 3px),
    top, top, top, top, top, top;
}
/* chair-rail position fix: the brass strip sits at the paneling's top edge */
.felt::after {
  /* vignette so attention falls on the table (kept above the glow) */
  content: "";
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background:
    radial-gradient(115% 92% at 50% 44%, transparent 52%, rgba(24, 12, 3, 0.55) 88%, rgba(18, 8, 2, 0.78));
}
/* warm chandelier glow pooling over the table (soft-light, above the scene) */
.chandelier {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    radial-gradient(46% 36% at 50% 16%, rgba(255, 217, 138, 0.55), transparent 70%),
    radial-gradient(70% 56% at 50% 30%, rgba(255, 217, 138, 0.35), transparent 72%);
  mix-blend-mode: soft-light;
}
/* a faint direct shaft of light, normal blend, so the glow reads on dark walls */
.chandelier::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(38% 26% at 50% 12%, rgba(255, 217, 138, 0.20), transparent 70%);
}
.felt > .table { position: relative; z-index: 1; }

/* Central call-to-action shown during betting */
.center-cta {
  position: absolute; left: 50%; top: 50%; transform: translateX(-50%);
  z-index: 3; border: none; font: inherit; white-space: nowrap;
}
.center-cta.hidden { display: none; }
.center-cta.cta-text {
  background: none; color: var(--brass-hi);
  font-family: var(--serif-display);
  font-size: 1.12rem; font-weight: 700; letter-spacing: 0.05em;
  text-shadow: 0 1px 4px rgba(20, 8, 0, 0.8); cursor: default;
}
.center-cta.cta-deal {
  background: linear-gradient(180deg, var(--brass-hi), var(--brass-lo));
  color: var(--ink);
  font-family: var(--serif-display);
  font-size: 1.22rem; font-weight: 800; letter-spacing: 0.07em; cursor: pointer;
  padding: 0.7rem 2.3rem; border-radius: 999px;
  border: 1px solid rgba(60, 40, 8, 0.8);
  text-shadow: 0 1px 0 rgba(255, 240, 190, 0.4);
  box-shadow:
    0 6px 18px var(--shadow-warm),
    inset 0 2px 0 rgba(255, 244, 200, 0.65),
    inset 0 -3px 6px rgba(80, 52, 8, 0.55),
    0 0 30px rgba(212, 175, 55, 0.35);
  animation: ctaPulse 1.7s ease-in-out infinite;
}
.center-cta.cta-deal:hover { filter: brightness(1.06); }
.center-cta.cta-deal:active { transform: translateX(-50%) scale(0.97); }
@keyframes ctaPulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.045); }
}

/* ---------- The table: a great ellipse of felt in a mahogany rail ---------- */
.table {
  position: relative;
  width: min(1180px, 96vw);
  aspect-ratio: 1.62 / 1;
  max-height: 82vh;
  transform-origin: center center;
  transition: transform 0.8s cubic-bezier(.45, .05, .2, 1); /* camera pivot */
  border-radius: 50%;
  /* Felt fills the centre (padding-box); polished mahogany fills the rail
     (border-box). Felt: chandelier-lit centre falling to deep green edges,
     with a soft cloth nap. */
  background-image:
    /* --- felt (padding-box) --- */
    repeating-linear-gradient(45deg, rgba(255, 246, 214, 0.02) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(-45deg, rgba(10, 30, 14, 0.05) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse 88% 80% at 50% 34%, var(--felt-lit), var(--felt-green) 52%, var(--felt-edge) 100%),
    /* --- polished mahogany rail (border-box) --- */
    linear-gradient(180deg, rgba(255, 232, 178, 0.18), rgba(0, 0, 0, 0.08) 32%, rgba(28, 12, 2, 0.5)),
    repeating-linear-gradient(87deg,
      rgba(0, 0, 0, 0.24) 0 1px, transparent 1px 6px,
      rgba(255, 226, 160, 0.06) 6px 7px, transparent 7px 14px),
    linear-gradient(180deg, var(--mahogany), var(--mahogany-hi) 46%, var(--mahogany));
  background-clip: padding-box, padding-box, padding-box,
                   border-box, border-box, border-box;
  border: 24px solid transparent;
  border-top-width: 20px;
  box-shadow:
    /* table sits in the room: deep warm drop shadow */
    0 34px 70px var(--shadow-warm),
    0 10px 26px rgba(40, 20, 5, 0.55),
    /* rail finish */
    inset 0 2px 0 rgba(255, 236, 190, 0.28),
    /* brass trim line between rail and felt (spec: 2-3px golden border) */
    inset 0 0 0 26px rgba(30, 14, 2, 0.5),
    inset 0 0 0 29px var(--brass),
    inset 0 0 0 31px rgba(30, 14, 2, 0.4),
    /* felt depth: subtle inner shadow */
    inset 0 -36px 90px rgba(16, 40, 24, 0.55),
    inset 0 18px 60px rgba(10, 30, 16, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 60px 2% 6%;
  overflow: hidden;
  /* brass nail heads dotted along the middle of the rail. An outline (unlike a
     pseudo-element ring) is NOT clipped by this element's own overflow:hidden,
     so the dots actually render on the rail. */
  outline: 3px dotted rgba(201, 162, 39, 0.6);
  outline-offset: -14px;
}

/* curved betting-area boundary line on the felt (no inset shadow — it printed
   a visible hard-edged panel silhouette across the felt on mobile) */
.table::after {
  content: "";
  position: absolute;
  left: 9%; right: 9%; top: 40%; bottom: 8%;
  border: 2px solid rgba(250, 246, 236, 0.17);
  border-top: none;
  border-radius: 0 0 50% 50% / 0 0 88% 88%;
  pointer-events: none;
}

/* Dealer chip rack — detailed SVG built in JS */
.rack {
  position: absolute;
  left: 50%; top: -2px; transform: translateX(-50%);
  width: clamp(190px, 23%, 300px);
  z-index: 2;
  filter: drop-shadow(0 5px 6px var(--shadow-warm));
}
.rack svg { display: block; width: 100%; height: auto; }

/* Card dispenser (shoe) — deck centered in a clear tray, top-right */
.shoe {
  position: absolute;
  top: 12px; right: 5%;
  width: 100px; height: 64px;
  transform: perspective(720px) rotateX(44deg) rotate(-7deg);
  transform-origin: center bottom;
  z-index: 2;
}
.shoe .deck {
  position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%);
  width: 56px; height: 42px;
  border-radius: 3px; border: 2px solid var(--cream);
  background-color: #6e1f2b;
  background-image:
    radial-gradient(circle, rgba(212, 175, 55, 0.9) 0.8px, transparent 1.1px),
    repeating-linear-gradient(45deg, rgba(212, 175, 55, 0.5) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(-45deg, rgba(212, 175, 55, 0.5) 0 1px, transparent 1px 7px);
  background-size: 7px 7px, auto, auto;
  background-position: 3.5px 3.5px, 0 0, 0 0;
  box-shadow:
    0 4px 0 -1px #f3eee0, 0 7px 0 -2px #ddd5c2, 0 10px 0 -3px #f0ebdc,
    0 13px 0 -4px #d6cdb8, 0 16px 1px -4px var(--shadow-warm);
}
.shoe .glass {
  position: absolute; inset: 0; border-radius: 7px;
  background: linear-gradient(160deg, rgba(255, 240, 200, 0.16), rgba(255, 240, 200, 0.03) 55%, rgba(255, 240, 200, 0.10));
  border: 1.5px solid rgba(250, 246, 236, 0.4);
  box-shadow: inset 0 1px 8px rgba(255, 240, 200, 0.2), 0 6px 12px var(--shadow-warm);
}

/* Dealer + player groups */
.dealer-area, .player-area {
  display: flex; flex-direction: column; align-items: center;
  position: relative; z-index: 1;
}
.cards { display: flex; justify-content: center; gap: 0.4rem; min-height: 104px; }

.score-badge {
  margin-top: -18px; z-index: 4;
  min-width: 34px; padding: 3px 11px;
  border-radius: 999px;
  background: linear-gradient(180deg, #2c1a0e, #1b0f06);
  color: var(--cream);
  font-weight: 800; font-size: 1rem; font-variant-numeric: tabular-nums;
  border: 2px solid rgba(201, 162, 39, 0.8);
  box-shadow: 0 2px 6px var(--shadow-warm);
}
.score-badge:empty { display: none; }

/* Felt rule print — embroidered in old gold */
.felt-rules {
  position: absolute; left: 50%; top: 21%; transform: translateX(-50%);
  width: 64%; max-width: 540px; text-align: center;
  color: rgba(222, 198, 128, 0.6); pointer-events: none; user-select: none;
  z-index: 0;
}
.felt-rules .arc { display: block; width: 100%; height: 112px; overflow: visible; margin: 0 auto -6px; }
.felt-rules .arc text {
  fill: rgba(222, 198, 128, 0.62);
  font-family: var(--serif-display);
  font-size: 40px; font-weight: 800; letter-spacing: 3px;
}
.felt-rules .rule-sub {
  font-family: var(--serif-body);
  font-size: 0.92rem; letter-spacing: 0.04em; opacity: 0.95; font-style: italic;
}
.felt-rules .rule-ins {
  display: inline-block; margin-top: 8px;
  font-family: var(--serif-display);
  font-size: 0.8rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(222, 198, 128, 0.62);
  border: 2px solid rgba(222, 198, 128, 0.38);
  border-radius: 999px; padding: 4px 20px;
}

.message {
  width: 100%; text-align: center; margin: 0;
  min-height: 1.3em;
  font-family: var(--serif-display);
  font-size: 1.02rem; font-weight: 700; letter-spacing: 0.04em;
  color: var(--brass-hi);
  text-shadow: 0 1px 3px rgba(20, 8, 0, 0.6);
}

/* ---------- Cards: cream stock, drawn in CSS ---------- */
.card {
  position: relative;
  width: 72px; height: 102px;
  border-radius: 8px;
  background: linear-gradient(168deg, #fffdf6, var(--cream) 60%, #efe8d6);
  color: var(--ink);
  box-shadow: 0 4px 10px var(--shadow-warm), 0 1px 2px rgba(40, 20, 5, 0.4);
  user-select: none;
}
/* stacked index: rank over a small suit, in each corner (works for flat + flip front) */
.card .corner {
  position: absolute; display: flex; flex-direction: column; align-items: center;
  line-height: 0.78; font-weight: 800;
  font-family: Georgia, "Times New Roman", serif;
}
.card .corner b { font-size: 1rem; }
.card .corner i { font-size: 0.82rem; font-style: normal; margin-top: 1px; }
.card .corner.tl { top: 6px; left: 7px; }
.card .corner.br { bottom: 6px; right: 7px; transform: rotate(180deg); }
.card .pip { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2.3rem; }
.card.red { color: var(--card-red); }

/* Burgundy-and-gold Victorian card back: cream stock, gold lattice + dots */
.card.back, .card.flip3d .face.back {
  color: transparent;
  background-color: #6e1f2b;
  background-image:
    radial-gradient(circle, rgba(212, 175, 55, 0.95) 1.1px, transparent 1.5px),
    repeating-linear-gradient(45deg, rgba(212, 175, 55, 0.5) 0 1px, transparent 1px 11px),
    repeating-linear-gradient(-45deg, rgba(212, 175, 55, 0.5) 0 1px, transparent 1px 11px);
  background-size: 11px 11px, auto, auto;
  background-position: 5.5px 5.5px, 0 0, 0 0;
  border: 4px solid var(--cream);
}
.card.back::after, .card.flip3d .face.back::after {
  content: ""; position: absolute; inset: 3px; border-radius: 5px;
  border: 1.5px solid rgba(212, 175, 55, 0.8);
  box-shadow: inset 0 0 0 1px rgba(90, 18, 30, 0.4);
}

/* 3D flip card (dealer hole card) */
.card.flip3d { background: transparent; box-shadow: none; perspective: 700px; }
.card.flip3d .inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d; transition: transform 0.62s cubic-bezier(.34,.62,.28,1);
}
.card.flip3d.revealed .inner { transform: rotateY(180deg); }
.card.flip3d .face {
  position: absolute; inset: 0; border-radius: 8px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: 0 4px 10px var(--shadow-warm);
}
.card.flip3d .face.back { transform: rotateY(0deg); }
.card.flip3d .face.front {
  background: linear-gradient(168deg, #fffdf6, var(--cream) 60%, #efe8d6);
  color: var(--ink); transform: rotateY(180deg);
}
.card.flip3d .face.front.red { color: var(--card-red); }

/* ---------- Betting seats (5 chairs along the table's front arc) ---------- */
.seats {
  position: absolute; inset: 0; pointer-events: none; z-index: 1;
}
.seat {
  position: absolute;            /* left/top set per-seat in JS */
  transform: translate(-50%, -50%);  /* anchor = centre of the bet circle */
  pointer-events: auto;
}
.seat-cards {
  position: absolute; bottom: calc(100% + 5px); left: 50%; transform: translateX(-50%);
  display: flex; align-items: flex-end; justify-content: center; gap: 6px;
}
.hand-group { display: flex; flex-direction: column; align-items: center; }
.hand-cards { display: flex; }
.hand-cards .card { width: 54px; height: 78px; box-shadow: 0 3px 7px var(--shadow-warm); }
.hand-cards .card:not(:first-child) { margin-left: -30px; }
.hand-cards .card .pip { font-size: 1.7rem; }
.hand-cards .card .corner b { font-size: 0.74rem; }
.hand-cards .card .corner i { font-size: 0.6rem; }
.hand-group .score-badge { margin-top: -14px; font-size: 0.82rem; padding: 1px 8px; }
.hand-group.active .score-badge {
  background: linear-gradient(180deg, var(--brass-hi), var(--brass-lo));
  color: var(--ink); border-color: var(--brass-hi);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.8);
}
.hand-group.won .score-badge { background: var(--win); color: var(--ink); }
.hand-group.lost .score-badge { opacity: 0.65; }
.hand-group.tie .score-badge { border-color: rgba(250, 246, 236, 0.75); }

.betspot {
  position: relative;
  width: 84px; height: 84px; border-radius: 50%;
  border: 2px dashed rgba(222, 198, 128, 0.5);
  box-shadow: inset 0 0 14px rgba(10, 30, 16, 0.3);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s;
}
.betspot.selected { border-color: var(--brass-hi); box-shadow: 0 0 14px rgba(212, 175, 55, 0.5), inset 0 0 14px rgba(10, 30, 16, 0.3); }
.betspot.has-bet { border-style: solid; border-color: rgba(222, 198, 128, 0.7); }
.betspot.dim { opacity: 0.35; }
.betspot.won { border-color: var(--win); box-shadow: 0 0 20px rgba(212, 175, 55, 0.6); }
.betspot.lost { border-color: var(--lose); }
.betspot.tie { border-color: rgba(250, 246, 236, 0.7); }

/* PP / 21+3 side bets — faint chip-spot markers so they read as playable options */
.side-bet {
  position: absolute; width: 30px;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  pointer-events: none;
}
.side-bet.pp { top: -14px; left: -26px; }
.side-bet.tt { top: -14px; right: -26px; }
.side-bet .spot {
  position: relative; width: 30px; height: 30px; border-radius: 50%;
  background: rgba(250, 246, 236, 0.04);
}
.side-bet .spot::before { /* spotted chip ring */
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: repeating-conic-gradient(rgba(222, 198, 128, 0.55) 0 10deg, transparent 10deg 30deg);
  -webkit-mask: radial-gradient(transparent 52%, #000 54% 80%, transparent 82%);
          mask: radial-gradient(transparent 52%, #000 54% 80%, transparent 82%);
}
.side-bet .spot::after { /* hub */
  content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 13px; height: 13px; border-radius: 50%;
  background: rgba(222, 198, 128, 0.12);
  box-shadow: 0 0 0 1.5px rgba(222, 198, 128, 0.25);
}
.side-bet em {
  font-style: normal; font-size: 0.34rem; font-weight: 800; line-height: 0.95;
  letter-spacing: 0.03em; text-transform: uppercase; text-align: center;
  color: rgba(222, 198, 128, 0.55);
}

.betspot-chips {
  position: absolute; bottom: 12px; left: 50%;
  width: 40px; height: 40px; transform: translateX(-50%);
}
.betspot-chips .chip {
  position: absolute; left: 0; bottom: 0; cursor: default;
  width: 38px; height: 38px; font-size: 0.7rem;
  animation: chipDrop 0.22s cubic-bezier(.3,.8,.4,1.4);
}
@keyframes chipDrop {
  from { transform: translateY(-10px) scale(1.18); opacity: 0.4; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.betspot-total {
  position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%);
  font-size: 0.78rem; font-weight: 800; color: var(--brass-hi);
  text-shadow: 0 1px 2px rgba(20, 8, 0, 0.8); pointer-events: none; white-space: nowrap;
}
.betspot-total:empty { display: none; }

/* ---------- Chips: classic colours, gold accents, dashed-edge detail ------- */
.chip {
  position: relative;
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.86rem; color: var(--cream);
  background: var(--chip, #a93226);
  box-shadow: 0 3px 6px var(--shadow-warm);
  cursor: pointer; transition: transform 0.08s ease; flex: none;
  text-shadow: 0 1px 1px rgba(20, 8, 0, 0.55);
  font-variant-numeric: tabular-nums;
}
/* edge spots around the rim, cream on the chip colour */
.chip::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: repeating-conic-gradient(var(--cream) 0 17deg, var(--chip, #a93226) 17deg 60deg);
  -webkit-mask: radial-gradient(transparent 57%, #000 58%);
          mask: radial-gradient(transparent 57%, #000 58%);
}
/* inner face with a dashed gold edge ring */
.chip::after {
  content: ""; position: absolute; inset: 8px; border-radius: 50%;
  background: var(--chip, #a93226);
  border: 1.5px dashed rgba(212, 175, 55, 0.85);
  box-shadow: inset 0 2px 5px rgba(255, 240, 200, 0.25), inset 0 -3px 6px rgba(20, 8, 0, 0.35);
}
.chip .val { position: relative; z-index: 2; }
.chiptray .chip:hover { transform: translateY(-3px); }
.chiptray .chip:active { transform: translateY(1px) scale(0.97); }
/* tray chips look like a small stack */
.chiptray .chip {
  box-shadow:
    0 4px 0 -1px rgba(40, 20, 5, 0.45),
    0 8px 0 -2px rgba(40, 20, 5, 0.45),
    0 12px 9px var(--shadow-warm);
  margin-bottom: 9px;
}
/* classic colours: red / blue / green / black, plus burgundy and black-gold */
.chip[data-v="5"]    { --chip: #a93226; }                       /* red */
.chip[data-v="10"]   { --chip: #2e5e9e; }                       /* blue */
.chip[data-v="20"]   { --chip: #1e7a4a; }                       /* green */
.chip[data-v="50"]   { --chip: #26221c; }                       /* black */
.chip[data-v="250"]  { --chip: #6e1f2b; }                       /* burgundy */
.chip[data-v="1000"] { --chip: #1b150c; } /* black & gold: cream label stays legible */
.chip[data-v="1000"]::after { border-color: var(--brass-hi); }
.chip[data-v="1000"] .val { color: var(--cream); text-shadow: 0 0 6px rgba(212, 175, 55, 0.55), 0 1px 1px rgba(20, 8, 0, 0.55); }

/* ---------- Controls: a mahogany ledge with brass-plate buttons ------------ */
.controls {
  padding: 0.9rem 1rem 1.1rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.8rem;
  background:
    linear-gradient(180deg, rgba(255, 226, 160, 0.06), transparent 30%),
    repeating-linear-gradient(89deg, rgba(0, 0, 0, 0.2) 0 1px, transparent 1px 8px),
    linear-gradient(180deg, #32200f, #20130a);
  border-top: 2px solid rgba(201, 162, 39, 0.5);
  box-shadow: 0 -4px 18px var(--shadow-warm);
}
.chiptray { display: flex; gap: 0.85rem; }
.action-row { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; }
/* engraved brass plates */
.btn {
  min-width: 104px; padding: 0.72rem 1.2rem;
  font-family: var(--serif-display);
  font-size: 0.98rem; font-weight: 700; letter-spacing: 0.05em;
  color: var(--ink);
  background: linear-gradient(180deg, var(--brass-hi), var(--brass-lo));
  border: 1px solid rgba(60, 40, 8, 0.85); border-radius: 10px;
  cursor: pointer; transition: transform 0.06s ease, opacity 0.15s ease, filter 0.15s ease;
  text-shadow: 0 1px 0 rgba(255, 240, 190, 0.45);   /* engraved into the metal */
  box-shadow:
    inset 0 2px 0 rgba(255, 244, 200, 0.65),        /* top bevel catch-light */
    inset 0 -3px 6px rgba(80, 52, 8, 0.55),         /* lower bevel shade */
    inset 0 0 0 1px rgba(255, 228, 150, 0.18),
    0 4px 10px var(--shadow-warm);
}
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn.primary {
  background: linear-gradient(180deg, #e9c34a, #b8901f);
  box-shadow:
    inset 0 2px 0 rgba(255, 248, 210, 0.75),
    inset 0 -3px 6px rgba(80, 52, 8, 0.55),
    0 4px 12px var(--shadow-warm),
    0 0 22px rgba(212, 175, 55, 0.3);
}
.btn.double { background: linear-gradient(180deg, #c98c3c, #8f5c18); color: #1f1206; }
.btn.split  { background: linear-gradient(180deg, #cdbd95, #978a60); }
.btn.ghost {
  background: linear-gradient(180deg, rgba(201, 162, 39, 0.10), rgba(201, 162, 39, 0.02));
  color: rgba(250, 246, 236, 0.88);
  border: 1px solid rgba(201, 162, 39, 0.5);
  text-shadow: none;
  box-shadow: inset 0 1px 0 rgba(255, 240, 190, 0.12), 0 3px 8px var(--shadow-warm);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.32; cursor: default; }
.btn.hidden { display: none; }

/* ---------- Result banner: a brass-framed plaque ---------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(24, 12, 3, 0.35);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 20;
}
.overlay.hidden { display: none; }
.result-card {
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(255, 226, 160, 0.08), transparent 55%),
    linear-gradient(180deg, #34200f, #241409);
  border: 2px solid rgba(201, 162, 39, 0.75);
  border-radius: 14px; padding: 1.3rem 2.4rem 1.5rem; text-align: center;
  box-shadow:
    0 12px 44px var(--shadow-warm),
    inset 0 0 0 5px rgba(20, 10, 3, 0.6),
    inset 0 0 0 6px rgba(201, 162, 39, 0.35);
  animation: popIn 0.3s ease both;
}
.result-card.win  { box-shadow: 0 0 56px rgba(212, 175, 55, 0.5), 0 12px 44px var(--shadow-warm), inset 0 0 0 5px rgba(20, 10, 3, 0.6), inset 0 0 0 6px rgba(201, 162, 39, 0.5); }
.result-card.lose { animation: shake 0.4s ease both; }
.result-card.push .result-detail { color: rgba(250, 246, 236, 0.92); }
/* engraved brass fleuron ornament (script supplies ❦ / ❧ / ❖) */
.result-emoji {
  font-size: 2.6rem; line-height: 1;
  color: var(--brass-hi);
  text-shadow: 0 1px 0 rgba(40, 20, 5, 0.7), 0 0 16px rgba(212, 175, 55, 0.35);
}
.result-title {
  margin: 0.3rem 0 0.15rem;
  font-family: var(--serif-display);
  font-size: 1.9rem; font-weight: 800; letter-spacing: 0.06em;
  color: var(--cream);
}
.result-card.win .result-title { color: var(--win); }
.result-card.lose .result-title { color: var(--lose); }
.result-detail {
  margin: 0 0 1.1rem;
  font-family: var(--serif-body);
  font-size: 1.4rem; font-weight: 700; opacity: 0.95;
}
.result-card.win .result-detail { color: var(--win); }
@keyframes popIn { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: scale(1); } }
@keyframes shake {
  0%,100% { transform: translateX(0); } 20% { transform: translateX(-9px); }
  40% { transform: translateX(9px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(6px); }
}

/* ---------- Small screens ---------- */
@media (max-width: 620px) {
  /* Fit the whole UI inside the phone viewport — no page scroll */
  body { height: 100dvh; min-height: 0; overflow: hidden; }
  .felt { flex: 1 1 auto; min-height: 0; padding: 0.4rem; align-items: stretch; }
  .table {
    width: 100%; height: 100%; min-height: 0; max-height: none;
    aspect-ratio: auto; border-width: 12px; padding: 40px 4% 5%;
    border-radius: 38% 38% 50% 50% / 30% 30% 60% 60%;
    outline-width: 2px; outline-offset: -8px;
  }
  .controls { padding: 0.45rem 0.6rem 0.6rem; gap: 0.45rem; }
  .chiptray { gap: 0.5rem; }
  .action-row { gap: 0.4rem; }
  /* dealer hand */
  .cards { min-height: 64px; }
  .dealer-area .card { width: 48px; height: 68px; }
  .dealer-area .card .pip { font-size: 1.5rem; }
  /* felt print: higher up, compact, so it clears the seat arc */
  .felt-rules { width: 92%; top: 12%; }
  .felt-rules .arc { height: 52px; }
  .felt-rules .arc text { font-size: 42px; }
  .felt-rules .rule-sub { font-size: 0.58rem; }
  .felt-rules .rule-ins { font-size: 0.54rem; padding: 2px 10px; }
  /* controls */
  .message { font-size: 0.88rem; min-height: 1.1em; }
  .chip { width: 44px; height: 44px; font-size: 0.78rem; }
  .player-name { width: 4.5rem; }
  .btn { min-width: 58px; padding: 0.5rem 0.6rem; font-size: 0.8rem; }
  .result-title { font-size: 1.55rem; }
  /* 5 seats: hide side bets, shrink cards/chips so they don't crowd */
  .side-bet { display: none; }
  .betspot { width: 46px; height: 46px; }
  .seat-cards { min-height: 50px; gap: 2px; }
  .hand-cards .card { width: 34px; height: 49px; }
  .hand-cards .card:not(:first-child) { margin-left: -21px; }
  .hand-cards .card .pip { font-size: 1.05rem; }
  .hand-cards .card .corner b { font-size: 0.56rem; }
  .hand-cards .card .corner i { font-size: 0.46rem; }
  .hand-group .score-badge { font-size: 0.6rem; margin-top: -9px; padding: 1px 5px; min-width: 22px; }
  .betspot-chips { width: 26px; height: 26px; bottom: 7px; }
  .betspot-chips .chip { width: 26px; height: 26px; font-size: 0.52rem; }
  .betspot-total { font-size: 0.58rem; bottom: -13px; }
  /* shoe + rack a touch smaller on phones (kept clear of the screen edge) */
  .shoe { width: 78px; height: 52px; top: 8px; right: 11%; }
  .shoe .deck { width: 44px; height: 33px; }
  .rack { width: 150px; top: 0; }
}
