/* ---- The blackjack table ---- */
/* A proper blackjack table seen from above: the dealer (the house) on the
   straight side at the top with the chip tray and the card shoe, the felt
   curving away below with the usual words printed on it, and the five seats
   along the curve, each with its betting circle. My own buttons are under the
   table. Everything here lives inside #blackjack; the colours come from the
   theme in style.css. */
#blackjack { max-width: 760px; margin: 0 auto; --bj-drop-1: 34px; --bj-drop-2: 48px; }
#blackjack #bj-title { text-align: center; font-weight: 700; font-size: 0.9rem; padding: 0 48px; min-height: 1.3em; margin-bottom: 6px; }

/* The padded rail around the felt: straight along the dealer's side, round along the players'. */
#blackjack #bj-rail {
  padding: 9px 11px 15px;
  border-radius: 26px 26px 50% 50% / 26px 26px 38% 38%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 30%, rgba(0, 0, 0, 0.35)),
    linear-gradient(90deg, #4a2d1c, #6b4227 22%, #7a4c2d 50%, #6b4227 78%, #4a2d1c);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(0, 0, 0, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.18);
}
#blackjack #bj-felt {
  position: relative;
  border-radius: 18px 18px 50% 50% / 18px 18px 37% 37%;
  padding: 8px 4% calc(var(--bj-drop-2) + 16px);
  background:
    radial-gradient(ellipse at 50% -10%, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 55%),
    radial-gradient(ellipse at 50% 35%, var(--t8), var(--felt) 60%, var(--felt-edge));
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35), inset 0 6px 26px rgba(0, 0, 0, 0.45);
}

/* The dealer's side: discard tray, chip tray, shoe */
#blackjack #bj-dealer { position: relative; text-align: center; }
#blackjack #bj-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
#blackjack #bj-tray {
  display: flex; gap: 3px; padding: 4px 7px; border-radius: 0 0 9px 9px; margin-top: -8px;
  background: linear-gradient(180deg, #1c1d1f, #303236); box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 255, 255, 0.12);
}
/* Each column of the tray is a stack of chips seen from the side. */
#blackjack #bj-tray i { display: block; width: 22px; height: 16px; border-radius: 3px; background: repeating-linear-gradient(90deg, var(--chip) 0 3px, rgba(255, 255, 255, 0.85) 3px 4px, var(--chip) 4px 7px, rgba(0, 0, 0, 0.35) 7px 8px); }
#blackjack #bj-tray i:nth-child(1) { --chip: #c9302c; }
#blackjack #bj-tray i:nth-child(2) { --chip: #1d6fb8; }
#blackjack #bj-tray i:nth-child(3) { --chip: #1f8a4c; }
#blackjack #bj-tray i:nth-child(4) { --chip: #1b1b1d; }
#blackjack #bj-tray i:nth-child(5) { --chip: #6d3fa0; }
#blackjack #bj-tray i:nth-child(6) { --chip: #d39a1c; }
#blackjack #bj-shoe, #blackjack #bj-discard { position: relative; flex: none; width: 44px; height: 30px; border-radius: 5px; }
#blackjack #bj-shoe { background: linear-gradient(135deg, #2a2b2e, #101112); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.18); transform: rotate(-8deg); }
/* The next card peeping out of the shoe. */
#blackjack #bj-shoe i { position: absolute; left: -7px; top: 5px; width: 14px; height: 20px; border-radius: 2px; background: repeating-linear-gradient(45deg, #9b2c2c 0 2px, #c44 2px 4px); box-shadow: 0 0 0 1px #fff; }
#blackjack #bj-discard { background: rgba(0, 0, 0, 0.28); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); transform: rotate(8deg); }
#blackjack .bj-who { font-weight: 700; }
#blackjack .bj-badge { display: inline-block; font-size: 0.62rem; color: #1b1b1b; background: var(--t15); border-radius: 999px; padding: 0 6px; font-weight: 800; margin-left: 5px; text-transform: uppercase; letter-spacing: 0.04em; vertical-align: middle; }
#blackjack .bj-cards { display: flex; justify-content: center; }
#blackjack #bj-dealer-cards { min-height: 64px; gap: 5px; margin: 6px 0 4px; flex-wrap: wrap; }
#blackjack .bj-total { font-weight: 700; font-variant-numeric: tabular-nums; min-height: 1.3em; }
#blackjack .bj-total.bj-bad { color: #ffb4a9; }
#blackjack .bj-note { font-size: 0.78rem; color: rgba(255, 255, 255, 0.72); min-height: 1.2em; font-variant-numeric: tabular-nums; }
#blackjack #bj-notice { text-align: center; font-size: 0.8rem; color: var(--t15); margin: 2px 6px 0; }
#blackjack #bj-notice:empty { display: none; }

