/* ThePit · Copyright (C) 2026 abel0x
   SPDX-License-Identifier: AGPL-3.0-or-later
   Free software with ABSOLUTELY NO WARRANTY; see LICENSE for the terms. */

/* =========================================================
   Table 21: offline blackjack
   ========================================================= */
:root {
  --surface-top: rgba(18, 42, 31, .96);
  --surface-bottom: rgba(8, 26, 18, .96);
  --red: #c8302a;
  --shadow: rgba(0, 0, 0, .45);
  --rim: #3a2a12;
  --panel: rgba(8, 22, 16, .72);
}

body[data-theme="midnight"] {
  --surface-top: rgba(15, 36, 57, .96);
  --surface-bottom: rgba(6, 20, 34, .96);
}

body[data-theme="bordeaux"] {
  --surface-top: rgba(63, 27, 36, .96);
  --surface-bottom: rgba(33, 10, 17, .96);
}
/* Onyx deals from deep green backs that stand out on the charcoal felt. */
body[data-theme="onyx"] {
  --surface-top: rgba(40, 43, 47, .96);
  --surface-bottom: rgba(20, 22, 25, .96);
}
/* Amethyst deals from antique gold backs. */
body[data-theme="amethyst"] {
  --surface-top: rgba(52, 33, 76, .96);
  --surface-bottom: rgba(25, 14, 40, .96);
}

html { height: 100%; }

/* ----------------------- Top bar ----------------------- */
.topbar {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(8px, 1.5vh, 14px) clamp(14px, 3vw, 34px);
  background: linear-gradient(180deg, var(--topbar-top), var(--topbar-bottom));
  border-bottom: 1px solid var(--panel-line);
  backdrop-filter: blur(6px);
}

.brand-mark {
  display: inline-flex;
  flex: 0 0 auto;
  line-height: 0;
  filter: drop-shadow(0 3px 8px rgba(217, 182, 95, .35));
}

.subtitle {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 9px;
  line-height: 1;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: rgba(244, 239, 226, .55);
}

.balance-value {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 700; color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
}

.lang-btn:disabled,
.icon-btn:disabled { opacity: .38; cursor: not-allowed; }

/* The settings gear, drawn as at the other tables (shared/css/chip-tables.css). */
.icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#soundToggle.sound-control:not(:disabled):hover {
  color: #fff4c9;
  border-color: rgba(244,226,166,.58);
  background:
    radial-gradient(circle at 35% 27%, rgba(255,255,255,.16), transparent 30%),
    linear-gradient(145deg, rgba(217,182,95,.22), rgba(8,24,17,.8));
}

#soundToggle[aria-pressed="true"]:hover .sound-wave-far {
  animation: soundSignal 1.1s ease-in-out infinite;
}
@keyframes soundSignal {
  0%, 100% { opacity: .45; }
  50% { opacity: 1; }
}

/* ----------------------- Table ----------------------- */
.table-wrap {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  min-height: 0;               /* allow the area to shrink within the viewport */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.6vh, 18px);
  padding: clamp(8px, 1.6vh, 26px) clamp(12px, 2.4vw, 30px);
  overflow: hidden;
}

.table {
  width: min(1080px, 100%);
  flex: 0 1 auto;
  min-height: 0;
  perspective: 1400px;
}

.table-felt {
  position: relative;
  border-radius: 50% 50% 46% 46% / 64% 64% 36% 36%;
  background:
    radial-gradient(ellipse 72% 50% at 48% -4%, rgba(255, 247, 218, .12), transparent 66%) padding-box,
    repeating-linear-gradient(4deg, rgba(255,255,255,.016) 0 1px, transparent 1px 4px) padding-box,
    repeating-linear-gradient(94deg, rgba(0,0,0,.024) 0 1px, transparent 1px 5px) padding-box,
    radial-gradient(120% 92% at 50% 8%, var(--felt-highlight) 0%, var(--felt-1) 24%, var(--felt-2) 61%, var(--felt-edge) 100%) padding-box,
    linear-gradient(142deg, rgba(255,232,164,.3), transparent 24%, rgba(0,0,0,.42) 72%, rgba(255,214,117,.2)) border-box,
    repeating-linear-gradient(102deg, #25160b 0 10px, #52371a 10px 18px, #30200f 18px 29px, #694821 29px 34px) border-box;
  /* extra bottom room reserves the betting-circle zone below the player's cards */
  padding: clamp(18px, 3.6vh, 44px) clamp(18px, 4vw, 54px) clamp(74px, 13vh, 112px);
  box-shadow:
    inset 0 0 0 1px rgba(241, 211, 130, .18),
    inset 0 0 105px rgba(0, 0, 0, .58),
    inset 0 9px 34px rgba(255, 255, 255, .055),
    0 0 0 1px #0b0704,
    0 0 0 4px rgba(105, 72, 31, .58),
    0 34px 68px rgba(0, 0, 0, .64);
  border: clamp(8px, 1.25vh, 12px) solid transparent;
  /* Viewport-relative height: constant during play, always fits one screen.
     The cap (640) holds the capped inner zones and their padding. */
  height: clamp(330px, 64vh, 640px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(4px, 1vh, 10px);
  overflow: hidden;
}

.table-rim {
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  pointer-events: none;
  border: 2px solid rgba(225, 190, 99, .58);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,.52),
    inset 0 0 0 clamp(6px, .9vh, 9px) rgba(0,0,0,.15),
    0 1px 0 rgba(255,244,205,.18);
  z-index: 3;
}
.table-rim::after {
  content: "";
  position: absolute;
  inset: clamp(7px, 1.15vh, 11px);
  border-radius: inherit;
  border: 1px solid rgba(9, 36, 25, .7);
  box-shadow: 0 1px 0 rgba(244,226,166,.1);
}

/* Felt monogram watermark */
.felt-monogram {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(180px, 34vw, 360px);
  line-height: 1;
  color: rgba(255, 255, 255, .035);
  text-shadow: 0 2px 1px rgba(0,0,0,.12);
  pointer-events: none;
  z-index: 0;
  user-select: none;
}

/* The layout printed on the felt: faint gold arcs and curved text, like
   ink on a real table. It stays below the cards and chips (z-index 0), so
   they are always painted over it. */
.felt-print {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  color: var(--gold-bright);
  overflow: visible;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.14));
}
.felt-print .print-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  opacity: .11;
}
.felt-print .print-line.thin  { stroke-width: 1;   opacity: .075; }
.felt-print .print-line.sweep { stroke-width: 2.2; opacity: .17; }
.felt-print .print-label {
  fill: currentColor;
  font-family: var(--font-display);
  text-transform: uppercase;
  text-anchor: middle;
  /* the printed-into-felt look: faint, slightly debossed */
  paint-order: stroke;
}
.felt-print .print-label.ins  { font-size: 21px; letter-spacing: 7px;  opacity: .20; }
.felt-print .print-label.rule { font-size: 30px; letter-spacing: 8px;  opacity: .26; }
.felt-print .print-label.sub  { font-size: 16px; letter-spacing: 4.5px; opacity: .16; }

/* Seats */
.seat { position: relative; z-index: 2; }
.dealer-seat { text-align: center; }
.player-seat { text-align: center; }

/* Dealer nameplate */
.dealer-plate {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px 6px 14px;
  border-radius: 4px;
  margin-bottom: 12px;
  background: linear-gradient(180deg, rgba(0,0,0,.42), rgba(0,0,0,.22));
  border: 1px solid rgba(217, 182, 95, .35);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}
.dealer-plate-tag {
  font-size: 9px; letter-spacing: 2.5px; text-transform: uppercase;
  color: rgba(244, 226, 166, .6);
}
.dealer-plate-name {
  font-family: var(--font-ui);
  font-size: 12px; font-weight: 600; letter-spacing: 1.8px;
  color: var(--gold-bright);
}
.dealer-line {
  min-height: 18px;
  margin-top: 6px;
  font-style: normal;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(244, 239, 226, .62);
  opacity: 0;
  transition: opacity .35s ease;
}
.dealer-line.show { opacity: 1; }

