/* ============ BLACKJACK — premium casino table ============ */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; overscroll-behavior: none; }

:root {
  --gold: #f3c95c;
  --gold-hot: #ffe9a8;
  --cream: #f7f1e1;
  --red: #c8323a;
  --ink: #1c2126;
  --win: #58e08a;
  --lose: #ff6b6b;
  --line: rgba(255,255,255,.4);
  --card-w: 56px;
  --card-h: 80px;
}

body {
  font-family: "Bebas Neue", sans-serif;
  background: #1c0507;
  color: var(--cream);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  letter-spacing: 0.04em;
  overflow: hidden;
}

button { font-family: inherit; letter-spacing: 0.06em; cursor: pointer; border: none; }
[hidden] { display: none !important; }

/* ============ join screen ============ */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: radial-gradient(ellipse 120% 90% at 50% 30%, #17804b 0%, #0d5c33 55%, #06371e 100%);
}
.join-card { width: min(420px, 100%); text-align: center; }
.logo-suits { font-size: 28px; letter-spacing: 14px; color: var(--gold); text-shadow: 0 0 24px rgba(243,201,92,.6); }
.logo {
  font-family: "Rye", serif;
  font-size: clamp(44px, 13vw, 72px);
  margin: 8px 0 4px;
  color: var(--gold);
  text-shadow: 0 2px 0 #7a5a14, 0 4px 0 #4d3a0e, 0 8px 30px rgba(0,0,0,.6), 0 0 40px rgba(243,201,92,.35);
}
.tagline { font-family: "Playfair Display", serif; font-style: italic; color: #bfe3c9; font-size: 17px; margin: 0 0 24px; }

#join input {
  width: 100%;
  font-family: "Bebas Neue", sans-serif;
  font-size: 24px; letter-spacing: .12em; text-align: center;
  padding: 13px; margin-bottom: 12px;
  background: rgba(0,0,0,.35);
  border: 2px solid rgba(243,201,92,.4);
  border-radius: 12px;
  color: var(--cream); outline: none;
  text-transform: uppercase;
}
#join input:focus { border-color: var(--gold); box-shadow: 0 0 18px rgba(243,201,92,.3); }

.cfg-row { display: flex; gap: 10px; margin-bottom: 12px; }
.cfg-row label {
  flex: 1;
  font-size: 13px; letter-spacing: .14em; color: #9fcfae;
  text-align: left;
}
.cfg-row input { margin: 4px 0 0 !important; font-size: 20px !important; padding: 9px !important; }

.join-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 14px; color: #9fcfae; font-size: 16px; }
.join-divider::before, .join-divider::after { content: ""; flex: 1; height: 1px; background: rgba(243,201,92,.3); }
.join-row { display: flex; gap: 10px; }
.join-row input { flex: 1; margin-bottom: 0; }
.join-row .btn { flex: 1; }