/* The words printed on the felt, following its curve */
#blackjack #bj-print { display: block; width: 100%; height: auto; margin: 0 0 -4px; pointer-events: none; }
#blackjack #bj-print text { fill: rgba(255, 226, 150, 0.8); font-family: Georgia, 'Times New Roman', serif; }
#blackjack .bj-print-big { font-size: 27px; font-weight: 700; letter-spacing: 3px; }
#blackjack .bj-print-small { font-size: 13.5px; letter-spacing: 1.2px; fill: rgba(255, 255, 255, 0.62) !important; }

/* The seats, along the curve: the middle one sits lowest */
#blackjack #bj-seats { display: flex; justify-content: center; align-items: flex-start; gap: 4px; margin-top: 2px; }
#blackjack .bj-seat { position: relative; flex: 1 1 0; min-width: 0; max-width: 150px; display: flex; flex-direction: column; align-items: center; text-align: center; }
#blackjack .bj-seat:nth-child(2), #blackjack .bj-seat:nth-child(4) { transform: translateY(var(--bj-drop-1)); }
#blackjack .bj-seat:nth-child(3) { transform: translateY(var(--bj-drop-2)); }
#blackjack .bj-seat.bj-gone { opacity: 0.6; }
#blackjack .bj-seat.bj-vacant { cursor: pointer; }

/* The cards in front of a seat */
#blackjack .bj-hands { display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-end; gap: 3px; min-height: 70px; }
#blackjack .bj-hand { border-radius: 8px; padding: 3px 3px 2px; }
#blackjack .bj-hand.bj-active { background: rgba(var(--r1), 0.22); box-shadow: 0 0 0 2px var(--accent); }
/* Small cards, fanned so the rank of each one shows. */
#blackjack .bj-seat .card { width: 30px; height: 42px; font-size: 0.82rem; border-radius: 5px; justify-items: start; padding-left: 3px; flex: none; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.45); }
#blackjack .bj-seat .card .suit { font-size: 0.82rem; }
#blackjack .bj-seat .card + .card { margin-left: -15px; }
#blackjack .bj-seat .bj-cards:has(.card:nth-child(5)) .card + .card { margin-left: -21px; }
#blackjack .bj-line { display: flex; justify-content: center; align-items: baseline; gap: 5px; }
#blackjack .bj-seat .bj-total { font-size: 0.85rem; min-height: 0; }
#blackjack .bj-bet { display: none; } /* the stake stands in the betting circle now */
#blackjack .bj-hands:has(.bj-hand + .bj-hand) .bj-bet { display: inline; font-size: 0.68rem; color: var(--t15); font-variant-numeric: tabular-nums; } /* after a split: each hand's own stake */
#blackjack .bj-result { font-size: 0.7rem; font-weight: 800; border-radius: 6px; padding: 1px 4px; margin-top: 2px; white-space: nowrap; font-variant-numeric: tabular-nums; background: rgba(255, 255, 255, 0.2); }
#blackjack .bj-result.bj-win { background: #1f8a4c; color: #fff; }
#blackjack .bj-result.bj-blackjack { background: var(--accent); color: #1b1b1b; }
#blackjack .bj-result.bj-lose, #blackjack .bj-result.bj-bust { background: #a12a26; color: #fff; }