.seat-header {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .28);
  border: 1px solid rgba(217, 182, 95, .25);
  margin-bottom: 12px;
}
.player-header { margin-top: 0; margin-bottom: 12px; }
.seat-name {
  font-family: var(--font-display);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-size: 13px;
  color: var(--gold-bright);
}
.score-chip {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 14px;
  min-width: 26px;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(0,0,0,.35);
  color: var(--cream);
}
.score-chip.bust { color: #fff; background: var(--red); }
.score-chip.bj { color: #2a1d05; background: linear-gradient(180deg,var(--gold-bright),var(--gold-soft)); }
.score-chip:empty { display: none; }

/* Hands: viewport-relative reserved heights + nowrap so the felt never resizes */
.hand, .hands-row {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 10px;
  min-height: clamp(66px, 11.5vh, 122px);
  flex-wrap: nowrap;
}
/* Reserve the full player block height even when empty (betting phase) */
.hands-row { gap: clamp(12px, 2.4vw, 26px); align-items: flex-start; min-height: clamp(84px, 14vh, 150px); }

.player-hand {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 14px;
  transition: .2s;
}
.player-hand .hand { min-height: clamp(62px, 10.5vh, 115px); }
.player-hand.active {
  background: radial-gradient(70% 100% at 50% 0%, rgba(217,182,95,.18), transparent 70%);
  box-shadow: inset 0 0 0 1px rgba(217,182,95,.35);
}
.hand-footer {
  min-height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.hand-wager {
  position: relative;
  flex: 0 0 48px;
  width: 48px;
  height: 34px;
  isolation: isolate;
}
.hand-wager::before {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 1px;
  height: 18px;
  border: 1px solid rgba(226,194,109,.25);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0,0,0,.24), transparent 68%);
}
.hand-wager .hand-bet-stack,
.hand-wager .bet-stack.hand-payout-stack {
  --stack-w: 38px;
  --stack-t: 5px;
  --stack-face: 18px;
  bottom: 3px;
  z-index: 2;
  filter: drop-shadow(0 5px 4px rgba(0,0,0,.48));
}
.hand-wager .hand-bet-stack.pile-medium,
.hand-wager .hand-payout-stack.pile-medium {
  --stack-w: 28px;
  --stack-t: 3px;
  --stack-face: 15px;
}
.hand-wager .pile-medium .pile-row { gap: 2px; }
.hand-wager .hand-bet-stack.pile-dense,
.hand-wager .hand-payout-stack.pile-dense {
  --stack-w: 24px;
  --stack-t: 2px;
  --stack-face: 13px;
}
.hand-wager .pile-dense .pile-row {
  gap: 2px;
}
.hand-wager .pile-dense .pile-row + .pile-row {
  margin-top: calc(0px - var(--stack-face) - 6px);
}
.hand-wager.wager-enter .hand-bet-stack { animation: wagerEnter .38s cubic-bezier(.2,.74,.24,1) both; }
.hand-wager.wager-split-left .hand-bet-stack { animation: wagerSplitLeft .4s cubic-bezier(.2,.74,.24,1) both; }
.hand-wager.wager-split-right .hand-bet-stack { animation: wagerSplitRight .4s cubic-bezier(.2,.74,.24,1) both; }
.hand-wager.wager-double .hand-bet-stack { animation: wagerDouble .38s cubic-bezier(.18,.76,.22,1) both; }
@keyframes wagerEnter {
  0% { opacity: 0; transform: translateX(-50%) translateY(42px) scale(.82); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
@keyframes wagerSplitLeft {
  0% { opacity: .45; transform: translateX(calc(-50% + 30px)) scale(.9); }
  100% { opacity: 1; transform: translateX(-50%) scale(1); }
}
@keyframes wagerSplitRight {
  0% { opacity: 0; transform: translateX(calc(-50% - 38px)) translateY(24px) scale(.82); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
@keyframes wagerDouble {
  0% { opacity: .55; transform: translateX(-50%) translateY(28px) scale(.86); }
  72% { transform: translateX(-50%) translateY(-2px) scale(1.03); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
.hand-tag {
  font-size: 11px;
  letter-spacing: 1px;
  padding: 3px 10px;
  border-radius: 4px;
  background: rgba(0,0,0,.4);
  border: 1px solid rgba(217,182,95,.25);
  display: flex; gap: 8px; align-items: center;
  white-space: nowrap;
}
.hand-tag .htag-bet { color: var(--gold-bright); font-weight: 700; }
.hand-tag .htag-score.bust { color: var(--bad); }
/* Split hands: total and stake on one line, the hand's net result below. A
   grid (not a wrapping flexbox) keeps the tag only as wide as its longest line. */
.hands-row:not(.hand-count-1) .hand-tag {
  display: grid;
  grid-template-columns: auto auto;
  justify-items: center;
  column-gap: 6px;
  row-gap: 0;
  padding: 2px 8px;
  line-height: 1.3;
}
.hands-row:not(.hand-count-1) .htag-res { grid-column: 1 / -1; }
.hands-row:not(.hand-count-1) .htag-hand,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.hand-tag .htag-res { font-weight: 700; }
.hand-tag .htag-res.win { color: var(--good); }
.hand-tag .htag-res.lose { color: var(--bad); }

/* The size of a card at this table; its look is in shared/css/cards.css. */
.card {
  --w: clamp(46px, min(8.4vw, 7.4vh), 82px);
}
.card:not(:first-child) { margin-left: -38px; }
.hand .card, .player-hand .hand .card { margin-left: 0; }
.hand .card:not(:first-child) { margin-left: -20px; }
/* Rotated about its centre, a sideways card is .4w wider than its layout box;
   the margins give that overhang back so it neither collides nor clips. */
.player-hand .hand .card.double-card {
  transform-origin: center center;
  margin-left: calc(var(--w) * .02);
  margin-right: calc(var(--w) * .2);
}
/* Three or four hands (and two on the narrowest phones) cannot afford the
   extra width, so the double card lies across the lower half of the first two
   cards, centred on them, leaving their corner indices readable. With the
   usual 20px fan the centring margin is -(3w - 20px) / 2. */
.hand-count-3 .hand .card.double-card,
.hand-count-4 .hand .card.double-card {
  --double-lift: calc(var(--w) * .26);
  margin-left: calc((var(--w) * -3 + 20px) / 2);
  margin-right: calc(var(--w) * .2);
}
#dealerHand .card { transition: margin-left .28s ease, z-index 0s; }
#dealerHand .card:first-child { z-index: 2; }
#dealerHand .card.hole-card {
  z-index: 1;
  margin-left: -31px;
}
#dealerHand .card.hole-card.hole-reveal-motion {
  z-index: 3;
  animation: exposeHoleCard .58s cubic-bezier(.22, .75, .25, 1) both;
}
@keyframes exposeHoleCard {
  0%   { transform: translateY(var(--card-lift)) rotate(var(--card-turn)); }
  46%  { transform: translate(18px, -5px) rotate(2deg); }
  100% { transform: translateY(var(--card-lift)) rotate(var(--card-turn)); }
}

/* Fresh cards use JS-measured vectors, so their first frame is inside the
   actual shoe mouth at every table size instead of at an arbitrary offset. */
.card.deal-ready,
.card.deal-ready::after { opacity: 0; }
.card.dealing {
  z-index: 4;
  will-change: transform, opacity;
  animation: dealFromShoe .56s cubic-bezier(.18, .76, .2, 1) both;
}
.card.dealing::after {
  animation: landShadow .56s cubic-bezier(.18, .76, .2, 1) both;
}
@keyframes dealFromShoe {
  0% {
    opacity: .62;
    transform: translate3d(var(--deal-x), var(--deal-y), 0) rotate(-7deg) scale(.5);
  }
  14% { opacity: 1; }
  58% {
    transform: translate3d(var(--deal-mid-x), var(--deal-mid-y), 0) rotate(-3.2deg) scale(.86);
  }
  84% { transform: translate3d(0, -5px, 0) rotate(1.2deg) scale(1.025); }
  100% {
    opacity: 1;
    transform: translate3d(0, var(--card-lift), 0) rotate(var(--card-turn)) scale(1);
  }
}
@keyframes landShadow {
  0%, 55% { opacity: 0; transform: scaleX(.5); }
  100%    { opacity: 1; transform: scaleX(1); }
}
/* Re-rendered (already-dealt) cards stay put: no replayed deal-in */
.card.no-deal { animation: none; }
.card.no-deal::after { animation: none; opacity: 1; transform: scaleX(1); }

/* Dealer gathers the cards into the dedicated discard tray. */
.card.collecting {
  z-index: 8;
  animation: collect .62s cubic-bezier(.4, 0, .7, .35) forwards;
}
.card.collecting::after { animation: none; opacity: 0; }
@keyframes collect {
  0%   { transform: translateY(var(--card-lift)) rotate(var(--card-turn)); opacity: 1; }
  32%  { transform: translate3d(var(--discard-mid-x), var(--discard-mid-y), 0) rotate(-2deg) scale(.9); }
  100% {
    transform: translate3d(var(--discard-x, -220px), var(--discard-y, -190px), 0) rotate(var(--discard-turn, 3deg)) scale(.48);
    opacity: 0;
  }
}

  

  

/* ----------------------- Result badge ----------------------- */
.result-badge {
  position: absolute;
  top: 43%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 6;
  pointer-events: none;
  padding: clamp(7px, 1.15vh, 11px) clamp(16px, 2.5vw, 28px);
  border: 1px solid rgba(236, 219, 170, .42);
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(7, 15, 12, .9), rgba(3, 8, 6, .82));
  box-shadow: 0 12px 30px rgba(0,0,0,.42), inset 0 1px rgba(255,255,255,.05);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: clamp(20px, 3.1vw, 38px);
  letter-spacing: clamp(1.8px, .34vw, 4px);
  text-align: center;
  white-space: nowrap;
  color: var(--cream);
  text-shadow: 0 2px 6px rgba(0, 0, 0, .65);
  opacity: 0;
}
.result-badge[hidden] { display: none; }
.result-word, .result-amount { display: block; }
.result-amount {
  margin-top: 2px;
  font-size: .5em;
  letter-spacing: .08em;
  font-variant-numeric: tabular-nums;
  opacity: .9;
}
/* The badge is the one visual verdict; the banner keeps announcing the full
   sentence to assistive technology but steps out of the way visually. */
.result-badge.show ~ .table-center .banner { opacity: 0; }
.result-badge.show { animation: badgePop .5s cubic-bezier(.2, 1.25, .3, 1) both; }
@keyframes badgePop {
  0%   { opacity: 0; transform: translate(-50%, -46%) scale(.94); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.result-badge.fade { animation: badgeFade .45s ease forwards; }
@keyframes badgeFade { to { opacity: 0; transform: translate(-50%, -54%) scale(.98); } }

.result-badge.win  { color: #d8f4e5; border-color: rgba(111,190,148,.56); }
.result-badge.lose { color: #f3d8d5; border-color: rgba(201,112,104,.5); }
.result-badge.push { color: var(--cream); }
.result-badge.bj {
  color: var(--gold-bright);
  border-color: rgba(226,194,109,.68);
}
html[lang="tr"] .result-badge.lose {
  font-size: clamp(19px, 3vw, 36px);
  letter-spacing: 1.5px;
}

/* ----------------------- Center ----------------------- */
.table-center {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.2vh, 12px);
  min-height: clamp(44px, 7.5vh, 82px);   /* reserve space so long banners don't resize the felt */
  pointer-events: none;
}
.arc-text {
  font-family: var(--font-display);
  font-size: clamp(9px, 1.3vw, 13px);
  letter-spacing: clamp(1px, .25vw, 3px);
  color: rgba(244, 226, 166, .55);
  text-transform: uppercase;
}
/* Used cards enter a separate acrylic discard tray, never the live shoe. */
.discard-tray {
  --discard-depth: 0px;
  position: absolute;
  top: clamp(38px, 14%, 88px);
  left: clamp(58px, 12%, 132px);
  width: 52px;
  height: 70px;
  z-index: 4;
  pointer-events: none;
  transform: perspective(180px) rotateX(-4deg) rotateZ(6deg);
  border: 1px solid rgba(224,231,226,.32);
  border-top-color: rgba(255,255,255,.5);
  border-radius: 5px 5px 9px 9px;
  background: linear-gradient(145deg, rgba(225,238,231,.13), rgba(5,12,9,.28));
  box-shadow: 0 10px 17px rgba(0,0,0,.45), inset 2px 1px rgba(255,255,255,.12);
}
.discard-tray::before,
.discard-tray::after {
  content: "";
  position: absolute;
  z-index: 3;
  bottom: -3px;
  width: 7px;
  height: 43px;
  border-radius: 2px;
  border: 1px solid rgba(231,238,234,.24);
  background: rgba(7,13,10,.28);
}
.discard-tray::before { left: -4px; }
.discard-tray::after { right: -4px; }
.discard-stack {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 7px;
  height: 53px;
  opacity: 0;
  transform: translateY(calc(8px - var(--discard-depth)));
  transition: opacity .25s ease, transform .35s ease;
}
.discard-tray.has-cards .discard-stack { opacity: 1; }
.discard-stack span {
  position: absolute;
  inset: 0;
  border-radius: 3px;
  border: 1px solid rgba(244,239,226,.72);
  background:
    linear-gradient(45deg, rgba(255,255,255,.07) 25%, transparent 25% 75%, rgba(255,255,255,.07) 75%) 0 0 / 6px 6px,
    var(--shoe-card-back);
  box-shadow: 0 1px 2px rgba(0,0,0,.42);
}
.discard-stack span:nth-child(1) { transform: translate(-2px, 3px) rotate(-1deg); }
.discard-stack span:nth-child(2) { transform: translate(2px, 1px) rotate(.7deg); }
.discard-stack span:nth-child(3) { transform: translate(-1px, -1px) rotate(-.4deg); }
.discard-stack span:nth-child(4) { transform: translate(1px, -3px) rotate(.25deg); }
.discard-count,
.shoe-count {
  position: absolute;
  z-index: 5;
  min-width: 20px;
  padding: 2px 5px;
  border-radius: 8px;
  background: rgba(2,7,5,.78);
  border: 1px solid rgba(226,194,109,.34);
  color: rgba(244,239,226,.78);
  font: 600 8px/1 var(--font-ui);
  letter-spacing: .3px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.discard-count { left: 50%; bottom: -12px; transform: translateX(-50%); }
.discard-tray.returning .discard-stack { animation: returnDiscard .62s ease both; }
@keyframes returnDiscard {
  55% { opacity: 1; transform: translate(105px, -18px) rotate(-6deg) scale(.78); }
  100% { opacity: 0; transform: translate(230px, -4px) rotate(-9deg) scale(.5); }
}

/* The dealing shoe sits in the felt's top-right corner (where cards deal from). */
.shoe {
  --shoe-depletion: 0px;
  position: absolute;
  top: clamp(38px, 14%, 88px);
  right: clamp(110px, 23%, 245px);
  width: 58px; height: 72px;
  border-radius: 7px 7px 10px 10px;
  background:
    linear-gradient(105deg, rgba(255,255,255,.12), transparent 24% 68%, rgba(255,255,255,.04)),
    linear-gradient(160deg, rgba(28,31,30,.96), rgba(7,9,8,.98));
  border: 1px solid rgba(209,178,98,.44);
  border-bottom-width: 4px;
  box-shadow:
    0 11px 18px rgba(0,0,0,.58),
    inset 2px 1px 2px rgba(255,255,255,.1),
    inset -3px -4px 7px rgba(0,0,0,.6);
  transform: perspective(180px) rotateX(-4deg) rotateZ(-7deg);
  z-index: 4;
  isolation: isolate;
  pointer-events: none;
}
.shoe::before {
  content: "";
  position: absolute;
  left: 5px; right: 5px; top: -5px;
  height: 13px;
  border-radius: 6px 6px 2px 2px;
  border: 1px solid rgba(229,203,139,.34);
  background: linear-gradient(180deg, #282a29, #090b0a 72%);
  box-shadow: 0 2px 3px rgba(0,0,0,.55), inset 0 1px rgba(255,255,255,.1);
  z-index: 0;
}
.shoe::after {
  content: "";
  position: absolute;
  left: -1px; right: -1px; bottom: -1px;
  height: 29px;
  clip-path: polygon(0 34%, 100% 2%, 100% 100%, 0 100%);
  border-radius: 0 0 8px 8px;
  background: linear-gradient(155deg, rgba(40,43,41,.96), #080a09 72%);
  box-shadow: inset 0 1px rgba(255,255,255,.13);
  z-index: 2;
}
.shoe-cards {
  position: absolute;
  left: 8px; top: 7px; right: calc(8px + var(--shoe-depletion)); bottom: 13px;
  border-radius: 3px;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.72) 0 1px, rgba(183,177,163,.72) 1px 2px),
    #d8d2c5;
  box-shadow: inset 0 0 0 1px rgba(54,39,25,.4), 0 2px 3px rgba(0,0,0,.38);
  overflow: hidden;
  z-index: 1;
  transition: right .3s ease;
}
.shoe-cards::before {
  content: "♠";
  position: absolute;
  inset: 2px 2px 8px;
  display: grid;
  place-items: center;
  border: 2px solid #eee6d2;
  border-radius: 2px;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.07) 0 3px, transparent 3px 6px),
    var(--shoe-card-back);
  color: rgba(241,214,143,.82);
  font-size: 17px;
  text-shadow: 0 1px 2px rgba(0,0,0,.55);
}
.cut-card {
  position: absolute;
  z-index: 2;
  top: 3px;
  bottom: 8px;
  right: 5px;
  width: 4px;
  border-radius: 1px;
  background: #df6940;
  box-shadow: -1px 0 rgba(255,220,183,.45), 1px 0 rgba(63,15,6,.42);
  opacity: 0;
  transition: opacity .2s ease, transform .3s ease;
}
.shoe.cut-near .cut-card { opacity: 1; transform: translateX(-3px); }
.shoe-count { right: 4px; bottom: -13px; }
.shoe.shuffling { animation: shoeShuffle .58s ease both; }
@keyframes shoeShuffle {
  0%, 100% { margin-right: 0; }
  25% { margin-right: -3px; }
  50% { margin-right: 3px; }
  75% { margin-right: -2px; }
}
.shoe-mouth {
  position: absolute;
  left: 3px;
  right: 9px;
  bottom: 7px;
  height: 15px;
  z-index: 3;
  overflow: hidden;
  border: 1px solid rgba(216,188,119,.2);
  border-radius: 3px 3px 6px 6px;
  transform: skewY(-4deg);
  background: linear-gradient(180deg, #010202 0 42%, #171a18 48% 100%);
  box-shadow:
    inset 0 4px 5px rgba(0,0,0,.92),
    inset 0 -1px rgba(255,255,255,.1),
    0 1px 2px rgba(0,0,0,.6);
}
.shoe-mouth::after {
  content: "";
  position: absolute;
  left: 8px;
  right: -5px;
  top: 4px;
  height: 8px;
  border: 1px solid rgba(242,235,219,.72);
  border-radius: 2px;
  background:
    linear-gradient(45deg, rgba(255,255,255,.08) 25%, transparent 25% 75%, rgba(255,255,255,.08) 75%) 0 0 / 6px 6px,
    var(--shoe-mouth-card);
  box-shadow: 0 1px 2px rgba(0,0,0,.7);
}
.banner {
  pointer-events: none;
  padding: 10px 26px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .42);
  border: 1px solid rgba(217, 182, 95, .35);
  font-family: var(--font-ui);
  font-weight: 600;
  letter-spacing: 1.2px;
  font-size: clamp(11px, 1.45vw, 14px);
  text-transform: uppercase;
  color: var(--gold-bright);
  min-height: 20px;
  transition: .25s;
  max-width: 90%;
}

.banner.flash-lose { background: rgba(120, 30, 26, .5); border-color: var(--bad); color: #ffd9d6; }

/* The engraved plate: limits, shoe size and dealer rule stay in sight. */
.table-specs {
  position: absolute;
  left: clamp(68px, 9%, 96px);
  bottom: clamp(88px, 13%, 104px);
  z-index: 2;
  display: flex;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid rgba(205,169,82,.46);
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(18,24,20,.78), rgba(5,10,8,.78));
  box-shadow: 0 5px 12px rgba(0,0,0,.3), inset 0 1px rgba(255,255,255,.05);
  pointer-events: none;
}
.table-spec {
  min-width: 62px;
  padding: 6px 10px 7px;
  text-align: left;
}

/* Split hands need the whole lower felt; the plaque returns with the next round
   and the full rules stay in settings. */
.table-specs { transition: opacity .25s ease, visibility .25s; }
body[data-hands="2"] .table-specs,
body[data-hands="3"] .table-specs,
body[data-hands="4"] .table-specs { opacity: 0; visibility: hidden; }

/* ----------------------- Bet spot ----------------------- */
.bet-spot {
  position: absolute;
  bottom: clamp(8px, 1.8vh, 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  display: flex;
  align-items: flex-end;
  gap: clamp(8px, 1.6vw, 18px);
}

/* The two side bets flank the main circle: Perfect Pairs and 21+3. A tap
   sends the next chips there; the circle taking chips is lit. */
.side-spot {
  --side: clamp(46px, 7vh, 60px);
  position: relative;
  width: var(--side);
  height: var(--side);
  margin-bottom: calc(var(--side) * .12);
  padding: 0;
  border-radius: 50%;
  border: 1px dashed rgba(226, 194, 109, .5);
  background: radial-gradient(circle, rgba(0,0,0,.2), rgba(0,0,0,.05) 68%, rgba(0,0,0,.24));
  color: rgba(244, 226, 166, .66);
  font: 700 9px/1 var(--font-ui);
  letter-spacing: 1px;
  cursor: pointer;
  transition: border-color .2s ease, box-shadow .2s ease, opacity .25s ease;
}
.side-spot:disabled { cursor: default; }
.side-spot[aria-pressed="true"] {
  border-style: solid;
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 2px rgba(244, 226, 166, .25), 0 0 14px rgba(244, 226, 166, .35);
  color: var(--gold-bright);
}
.side-name { position: absolute; top: 16%; left: 0; right: 0; text-align: center; }
.side-value {
  position: absolute;
  bottom: 9%;
  left: 0;
  right: 0;
  z-index: 5;
  text-align: center;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0;
  color: var(--gold-bright);
  text-shadow: 0 1px 3px rgba(0,0,0,.7);
  font-variant-numeric: tabular-nums;
}
.side-spot .side-stack {
  --stack-w: calc(var(--side) * .58);
  --stack-t: 4px;
  --stack-face: calc(var(--side) * .28);
  bottom: 34%;
}
.side-spot.won { border-color: var(--good); box-shadow: 0 0 16px rgba(110, 220, 160, .45); }
.side-spot.lost .side-stack,
.side-spot.lost .side-value { opacity: 0; transition: opacity .4s ease .3s; }
body[data-side-bets="false"] .side-spot { display: none; }

/* The Hi-Lo count rides on the shoe while the trainer shows it. */
.count-badge {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: -32px;
  transform: translateX(-50%);
  padding: 3px 7px;
  border-radius: 9px;
  background: rgba(2, 7, 5, .82);
  border: 1px solid rgba(226, 194, 109, .5);
  color: var(--gold-bright);
  font: 700 10px/1 var(--font-ui);
  letter-spacing: .3px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.count-badge[hidden] { display: none; }
body:not([data-count="check"]) .count-btn { display: none; }
.bet-circle {
  width: clamp(74px, 11vh, 94px); height: clamp(74px, 11vh, 94px);
  border-radius: 50%;
  border: 1px solid rgba(226, 194, 109, .58);
  display: grid;
  place-items: center;
  position: relative;
  background:
    radial-gradient(circle at 48% 42%, rgba(255,255,255,.025), transparent 55%),
    radial-gradient(circle, rgba(0,0,0,.22), rgba(0,0,0,.04) 68%, rgba(0,0,0,.28));
  box-shadow:
    inset 0 0 0 4px rgba(4,33,22,.32),
    0 1px 0 rgba(255,239,192,.08);
}
.bet-circle::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 1px dashed rgba(226,194,109,.44);
  pointer-events: none;
}
.bet-circle-label {
  position: absolute; top: 12%; left: 0; right: 0;
  text-align: center;
  font-size: 9px; letter-spacing: 3px;
  color: rgba(244, 226, 166, .55);
}
/* Player total is shown on the per-hand tag; the chip element stays in the DOM only for logic */
#playerScore { display: none; }
/* The bet amount sits at the foot of the circle so chips can pile in the middle */
.bet-circle-value {
  position: absolute; bottom: 11%; left: 0; right: 0;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 3px rgba(0,0,0,.7);
  z-index: 5;
}
/* A placed bet is a pile of whole chip cylinders, each a fixed offset from
   the one below. Every chip has its own curved wall and face, so a mixed
   pile shows each chip instead of flat coloured bands. */
.bet-stack {
  --stack-w: clamp(44px, 6.2vh, 56px);
  --stack-t: clamp(6px, .85vh, 8px);
  --stack-face: clamp(20px, 2.85vh, 26px);
  position: absolute;
  bottom: 32%;                 /* chips pile up out of the betting circle */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 8px 7px rgba(0, 0, 0, .5));
  isolation: isolate;
  pointer-events: none;
}
#betStack,
.bet-circle-value { transition: opacity .22s ease; }
body:not([data-phase="betting"]) #betStack,
body:not([data-phase="betting"]) .bet-circle-value { opacity: 0; }
.bet-stack.pile-medium {
  --stack-w: clamp(40px, 5.65vh, 51px);
  --stack-t: clamp(5px, .72vh, 7px);
  --stack-face: clamp(19px, 2.6vh, 24px);
}
.bet-stack.pile-dense {
  --stack-w: clamp(33px, 4.7vh, 42px);
  --stack-t: clamp(3px, .42vh, 4px);
  --stack-face: clamp(17px, 2vh, 19px);
}
.bet-stack .pile-row {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(3px, .5vw, 6px);
  min-height: 1px;
}
.bet-stack .pile-row + .pile-row {
  margin-top: -13px;
}
.bet-stack.pile-dense .pile-row + .pile-row {
  margin-top: calc(0px - var(--stack-face) - 9px);
}
.bet-stack .pile-row:first-child:not(:last-child) {
  transform: scale(.95);
  transform-origin: 50% 100%;
}
.bet-stack::before {
  content: "";
  position: absolute;
  left: 5%;
  right: 5%;
  bottom: -8px;
  height: 15px;
  z-index: 0;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0,0,0,.72), transparent 70%);
  transform: scaleY(.55);
  filter: blur(1.5px);
}
.bet-stack .chip-col {
  position: relative;
  z-index: 1;
  width: var(--stack-w);
  height: calc(var(--stack-face) + var(--stack-t));
  transform: translateY(var(--stack-nudge-y, 0)) rotate(var(--stack-turn, 0deg));
  transform-origin: 50% 100%;
}
.bet-stack .chip-col:only-child { --stack-turn: .4deg; }
.bet-stack .chip-col:nth-child(4n + 1):not(:only-child) { --stack-turn: -.72deg; --stack-nudge-y: 1px; }
.bet-stack .chip-col:nth-child(4n + 2) { --stack-turn: .58deg; --stack-nudge-y: -1px; }
.bet-stack .chip-col:nth-child(4n + 3) { --stack-turn: -.38deg; --stack-nudge-y: 1px; }
.bet-stack .chip-col:nth-child(4n) { --stack-turn: .3deg; --stack-nudge-y: 0; }
.bet-stack .chip-col.stack-count-2 { height: calc(var(--stack-face) + var(--stack-t) + var(--stack-t)); }
.bet-stack .chip-col.stack-count-3 { height: calc(var(--stack-face) + var(--stack-t) + var(--stack-t) + var(--stack-t)); }
.bet-stack .chip-col.stack-count-4 { height: calc(var(--stack-face) + var(--stack-t) + var(--stack-t) + var(--stack-t) + var(--stack-t)); }
.bet-stack .chip-col.stack-count-5 { height: calc(var(--stack-face) + var(--stack-t) + var(--stack-t) + var(--stack-t) + var(--stack-t) + var(--stack-t)); }
.bet-stack .chip-col.stack-count-6 { height: calc(var(--stack-face) + var(--stack-t) + var(--stack-t) + var(--stack-t) + var(--stack-t) + var(--stack-t) + var(--stack-t)); }
.bet-stack .chip-col.stack-count-7 { height: calc(var(--stack-face) + var(--stack-t) + var(--stack-t) + var(--stack-t) + var(--stack-t) + var(--stack-t) + var(--stack-t) + var(--stack-t)); }
.bet-stack .chip-col.stack-count-8 { height: calc(var(--stack-face) + var(--stack-t) + var(--stack-t) + var(--stack-t) + var(--stack-t) + var(--stack-t) + var(--stack-t) + var(--stack-t) + var(--stack-t)); }
.bet-stack.payout-stack {
  --stack-w: clamp(38px, 5.3vh, 48px);
  --stack-t: clamp(5px, .68vh, 7px);
  --stack-face: clamp(18px, 2.45vh, 22px);
  z-index: 7;
  opacity: 0;
  transform: translateX(-50%) translateY(-165px) scale(.62);
}
.bet-stack.payout-stack:empty { display: none; }
.bet-stack.payout-stack.arriving {
  animation: payoutArrive .68s cubic-bezier(.18,.76,.22,1) both;
}
@keyframes payoutArrive {
  0% { opacity: 0; transform: translateX(-50%) translateY(-165px) scale(.62); }
  18% { opacity: 1; }
  76% { transform: translateX(calc(-50% + 28px)) translateY(-12px) scale(1); }
  100% { opacity: 1; transform: translateX(calc(-50% + 22px)) translateY(-3px) scale(.92); }
}
.bet-stack.payout-stack.to-player {
  animation: payoutToPlayer .67s cubic-bezier(.22,.7,.3,1) both;
}
@keyframes payoutToPlayer {
  0% { opacity: 1; transform: translateX(calc(-50% + 22px)) translateY(-3px) scale(.92); }
  100% { opacity: 0; transform: translateX(calc(-50% + 18px)) translateY(120px) scale(.98); }
}

/* The parts every round tray chip is drawn from. */
.chip-art,
.stack-chip-art {
  shape-rendering: geometricPrecision;
}

.chip-svg-groove { fill: var(--ringline, var(--ring)); }

.chip-svg-value {
  fill: var(--ink, #f4efe2);
  stroke: rgba(0,0,0,.26);
  stroke-width: .8;
  paint-order: stroke fill;
  text-anchor: middle;
  dominant-baseline: middle;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .15px;
}
/* Settled wagers slide over to the player; they do not grow or glow. */
.bet-stack.to-player { animation: toPlayer .72s cubic-bezier(.22, .7, .3, 1) forwards; }
@keyframes toPlayer {
  0%   { transform: translateX(-50%) scale(1); }
  22%  { transform: translateX(-50%) translateY(-4px) scale(1.02); }
  100% { transform: translateX(-50%) translateY(120px) scale(1); opacity: 0; }
}
/* Loss: chips are swept up to the dealer */
.bet-stack.to-dealer { animation: toDealer .58s cubic-bezier(.5, 0, .75, .4) forwards; }
@keyframes toDealer {
  100% { transform: translateX(-50%) translateY(-230px) scale(.66); opacity: 0; }
}
/* Kept for legacy states; real pushes now use the same physical return path. */
.bet-stack.to-push { animation: toPlayer .72s cubic-bezier(.22, .7, .3, 1) forwards; }

/* ----------------------- Strategy coach ----------------------- */
/* Hints mode marks the basic-strategy play with a quiet brass ring and dot. */
.btn.coach-pick:not(:disabled) {
  position: relative;
  box-shadow: 0 0 0 2px var(--gold-bright), 0 0 14px rgba(226, 194, 109, .35);
}
.btn.coach-pick:not(:disabled)::after {
  content: "";
  position: absolute;
  top: 5px; right: 6px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold-bright);
}
.toast.coach { border-color: var(--gold-bright); color: var(--cream); }
.coach-seg .seg-btn { padding-inline: 11px; font-size: 12px; }

/* ----------------------- Insurance prompt ----------------------- */
/* The offer covers the (inactive) controls instead of the felt, so the player
   can still read both hands while deciding. It is anchored to the bottom of
   the controls box and never changes its size, so the table does not reflow. */
.ins-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  min-height: 100%;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .25s ease both;
}
.ins-overlay[hidden] { display: none; }
/* Not visibility: .btn transitions "all", so visibility would return a frame
   late and swallow the first click after the offer closes. */
body[data-phase="insurance"] .controls > :not(.ins-overlay) { opacity: 0; pointer-events: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.ins-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 24px;
  width: min(640px, 100%);
  text-align: left;
  padding: 14px 22px;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--surface-top), var(--surface-bottom));
  border: 1px solid rgba(217, 182, 95, .45);
  box-shadow: 0 22px 50px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(255,255,255,.04);
  animation: insRise .35s cubic-bezier(.2, .8, .25, 1) both;
}
.ins-panel > :not(.ins-actions) { grid-column: 1; }
.ins-panel > .ins-actions { grid-column: 2; grid-row: 1 / span 3; }
@keyframes insRise { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
.ins-line {
  font-size: 10px; letter-spacing: 5px; color: rgba(244, 226, 166, .55);
  margin-bottom: 4px;
}
.ins-panel h3 {
  font-family: var(--font-display);
  font-size: 22px; letter-spacing: 1px; color: var(--gold-bright); margin-bottom: 4px;
}
.ins-panel p { font-size: 13px; color: rgba(244, 239, 226, .75); line-height: 1.45; }
.ins-actions { display: flex; gap: 12px; justify-content: center; }

/* ----------------------- Controls ----------------------- */
.controls {
  position: relative;
  width: min(1080px, 100%);
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 1.6vh, 16px);
}

.chips-tray {
  display: flex;
  gap: clamp(8px, 1.4vw, 16px);
  flex-wrap: wrap;
  justify-content: center;
  padding: clamp(8px, 1.4vh, 14px) clamp(12px, 2vw, 22px);
  background:
    linear-gradient(180deg, rgba(255,255,255,.045), transparent 36%),
    linear-gradient(180deg, var(--tray-top), var(--tray-bottom));
  border: 1px solid rgba(217,182,95,.25);
  border-radius: 16px;
  backdrop-filter: blur(6px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.055),
    inset 0 -8px 16px rgba(0,0,0,.24),
    0 12px 25px rgba(0,0,0,.24);
}

/* The clay chip: solid body, 8 edge spots, centre inlay, bevel.
   Per-denomination colours are set via the variables below. */
.chip {
  --size: clamp(46px, min(7vw, 8vh), 66px);
  --body: #23232b;
  --spot: #ececf2;
  --spot-alt: var(--spot);
  --inlay: #30303a;
  --ringline: #cbb069;
  --ink: #f4efe2;
  --edge: #101015;
  --edge-dark: #050507;
  --chip-turn: 0deg;
  width: var(--size); height: var(--size);
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.42);
  cursor: pointer;
  position: relative;
  isolation: isolate;
  background: var(--body);
  box-shadow:
    0 6px 0 var(--edge),
    0 7px 0 var(--edge-dark),
    0 12px 18px rgba(0,0,0,.48);
  color: var(--ink);
  font-weight: 800;
  transform: rotate(var(--chip-turn));
  transition: transform .14s ease, box-shadow .14s ease;
  display: grid;
  place-items: center;
}

