.table {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 1100px;
  min-height: calc(100vh - 64px);
  min-height: calc(100dvh - 64px);
  margin: 0 auto;
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
}

/* ---------- Trays ---------- */
.tray {
  position: absolute;
  top: 16px;
  width: calc(var(--card-w) * 0.78);
  height: calc(var(--card-w) * 0.78 * 1.4);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(244, 220, 149, 0.16);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.35);
}
.discard { left: 16px; }
.discard span {
  position: absolute;
  inset: 8px;
  border-radius: 6px;
  border: 1px dashed rgba(244, 220, 149, 0.18);
}
.shoe { right: 16px; }
.shoe-card {
  position: absolute;
  inset: 6px 6px 16px;
  border-radius: 6px;
  border: 3px solid #fbfaf5;
  background: repeating-linear-gradient(45deg, var(--card-back-1) 0 4px, var(--card-back-2) 4px 8px);
  box-shadow: 2px 2px 0 #e9e4d6, 4px 4px 0 #d6d0bf, 6px 6px 8px rgba(0, 0, 0, 0.4);
}
.shoe-meter {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 6px;
  height: 4px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.4);
  overflow: hidden;
}
.shoe-meter i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--gold-3), var(--gold-2));
  transform-origin: left;
  transition: transform 0.4s var(--ease);
}

/* ---------- Zones ---------- */
.zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.dealer { min-height: calc(var(--card-w) * 1.4 + 44px); }
.zone-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.cards {
  display: flex;
  justify-content: center;
  min-height: calc(var(--card-w) * 1.4);
}
.cards .card + .card { margin-left: calc(var(--card-w) * -0.58); }
.dealer .cards .card + .card { margin-left: calc(var(--card-w) * -0.42); }