/* What the side bets pay, printed on the felt on either side of the dealer */
#blackjack .bj-pay {
  position: absolute; top: 46px; width: 132px; padding: 5px 7px 6px; border: 1px solid rgba(255, 226, 150, 0.45); border-radius: 8px;
  font-family: Georgia, 'Times New Roman', serif; color: rgba(255, 226, 150, 0.8); text-align: left; line-height: 1.3; pointer-events: none;
}
#blackjack #bj-pay-pairs { left: 2%; transform: rotate(-4deg); transform-origin: left top; }
#blackjack #bj-pay-plus3 { right: 2%; transform: rotate(4deg); transform-origin: right top; }
#blackjack .bj-pay-title { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; text-align: center; margin-bottom: 2px; padding-bottom: 2px; border-bottom: 1px solid rgba(255, 226, 150, 0.3); }
#blackjack .bj-pay-line { display: flex; justify-content: space-between; gap: 6px; font-size: 0.6rem; white-space: nowrap; color: rgba(255, 255, 255, 0.66); }
#blackjack .bj-pay-odds { color: rgba(255, 226, 150, 0.9); font-weight: 700; font-variant-numeric: tabular-nums; }
#blackjack .bj-pay-short { display: none; }
/* The cards lie on top of the print, as on a real table. */
#blackjack #bj-dealer-cards, #blackjack .bj-who, #blackjack #bj-house-seat, #blackjack #bj-dealer-total { position: relative; z-index: 1; }
@media (max-width: 699px) {
  /* A phone: narrow, upright, beside the dealer's cards, with short names and the odds as a number. */
  #blackjack .bj-pay { top: 96px; width: 74px; padding: 3px 4px 4px; border-radius: 6px; line-height: 1.25; }
  #blackjack #bj-pay-pairs { left: 0; transform: none; }
  #blackjack #bj-pay-plus3 { right: 0; transform: none; }
  #blackjack .bj-pay-title { font-size: 0.47rem; letter-spacing: 0.04em; }
  #blackjack .bj-pay-line { font-size: 0.5rem; gap: 2px; }
  #blackjack .bj-pay-long, #blackjack .bj-pay-to { display: none; }
  #blackjack .bj-pay-short { display: inline; }
}

/* The two side bet spots printed on the felt past the betting circle: Perfect Pairs and 21+3 */
#blackjack .bj-sspots { display: flex; justify-content: center; gap: 4px; margin-top: 4px; }
#blackjack .bj-sspots.bj-sspots-off { visibility: hidden; }
#blackjack .bj-sspot {
  flex: none; width: 28px; height: 28px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1.5px solid rgba(255, 226, 150, 0.4); color: rgba(255, 226, 150, 0.65); line-height: 1; font-variant-numeric: tabular-nums;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
#blackjack .bj-sspot-name { font-size: 0.5rem; font-weight: 800; letter-spacing: 0.02em; }
#blackjack .bj-sspot-amt { font-size: 0.56rem; font-weight: 800; margin-top: 1px; }
#blackjack .bj-sspot-on { background: #6d3fa0; border: 2px dashed rgba(255, 255, 255, 0.9); color: #fff; box-shadow: 0 2px 0 #4a2a70, 0 4px 5px rgba(0, 0, 0, 0.45); }
#blackjack .bj-sspot-on .bj-sspot-name { font-size: 0.42rem; opacity: 0.85; }
#blackjack .bj-sspot-draft { opacity: 0.7; } /* still being built up, not placed yet */
#blackjack .bj-sspot-win { background: #1f8a4c; box-shadow: 0 0 0 2px #9be29b, 0 0 12px 2px rgba(155, 226, 155, 0.7); animation: bj-side-won 0.7s ease-in-out 3 alternate; }
#blackjack .bj-sspot-lose { background: none; border: 1.5px solid rgba(255, 255, 255, 0.25); color: rgba(255, 255, 255, 0.35); box-shadow: none; }
#blackjack .bj-sspot-lose .bj-sspot-amt { text-decoration: line-through; }
/* My own, while I can still bet: bigger, and plainly something to tap. */
#blackjack .bj-seat.bj-me .bj-sspot-tap { width: 36px; height: 36px; cursor: pointer; border-color: var(--accent); color: var(--t15); }
#blackjack .bj-seat.bj-me .bj-sspot-tap:not(.bj-sspot-on) { border-style: dashed; }
#blackjack .bj-seat.bj-me .bj-sspot-tap .bj-sspot-name { font-size: 0.58rem; }
#blackjack .bj-seat.bj-me .bj-sspot-tap.bj-sspot-on .bj-sspot-name { font-size: 0.46rem; }
#blackjack .bj-seat.bj-me .bj-sspot-tap .bj-sspot-amt { font-size: 0.66rem; }
@keyframes bj-side-won { from { transform: scale(1); } to { transform: scale(1.18); } }