.chip::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  z-index: 1;
  pointer-events: none;
  opacity: .72;
  background:
    radial-gradient(ellipse 72% 52% at 38% 18%, rgba(255,255,255,.15), transparent 62%),
    radial-gradient(ellipse 78% 54% at 56% 96%, rgba(0,0,0,.16), transparent 68%);
  mix-blend-mode: soft-light;
}

.chip .denom {
  position: relative;
  z-index: 3;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: calc(var(--size) * .235);
  font-weight: 700;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: .05px;
  text-shadow: 0 1px 1px rgba(0,0,0,.42), 0 -1px rgba(255,255,255,.1);
}
.chip:hover {
  transform: translateY(-7px) rotate(var(--chip-turn));
  box-shadow:
    0 6px 0 var(--edge),
    0 7px 0 var(--edge-dark),
    0 20px 26px rgba(0,0,0,.55);
}
.chip:active { transform: translateY(-1px) rotate(var(--chip-turn)) scale(.96); }
.chip:disabled { opacity: .32; cursor: not-allowed; transform: rotate(var(--chip-turn)); filter: saturate(.6); }

/* Each chip's colours come from the pit's one palette (shared/js/chips.js). */
/* Two compact lines keep the royal label inside the centre inlay at every size. */
.chip-allin .denom {
  width: 42%;
  height: 42%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: clamp(7.5px, calc(var(--size) * .145), 9.5px);
  line-height: .82;
  letter-spacing: .55px;
  white-space: normal;
  text-shadow: 0 1px 2px rgba(0,0,0,.55);
}
.chip-allin .denom span { display: block; }

