/* blackjack/public/css/game.css — only what is specific to the Blackjack
   table. Page chrome, seats, cards, tray, lobby and modals all come from
   the shared kit stylesheets. */

/* Room reserved around the felt for the top bar, info strip and this
   game's tray (status row, chip rack or Hit/Stand row, hint). The dealer
   sits in the centre, so the oval is a little rounder than the kit's
   default; with container units it takes whatever height is free. */
.table-felt {
  --tbl-felt-chrome: 400px;
  width: min(94%, calc((100dvh - var(--tbl-felt-chrome)) * 1.1));
  aspect-ratio: 1.1 / 1;
}
@supports (width: 1cqw) {
  #game-table { container-type: size; }
  .table-felt { width: max(220px, min(94cqw, calc(100cqh * 1.1))); }
}
/* Seat tokens carry a hand of small cards, so the rail overhang grows. */
#game-table { padding: 50px 40px; }

/* ── Dealer in the felt centre ─────────────────────────────────────── */
#table-center { align-items: center; }
#bj-dealer { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bj-dealer-label { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--tbl-text-muted); }
.bj-dealer-cards { display: flex; gap: 6px; justify-content: center; perspective: 600px; min-height: 60px; }
.bj-dealer-cards .pcard { width: 44px; height: 62px; font-size: 15px; }
.bj-dealer-cards .pcard .pc-suit { font-size: 16px; }
.bj-dealer-cards.many .pcard + .pcard { margin-left: -18px; }
.bj-dealer-value { font-family: var(--font-display); font-weight: 800; font-size: 1rem; color: var(--tbl-text); min-height: 1.2em; }
.bj-shoe { font-size: 0.62rem; color: var(--tbl-text-muted); }