.btn { border-radius: 12px; font-size: 22px; padding: 12px 18px; color: var(--ink); transition: transform .08s; }
.btn:active { transform: scale(.95); }
.btn.big { width: 100%; font-size: 24px; padding: 15px; }
.btn.gold { background: linear-gradient(180deg, var(--gold-hot), var(--gold) 50%, #c99a2e); box-shadow: 0 4px 0 #8a6a1d, 0 8px 22px rgba(0,0,0,.45); }
.btn.green { background: linear-gradient(180deg, #7be3a4, #34b566 50%, #1d8c4a); box-shadow: 0 4px 0 #11532c, 0 8px 22px rgba(0,0,0,.45); color: #06281a; }

/* ============ table frame ============ */
#table { display: flex; flex-direction: column; height: 100dvh; position: relative; }

#table::before {
  content: "♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣ ♠ ♥ ♦ ♣";
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 115%, #4a0e13 0%, #2e080b 55%, #1c0507 100%);
  color: rgba(0,0,0,.3);
  font-size: 30px; line-height: 2.4; letter-spacing: 34px;
  overflow: hidden; word-break: break-all; padding: 6px;
  z-index: 0;
}

#felt { position: relative; flex: 1; min-height: 0; z-index: 1; overflow: hidden; }

/* wooden rim */
#felt::before {
  content: "";
  position: absolute;
  left: 50%; top: -80%;
  width: 178%; height: 178%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: linear-gradient(180deg, #c19154 0%, #96672f 18%, #7a4e20 45%, #5d3915 75%, #432708 100%);
  box-shadow:
    inset 0 4px 8px rgba(255,235,190,.5),
    inset 0 -10px 22px rgba(0,0,0,.6),
    0 26px 70px rgba(0,0,0,.8);
}
/* cloth */
#cloth {
  position: absolute;
  left: 50%; top: calc(-80% + 22px);
  width: calc(178% - 44px); height: calc(178% - 44px);
  transform: translateX(-50%);
  border-radius: 50%;
  background:
    radial-gradient(ellipse 55% 38% at 50% 30%, rgba(255,255,255,.07), transparent 70%),
    repeating-radial-gradient(circle at 50% 45%, rgba(255,255,255,.012) 0 2px, transparent 2px 4px),
    radial-gradient(ellipse at 50% 58%, #1c8a53 0%, #126740 48%, #0a4d2c 78%, #063821 100%);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,.4),
    inset 0 10px 40px rgba(0,0,0,.35),
    inset 0 0 140px rgba(0,0,0,.42);
}
/* gold pinstripe */
#felt::after {
  content: "";
  position: absolute;
  left: 50%; top: calc(-80% + 42px);
  width: calc(178% - 84px); height: calc(178% - 84px);
  transform: translateX(-50%);
  border-radius: 50%;
  border: 1.6px solid rgba(243,201,92,.32);
  pointer-events: none;
}

/* ============ floating top bar ============ */
#topbar {
  position: absolute; z-index: 10;
  top: max(8px, env(safe-area-inset-top));
  left: 10px; right: 10px;
  display: flex; align-items: center; gap: 8px;
  font-size: 16px;
}
.room-chip {
  background: rgba(0,0,0,.45); color: var(--cream);
  border: 1px dashed rgba(243,201,92,.5); border-radius: 999px;
  padding: 4px 12px; font-size: 15px; letter-spacing: .1em;
}
.room-chip b { color: var(--gold); }
#shoeMeter { margin-left: auto; font-size: 14px; opacity: .9; background: rgba(0,0,0,.45); border-radius: 999px; padding: 4px 10px; }
.icon-btn { background: rgba(0,0,0,.45); color: var(--cream); border-radius: 999px; padding: 4px 11px; font-size: 16px; }

/* ============ felt artwork ============ */
#feltArt {
  position: absolute; z-index: 2;
  left: 50%; top: 1%;
  width: min(92%, 860px);
  transform: translateX(-50%);
  pointer-events: none;
}
.fa-title {
  font-family: "Playfair Display", serif;
  font-weight: 800;
  font-size: 64px;
  letter-spacing: 10px;
  fill: rgba(255,255,255,.9);
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.3));
}
.fa-white { font-family: "Playfair Display", serif; font-weight: 600; font-size: 21px; letter-spacing: 4px; fill: rgba(255,255,255,.85); }
.fa-gold  { font-family: "Playfair Display", serif; font-style: italic; font-weight: 700; font-size: 30px; letter-spacing: 3px; fill: var(--gold); filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }
.fa-rule  { font-family: "Playfair Display", serif; font-weight: 600; font-size: 16px; letter-spacing: 3.5px; fill: rgba(255,255,255,.75); }

.paytable {
  position: absolute; z-index: 2; pointer-events: none;
  font-family: "Playfair Display", serif; font-weight: 700;
  color: rgba(255,255,255,.82);
}
#payLeft  { left: 4%;  top: 11%; width: 150px; }
#payRight { right: 4%; top: 9%;  width: 195px; }
.paytable h4 { margin: 0 0 3px; font-size: 14px; letter-spacing: 2px; color: var(--gold); font-style: italic; }
.paytable div { display: flex; justify-content: space-between; font-size: 11px; letter-spacing: 1px; line-height: 1.55; }
.paytable b { color: rgba(255,255,255,.93); }

#minmax {
  position: absolute; z-index: 2; pointer-events: none;
  left: 4%; top: 34%;
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(180deg, #eceef0, #b9bcc2 60%, #d6d8dc);
  border-radius: 10px; padding: 6px 12px;
  box-shadow: 0 3px 8px rgba(0,0,0,.5), inset 0 1px 0 #fff;
  color: #2b2e33; text-align: center;
  font-size: 11px; line-height: 1.1; letter-spacing: .08em;
}
#minmax b { font-size: 15px; }
#minmax i { width: 1px; align-self: stretch; background: #8a8d93; }