.score {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font: 700 0.85rem/1 var(--font-ui);
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.score.bust { background: rgba(160, 30, 30, 0.85); border-color: var(--lose); }
.score.twentyone { color: #2b1c04; background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-color: transparent; }

/* ---------- Felt print ---------- */
.felt-print {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: clamp(12px, 3vh, 28px) 0;
  text-align: center;
  pointer-events: none;
}
/* The curved line printed on the felt, below the rules text */
.felt-print::after {
  content: '';
  width: min(760px, 92vw);
  height: clamp(28px, 6vw, 56px);
  margin-top: -6px;
  border-bottom: 2px solid rgba(244, 220, 149, 0.16);
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
}
.print-main {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.05rem, 3.2vw, 1.6rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(244, 220, 149, 0.42);
}
.print-sub {
  font-size: clamp(0.68rem, 1.8vw, 0.8rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(244, 220, 149, 0.28);
}

/* ---------- Toast ---------- */
.toast {
  position: absolute;
  left: 50%;
  top: calc(18px + var(--card-w) * 1.4 + 40px);
  z-index: 10;
  translate: -50% 0;
  padding: 12px 26px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.1rem, 3.6vw, 1.6rem);
  white-space: nowrap;
  color: var(--ink);
  background: rgba(2, 14, 8, 0.82);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  opacity: 0;
  scale: 0.9;
  pointer-events: none;
  transition: opacity 0.25s, scale 0.3s var(--ease);
}
.toast.show { opacity: 1; scale: 1; }
.toast.win { color: var(--win); border-color: rgba(95, 211, 148, 0.5); }
.toast.lose { color: var(--lose); border-color: rgba(255, 114, 114, 0.4); }
.toast.gold { color: #2b1c04; background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-color: transparent; box-shadow: 0 10px 40px rgba(244, 220, 149, 0.35); }

/* ---------- Player hands ---------- */
.player { flex: 1; justify-content: center; }
.hands {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px clamp(16px, 4vw, 44px);
}
.hands[data-count='3'], .hands[data-count='4'] { --card-w: clamp(52px, 8vw, 88px); }
.hand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 10px;
  border-radius: 18px;
  border: 1px solid transparent;
  transition: background 0.3s, border-color 0.3s, opacity 0.3s, translate 0.3s var(--ease);
}
.hands.multi .hand { opacity: 0.6; }
.hands.multi .hand.active {
  opacity: 1;
  translate: 0 -6px;
  background: rgba(244, 220, 149, 0.06);
  border-color: rgba(244, 220, 149, 0.35);
  box-shadow: 0 0 30px rgba(244, 220, 149, 0.08);
}
.hands.multi.over .hand { opacity: 1; }
.hand-meta { display: flex; align-items: center; gap: 8px; }
.hand-bet {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  color: var(--gold-2);
}
.hand-bet::before {
  content: '';
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle, #c0392b 0 45%, transparent 46%), repeating-conic-gradient(#c0392b 0 30deg, #fff 30deg 60deg);
}
.result {
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  animation: pop 0.4s var(--ease);
}
.result.win, .result.blackjack { color: #062414; background: var(--win); }
.result.blackjack { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #2b1c04; }
.result.lose { color: #fff; background: rgba(190, 40, 40, 0.9); }
.result.push { color: #2b1c04; background: var(--push); }
@keyframes pop { from { opacity: 0; scale: 0.6; } 60% { scale: 1.08; } }

/* ---------- Bet spot ---------- */
.bet-spot { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.bet-ring {
  position: relative;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  border: 2px solid rgba(244, 220, 149, 0.4);
  box-shadow: inset 0 0 0 6px rgba(244, 220, 149, 0.06), 0 0 30px rgba(0, 0, 0, 0.2);
}
.bet-ring::after {
  content: 'BET';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.2em;
  color: rgba(244, 220, 149, 0.28);
  transition: opacity 0.2s;
}
.bet-ring.has-chips::after { opacity: 0; }
.bet-stack { position: absolute; inset: 0; display: grid; place-items: center; }
.bet-stack .chip {
  position: absolute;
  width: 58px;
  height: 58px;
  font-size: 0.82rem;
  pointer-events: none;
  translate: 0 calc(var(--n) * -5px);
}
.bet-amount {
  min-height: 1.4em;
  font-weight: 700;
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}
.bet-amount.placed { color: var(--gold-2); }

/* ---------- Controls ---------- */
.controls { width: 100%; padding-top: 18px; display: flex; flex-direction: column; gap: 14px; }
.group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: rise 0.3s var(--ease);
}
.buyin-btn { align-self: center; }

/* (.row, the Ranked lock panel, .sr-only and the stats grid are in base.css, shared with other games.) */
/* ---------- Ranked (server-dealt) ---------- */
.rank-pill { padding: 0 14px; color: var(--gold-2); text-decoration: none; }
.rank-pill:hover { border-color: rgba(217, 180, 90, 0.55); }
.broke-panel {
  position: absolute;
  left: 50%;
  top: 42%;
  z-index: 20;
  translate: -50% -50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(360px, calc(100% - 32px));
  padding: 26px 22px;
  text-align: center;
  border-radius: 20px;
  background: rgba(3, 22, 13, 0.96);
  border: 1px solid rgba(217, 180, 90, 0.45);
  box-shadow: var(--shadow);
  animation: rise 0.3s var(--ease);
}
.broke-panel h2 { margin: 0; font-family: var(--font-display); font-size: 1.5rem; color: var(--gold-2); }
.broke-panel p { margin: 0; color: var(--ink-2); }
.broke-panel .btn-gold .coin { width: 20px; height: 20px; }
.card.blank .card-face { visibility: hidden; }
/* Ranked: the hole card lifts slightly while the dealer's turn is on its way from the server. */
.dealer .card { transition: translate 0.25s var(--ease); }
.dealer .card.lift { translate: 0 calc(var(--w) * -0.1); }
/* Ranked: an answer that's taking over 1.5s. A soft light sweeps slowly across the waiting card's back. */
.card.waiting .card-back { overflow: hidden; }
.card.waiting .card-back::before {
  content: '';
  position: absolute;
  top: -10%;
  bottom: -10%;
  left: 0;
  width: 45%;
  background: linear-gradient(90deg, transparent, rgba(255, 243, 210, 0.24), transparent);
  transform: translateX(-130%) skewX(-16deg);
  animation: shimmer 2s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-130%) skewX(-16deg); }
  60%, 100% { transform: translateX(260%) skewX(-16deg); }
}
/* Reduced motion: a gentle pulse instead. (base.css cuts every animation short there, so this one
   has to outrank that rule.) */
@media (prefers-reduced-motion: reduce) {
  .card.waiting .card-back::before { content: none; }
  .card.waiting .card-back { animation: waiting-pulse 2s ease-in-out infinite !important; }
}
@keyframes waiting-pulse { 50% { opacity: 0.72; } }

.chip-rack { display: flex; gap: clamp(10px, 3vw, 18px); }
.actions .btn { min-width: 108px; min-height: 52px; font-size: 1rem; }
.btn.suggest {
  border-color: var(--gold-2);
  box-shadow: 0 0 0 3px rgba(244, 220, 149, 0.35), 0 0 26px rgba(244, 220, 149, 0.35);
  animation: suggest 0.9s ease-in-out 2;
}
@keyframes suggest { 50% { box-shadow: 0 0 0 6px rgba(244, 220, 149, 0.15), 0 0 34px rgba(244, 220, 149, 0.5); } }
.hint-btn { min-height: 36px; font-size: 0.85rem; }

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .topbar { gap: 8px; }
  .topbar .brand { display: none; }
  .topbar-title { border-left: none; padding-left: 4px; font-size: 1.05rem; color: var(--ink); }
  .pill { padding-right: 12px; }
  .table { padding-top: 12px; }
  .tray { top: 12px; width: 40px; height: 56px; }
  .discard { left: 12px; }
  .shoe { right: 12px; }
  .toast { top: calc(12px + var(--card-w) * 1.4 + 36px); }
  .actions .btn { min-width: 0; flex: 1 1 40%; }
  .actions { width: 100%; max-width: 420px; }
  .chip { width: 56px; height: 56px; }
}
@media (max-width: 480px) {
  .topbar { padding-inline: 12px; gap: 6px; }
  .topbar-heading { flex-direction: column; align-items: flex-start; gap: 3px; }
  .topbar-title { font-size: 1rem; line-height: 1.1; padding-left: 0; }
  .mode-badge { padding: 3px 7px; font-size: 0.6rem; }
  .topbar .btn-icon { width: 36px; height: 36px; min-height: 36px; }
  .pill { gap: 6px; height: 36px; padding: 0 10px 0 6px; font-size: 0.92rem; }
  .pill .coin { width: 20px; height: 20px; }
  .credits-pill .pill-label { display: none; }
  .rank-pill { padding: 0 9px; }
}