/* Cards turn up one at a time (see renderDealer's in-place patching). */
.pcard.card-deal-anim { animation: pcard-flip-in 1.4s cubic-bezier(0.2, 0.6, 0.25, 1); }
@keyframes pcard-flip-in {
  from { transform: rotateY(-100deg); opacity: 0.3; }
  60% { opacity: 1; }
  to { transform: rotateY(0deg); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .pcard.card-deal-anim { animation: none; } }

/* ── Seat tokens: hand(s), value, result, bet ───────────────────────── */
.bj-hand { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 2px 3px; border-radius: 6px; }
.bj-hand.active { outline: 1px dashed var(--tbl-accent); }
.bj-hand + .bj-hand { margin-top: 3px; }
.bj-hand-cards { display: flex; gap: 2px; }
.pcard.bj-mini { width: 26px; height: 36px; border-radius: 4px; font-size: 10px; box-shadow: 0 1px 2px rgba(0,0,0,0.35); }
.pcard.bj-mini .pc-rank { font-size: 10px; }
.pcard.bj-mini .pc-suit { font-size: 11px; margin-top: 0; }
.bj-hand-meta { display: flex; align-items: center; gap: 4px; font-size: 0.66rem; white-space: nowrap; }
.tk-seat .tk-foot { white-space: nowrap; }
.bj-hand-value { font-weight: 800; color: var(--tbl-text); }
.bj-hand-bet { color: var(--tbl-text-muted); }
.hand-badge { font-size: 0.56rem; font-weight: 700; padding: 1px 6px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.05em; }
.hand-badge.win, .hand-badge.blackjack { background: rgba(76, 175, 80, 0.22); color: #7ed17f; }
.hand-badge.push { background: rgba(255,255,255,0.12); color: var(--tbl-text-mid); }
.hand-badge.lose, .hand-badge.bust { background: rgba(209, 69, 58, 0.22); color: #ff8a80; }
.hand-badge.playing { background: rgba(255, 228, 56, 0.2); color: var(--accent); }
.bj-net.up { color: #7ed17f; }
.bj-net.down { color: #ff8a80; }
.tk-muted { font-size: 0.64rem; color: var(--tbl-text-muted); }

/* ── Betting rack ───────────────────────────────────────────────────── */
.bj-bet-box { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.bj-bet-amount { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; color: var(--tbl-text-mid); }
.bj-bet-amount b { color: var(--accent); font-family: var(--font-display); font-size: 1.15rem; }
#action-row button.bj-clear { padding: 0.25rem 0.7rem; font-size: 0.72rem; background: transparent; color: var(--tbl-text-muted); border: 1px solid var(--tbl-panel-border); box-shadow: none; }
.bj-chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
#action-row button.chip, .chip {
  width: 50px; height: 50px; border-radius: 50%; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; font-family: var(--font-body);
  border: 2px solid rgba(255,255,255,0.18); box-shadow: 0 3px 8px rgba(0,0,0,0.35);
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
}
#action-row button.chip:hover { transform: translateY(-2px); }
#action-row button.chip:disabled { opacity: 0.35; transform: none; }
.chip.white, #action-row button.chip.white { background: #a9a9a9; border-color: #e0e0e0; color: #111; }
.chip.red, #action-row button.chip.red { background: #c0392b; color: #fff; }
.chip.blue, #action-row button.chip.blue { background: #1565c0; color: #fff; }
.chip.black, #action-row button.chip.black { background: #1a1a1a; border-color: #555; color: #fff; }
.chip.green, #action-row button.chip.green { background: #2e7d32; color: #fff; }
#action-row button.chip { box-shadow: 0 3px 8px rgba(0,0,0,0.35); }
.bj-bet-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; width: 100%; margin-top: 4px; }
#action-row { flex-direction: column; align-items: center; }
#hand-area .pcard { width: 52px; height: 74px; font-size: 16px; }

/* ── Lobby ──────────────────────────────────────────────────────────── */
.bj-lobby-note { font-size: 0.8rem; color: var(--tbl-text-mid); text-align: center; margin: 6px 0 0; }

/* ── Create options (join page) ─────────────────────────────────────── */
.chip.bj-chip-mini { width: 40px; height: 40px; font-size: 10px; cursor: default; }
.bj-chip-total { border-top: 1px solid var(--border); padding-top: 0.6rem; }
.bj-chip-total b { color: var(--text); }

/* ── Real-cards picker ──────────────────────────────────────────────── */
.bj-picker-box { max-width: 420px; width: 94%; }
.bj-picker-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 0.9rem; }
.bj-picker-head span { font-size: 0.75rem; color: var(--tbl-text-muted); }
.bj-picker-picked { display: flex; gap: 6px; justify-content: center; min-height: 40px; margin-bottom: 8px; }
.bj-picker-picked .pcard { width: 36px; height: 50px; font-size: 12px; }
.bj-picker-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.bj-pick { padding: 6px 0; border-radius: 6px; border: 1px solid var(--tbl-panel-border); background: rgba(255,255,255,0.06); color: var(--tbl-text); font-weight: 700; font-size: 0.78rem; cursor: pointer; }
.bj-pick.red { color: #ff8a80; }
.bj-pick:disabled { opacity: 0.25; cursor: default; }

/* ── Focus mode: hide the felt, keep the controls ──────────────────── */
body.bj-focus #game-table, body.bj-focus #table-info-strip { display: none !important; }
body.bj-focus #hand-section { flex: 1; justify-content: center; }
body.bj-focus #action-row button.chip { width: 64px; height: 64px; font-size: 13px; }

@media (max-width: 480px) {
  .bj-dealer-cards .pcard { width: 38px; height: 54px; font-size: 13px; }
  .pcard.bj-mini { width: 22px; height: 31px; }
  .pcard.bj-mini .pc-rank { font-size: 9px; }
  .pcard.bj-mini .pc-suit { font-size: 10px; }
  #action-row button.chip, .chip { width: 44px; height: 44px; font-size: 10px; }
  .bj-chips { gap: 6px; }
  #hand-area .pcard { width: 46px; height: 66px; font-size: 14px; }
}