.action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.action-sep {
  width: 1px; height: 30px;
  background: rgba(217,182,95,.25);
  margin: 0 4px;
}

.btn-primary:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(217,182,95,.45); }

.btn-action {
  background: linear-gradient(180deg, var(--action-top), var(--action-bottom));
  border-color: rgba(217,182,95,.4);
  color: var(--gold-bright);
  min-width: 92px;
}
.btn-action:not(:disabled):hover { transform: translateY(-2px); border-color: var(--gold); background: linear-gradient(180deg, var(--action-hover-top), var(--action-hover-bottom)); }
.btn-small { padding: 8px 16px; font-size: 13px; }

/* ----------------------- Modal ----------------------- */
.modal-card {
  position: relative;
  width: min(480px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--modal-top), var(--modal-bottom));
  border: 1px solid var(--panel-line);
  border-radius: 18px;
  box-shadow: 0 30px 60px rgba(0,0,0,.6);
  scrollbar-width: thin;
  scrollbar-color: rgba(217,182,95,.62) rgba(0,0,0,.22);
}

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--panel-line);
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--modal-top);
  backdrop-filter: blur(8px);
}

.theme-option {
  --preview-felt-top: #207653;
  --preview-felt-bottom: #0c3d2a;
  --preview-card-top: #982c34;
  --preview-card-bottom: #4b0d14;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: stretch;
  padding: 6px 6px 8px;
  border: 1px solid rgba(217,182,95,.22);
  border-radius: 11px;
  background: rgba(255,255,255,.035);
  color: rgba(244,239,226,.7);
  cursor: pointer;
  font-family: var(--font-ui);
  transition: border-color .18s ease, background .18s ease, transform .18s ease, color .18s ease;
}

