/* ============ Game table layout ============ */
.table-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  padding-bottom: calc(0.5rem + var(--safe-bottom));
  overflow: hidden;
}

.dealer-area {
  text-align: center;
  padding: 0.5rem 0;
}
.dealer-label {
  font-family: 'Cinzel', serif;
  color: var(--chalk);
  letter-spacing: 0.1em;
  margin-bottom: 0.3rem;
  font-size: 0.95rem;
}
.dealer-label span { color: var(--accent); font-weight: 700; }

/* Fixed 3-column grid, 2 rows for RULES.maxSeats=6 — guarantees every seat
   fits on screen with no scrolling, regardless of viewport size. Seat cards
   are sized down (below) specifically so two full rows comfortably fit. */
.seats {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem 0.2rem;
  align-content: center;
  /* Smaller cards for seats than the default/dealer size, so 2 rows of 6
     always fit without scrolling. */
  --card-w: 34px;
  --card-h: 48px;
}

.seat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px;
  border-radius: 10px;
  min-width: 0;
  transition: box-shadow 0.3s, background 0.3s;
}
.seat.active-turn {
  background: rgba(212,175,55,0.12);
  box-shadow: 0 0 0 2px var(--accent), 0 0 20px var(--gold-glow);
}
.seat.you {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
}
.seat.empty { opacity: 0.3; }
.seat .seat-name {
  font-size: 0.7rem;
  color: var(--text-dim);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seat .seat-score {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  /* Reserve height up front — an empty/blank score (before a hand settles)
     could otherwise render at a different height than an actual number,
     shifting the seat (and the row's centering) the instant the score
     first appears. */
  min-height: 1.2em;
  line-height: 1.2em;
}
.seat .seat-score.bust { color: var(--red); }
.seat .seat-bet { font-size: 0.7rem; color: var(--gold); min-height: 1.1em; line-height: 1.1em; }
.seat .hand-result {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-height: 1.1em;
  line-height: 1.1em;
}
.seat .hand-result.win { color: #4caf50; }
.seat .hand-result.lose, .seat .hand-result.bust { color: var(--red); }
.seat .hand-result.push { color: var(--text-dim); }
.seat .hand-result.blackjack { color: var(--gold); }

/* Multiple split hands in a seat */
.seat .hands { display: flex; gap: 8px; }
.seat .hand { display: flex; flex-direction: column; align-items: center; gap: 2px; }

.message-area {
  text-align: center;
  min-height: 28px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--chalk);
}

.bet-area {
  padding: 0.5rem 0;
}

.action-bar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-bottom: 0.5rem;
}
/* The `hidden` attribute alone loses to the `display: flex` rule above —
   author CSS beats the UA default [hidden]{display:none}. Swapping this
   with .bet-area relies on `hidden` actually hiding it. */
.action-bar[hidden], .bet-area[hidden] { display: none; }

.action-row {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.action-bar .btn.act {
  flex: 1;
  max-width: 110px;
  min-width: 60px;
  padding: 0.8rem 0.3rem;
  font-size: 0.9rem;
  min-height: 48px;
  white-space: nowrap;
  text-align: center;
}
/* Split/Surrender share a row of only 2 (vs. 3 on top), so each gets more
   width — plenty of room for "Surrender" on one line at full size. */
.action-row-wide .btn.act {
  max-width: 160px;
}

.action-bar .btn.act[data-action="hit"]   { background: #1976d2; border: none; }
.action-bar .btn.act[data-action="stand"] { background: #d32f2f; border: none; }
.action-bar .btn.act[data-action="double"]{ background: #7b1fa2; border: none; }
.action-bar .btn.act[data-action="split"] { background: #2e7d32; border: none; }
.action-bar .btn.act[data-action="surrender"] { background: #616161; border: none; }

.insurance-banner {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.85);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  align-items: center;
  z-index: 20;
}
.insurance-banner[hidden] { display: none; }

/* ============ Desktop: wider layout ============ */
@media (min-width: 1025px) {
  :root { --card-w: 72px; --card-h: 100px; }
  .table-wrap { max-width: 1100px; margin: 0 auto; width: 100%; }
  .seat .seat-name { font-size: 0.85rem; max-width: 120px; }
  .action-bar .btn.act { min-height: 56px; font-size: 1rem; }
  .chip { width: 60px; height: 60px; }
}

