/* DrawPack: Blackjack. Loaded after arcade.css and games-*.css.

   Mr Fr0gg1e's table, grown up. The oval green felt, the wood rim, the gold line inside it, the gold mark in
   the middle (BLACKJACK) are theirs, with their
   colours. On that table now sit real card faces, a shoe the cards are dealt from, totals, result badges and
   the four action buttons.

   The table sizes itself from the width of the stage (a container query), so it fits beside the controls, on
   a tablet and on a phone. Cards overlap as far as a hand needs: --n is the number of cards in a hand (set by
   the game). Narrow things (the dealer's name) sit in the narrow ends of the oval, wide things
   (cards, buttons) in its wide middle.

   The felt stays green on every skin, and everything on it carries its own fixed colours (light ink, dark
   plates), so the light skin can never put dark ink on it. Around the felt lies the stage of the Night Arcade
   shell (the game's colour world, WORLDS in arcade.css), and the controls panel is the shell's own.
   Class prefix: bj-. Only transform and opacity move. */

/* shell bridge: the few tokens this table was drawn with, mapped to the Night Arcade tokens (src/game.html) on this
   game's page only. --gc is the game's colour: the first colour of its world. */
:root .view[data-view="blackjack"] { --gc: var(--g1); --hair-2: var(--line-2); --spring: var(--ease-pop); --t-1: var(--t-press); --t-2: var(--t-ui); --t-3: var(--t-panel); }

.view[data-view="blackjack"] .board { padding: 0; container: bj-board / inline-size; }

/* ---------- the frame around the table: the stage of the shell shows through, with a light in the game's colour ---------- */
.bj-table { --bj-back: #2a3042; display: grid; grid-template-columns: minmax(0, 1fr); padding: 14px; outline: 0; user-select: none; -webkit-user-select: none;
  background: radial-gradient(ellipse at 50% 45%, color-mix(in srgb, var(--gc) 20%, transparent), transparent 70%); }