.theme-preview {
  position: relative;
  display: block;
  width: 100%;
  height: 48px;
  overflow: hidden;
  border-radius: 8px;
  background:
    repeating-linear-gradient(5deg, rgba(255,255,255,.018) 0 1px, transparent 1px 4px),
    radial-gradient(110% 100% at 45% 0%, var(--preview-felt-top), var(--preview-felt-bottom) 72%);
  box-shadow: inset 0 0 17px rgba(0,0,0,.42), inset 0 0 0 1px rgba(255,255,255,.06);
}
.theme-preview::before {
  content: "";
  position: absolute;
  left: -4px;
  right: -4px;
  bottom: -9px;
  height: 17px;
  border-top: 2px solid rgba(228,191,98,.72);
  border-radius: 50% 50% 0 0;
  background: linear-gradient(180deg, #543718, #211309);
  box-shadow: 0 -2px 6px rgba(0,0,0,.28);
}
.theme-preview::after {
  content: "♠";
  position: absolute;
  right: 10%;
  top: 5px;
  width: 24px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 2px double #efe5c9;
  border-radius: 3px;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.07) 0 3px, transparent 3px 6px),
    linear-gradient(145deg, var(--preview-card-top), var(--preview-card-bottom));
  color: #efd683;
  font-family: Georgia, serif;
  font-size: 13px;
  text-shadow: 0 1px 2px #000;
  box-shadow: 0 4px 7px rgba(0,0,0,.45);
  transform: rotate(5deg);
}
.theme-option[data-set-theme="midnight"] {
  --preview-felt-top: #2b6288;
  --preview-felt-bottom: #0b2b47;
  --preview-card-top: #465ea8;
  --preview-card-bottom: #111b46;
}
.theme-option[data-set-theme="bordeaux"] {
  --preview-felt-top: #8e3a49;
  --preview-felt-bottom: #3e111c;
  --preview-card-top: #555147;
  --preview-card-bottom: #0c0f0d;
}
.theme-option[data-set-theme="onyx"] {
  --preview-felt-top: #5d6268;
  --preview-felt-bottom: #2a2d31;
  --preview-card-top: #2f7354;
  --preview-card-bottom: #0b3324;
}
.theme-option[data-set-theme="amethyst"] {
  --preview-felt-top: #7a54a8;
  --preview-felt-bottom: #36215a;
  --preview-card-top: #a07a32;
  --preview-card-bottom: #3f2c0c;
}