#discardPile, #shoeBox { position: absolute; z-index: 2; pointer-events: none; }
#discardPile { left: 5%; top: 2%; height: 74px; width: 60px; }
#discardPile i {
  position: absolute; width: 52px; height: 70px; border-radius: 6px;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.12) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.12) 0 2px, transparent 2px 7px),
    radial-gradient(circle at 50% 40%, #b3242e, #8e1c22 75%);
  box-shadow: inset 0 0 0 3px #f3e9d2, inset 0 0 0 4px #8e1c22, 0 2px 5px rgba(0,0,0,.5);
}
#discardPile i:nth-child(1) { transform: rotate(-7deg) translate(2px, 4px); }
#discardPile i:nth-child(2) { transform: rotate(3deg) translate(-1px, 2px); }
#discardPile i:nth-child(3) { transform: rotate(-2deg); }
#shoeBox { right: 5%; top: 2%; width: 86px; height: 80px; }
#shoeBox::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(160deg, #f2f3f5, #9da1a8 55%, #c9ccd2);
  border-radius: 10px 14px 8px 8px;
  transform: skewX(-8deg);
  box-shadow: 0 4px 10px rgba(0,0,0,.55), inset 0 0 0 2px rgba(255,255,255,.5);
}
#shoeBox i {
  position: absolute; left: 16px; top: 18px; width: 48px; height: 56px; border-radius: 5px;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.12) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.12) 0 2px, transparent 2px 7px),
    radial-gradient(circle at 50% 40%, #b3242e, #8e1c22 75%);
  box-shadow: inset 0 0 0 3px #f3e9d2, inset 0 0 0 4px #8e1c22;
  transform: skewX(-8deg) rotate(2deg);
}

/* ============ dealer ============ */
#dealerArea {
  position: absolute; z-index: 3;
  left: 50%; top: 26%;
  transform: translateX(-50%);
  text-align: center;
  min-height: var(--card-h);
}
#dealerCards { justify-content: center; min-height: var(--card-h); }
#dealerArea .total-badge { margin-top: 4px; }