/* While a button is switched off the table itself holds the keyboard focus: its gold line lights up instead of a ring */
.view[data-view="blackjack"] .bj-table:focus-visible { outline: 0; border-radius: 0; }
.bj-table:focus-visible .bj-felt { --bj-line: #ffffffd9; }

/* ---------- the felt: an oval of green cloth in a wood rim, with a gold line along the rim ---------- */
.bj-felt { --cw: 92px; --ch: calc(var(--cw) * 1.4); --bj-hand: calc(var(--ch) + 57px); --bj-line: #d6aa5d66; --bj-glow: inset 0 0 40px #001c12a8, 0 20px 46px #0007;
  position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; width: min(100%, 940px); justify-self: center; padding: 20px 26px 14px; color: #fff;
  border: 7px solid transparent; border-radius: 44% / 18%;
  background: radial-gradient(#ffffff0d .7px, transparent 1.1px) 0 0 / 5px 5px padding-box, radial-gradient(#0000000f .7px, transparent 1.1px) 2px 3px / 5px 5px padding-box,
    radial-gradient(ellipse at 50% 40%, #167349, #075638 68%, #06442f) padding-box, linear-gradient(180deg, #8b5d2d, #6c461f 42%, #543517) border-box;
  box-shadow: inset 0 0 0 2px var(--bj-line), var(--bj-glow); }
/* a second, fainter line printed on the cloth */
.bj-felt::after { content: ""; position: absolute; inset: 9px; z-index: -1; pointer-events: none; border: 1px solid #d6aa5d30; border-radius: 44% / 18%; }
.bj-table.is-win .bj-felt, .bj-table.is-bj .bj-felt { --bj-line: #f7e0a0e6; }

/* ---------- the shoe: the stack the cards are dealt from. It sits where the oval is wide enough for it ---------- */
.bj-shoe { position: absolute; top: 54px; right: 64px; width: calc(var(--cw) * .56); height: calc(var(--cw) * .56 * 1.4); transform: rotate(8deg); pointer-events: none; }
.bj-shoe::before { content: ""; position: absolute; inset: -6px -6px -10px -10px; border-radius: 11px; background: linear-gradient(160deg, #262d3d, #0b0e15 70%); box-shadow: inset 0 1px 0 #ffffff2e, 0 16px 22px -12px #000000d9; }
.bj-shoe i { position: absolute; inset: 0; border-radius: 5px; }
.bj-shoe i:nth-child(1) { transform: translate(-4.5px, 4.5px); }
.bj-shoe i:nth-child(2) { transform: translate(-3px, 3px); }
.bj-shoe i:nth-child(3) { transform: translate(-1.5px, 1.5px); }
/* the chip rack on the dealer's other side: only for looks */
.bj-rack { position: absolute; top: 58px; left: 64px; display: flex; align-items: flex-end; gap: 3px; padding: 6px 6px 7px; border-radius: 11px; transform: rotate(-7deg); pointer-events: none; background: linear-gradient(160deg, #262d3d, #0b0e15 70%); box-shadow: inset 0 1px 0 #ffffff2e, 0 16px 22px -12px #000000d9; }
.bj-rack i { width: calc(var(--cw) * .16); height: calc(var(--cw) * .62); border-radius: 3px; background: repeating-linear-gradient(180deg, var(--c) 0 3px, color-mix(in srgb, var(--c) 52%, #000) 3px 4px); box-shadow: inset 2px 0 0 #ffffff47, inset -2px 0 0 #00000047; }
.bj-rack i:nth-child(1) { --c: #f4f6fb; }
.bj-rack i:nth-child(2) { --c: #ffb43d; height: calc(var(--cw) * .5); }
.bj-rack i:nth-child(3) { --c: #4cc9ff; height: calc(var(--cw) * .4); }

/* ---------- seats ---------- */
.bj-seat, .bj-hand { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 8px; min-width: 0; container-type: inline-size; }
.bj-seat { --side: calc(var(--cw) * 1.35); padding-inline: var(--side); } /* the dealer's cards stay clear of the shoe and the rack */
.bj-seat > .bj-plate { max-width: none; margin-inline: calc(var(--side) * -.6); } /* the name sits above them and may be wider */
.bj-plate { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 8px; min-height: 28px; max-width: 100%; }
.bj-who { font-size: 13px; font-weight: 700; color: #e4f2e9; }
.bj-total { min-width: 36px; padding: 3px 11px; border-radius: 99px; font-family: var(--font-mono); font-size: 14px; font-weight: 700; line-height: 1.35; text-align: center; white-space: nowrap; color: #f9d775; background: #001c12cc; border: 1px solid #d6aa5d66; box-shadow: 0 8px 14px -8px #000; }
.bj-total.pop { animation: bjPop .3s var(--spring); }
.bj-total.is-21, .bj-total.is-bj { color: #2a1800; border-color: #ffffff73; background: linear-gradient(180deg, #ffe7a3, #ffc54d 55%, #e59a12); box-shadow: inset 0 1px 0 #ffffffa6, 0 10px 20px -8px #ffb43dcc; }
.bj-total.is-bust { color: #fff; border-color: #ffffff40; background: linear-gradient(180deg, #ff6680, #c8354d); }
.bj-table.is-idle .bj-hand .bj-who { display: none; }

/* the player's side: one hand, or two after a split. The room of one full hand is kept, so the table never changes its height */
.bj-hands { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-items: start; min-height: var(--bj-hand); }
.bj-hands.is-split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bj-hand { --pt: 12px; position: relative; padding: var(--pt) 8px 6px; border-radius: 16px; border: 1.5px solid transparent; }
.bj-hand.is-active { border-color: #f7e0a0cc; background: #ffffff14; box-shadow: 0 0 0 4px #f7e0a01f, 0 18px 30px -22px #000; }
.bj-hand.is-active::before { content: "Your move"; position: absolute; top: -9px; left: 50%; transform: translateX(-50%); padding: 1px 9px; border-radius: 99px; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; color: #06442f; background: #f7e0a0; box-shadow: 0 6px 12px -6px #000; }
.bj-hand.is-wait .bj-plate { opacity: .6; }
.bj-stake { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px 3px 4px; border-radius: 99px; font-family: var(--font-mono); font-size: 13px; font-weight: 700; line-height: 1.35; white-space: nowrap; color: #f7e0a0; background: #3a240fe0; border: 1px solid #8b5d2d; } /* the bet on a hand lies on a small wooden plate, so it is never taken for a total */
.bj-chip { flex: none; width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle, #ffb43d 0 36%, #fff6cf 37% 45%, transparent 46%), repeating-conic-gradient(#fff6cf 0 14deg, #c97a00 14deg 45deg); box-shadow: inset 0 0 0 1.5px #7a4300, 0 2px 4px #00000080; }
.bj-chip + .bj-chip { margin-left: -13px; }

/* how a hand ended: a stamp across the lower part of its cards (the corners with the ranks stay in sight) */
.bj-badge { position: absolute; left: 0; right: 0; top: calc(var(--pt) + var(--ch) * .8); z-index: 3; width: -webkit-fit-content; width: fit-content; max-width: 100%; margin-inline: auto; transform: translateY(-50%) rotate(-4deg); padding: 6px 14px; border-radius: 12px; font-family: var(--font-display); font-size: 16px; font-weight: 800; letter-spacing: -.01em; line-height: 1.15; text-align: center; color: #fff; background: #0b0e15eb; border: 1.5px solid #ffffff59; box-shadow: 0 14px 24px -10px #000; animation: bjStamp .36s var(--spring) both; }
.bj-hand.is-win .bj-badge, .bj-hand.is-blackjack .bj-badge { color: #2a1800; border-color: #ffffff8c; background: linear-gradient(180deg, #ffe7a3, #ffc54d 55%, #e59a12); box-shadow: inset 0 1px 0 #ffffffa6, 0 14px 26px -10px #ffb43dd9; }
.bj-hand.is-lose .bj-badge, .bj-hand.is-bust .bj-badge { color: #ffd9de; border-color: #ff8ea0; background: #4b1622; }
/* a hand that lost, and the hand that is not being played, sit in the shade (a see-through card would show the cards under it) */
.bj-hand.is-lose .bj-card::after, .bj-hand.is-bust .bj-card::after, .bj-hand.is-wait .bj-card::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: #001c12; opacity: .46; }
.bj-hand.is-win .bj-cards, .bj-hand.is-blackjack .bj-cards { animation: bjLift .5s var(--spring); }
.bj-hand.is-win::after, .bj-hand.is-blackjack::after { content: ""; position: absolute; left: 50%; top: -12px; z-index: -1; width: min(100%, calc(var(--cw) * 4.4)); height: calc(var(--ch) + 40px); transform: translateX(-50%); pointer-events: none; background: radial-gradient(closest-side, #ffc54d4d, transparent); } /* a warm light under a hand that won */

/* ---------- a row of cards ---------- */
/* --n cards share the width of their seat: each card covers a part of the one before it, and more of it when the hand is long */
.bj-cards { --n: 2; --step: min(calc(var(--cw) * .74), calc((100cqw - var(--cw)) / (var(--n) - 1))); display: flex; justify-content: center; min-height: var(--ch); max-width: 100%; }
.bj-cards > * + * { margin-left: calc(var(--step) - var(--cw)); }
.bj-ghost { flex: none; width: var(--cw); height: var(--ch); border-radius: calc(var(--cw) * .085); border: 1.5px dashed #f7e0a066; background: #001c1233; }
.bj-cards > .bj-ghost + .bj-ghost { margin-left: calc(var(--cw) * .1); }

/* ---------- a playing card ---------- */
.bj-card { --drop: 0 5px 12px #001c1280, 0 18px 24px -16px #000000d9; position: relative; flex: none; width: var(--cw); height: var(--ch); border-radius: calc(var(--cw) * .085); perspective: calc(var(--cw) * 7); font-family: var(--font-display); font-weight: 800; font-size: calc(var(--cw) * .2); line-height: 1; color: #202533; }
.bj-card.red { color: #d72c49; }
.bj-flip { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .36s var(--ease); }
.bj-card.is-down .bj-flip { transform: rotateY(180deg); }
/* the two sides of a card. Each side carries the shadow, so the shadow turns over with the card */
.bj-face, .bj-back { position: absolute; inset: 0; border-radius: calc(var(--cw) * .085); overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.bj-face { background: linear-gradient(145deg, #fff, #e8ebf0); box-shadow: inset 0 0 0 1px #d6dbe2, var(--drop); }
.bj-back { transform: rotateY(180deg); display: grid; place-items: center; box-shadow: var(--drop); }
/* the back: a gold edge and stripes in the colour the player picked in Settings, with a spade in the middle */
.bj-back, .bj-shoe i { border: calc(var(--cw) * .045) solid #f0d48a; background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--bj-back) 70%, #fff) 0 5px, var(--bj-back) 5px 9px); }
.bj-shoe i { border-width: 2.5px; box-shadow: 0 0 0 1px #00000033; }
.bj-back i { width: 46%; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; color: #fff; background: #071b31cc; }
.bj-back i svg { width: 56%; height: 56%; }
.bj-card svg, .bj-mark svg { display: block; fill: currentColor; }
/* the rank and the suit in two corners */
.bj-ix { position: absolute; top: 5%; left: 5.5%; display: grid; justify-items: center; gap: .1em; min-width: .76em; font-size: .96em; letter-spacing: -.08em; }
.bj-ix b { font-weight: 800; }
.bj-ix.ten b { font-size: .86em; letter-spacing: -.13em; line-height: 1.12; } /* two digits in the room of one */
.bj-ix svg { width: .62em; height: .62em; }
.bj-ix.b { top: auto; left: auto; right: 5.5%; bottom: 5%; transform: rotate(180deg); }
/* Ace to 10: the real pip layout */
.bj-pips { position: absolute; left: 34%; right: 34%; top: 18%; bottom: 18%; }
.bj-pips i { position: absolute; width: 0; height: 0; }
.bj-pips svg { position: absolute; left: 0; top: 0; width: calc(var(--cw) * .19); height: calc(var(--cw) * .19); transform: translate(-50%, -50%); }
.bj-pips i.f svg { transform: translate(-50%, -50%) rotate(180deg); }
.bj-pips.ace svg { width: calc(var(--cw) * .5); height: calc(var(--cw) * .5); }
/* Jack, Queen, King: a framed panel with the crest twice (the lower one upside down, like a real court card) and the suit in the middle */
.bj-court { position: absolute; left: 24%; right: 24%; top: 14%; bottom: 14%; display: grid; grid-template-rows: 1fr 1fr; overflow: hidden; border-radius: calc(var(--cw) * .05); border: 1.5px solid currentColor;
  background: repeating-linear-gradient(45deg, color-mix(in srgb, currentColor 11%, transparent) 0 3px, transparent 3px 7px), #fff; }
.bj-court::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1.5px; margin-top: -.75px; background: currentColor; opacity: .5; }
.bj-court > span { display: grid; place-items: center; padding-bottom: 22%; }
.bj-court > span + span { transform: rotate(180deg); }
.bj-court > span svg { width: calc(var(--cw) * .32); height: calc(var(--cw) * .32); }
.bj-court > i { position: absolute; left: 50%; top: 50%; z-index: 1; width: calc(var(--cw) * .25); height: calc(var(--cw) * .25); margin: calc(var(--cw) * -.125) 0 0 calc(var(--cw) * -.125); display: grid; place-items: center; border-radius: 50%; background: #fff; border: 1.5px solid currentColor; }
.bj-court > i svg { width: 58%; height: 58%; }

/* ---------- the middle of the table: Mr Fr0gg1e's gold mark, and over it the result of the round ---------- */
.bj-mid { position: relative; display: grid; place-items: center; min-height: 66px; }
.bj-center { display: grid; justify-items: center; gap: 2px; color: #f7e0a0; text-align: center; transition: opacity var(--t-3) var(--ease); }
.bj-mark { width: 28px; height: 28px; }
.bj-mark svg { width: 100%; height: 100%; }
.bj-center b { margin-right: -.22em; font: 800 14px var(--font-display); letter-spacing: .22em; }
.bj-table.is-over .bj-center { opacity: 0; } /* the result takes its place until the next deal */
.bj-banner { position: absolute; left: 0; right: 0; top: 50%; z-index: 2; width: -webkit-fit-content; width: fit-content; max-width: 100%; margin-inline: auto; transform: translateY(-50%); display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 0 10px; padding: 8px 22px; border-radius: 26px; white-space: nowrap; color: #fff; background: #0b0e15e6; border: 1px solid #ffffff3d; box-shadow: inset 0 1px 0 #ffffff1f, 0 18px 30px -14px #000; animation: bjBanner .42s var(--spring) both; }
.bj-banner b { font-family: var(--font-display); font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.bj-banner em { font-style: normal; font-family: var(--font-mono); font-size: 16px; font-weight: 700; color: #ffffffb8; }
.bj-banner.is-win, .bj-banner.is-bj { color: #2a1800; border-color: #ffffff73; background: linear-gradient(180deg, #ffe7a3, #ffc54d 55%, #e59a12); box-shadow: inset 0 1px 0 #ffffffa6, inset 0 -3px 0 #7a4b0040, 0 18px 36px -12px #ffb43dd9; }
.bj-banner.is-win em, .bj-banner.is-bj em { color: #5a3a00; }
.bj-banner.is-lose { border-color: #ff8ea0b3; background: #4b1622f2; }
.bj-banner.is-lose em { color: #ffd3d9; }

/* ---------- hit, stand, double, split: flat dark plates with a gold edge, the label and (Double, Split) the extra stake ---------- */
/* the row is a little narrower than the table: its lower corners must stay inside the curve of the rim */
.bj-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; width: min(84% + 40px, 640px); justify-self: center; }
.bj-table:not(.is-play):not(.is-show) .bj-actions { visibility: hidden; } /* no hand in play: the row keeps its room but shows nothing */
.bj-act { display: flex; align-items: baseline; justify-content: center; gap: 6px; min-width: 0; min-height: 48px; padding: 8px; border-radius: 8px; color: #fff; font-family: var(--font-body); touch-action: manipulation; white-space: nowrap;
  background: #0b2a20; border: 1px solid #d6aa5da6; transition: transform var(--t-1) var(--ease), opacity var(--t-2) var(--ease); }
.bj-act b { font-size: 16px; font-weight: 700; }
.bj-act small { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: #f9d775; }
.bj-act small:empty { display: none; }
@media (hover: hover) { .bj-act:hover:not(:disabled) { border-color: #f7e0a0; } }
.bj-act:active:not(:disabled) { transform: scale(.98); }
.bj-act:disabled { opacity: .45; cursor: not-allowed; }
.bj-act[data-wait]:disabled { opacity: 1; cursor: progress; } /* open again in a moment: it keeps its look while the cards move */
.view[data-view="blackjack"] .bj-act:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 8px; }

@keyframes bjPop { from { transform: scale(.6); } }
@keyframes bjStamp { from { opacity: 0; transform: translateY(-50%) rotate(-4deg) scale(1.5); } }
@keyframes bjBanner { from { opacity: 0; transform: translateY(-50%) scale(.6); } }
@keyframes bjLift { 45% { transform: translateY(-8px); } }

/* ---------- a table that is a little narrower (a laptop): the buttons give up their icons ---------- */
@container bj-board (max-width: 799px) {
  .bj-felt { --cw: 86px; }
}
/* ---------- a narrow table: the stage beside the controls on a small laptop, and big phones on their side ---------- */
@container bj-board (max-width: 640px) {
  .bj-table { padding: 8px; }
  .bj-felt { --cw: 80px; --bj-hand: calc(var(--ch) + 49px); gap: 8px; padding: 16px 16px 12px; }
  .bj-felt::after { inset: 7px; }
  .bj-shoe { top: 48px; right: 44px; }
  .bj-rack { display: none; }
  .bj-seat { --side: calc(var(--cw) * 1.2); gap: 6px; }
  .bj-plate { min-height: 24px; gap: 6px; }
  .bj-total { font-size: 13px; padding: 2px 9px; min-width: 32px; }
  .bj-stake { font-size: 12px; padding: 2px 9px 2px 3px; }
  .bj-chip { width: 16px; height: 16px; }
  .bj-chip + .bj-chip { margin-left: -11px; }
  .bj-hands { gap: 6px; }
  .bj-hand { --pt: 11px; gap: 6px; padding: var(--pt) 4px 5px; border-radius: 14px; }
  .bj-hand.is-active::before { top: -6px; padding: 0 8px; font-size: 9.5px; }
  .bj-badge { padding: 4px 10px; font-size: 13.5px; border-radius: 10px; }
  .bj-mid { min-height: 50px; }
  .bj-mark { width: 20px; height: 20px; }
  .bj-center b { font-size: 12px; }
  .bj-banner { padding: 5px 16px; gap: 0 8px; }
  .bj-banner b { font-size: 16px; }
  .bj-banner em { font-size: 13.5px; }
  .bj-actions { gap: 6px; width: min(84% + 26px, 100%); }
  .bj-act { flex-direction: column; align-items: center; justify-content: center; gap: 0; min-height: 48px; padding: 4px 2px; }
  .bj-act b { font-size: 15px; }
  .bj-act small { max-width: 100%; font-size: 11px; }
}
/* ---------- a phone: Mr Fr0gg1e's narrow oval with its thinner rim ---------- */
@container bj-board (max-width: 500px) {
  .bj-table { padding: 6px; }
  .bj-felt { border-width: 5px; border-radius: 48% / 14%; padding: 12px 10px 9px; gap: 6px; }
  .bj-felt::after { inset: 6px; border-radius: 48% / 14%; }
  .bj-shoe { top: 42px; right: 22px; width: calc(var(--cw) * .5); height: calc(var(--cw) * .5 * 1.4); }
  .bj-shoe::before { inset: -5px -5px -8px -8px; border-radius: 9px; }
  .bj-seat { --side: calc(var(--cw) * .92); }
  .bj-mid { min-height: 46px; }
  .bj-mark { width: 18px; height: 18px; }
  .bj-center b { font-size: 11.5px; }
  .bj-hands.is-split .bj-who { display: none; } /* left is hand 1, right is hand 2: the room goes to the bet and the total */
  .bj-actions { width: calc(100% - 12px); } /* the row stays inside the curve of the rim */
  .bj-act { min-height: 46px; }
}
/* The card size follows the width of the table in steps. (A fluid size in container units would be worked out
   again inside every seat, because each seat is a container of its own.) */
@container bj-board (max-width: 430px) { .bj-felt { --cw: 72px; } }
@container bj-board (max-width: 340px) { .bj-felt { --cw: 64px; } .bj-act b { font-size: 14.5px; } .bj-actions { gap: 5px; } .bj-plate { gap: 4px; } .bj-total { padding: 2px 7px; } .bj-hands.is-split .bj-chip { width: 11px; height: 11px; } .bj-hands.is-split .bj-chip + .bj-chip { display: none; } .bj-hands.is-split .bj-stake { gap: 4px; padding: 2px 7px 2px 4px; } }
@container bj-board (max-width: 300px) { .bj-felt { --cw: 56px; } .bj-act b { font-size: 13.5px; } .bj-badge { font-size: 12px; padding: 3px 8px; } .bj-total { font-size: 12px; min-width: 0; } .bj-stake { font-size: 12px; } }
@container bj-board (max-width: 260px) { .bj-felt { --cw: 50px; } .bj-total { font-size: 11.5px; padding: 2px 6px; } .bj-stake { font-size: 11px; } .bj-hands.is-split .bj-chip { display: none; } .bj-hands.is-split .bj-stake { padding: 2px 6px; } }
/* two hands side by side need smaller cards on a narrow table */
@container bj-board (max-width: 520px) { .bj-hands.is-split { --cw: 64px; --ch: calc(var(--cw) * 1.4); } }
@container bj-board (max-width: 430px) { .bj-hands.is-split { --cw: 58px; } }
@container bj-board (max-width: 340px) { .bj-hands.is-split { --cw: 52px; } }
@container bj-board (max-width: 300px) { .bj-hands.is-split { --cw: 46px; } }
@container bj-board (max-width: 260px) { .bj-hands.is-split { --cw: 40px; } }

/* the low quality setting drops the cloth texture, the glows and the soft shadows */
:root[data-q="low"] .bj-table { background: none; }
:root[data-q="low"] .bj-felt { --bj-glow: 0 0 0 0 transparent; background: radial-gradient(ellipse at 50% 40%, #167349, #075638 68%, #06442f) padding-box, linear-gradient(180deg, #8b5d2d, #6c461f 42%, #543517) border-box; }
:root[data-q="low"] .bj-hand::after { display: none; }
:root[data-q="low"] .bj-card { --drop: 0 0 0 0 transparent; }
:root[data-q="low"] :root[data-q="low"] .bj-banner, :root[data-q="low"] .bj-badge, :root[data-q="low"] .bj-total, :root[data-q="low"] .bj-shoe::before, :root[data-q="low"] .bj-rack, :root[data-q="low"] .bj-hand.is-active, :root[data-q="low"] .bj-hand.is-active::before { box-shadow: none; }

/* the extra stake on Double and Split must fit on the narrowest tables (a bet of 100,000 or more is 8 characters) */
@container bj-board (max-width: 310px) { .bj-act small { font-size: 10px; letter-spacing: -.04em; } }
@container bj-board (max-width: 300px) { .bj-act small { font-size: 9.5px; letter-spacing: -.06em; } }
@container bj-board (max-width: 260px) { .bj-act b { font-size: 12.5px; } .bj-act small { font-size: 9px; letter-spacing: -.08em; } }

/* ---------- a phone on its side: the screen is wide and very low. The dealer sits on the left and the player on the right,
   so the table is half as high and the cards, the totals and the four buttons are in sight together ---------- */
@media (orientation: landscape) and (max-height: 500px) and (min-width: 560px) {
  .bj-table { padding: 6px; }
  .bj-felt { --cw: 58px; --bj-hand: 0px; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 4px 10px; align-items: center; padding: 8px 22px 6px; border-radius: 9% / 22%; }
  .bj-felt::after { inset: 6px; border-radius: 9% / 22%; }
  .bj-rack { display: none; }
  .bj-shoe { top: 18px; left: 38px; right: auto; width: calc(var(--cw) * .4); height: calc(var(--cw) * .4 * 1.4); }
  .bj-shoe::before { inset: -4px -4px -6px -6px; border-radius: 7px; }
  .bj-seat { grid-column: 1; grid-row: 1; --side: calc(var(--cw) * .8); gap: 4px; }
  .bj-seat > .bj-plate { margin-inline: 0; }
  .bj-mid { grid-column: 1; grid-row: 2; min-height: 34px; }
  .bj-mark { display: none; }
  .bj-hands { grid-column: 2; grid-row: 1 / span 2; }
  .bj-hands.is-split { --cw: 58px; --ch: calc(var(--cw) * 1.4); }
  .bj-hand { --pt: 10px; gap: 4px; padding-bottom: 4px; }
  .bj-actions { grid-column: 1 / -1; }
  .bj-actions { width: min(84% + 26px, 640px); gap: 6px; }
  .bj-act { min-height: 40px; padding-block: 4px; }
  .bj-banner { padding: 4px 14px; }
  .bj-banner b { font-size: 16px; }
  .bj-banner em { font-size: 13.5px; }
}

/* ---------- Deal sits on the table, in the row of the four moves: with no hand in play the row holds Deal alone,
   during a hand it holds Hit, Stand, Double and Split (one thing to press at a time, always in the same place) ---------- */
.bj-table:not(.is-play):not(.is-show) .bj-actions { visibility: visible; }
.bj-table:not(.is-play):not(.is-show) .bj-act { display: none; }
.bj-table:is(.is-play, .is-show) #bj-deal { display: none; }
.bj-actions #bj-deal { grid-column: 1 / -1; justify-self: center; width: min(100%, 320px); min-height: 52px; padding: 8px 22px; border-radius: 12px; font: 700 17px/1.15 var(--font-body); background: var(--g1, #22c27a); color: var(--g-ink, #06140d); box-shadow: 0 10px 22px -10px #000d, inset 0 -3px 0 #0000002e; touch-action: manipulation; }
.bj-actions #bj-deal:disabled { opacity: .55; cursor: progress; }
.view[data-view="blackjack"] #bj-deal:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (max-width: 699px) { .bj-actions #bj-deal { width: calc(100% - 28px); min-height: 48px; font-size: 16.5px; } }