/* The betting circle printed on the felt, with the chips bet standing in it */
#blackjack .bj-spot {
  position: relative; flex: none; width: 50px; height: 50px; margin: 4px 0 5px; border-radius: 50%;
  border: 2px solid rgba(255, 226, 150, 0.55); box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.12);
  display: flex; align-items: center; justify-content: center;
}
#blackjack .bj-seat.bj-empty .bj-spot { border-style: dashed; border-color: rgba(255, 255, 255, 0.3); }
#blackjack .bj-seat.bj-turn .bj-spot { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), 0 0 14px 2px rgba(var(--r1), 0.7); }
/* My own circle while I can still bet: tap it to add a chip. */
#blackjack .bj-spot-tap { cursor: pointer; border-color: var(--accent); touch-action: manipulation; user-select: none; -webkit-user-select: none; }
#blackjack .bj-spot-tap:not(.bj-spot-on) { border-style: dashed; animation: bj-tap-me 1.6s ease-in-out infinite; }
#blackjack .bj-spot-tap:not(.bj-spot-on)::after { content: 'TAP'; font-size: 0.56rem; font-weight: 800; letter-spacing: 0.08em; color: var(--t15); opacity: 0.8; }
@keyframes bj-tap-me { 50% { box-shadow: 0 0 0 4px rgba(var(--r1), 0.28); } }
#blackjack .bj-chip.bj-chip-tap { box-shadow: 0 0 0 2px var(--accent); }
#blackjack .bj-spot-house { border-color: var(--t15); background: rgba(var(--r0), 0.16); }
#blackjack .bj-spot-word { font-size: 0.58rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--t15); }
/* A chip, seen from above, with a second one under it. */
#blackjack .bj-disc {
  position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -19px 0 0 -17px; border-radius: 50%;
  background:
    radial-gradient(circle, var(--chip) 0 44%, rgba(255, 255, 255, 0.92) 45% 50%, var(--chip) 51% 100%),
    var(--chip);
  border: 3px dashed rgba(255, 255, 255, 0.9);
  box-shadow: 0 3px 0 -1px var(--chip-edge), 0 4px 0 -1px rgba(255, 255, 255, 0.5), 0 6px 6px rgba(0, 0, 0, 0.5);
}
#blackjack .bj-c100 { --chip: #1b1b1d; --chip-edge: #000; }
#blackjack .bj-c500 { --chip: #6d3fa0; --chip-edge: #4a2a70; }
#blackjack .bj-c1000 { --chip: #d39a1c; --chip-edge: #94690c; }
#blackjack .bj-c5000 { --chip: #c9302c; --chip-edge: #8a1f1c; }
#blackjack .bj-spot-amt {
  position: relative; z-index: 1; margin-top: -4px; font-size: 0.66rem; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px #000, 0 0 3px #000;
}
#blackjack .bj-spot-draft .bj-disc { opacity: 0.6; } /* still being built up, not placed yet */

/* The player at the rail: picture, name, chips */
#blackjack .bj-head {
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; max-width: 100%;
  padding: 3px 8px; border-radius: 10px; background: rgba(0, 0, 0, 0.42); border: 1px solid rgba(255, 255, 255, 0.12);
}
#blackjack .bj-seat.bj-me .bj-head { border-color: var(--accent); background: rgba(0, 0, 0, 0.6); }
#blackjack .bj-seat.bj-banker .bj-head { border-color: var(--t15); }
#blackjack .bj-seat.bj-empty .bj-head { background: none; border-color: transparent; color: rgba(255, 255, 255, 0.6); }
#blackjack .bj-seat.bj-empty .bj-hands { visibility: hidden; }
#blackjack .bj-seat.bj-empty .bj-foot, #blackjack .bj-seat.bj-empty .bj-cam { display: none; }
#blackjack .bj-seat.bj-empty .bj-name { white-space: normal; font-weight: 600; font-size: 0.72rem; }
#blackjack .bj-seat.bj-vacant .bj-name { text-decoration: underline; color: var(--text); }
#blackjack .bj-id { min-width: 0; max-width: 100%; }
#blackjack .bj-cam { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: #000; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6); flex: none; }
#blackjack .bj-cam.mirror { transform: none; /* my own picture is shown as the others see it, not mirrored */ }
#blackjack .bj-cam.blank { display: none; }
#blackjack .bj-name { font-weight: 700; font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#blackjack .bj-name .bj-badge { display: none; } /* the betting circle says "house" already */
#blackjack .bj-chips { font-size: 0.74rem; color: var(--t15); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#blackjack .bj-foot { font-size: 0.72rem; min-height: 1.25em; margin-top: 2px; color: rgba(255, 255, 255, 0.75); font-variant-numeric: tabular-nums; }
#blackjack .bj-foot.bj-placed { color: var(--t15); font-weight: 700; }
#blackjack .bj-foot.bj-up-chips { color: #8fe0ad; font-weight: 700; }
#blackjack .bj-foot.bj-down-chips { color: #ffb4a9; font-weight: 700; }