.active-rules {
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  border-left: 2px solid rgba(217,182,95,.48);
  background: rgba(0,0,0,.16);
}
.active-rules > span {
  color: rgba(217,182,95,.66);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.active-rules strong {
  color: rgba(244,239,226,.72);
  font-size: 10px;
  font-weight: 400;
  line-height: 1.45;
}

.seg-btn {
  background: transparent; border: none; color: rgba(244,239,226,.6);
  padding: 8px 14px; cursor: pointer; font-size: 13px; font-weight: 600; transition: .16s;
}

.switch input:disabled + .slider { opacity: .38; cursor: not-allowed; }

.volume-slider::-moz-range-track {
  height: 4px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.35);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--panel-line);
}
.stats-grid h3 {
  grid-column: 1 / -1;
  font-family: var(--font-display);
  font-size: 15px; letter-spacing: 1px; color: var(--gold-bright);
}
.stat {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-radius: 9px; background: rgba(0,0,0,.25);
  font-size: 13px;
}
.stat b { font-variant-numeric: tabular-nums; color: var(--gold-bright); }
/* Deposit / add-funds */
.deposit-field {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--panel-line);
  border-radius: 10px;
  padding: 4px 4px 4px 12px;
  background: rgba(0,0,0,.28);
}

.deposit-btn { padding: 7px 16px; font-size: 13px; }

.about h3 {
  font-family: var(--font-display);
  font-size: 15px; letter-spacing: 1px; color: var(--gold-bright);
}

/* ----------------------- Toast ----------------------- */
.toast {
  position: fixed;
  top: 84px; left: 50%;
  transform: translateX(-50%) translateY(-14px);
  z-index: 30;
  padding: 12px 26px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 18px; letter-spacing: 1px;
  background: rgba(0,0,0,.78);
  border: 1px solid var(--gold);
  color: var(--gold-bright);
  opacity: 0;
  transition: opacity .3s, transform .3s;
  pointer-events: none;
}