/* ============ banner ============ */
#banner {
  position: absolute; z-index: 4;
  left: 50%; top: 41%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  width: 90%;
}
#bannerText {
  font-family: "Playfair Display", serif;
  font-style: italic; font-weight: 700;
  font-size: clamp(16px, 3vw, 24px);
  letter-spacing: .12em;
  color: var(--gold-hot);
  text-shadow: 0 2px 10px rgba(0,0,0,.6);
}
#bannerText.flash { animation: bannerPop .5s ease; }
@keyframes bannerPop { 0% { transform: scale(.8); opacity: 0; } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
#timebar { width: min(220px, 46vw); height: 4px; margin: 6px auto 0; background: rgba(0,0,0,.4); border-radius: 2px; overflow: hidden; }
#timefill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--gold), #ff9d3c); border-radius: 2px; }
#timefill.hot { background: linear-gradient(90deg, #ff7043, var(--red)); }

/* ============ chips (shared) ============ */
.chipface {
  border-radius: 50%;
  position: relative;
  background:
    radial-gradient(circle at 50% 36%, rgba(255,255,255,.32), transparent 52%),
    repeating-conic-gradient(var(--cc) 0 30deg, #f2eedf 30deg 60deg);
  box-shadow: 0 2px 4px rgba(0,0,0,.5), 0 1px 1px rgba(0,0,0,.4);
}
.chipface::before {
  content: "";
  position: absolute; inset: 16%;
  border-radius: 50%;
  background: radial-gradient(circle at 45% 35%, var(--cc-hi), var(--cc) 70%);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.5), inset 0 2px 5px rgba(0,0,0,.3);
}
.chipface span {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6);
  z-index: 1;
}
.t0 { --cc: #b9bec6; --cc-hi: #e4e7eb; }
.t1 { --cc: #c8323a; --cc-hi: #ef6a6a; }
.t2 { --cc: #1f9e57; --cc-hi: #58cf8b; }
.t3 { --cc: #2f5fb8; --cc-hi: #6f9be8; }
.t4 { --cc: #7a3fc9; --cc-hi: #b083ec; }
.t5 { --cc: #c79a23; --cc-hi: #f0cd6b; }

/* ============ seats / betting spots ============ */
#seats { position: absolute; inset: 0; z-index: 5; }

.spot {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 150px;
}
.spot .oval {
  position: relative;
  width: 86px; height: 58px; margin: 0 auto;
  border: 2px solid var(--line);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 14px rgba(0,0,0,.12);
  transition: box-shadow .2s, border-color .2s;
}
.spot.open .oval { cursor: pointer; }
.spot.open .oval span { font-family: "Playfair Display", serif; font-style: italic; font-size: 15px; color: rgba(255,255,255,.5); letter-spacing: .2em; }
.spot.open .oval:hover, .spot.open .oval:active { border-color: var(--gold); box-shadow: 0 0 18px rgba(243,201,92,.35); }
.spot.mine .oval { border-color: rgba(243,201,92,.7); }
.spot.active .oval { border-color: var(--gold); animation: spotPulse 1.4s ease-in-out infinite; }
@keyframes spotPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(243,201,92,.3); }
  50% { box-shadow: 0 0 30px rgba(243,201,92,.65); }
}
.spot.betting-mine .oval, .spot.betting-mine .side { cursor: pointer; }
.spot.betting-mine .oval:hover, .spot.betting-mine .side:hover { border-color: var(--gold-hot); box-shadow: 0 0 14px rgba(243,201,92,.4); }

/* side-bet spots — diagonal cluster, clear of the main oval */
.spot .side {
  position: absolute;
  width: 46px; height: 34px;
  border: 1.6px solid var(--line);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: box-shadow .2s, border-color .2s;
}
.spot .side label {
  font-family: "Playfair Display", serif; font-style: italic; font-weight: 700;
  font-size: 8.5px; letter-spacing: .04em; color: var(--gold);
  pointer-events: none; line-height: 1.1; text-align: center;
}
.spot .side.pair { left: -14px; top: -20px; transform: rotate(-16deg); }
.spot .side.p3   { right: -14px; top: 46px;  transform: rotate(14deg); }

/* chips stacked on a spot */
.placed {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -58%);
  pointer-events: none;
}
.placed .chipface {
  position: absolute; left: -14px;
  width: 28px; height: 28px;
}
.placed.bounce { animation: stackBounce .3s ease; }
@keyframes stackBounce {
  0% { transform: translate(-50%, -58%) scale(1); }
  40% { transform: translate(-50%, -64%) scale(1.06); }
  100% { transform: translate(-50%, -58%) scale(1); }
}
.placed .amt {
  position: absolute; left: 50%; top: 17px;
  transform: translateX(-50%);
  background: rgba(0,0,0,.78);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  font-size: 12px; padding: 1px 8px;
  color: #fff; white-space: nowrap;
}
.side .placed .chipface { width: 22px; height: 22px; left: -11px; }
.side .placed .amt { font-size: 10px; top: 12px; }

/* player name & cards */
.spot .pname {
  margin-top: 5px;
  text-align: center;
  font-size: 14px;
  color: var(--cream);
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.spot.mine .pname { color: var(--gold); }
.spot .pname.away { opacity: .4; text-decoration: line-through; }
.spot .pstack { text-align: center; font-size: 11.5px; color: #cfe9d8; }

.spot .hands {
  position: absolute;
  left: 50%; bottom: calc(100% - 4px);
  transform: translateX(-50%);
  display: flex; gap: 8px;
  justify-content: center;
}
.hand { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.hand.dim { opacity: .45; }

.result-tag {
  font-size: 13px; padding: 1px 9px; border-radius: 999px;
  animation: bannerPop .45s ease;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.result-tag.win { background: var(--win); color: #06301a; }
.result-tag.blackjack { background: linear-gradient(90deg, var(--gold-hot), var(--gold)); color: #4d3a0e; }
.result-tag.lose { background: var(--lose); color: #4d0e0e; }
.result-tag.push { background: rgba(247,241,225,.88); color: var(--ink); }

.side-tag {
  position: absolute; left: 50%; transform: translateX(-50%);
  top: -19px;
  font-size: 10px; padding: 1px 7px; border-radius: 999px;
  white-space: nowrap;
  animation: bannerPop .45s ease;
  z-index: 6;
  box-shadow: 0 2px 5px rgba(0,0,0,.4);
}
.side-tag.hit { background: var(--gold); color: #4d3a0e; }
.side-tag.miss { background: rgba(0,0,0,.65); color: rgba(255,255,255,.7); }

.ins-marker { margin-top: 2px; text-align: center; font-size: 11px; color: var(--gold); }

/* ============ cards ============ */
.cards { display: flex; }
.cards > *:not(:first-child) { margin-left: calc(var(--card-w) * -0.46); }
.card {
  width: var(--card-w); height: var(--card-h);
  border-radius: 8px;
  background: linear-gradient(155deg, #ffffff 0%, #fbfaf5 55%, #efeee7 100%);
  box-shadow: 0 4px 10px rgba(0,0,0,.42), 0 1px 2px rgba(0,0,0,.3);
  position: relative;
  color: var(--ink);
  font-family: "Playfair Display", serif;
  font-weight: 800;
  flex-shrink: 0;
}
.card::after {
  content: "";
  position: absolute; inset: 3px;
  border: 1px solid rgba(0,0,0,.05);
  border-radius: 5px;
  pointer-events: none;
}
.card.red { color: var(--red); }
.card .corner {
  position: absolute; top: 4px; left: 5px;
  font-size: calc(var(--card-w) * 0.30); line-height: .95;
  text-align: center;
}
.card .corner small { display: block; font-size: .8em; }
.card .pip { position: absolute; right: 6px; bottom: 2px; font-size: calc(var(--card-w) * 0.58); line-height: 1; opacity: .95; }
.card.back {
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.13) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.13) 0 2px, transparent 2px 7px),
    radial-gradient(circle at 50% 40%, #b3242e, #8e1c22 78%);
  box-shadow: 0 4px 10px rgba(0,0,0,.42), inset 0 0 0 3px #f3e9d2, inset 0 0 0 4px #8e1c22;
}

/* deal from the shoe: per-card --dx/--dy set in JS */
.card.dealt, .cardflip.dealt {
  animation: dealIn .5s cubic-bezier(.22,.8,.34,1) backwards;
}
@keyframes dealIn {
  0%   { transform: translate(var(--dx, 30vw), var(--dy, -30vh)) rotate(9deg) scale(.94); opacity: 0; }
  12%  { opacity: 1; }
  82%  { transform: translate(0, 0) rotate(-1.6deg) scale(1.025); }
  100% { transform: none; }
}

/* 3D hole-card reveal */
.cardflip {
  width: var(--card-w); height: var(--card-h);
  perspective: 700px;
  flex-shrink: 0;
  position: relative;
}
.cardflip .flipinner {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  animation: flipReveal .6s cubic-bezier(.4,.1,.3,1) forwards;
}
@keyframes flipReveal { from { transform: rotateY(180deg); } to { transform: rotateY(0deg); } }
.cardflip .card {
  position: absolute; inset: 0;
  margin: 0 !important;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.cardflip .card.backface { transform: rotateY(180deg); }

.total-badge {
  display: inline-block;
  background: rgba(0,0,0,.62);
  border: 1px solid rgba(243,201,92,.5);
  color: var(--cream);
  border-radius: 999px;
  font-size: 13px; padding: 1px 9px;
  font-family: "Bebas Neue", sans-serif;
}
.total-badge.bust { background: var(--lose); color: #3d0606; border-color: transparent; }
.total-badge.bj { background: linear-gradient(90deg, var(--gold-hot), var(--gold)); color: #4d3a0e; border-color: transparent; }

/* ============ floating action dock ============ */
#actionDock {
  position: absolute; z-index: 9;
  left: 50%; bottom: 16px;
  transform: translateX(-50%);
  display: flex; gap: 14px; align-items: center;
}
.round-btn {
  width: 82px; height: 82px; border-radius: 50%;
  color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 2px solid rgba(255,255,255,.22);
  box-shadow:
    0 8px 20px rgba(0,0,0,.55),
    inset 0 2px 2px rgba(255,255,255,.45),
    inset 0 -4px 8px rgba(0,0,0,.3);
  transition: transform .08s, filter .15s;
  flex-shrink: 0;
}
.round-btn:active { transform: translateY(3px) scale(.95); }
.round-btn i { font-style: normal; font-size: 28px; line-height: 1; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.round-btn label { font-size: 13px; letter-spacing: .1em; margin-top: 2px; pointer-events: none; }
.round-btn:disabled { filter: grayscale(.7) brightness(.55); pointer-events: none; }

.rb-green  { background: radial-gradient(circle at 35% 28%, #5fd590, #1f9e57 60%, #0c5630); }
.rb-red    { background: radial-gradient(circle at 35% 28%, #ff8a5c, #df5025 60%, #93300f); }
.rb-blue   { background: radial-gradient(circle at 35% 28%, #82b4ff, #2f6fd0 60%, #1a4488); }
.rb-purple { background: radial-gradient(circle at 35% 28%, #cda4f7, #8746d8 60%, #54278a); }
.rb-gold   { background: radial-gradient(circle at 35% 28%, #ffe9a8, #ddb041 60%, #926d12); color: #2e2103; }
.rb-gold i, .rb-gold label { text-shadow: none; }
.rb-dark   { background: radial-gradient(circle at 35% 28%, #4a4f57, #23262b 60%, #101216); }

/* ============ bottom rail ============ */
#rail {
  position: relative; z-index: 8;
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 9px 16px;
  padding-bottom: max(9px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #23262c, #101216 75%);
  border-top: 4px solid #5d3915;
  box-shadow: inset 0 1px 0 rgba(255,235,190,.18), 0 -10px 28px rgba(0,0,0,.6);
  min-height: 84px;
}
.rail-stat label { display: block; font-size: 12px; letter-spacing: .15em; color: var(--gold); }
.rail-stat b { font-size: 24px; color: #fff; }
.rail-stat.right { text-align: right; }

#centerMsg {
  text-align: center;
  font-family: "Playfair Display", serif;
  font-style: italic;
  font-size: 16px;
  color: rgba(255,255,255,.85);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

#chipRack {
  display: flex; gap: 9px; align-items: center;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 999px;
  padding: 7px 11px;
}
.chip-btn {
  width: 54px; height: 54px;
  font-size: 16px;
  padding: 0;
  background: none;
  transition: transform .14s, box-shadow .2s;
  flex-shrink: 0;
}
.chip-btn:active { transform: translateY(2px) scale(.96); }
.chip-btn.selected {
  transform: translateY(-7px) scale(1.1);
  box-shadow: 0 0 0 3px var(--gold-hot), 0 10px 18px rgba(0,0,0,.55);
}
.chip-btn:disabled { filter: grayscale(.8) brightness(.55); pointer-events: none; }

/* win glow */
.spot.flash-win .oval { animation: winGlow 1s ease 2; }
@keyframes winGlow {
  0%, 100% { box-shadow: 0 0 10px rgba(88,224,138,0); }
  50% { box-shadow: 0 0 34px rgba(88,224,138,.85); }
}

/* flying chip */
.fly-chip {
  position: fixed; z-index: 60;
  width: 28px; height: 28px;
  pointer-events: none;
  transition: transform .5s cubic-bezier(.3,.6,.3,1), opacity .5s ease;
}

/* ============ responsive ============ */
@media (max-width: 760px) {
  :root { --card-w: 42px; --card-h: 60px; }
  .fa-title { font-size: 72px; }
  .fa-white { font-size: 26px; }
  .fa-gold, .fa-rule { display: none; }
  .paytable { background: rgba(0,0,0,.28); border-radius: 8px; padding: 5px 7px; }
  #feltArt { top: 5.5%; }
  #payLeft  { left: 2%; top: 17%; width: 104px; }
  #payRight { right: 2%; top: 17%; width: 136px; }
  .paytable h4 { font-size: 10.5px; }
  .paytable div { font-size: 8px; }
  #minmax { display: none; }
  #discardPile { display: none; }
  #shoeBox { display: none; }
  #dealerArea { top: 29%; }
  #banner { top: 44%; }
  .spot { width: 112px; }
  .spot .oval { width: 66px; height: 46px; }
  .spot .side { width: 38px; height: 28px; }
  .spot .side label { font-size: 7px; }
  .spot .side.pair { left: -8px; top: -16px; }
  .spot .side.p3 { right: -8px; top: 36px; }
  .spot .pname { font-size: 12px; }
  #actionDock { bottom: 10px; gap: 10px; }
  .round-btn { width: 68px; height: 68px; }
  .round-btn i { font-size: 23px; }
  .round-btn label { font-size: 11px; }
  #rail {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "balance rack total";
    min-height: 0;
    gap: 10px;
  }
  #balanceBox { grid-area: balance; }
  #centerMsg { display: none; }
  #totalBox { grid-area: total; }
  #chipRack { grid-area: rack; justify-self: center; }
  .rail-stat b { font-size: 17px; }
  .rail-stat label { font-size: 10px; }
  .chip-btn { width: 44px; height: 44px; font-size: 13px; }
}
@media (max-width: 400px) {
  .chip-btn { width: 40px; height: 40px; font-size: 12px; }
  #chipRack { gap: 6px; padding: 5px 8px; }
  .round-btn { width: 62px; height: 62px; }
  #actionDock { gap: 8px; }
}
@media (min-width: 1100px) {
  :root { --card-w: 68px; --card-h: 98px; }
  .spot { width: 180px; }
  .spot .oval { width: 104px; height: 70px; }
  .spot .side { width: 54px; height: 40px; }
  .spot .side label { font-size: 10px; }
  .spot .side.pair { left: -16px; top: -24px; }
  .spot .side.p3 { right: -16px; top: 56px; }
}