/* A card being dealt, or turned over: it comes from the shoe */
#blackjack .card.bj-new { animation: bj-deal 0.3s ease-out; }
@keyframes bj-deal { from { opacity: 0; translate: 60px -40px; rotate: 12deg; } }
@media (prefers-reduced-motion: reduce) { #blackjack .card.bj-new { animation: none; } }

/* Speech bubbles: Mr.GTO's under the dealer, a player's above the seat */
#blackjack .bj-bubble {
  position: absolute; z-index: 6; left: 50%; transform: translateX(-50%); top: calc(100% + 4px);
  width: max-content; max-width: min(300px, 80vw); padding: 7px 11px; text-align: center;
  background: #fdfdfd; color: #161616; border-radius: 12px; font-size: 0.88rem; font-weight: 600; line-height: 1.25;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5); pointer-events: none;
}
#blackjack .bj-bubble::after { content: ''; position: absolute; left: 50%; margin-left: -6px; top: -12px; border: 6px solid transparent; border-bottom-color: #fdfdfd; }
#blackjack .bj-bubble.bj-up { top: auto; bottom: calc(100% + 4px); max-width: 190px; }
#blackjack .bj-bubble.bj-up::after { top: auto; bottom: -12px; border-bottom-color: transparent; border-top-color: #fdfdfd; }
#blackjack .bj-bubble.bj-pop { animation: bj-pop 0.22s ease-out; }
@keyframes bj-pop { from { opacity: 0; scale: 0.7; } }

/* Under the table: what is going on, and my buttons */
#blackjack #bj-status { text-align: center; font-weight: 700; min-height: 1.5em; margin: 12px 0 2px; font-variant-numeric: tabular-nums; }
#blackjack #bj-error { text-align: center; min-height: 1.2em; margin: 0; }
#blackjack #bj-limit { margin: 0; text-align: center; }
/* The three chips to bet with */
#blackjack #bj-chips { justify-content: center; gap: 16px; }
#blackjack #bj-chips .bj-chip {
  flex: none; width: 68px; height: 68px; min-height: 0; padding: 0; border-radius: 50%;
  font-weight: 800; font-size: 0.86rem; color: #fff; font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px #000;
  background: radial-gradient(circle, var(--chip) 0 52%, rgba(255, 255, 255, 0.92) 53% 57%, var(--chip) 58% 100%);
  border: 5px dashed rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 0 -1px var(--chip-edge), 0 7px 10px rgba(0, 0, 0, 0.5);
}
#blackjack #bj-chips .bj-chip[data-add="100"] { --chip: #1b1b1d; --chip-edge: #000; }
#blackjack #bj-chips .bj-chip[data-add="500"] { --chip: #6d3fa0; --chip-edge: #4a2a70; }
#blackjack #bj-chips .bj-chip[data-add="1000"] { --chip: #d39a1c; --chip-edge: #94690c; }
#blackjack #bj-chips .bj-chip[data-add="5000"] { --chip: #c9302c; --chip-edge: #8a1f1c; }
#blackjack #bj-chips .bj-chip[hidden] { display: none; }
#blackjack #bj-chips .bj-chip:active:not(:disabled) { translate: 0 2px; }
#blackjack #bj-chips .bj-chip:disabled { opacity: 0.4; }
#blackjack #bj-play-box .row > button { min-height: 54px; font-size: 1.02rem; }
#blackjack #bj-house-box { margin-top: 10px; }
#blackjack #bj-house-text { margin-top: 6px; }
#blackjack #bj-leave { margin-top: 6px; }