/* The pace setting slows the dealing and the chips, not the hover effects. */
body[data-animation-speed="fast"] .dealer-line { transition-duration: .23s; }
body[data-animation-speed="fast"] .player-hand { transition-duration: .13s; }
body[data-animation-speed="fast"] .card-inner { transition-duration: .4s; }
body[data-animation-speed="fast"] .card.dealing,
body[data-animation-speed="fast"] .card.dealing::after { animation-duration: .36s; }
body[data-animation-speed="fast"] .card.collecting { animation-duration: .4s; }
body[data-animation-speed="fast"] .bet-stack.payout-stack.arriving { animation-duration: .36s; }
body[data-animation-speed="fast"] .bet-stack.payout-stack.to-player { animation-duration: .44s; }
body[data-animation-speed="fast"] .card-inner.revealing .card-face.front::before { animation-duration: .39s; animation-delay: .1s; }
body[data-animation-speed="fast"] .result-badge.show { animation-duration: .33s; }
body[data-animation-speed="fast"] .result-badge.fade { animation-duration: .29s; }
body[data-animation-speed="fast"] .bet-stack.to-player { animation-duration: .47s; }
body[data-animation-speed="fast"] .bet-stack.to-dealer { animation-duration: .38s; }
body[data-animation-speed="fast"] .bet-stack.to-push { animation-duration: .33s; }
body[data-animation-speed="fast"] .balance-pill.win-flash { animation-duration: .52s; }
body[data-animation-speed="fast"] .ins-overlay { animation-duration: .16s; }
body[data-animation-speed="fast"] .ins-panel { animation-duration: .23s; }

body[data-animation-speed="cinematic"] .dealer-line { transition-duration: .47s; }
body[data-animation-speed="cinematic"] .player-hand { transition-duration: .27s; }
body[data-animation-speed="cinematic"] .card-inner { transition-duration: .84s; }
body[data-animation-speed="cinematic"] .card.dealing,
body[data-animation-speed="cinematic"] .card.dealing::after { animation-duration: .76s; }
body[data-animation-speed="cinematic"] .card.collecting { animation-duration: .84s; }
body[data-animation-speed="cinematic"] .bet-stack.payout-stack.arriving { animation-duration: .76s; }
body[data-animation-speed="cinematic"] .bet-stack.payout-stack.to-player { animation-duration: .9s; }
body[data-animation-speed="cinematic"] .card-inner.revealing .card-face.front::before { animation-duration: .81s; animation-delay: .2s; }
body[data-animation-speed="cinematic"] .result-badge.show { animation-duration: .68s; }
body[data-animation-speed="cinematic"] .result-badge.fade { animation-duration: .61s; }
body[data-animation-speed="cinematic"] .bet-stack.to-player { animation-duration: .97s; }
body[data-animation-speed="cinematic"] .bet-stack.to-dealer { animation-duration: .78s; }
body[data-animation-speed="cinematic"] .bet-stack.to-push { animation-duration: .68s; }
body[data-animation-speed="cinematic"] .balance-pill.win-flash { animation-duration: 1.08s; }
body[data-animation-speed="cinematic"] .ins-overlay { animation-duration: .34s; }
body[data-animation-speed="cinematic"] .ins-panel { animation-duration: .47s; }

/* ----------------------- Responsive ----------------------- */
@media (max-width: 640px) {
  .subtitle { display: none; }
  .topbar { gap: 8px; padding-inline: 12px; }
  .topbar .lang-switch { display: none; }
  .topbar-actions { gap: 7px; }
  .brand { gap: 9px; min-width: 0; }
  .brand-mark svg { width: 38px; height: 38px; }
  .brand-text h1 { font-size: clamp(17px, 5vw, 21px); letter-spacing: 1.2px; }
  .balance-pill { min-width: 92px; padding: 5px 12px; }
  .table-felt { padding: clamp(12px, 2vh, 22px) 12px clamp(58px, 11vh, 82px); }
  .arc-text { display: none; }
  /* Curved felt text gets cramped on phones: keep the printed arcs, drop the labels. */
  .felt-print .print-label { display: none; }
  .shoe {
    display: block;
    top: clamp(30px, 13%, 54px);
    right: clamp(52px, 18%, 76px);
    transform: perspective(180px) rotateX(-4deg) rotateZ(-7deg) scale(.72);
    transform-origin: top right;
  }
  .discard-tray {
    top: clamp(30px, 13%, 54px);
    left: clamp(40px, 14%, 68px);
    transform: perspective(180px) rotateX(-4deg) rotateZ(6deg) scale(.72);
    transform-origin: top left;
  }
  .table-specs {
    left: 20px;
    bottom: 62px;
    transform: scale(.78);
    transform-origin: bottom left;
  }
  .btn { min-height: 44px; }
  .btn-action { min-width: 0; flex: 1 1 28%; }
  .action-sep { display: none; }
  .bet-spot { bottom: 8px; }
  .bet-circle { width: 72px; height: 72px; }
  .bet-stack.pile-medium {
    --stack-w: 34px;
    --stack-t: 5px;
    --stack-face: 18px;
  }
  .bet-stack.pile-dense {
    --stack-w: 32px;
    --stack-t: 3px;
    --stack-face: 15px;
  }
  .bet-stack.pile-dense .pile-row + .pile-row { margin-top: -18px; }
  .result-badge { font-size: clamp(20px, 7.5vw, 34px); }
  .ins-panel { grid-template-columns: 1fr; row-gap: 8px; text-align: center; padding: 10px 14px; }
  .ins-panel > .ins-actions { grid-column: 1; grid-row: auto; }
  .ins-line { display: none; }
  .ins-panel h3 { font-size: 19px; margin-bottom: 0; }
  .ins-panel p { font-size: 12px; }
  body[data-phase="betting"] .btn-action { display: none; }
  body:not([data-phase="betting"]) .btn-bet-control { display: none; }
  body:not([data-phase="betting"]) .chips-tray { display: none; }
  /* Once play starts, each hand owns the wager. Retire the staging circle and
     leave the lower felt clear for split-hand labels and the rules plaque. */
  body:not([data-phase="betting"]) .bet-spot {
    opacity: 0;
    visibility: hidden;
  }
  body:not([data-phase="betting"]) .table-specs { bottom: 18px; }
  .hand-count-3,
  .hand-count-4 { gap: 2px; }
  .hand-count-3 .player-hand,
  .hand-count-4 .player-hand { padding: 3px; gap: 2px; min-width: 0; }
  .hand-count-3 .card,
  .hand-count-4 .card { --w: 40px; }
  .hand-count-3 .hand .card:not(:first-child),
  .hand-count-4 .hand .card:not(:first-child) { margin-left: -34px; }
  .hand-count-3 .hand .card.double-card,
  .hand-count-4 .hand .card.double-card { margin-left: calc((var(--w) * -3 + 34px) / 2); }
  /* Narrow rows keep tags to two short lines: once settled, the net result
     takes the stake's place. */
  .hands-row.hand-count-3 .hand-tag:has(.htag-res) .htag-bet,
  .hands-row.hand-count-4 .hand-tag:has(.htag-res) .htag-bet { display: none; }
  .hands-row.hand-count-3 .hand-tag,
  .hands-row.hand-count-4 .hand-tag {
    grid-template-columns: auto;
    gap: 0;
    padding: 2px 4px;
    font-size: 9px;
    line-height: 1.05;
    letter-spacing: .3px;
  }
  .hand-count-3 .hand-footer,
  .hand-count-4 .hand-footer {
    min-height: 48px;
    flex-direction: column;
    gap: 0;
  }
  .hand-count-3 .hand-wager,
  .hand-count-4 .hand-wager {
    flex-basis: 26px;
    width: 42px;
    height: 26px;
  }
  .hand-count-3 .hand-wager .hand-bet-stack,
  .hand-count-3 .hand-wager .hand-payout-stack,
  .hand-count-4 .hand-wager .hand-bet-stack,
  .hand-count-4 .hand-wager .hand-payout-stack {
    --stack-w: 28px;
    --stack-t: 3px;
    --stack-face: 14px;
  }
  .hand-count-3 .hand-wager .pile-medium,
  .hand-count-4 .hand-wager .pile-medium {
    --stack-w: 22px;
    --stack-t: 2px;
    --stack-face: 12px;
  }
  .hand-count-3 .hand-wager .pile-dense,
  .hand-count-4 .hand-wager .pile-dense {
    --stack-w: 20px;
    --stack-t: 2px;
    --stack-face: 11px;
  }
  .hand-count-3 .hand-wager .pile-row,
  .hand-count-4 .hand-wager .pile-row { gap: 2px; }
}

/* Portrait tablets: a centred hand reaches the full plaque, so keep the two
   cells that matter during play; limits and shoe size remain in settings. */
@media (max-width: 900px) {
  .table-spec:nth-child(1),
  .table-spec:nth-child(3) { display: none; }
}

