/* Blackjack. Cards are the shared `card-` rules (cards.css), chips the
   `chip-` rules (chips.css); `bj-` rules are this game's. The dealer is at the
   top of the felt with the shoe, every chair in the order of play in a grid
   that wraps (yours marked, not moved), with your bet or your moves under the
   felt. A hand's cards overlap, as dealt on a table, so four split
   hands still fit a phone. */
@import url("cards.css");
@import url("chips.css");

.bj { display: flex; flex-direction: column; gap: 0.8rem; width: 100%; max-width: 46rem; }

.bj-felt {
  display: flex; flex-direction: column; gap: 0.7rem; padding: 0.6rem;
  background: var(--felt); color: var(--felt-ink); border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ---- The dealer ---- */
.bj-dealer { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; padding-bottom: 0.3rem; }
.bj-dealer-head { display: flex; align-items: baseline; gap: 0.6rem; }
.bj-dealer .card { --card-w: 3.4rem; }
.bj-dealer .card-slot { border-color: rgb(255 255 255 / 0.3); }
.bj-shoe { margin: 0; font-size: 0.85rem; opacity: 0.85; }
.bj-name { font-weight: 700; overflow-wrap: anywhere; }
.bj-total { font-weight: 700; font-variant-numeric: tabular-nums; }

/* The hole card and the dealer's draws come in one after another, once, for
   a page that saw it happen (`PlayOnce`, `DealerView`); then each hand's
   outcome shows. */
@keyframes bj-in { from { opacity: 0; transform: translateY(-0.6rem) scale(0.92); } }
.bj-reveal { display: inline-block; }
.gn-news .bj-reveal { animation: bj-in 0.25s ease-out calc(var(--i) * 0.45s - var(--played, 0s)) both; }
@keyframes bj-show { from { opacity: 0; } }
.bj-outcome.gn-news { animation: bj-show 0.25s calc(var(--after) * 0.45s - var(--played, 0s)) both; }

/* ---- Cards in a hand ---- */
.bj-cards { display: flex; min-height: calc(2.6rem * 7 / 5); }
.bj-seat .bj-cards > .card + .card { margin-left: calc(var(--card-w) * -0.35); }
.bj-dealer .bj-cards { gap: 0.25rem; }

/* ---- The chairs ---- */
.bj-seats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 0.45rem; }
.bj-seat {
  display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; padding: 0.4rem 0.5rem;
  border: 2px solid transparent; border-radius: var(--radius); background: rgb(0 0 0 / 0.14);
}
.bj-turn { border-color: var(--accent); background: rgb(0 0 0 / 0.24); }
.bj-away { opacity: 0.6; }
.bj-seat-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.2rem 0.5rem; }
.bj-note { font-size: 0.85rem; font-weight: 600; opacity: 0.9; }
.bj-bet { display: flex; align-items: center; gap: 0.35rem; font-size: 0.9rem; }
.bj-seat .card { --card-w: 2.6rem; }
.bj-seat .card-corner { top: 0.1rem; left: 0.15rem; }

.bj-hands { display: flex; flex-wrap: wrap; gap: 0.4rem 0.7rem; }
.bj-hand { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.2rem; border-radius: var(--radius); border: 2px solid transparent; }
.bj-hand-turn { border-color: var(--accent); }
/* Last round's hand, still on the table while the next bets go down. */
.bj-past { opacity: 0.7; }
.bj-hand-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.1rem 0.5rem; font-size: 0.9rem; }
.bj-doubled { font-size: 0.8rem; font-style: italic; opacity: 0.9; }
.bj-outcome { font-size: 0.85rem; font-weight: 700; }
.bj-blackjack, .bj-win { color: #f5d36b; }
.bj-lose, .bj-bust, .bj-surrender { opacity: 0.8; }

/* Your own chair, in its place in the order: bigger cards. */
.bj-mine { background: rgb(0 0 0 / 0.2); }
.bj-mine .card { --card-w: 3.6rem; }
.bj-mine .card-corner { top: 0.2rem; left: 0.25rem; }
.bj-mine .bj-hand-foot { font-size: 1rem; }

/* ---- Your bet, your moves ---- */
.bj-choices { display: flex; flex-direction: column; gap: 0.5rem; }
.bj-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.bj-amount label { display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
.bj-input {
  width: 6rem; min-height: 2.5rem; padding: 0.2rem 0.5rem; font: inherit; font-variant-numeric: tabular-nums;
  border: 2px solid var(--edge); border-radius: var(--radius); background: var(--card); color: var(--ink);
}
.bj-range { font-size: 0.85rem; color: var(--ink-soft); }

/* A phone: two chairs a row across the felt. */
@media (max-width: 30rem) {
  .bj-seats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bj-seat .card { --card-w: 2.2rem; }
  .bj-mine .card { --card-w: 3.2rem; }
  .bj-dealer .card { --card-w: 3rem; }
}

@media (min-width: 40rem) {
  .bj-dealer .card { --card-w: 3.8rem; }
  .bj-mine .card { --card-w: 4rem; }
}