@media (min-width: 700px) {
  #blackjack #bj-rail { padding: 12px 14px 20px; }
  #blackjack #bj-felt { padding-top: 10px; }
  #blackjack #bj-seats { gap: 8px; }
  #blackjack .bj-seat .card { width: 36px; height: 50px; font-size: 0.95rem; }
  #blackjack .bj-seat .card .suit { font-size: 0.95rem; }
  #blackjack .bj-seat .card + .card { margin-left: -17px; }
  #blackjack .bj-hands { min-height: 82px; }
  #blackjack .bj-spot { width: 58px; height: 58px; }
  #blackjack .bj-disc { width: 40px; height: 40px; margin: -22px 0 0 -20px; }
  #blackjack .bj-spot-amt { font-size: 0.72rem; }
}
@media (max-width: 699px) {
  #blackjack { padding-top: 46px; --bj-drop-1: 22px; --bj-drop-2: 32px; } /* room for the row of round buttons along the top */
  #blackjack #bj-title { padding: 0; }
  #blackjack #bj-rail { padding: 7px 7px 11px; border-radius: 20px 20px 50% 50% / 20px 20px 30% 30%; }
  #blackjack #bj-felt { padding-left: 2%; padding-right: 2%; border-radius: 14px 14px 50% 50% / 14px 14px 29% 29%; }
  #blackjack #bj-seats { gap: 2px; }
  #blackjack .bj-spot { width: 44px; height: 44px; }
  #blackjack .bj-disc { width: 30px; height: 30px; margin: -17px 0 0 -15px; border-width: 2px; }
  #blackjack .bj-head { padding: 2px 4px; border-radius: 8px; }
  #blackjack .bj-name { font-size: 0.74rem; }
  #blackjack .bj-chips { font-size: 0.68rem; }
  #blackjack .bj-foot { font-size: 0.64rem; }
  #blackjack .bj-cam { width: 40px; height: 40px; }
  #blackjack #bj-tray i { width: 16px; height: 13px; }
  #blackjack #bj-shoe, #blackjack #bj-discard { width: 34px; height: 24px; }
  /* Bubbles stay inside the screen: the seats at the edges hang theirs inwards. */
  #blackjack .bj-bubble.bj-up { max-width: 160px; }
  #blackjack .bj-seat:nth-child(-n+2) .bj-bubble.bj-up { left: 0; transform: none; }
  #blackjack .bj-seat:nth-child(-n+2) .bj-bubble.bj-up::after { left: 24px; }
  #blackjack .bj-seat:nth-child(n+4) .bj-bubble.bj-up { left: auto; right: 0; transform: none; }
  #blackjack .bj-seat:nth-child(n+4) .bj-bubble.bj-up::after { left: auto; right: 18px; }
  #blackjack #bj-play-box .row > button, #blackjack #bj-bet-box .row > button { padding: 0 2px; font-size: 0.9rem; }
  #blackjack #bj-chips .bj-chip { width: 60px; height: 60px; font-size: 0.8rem; }
  /* Narrow seats: the result goes on two lines, and a long hand is fanned tighter, so neither runs into the next seat. */
  #blackjack .bj-result { white-space: normal; line-height: 1.15; font-size: 0.66rem; }
  #blackjack .bj-seat .bj-cards:has(.card:nth-child(4)) .card + .card { margin-left: -20px; }
  #blackjack .bj-seat .bj-cards:has(.card:nth-child(6)) .card + .card { margin-left: -23px; }
}