@media (max-width: 420px) {
  .topbar { padding: 7px 8px; }
  .brand-mark svg { width: 34px; height: 34px; }
  .brand-text h1 { font-size: 16px; }
  .balance-pill { min-width: 76px; padding: 5px 8px; }
  .balance-label { display: none; }
  .balance-value { font-size: 17px; }
  .icon-btn { width: 36px; height: 36px; }
  .modal-body { padding-inline: 16px; }
  .theme-picker { gap: 6px; }
  .theme-option { padding-inline: 5px; }
  .animation-setting, .coach-setting { align-items: stretch; flex-direction: column; gap: 8px; }
  .animation-seg, .coach-seg { width: 100%; }
  .animation-seg .seg-btn, .coach-seg .seg-btn { flex: 1 1 0; padding-inline: 6px; }
  .deposit-row { align-items: stretch; flex-direction: column; gap: 8px; }
  .deposit-field { width: 100%; }
  .deposit-input { flex: 1 1 auto; width: auto; min-width: 0; }
  .table-spec:nth-child(1),
  .table-spec:nth-child(3) { display: none; }
  .table-specs {
    left: 24px;
    bottom: 70px;
    transform: scale(.74);
  }
  /* The side circles flank the bet: the plaque waits above them. */
  body[data-side-bets="true"][data-phase="betting"] .table-specs { bottom: 104px; }
  /* The oval narrows at the bottom corners; during play the retired bet circle
     leaves the bottom centre free, which keeps the plaque inside the rail. */
  body:not([data-phase="betting"]) .table-specs {
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%) scale(.74);
    transform-origin: bottom center;
  }
  /* The brand already sits in the top bar; the discard tray needs this corner. */
  .dealer-plate-tag { display: none; }
  .hand-count-2 {
    width: 100%;
    gap: 4px;
  }
  .hand-count-2 .player-hand {
    flex: 1 1 0;
    min-width: 0;
    padding-inline: 2px;
  }
  .hand-count-2 .hand-footer { gap: 4px; }
  .hand-count-2 .hand-wager {
    flex-basis: 42px;
    width: 42px;
  }
  .hand-count-2 .hand-tag {
    gap: 4px;
    padding-inline: 5px;
    font-size: 10px;
    letter-spacing: .5px;
  }
}

@media (max-width: 350px) {
  #soundToggle { display: none; }
  .chips-tray { gap: 4px; padding: 7px 8px; }
  .chip { --size: 42px; }
  .hand-count-2 .hand .card.double-card {
    --double-lift: calc(var(--w) * .26);
    margin-left: calc((var(--w) * -3 + 20px) / 2);
  }
  .hand-count-3 .card,
  .hand-count-4 .card { --w: 34px; }
  .hand-count-3 .hand .card:not(:first-child),
  .hand-count-4 .hand .card:not(:first-child) { margin-left: -28px; }
  .hand-count-3 .hand .card.double-card,
  .hand-count-4 .hand .card.double-card { margin-left: calc((var(--w) * -3 + 28px) / 2); }
}

/* Short viewports (landscape phones, small laptops): trim further to avoid scroll */
@media (max-height: 620px) {
  .topbar { padding: 6px clamp(12px, 3vw, 28px); }
  .subtitle { display: none; }
  .arc-text { display: none; }
  .felt-print .print-label.sub { display: none; }   /* trim the third line on short screens */
  .dealer-line { display: none; }
  .table-felt {
    height: clamp(290px, 66vh, 430px);
    padding: clamp(10px, 2.4vh, 18px) clamp(16px, 4vw, 40px) clamp(60px, 12.5vh, 86px);
  }
  .bet-circle { width: clamp(60px, 10vh, 76px); height: clamp(60px, 10vh, 76px); }
  .hand, .hands-row { min-height: clamp(62px, 11vh, 110px); }
  .hands-row { min-height: clamp(82px, 14vh, 140px); }
  .table-center { min-height: clamp(38px, 7vh, 66px); }
  .player-hand .hand { min-height: clamp(58px, 10vh, 100px); }
  .card { --w: clamp(42px, min(8vw, 7vh), 72px); }
  .chip { --size: clamp(38px, min(6vw, 7vh), 52px); }
  .chips-tray { padding: clamp(6px, 1.2vh, 10px) clamp(10px, 2vw, 18px); }
  .btn { padding: clamp(6px, 1.2vh, 9px) clamp(12px, 1.6vw, 18px); font-size: clamp(11px, 1.4vh, 13px); }
}

/* Landscape keeps the controls in normal flow. At very short heights the page
   can scroll instead of clipping the table or painting buttons over its felt. */
@media (max-height: 450px) {
  body { height: auto; min-height: 100vh; min-height: 100dvh; overflow-x: hidden; overflow-y: auto; }
  .table-wrap { flex: 1 0 auto; justify-content: flex-start; overflow: visible; gap: 8px; padding-block: 8px; }
  .table { flex: 0 0 auto; }
  .table-felt { height: calc(100vh - 130px); height: calc(100dvh - 130px); min-height: 210px; padding: 6px 16px; border-width: 6px; gap: 4px; }
  .dealer-plate { margin-bottom: 3px; padding: 2px 8px; gap: 6px; }
  .dealer-plate-name { font-size: 10px; }
  .dealer-plate-tag { font-size: 8px; letter-spacing: 1px; }
  .score-chip { font-size: 11px; padding: 1px 6px; }
  .hand, .hands-row, .player-hand .hand { min-height: 0; }
  .player-hand { padding: 2px 4px; gap: 3px; }
  .hand-footer { min-height: 30px; }
  .hand-tag { font-size: 10px; gap: 5px; padding: 2px 6px; }
  .table-center { position: absolute; left: 16px; top: 44%; width: 26%; min-height: 0; }
  .banner { font-size: 10px; letter-spacing: .4px; padding: 5px 7px; white-space: normal; }
  .felt-print .print-label { display: none; }
  .table-specs { bottom: 24px; left: 18%; transform: scale(.68); transform-origin: bottom left; }
  /* Beside the side circles there is no room on the left: the plaque takes
     the matching place on the right. */
  body[data-side-bets="true"][data-phase="betting"] .table-specs { left: auto; right: 12%; transform-origin: bottom right; }
  .table-spec:nth-child(1), .table-spec:nth-child(3) { display: none; }
  .shoe { top: 25px; right: 16%; transform: rotateZ(-7deg) scale(.62); transform-origin: top right; }
  .discard-tray { top: 25px; left: 16%; transform: rotateZ(6deg) scale(.62); transform-origin: top left; }
  .bet-spot { bottom: 12px; }
  .action-row { gap: 6px; }
  .action-sep { display: none; }
  .btn-action { min-width: 0; flex: 0 0 auto; }
  .hand-count-3 .hand-footer, .hand-count-4 .hand-footer { min-height: 32px; flex-direction: row; gap: 3px; }
  .hand-count-3 .hand-wager, .hand-count-4 .hand-wager { flex-basis: 30px; width: 30px; }
  /* Three or four hands span the felt: lift them off the curved bottom rail,
     and let the active-hand highlight speak for the banner, which stays
     available to screen readers. */
  body[data-hands="3"] .table-felt, body[data-hands="4"] .table-felt { justify-content: space-evenly; }
  .hands-row.hand-count-4 { gap: 4px; }
  body[data-hands="3"] .banner, body[data-hands="4"] .banner { opacity: 0; }
  body[data-phase="betting"] .btn-action { display: none; }
  body:not([data-phase="betting"]) .btn-bet-control,
  body:not([data-phase="betting"]) .chips-tray { display: none; }
  body:not([data-phase="betting"]) .bet-spot { visibility: hidden; }
  .ins-panel { padding: 4px 6px 4px 14px; }
  .ins-line { display: none; }
  .ins-panel h3 { font-size: 16px; margin-bottom: 0; }
  .ins-panel p { font-size: 11px; line-height: 1.3; }
  .toast { max-width: calc(100vw - 24px); font-size: 13px; padding: 8px 14px; text-align: center; }
}

@media (max-height: 450px) and (min-width: 540px) {
  /* Landscape phones: a slimmer top bar pays for 44px touch targets and larger cards. */
  .topbar { padding-block: 3px; }
  .brand-mark svg { width: 30px; height: 30px; }
  .balance-pill { padding: 3px 12px; }
  .balance-label { display: none; }
  .icon-btn { width: 36px; height: 36px; }
  .lang-btn { padding-block: 5px; }
  .hand-count-4 .card { --w: clamp(40px, 12vh, 54px); }
  .card { --w: clamp(42px, 13vh, 60px); }
  .controls { flex-direction: row; justify-content: center; gap: 10px; }
  .chips-tray { flex-wrap: nowrap; gap: 6px; padding: 3px 8px; }
  .chip { --size: 40px; }
  .action-row { flex-wrap: nowrap; }
  .btn { min-height: 44px; padding-inline: 14px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