/* Wide screens: the table gets the room a table for five needs. */
@media (min-width: 760px) {
  main:has(#blackjack:not([hidden])), body > :has(> #blackjack:not([hidden])) { max-width: 800px; }
  #blackjack { --bj-drop-1: 44px; --bj-drop-2: 62px; }
  #blackjack #bj-play-box, #blackjack #bj-bet-box, #blackjack #bj-house-box, #blackjack #bj-rebuy-box, #blackjack #bj-add-box, #blackjack #bj-status ~ .row { max-width: 520px; margin-left: auto; margin-right: auto; }
}

/* The house's own settings: the biggest bet allowed, and chips for the players */
#blackjack #bj-max-box, #blackjack #bj-give-box { margin-top: 8px; }
#blackjack #bj-max-box p, #blackjack #bj-give-box p { margin: 0 0 4px; text-align: center; }
#blackjack #bj-max, #blackjack #bj-give { flex-wrap: wrap; justify-content: center; }
#blackjack #bj-max button { flex: 1 1 70px; min-height: 40px; padding: 0 6px; font-variant-numeric: tabular-nums; }
#blackjack #bj-max button.picked { background: var(--t15); color: #1b1b1b; border-color: var(--t15); }
#blackjack #bj-give button { flex: 1 1 150px; min-height: 44px; }
#blackjack #bj-give-amount { justify-content: center; align-items: center; gap: 12px; margin-bottom: 6px; }
#blackjack #bj-give-amount button { flex: none; width: 48px; min-height: 44px; padding: 0; font-size: 1.3rem; font-weight: 800; }
#blackjack #bj-give-now { min-width: 90px; text-align: center; font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; color: var(--t15); }
#blackjack .bj-given { font-size: 0.62rem; color: rgba(255, 255, 255, 0.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Up or down since sitting down: on each player's plate, and for the house under the dealer's cards */
#blackjack .bj-net { font-size: 0.68rem; font-weight: 800; color: rgba(255, 255, 255, 0.75); white-space: nowrap; font-variant-numeric: tabular-nums; }
#blackjack .bj-net-up { color: #8fe0ad !important; }
#blackjack .bj-net-down { color: #ffb4a9 !important; }
#blackjack #bj-house-net { font-size: 0.86rem; font-weight: 700; }

/* A player as the house: their plate and picture stand at the dealer's place. */
#bj-house-seat { display: none; justify-content: center; }
#bj-dealer.bj-player-house #bj-house-seat { display: flex; }
#blackjack #bj-house-seat .bj-seat { transform: none; width: auto; min-width: 0; }
#blackjack #bj-house-seat .bj-hands, #blackjack #bj-house-seat .bj-spot, #blackjack #bj-house-seat .bj-sspots, #blackjack #bj-house-seat .bj-foot { display: none; }
#blackjack #bj-house-seat .bj-head { border-color: var(--t15); background: rgba(0, 0, 0, 0.55); margin-bottom: 4px; }
#blackjack #bj-house-seat .bj-cam { width: 64px; height: 64px; }
#bj-dealer.bj-player-house #bj-house-name { display: none; }
@media (max-width: 700px) { #blackjack #bj-house-seat .bj-cam { width: 44px; height: 44px; } }

/* The side bets: two buttons in the bet box, and how they came out under the hand. */
#blackjack #bj-side-text { margin: 8px 0 4px; text-align: center; }
#blackjack .bj-side.picked { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
#blackjack .bj-sidebets { margin-top: 2px; font-size: 0.62rem; font-weight: 700; line-height: 1.25; text-align: center; }
#blackjack .bj-sidebet.bj-win { color: #9be29b; }
#blackjack .bj-sidebet.bj-lose { color: rgba(255, 255, 255, 0.55); }

/* ---- extra pockets: an empty seat played by somebody already seated, with their chips ---- */
#blackjack .bj-seat.bj-pocket .bj-cam { display: none; }
#blackjack .bj-seat.bj-pocket .bj-head { border-style: dashed; }
#blackjack .bj-seat.bj-picked .bj-spot { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
#blackjack .bj-unbox { margin-top: 3px; padding: 2px 5px; font-size: 0.56rem; min-height: 0; white-space: nowrap; border-radius: 999px; background: rgba(0, 0, 0, 0.45); color: rgba(255, 255, 255, 0.85); border: 1px solid rgba(255, 255, 255, 0.35); cursor: pointer; }

/* ---- dragging a chip onto the table ---- */
#blackjack #bj-chips .bj-chip:not(#bj-allin) { touch-action: none; cursor: grab; } /* so a finger drags the chip, not the page */
#blackjack #bj-chips .bj-chip.bj-drag { position: fixed; z-index: 60; margin: -30px 0 0 -30px; width: 60px; height: 60px; pointer-events: none; opacity: 0.92; cursor: grabbing; transform: scale(1.05); }
#blackjack.bj-dragging .bj-seat.bj-me .bj-spot-tap, #blackjack.bj-dragging .bj-seat.bj-me .bj-sspot-tap { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), 0 0 12px 2px rgba(var(--r1), 0.6); }

/* ---- the big chips ---- */
#blackjack #bj-chips .bj-chip[data-add="25000"], #blackjack .bj-c25000 { --chip: #1d6fb8; --chip-edge: #124a7c; }
#blackjack #bj-chips .bj-chip[data-add="100000"], #blackjack .bj-c100000 { --chip: #c2257a; --chip-edge: #861652; }
#blackjack #bj-chips.bj-many { gap: 8px; }
#blackjack #bj-chips.bj-many .bj-chip { width: 52px; height: 52px; font-size: 0.7rem; border-width: 4px; }
@media (max-width: 699px) {
  #blackjack #bj-chips.bj-many { gap: 5px; flex-wrap: nowrap; }
  #blackjack #bj-chips.bj-many .bj-chip { width: 46px; height: 46px; font-size: 0.62rem; border-width: 3px; }
}
