/* Blackjack. Page classes use the bj- prefix; shared table pieces come from /demos/_tables/table.css (tb-)
   and cards from /demos/_tables/cards.css (pc-). */
.bj-screen { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.bj-main { min-width: 0; display: flex; flex-direction: column; gap: 12px; }

/* ---------- the table ---------- */
.bj-table { height: 610px; }
.bj-table > .tb-felt { --cw: 70px; }
.bj-print { position: absolute; inset: 0; z-index: 0; }
.bj-print .tb-arc { left: 0; top: 0; width: 100%; height: 100%; }
.bj-print .tb-print.big { font-size: 20px; letter-spacing: .2em; }
.bj-print .tb-print.sub { font-size: 11px; letter-spacing: .26em; }
.bj-tray { position: absolute; z-index: 2; left: 50%; top: 0; transform: translateX(-50%); }
.bj-discard { position: absolute; z-index: 2; left: 9%; top: 16px; }
.bj-shoe { position: absolute; z-index: 3; right: 8.5%; top: 14px; }
.bj-shoe .tb-shoe-top { position: absolute; left: 18px; top: -4px; --cw: 38px; transform: rotate(-14deg); }
.bj-shoe .tb-shoe-top .pc { --cw: 38px; }
.bj-discard .tb-discard-tray .pc { position: absolute; left: 9px; top: 7px; --cw: 40px; }

/* dealer */
.bj-dealer { position: absolute; z-index: 4; left: 50%; top: 72px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; }
.bj-dcards { justify-content: center; min-width: calc(var(--cw) * 1.4); }
.bj-dcards:empty::before { content: ''; width: var(--cw); height: calc(var(--cw) * 1.4); border-radius: calc(var(--cw) * .085); border: 1.5px dashed rgba(255,255,255,.12); }
.bj-dmeta { position: absolute; left: calc(100% + 14px); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.bj-peek { position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 4px 10px; border-radius: 999px; background: rgba(6,10,8,.75); border: 1px solid rgba(255,255,255,.14); font: 600 10.5px 'IBM Plex Mono', monospace; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.75); animation: tbpop .35s cubic-bezier(.2,.9,.3,1.3); }
.bj-peek.bad { background: var(--tb-lose); border-color: var(--tb-lose); color: #fff; }
.bj-peek.ok { color: var(--tb-win); border-color: rgba(53,227,154,.45); }
.pc.bj-peeking .pc-in { transform: rotateY(180deg) rotateX(-22deg) translateY(-3px); transition: transform .3s; }

/* seats: one betting spot each, hands above it */
.bj-seats { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.bj-seat { position: absolute; left: var(--x); top: var(--y); width: 0; height: 0; }
.bj-seat[data-s="0"] { --x: 83%; --y: 62%; }
.bj-seat[data-s="1"] { --x: 50%; --y: 82%; }
.bj-seat[data-s="2"] { --x: 17%; --y: 62%; }
.bj-seat > * { pointer-events: auto; }
.bj-seat .tb-spot { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); --spot: 84px; }
.bj-seat .tb-spot.locked { pointer-events: none; }
.bj-seat.off .tb-spot { opacity: .22; pointer-events: none; border-style: dashed; }
.bj-seat-n { position: absolute; left: 0; top: 52px; transform: translateX(-50%); font: 700 10px 'IBM Plex Mono', monospace; letter-spacing: .2em; color: var(--tb-ink-dim); pointer-events: none; white-space: nowrap; }
.bj-seat.off .bj-seat-n { opacity: .35; }
.bj-xstake { position: absolute; left: 50px; top: -8px; transform: translateY(-50%); --chip: 38px; }
.bj-xstake.empty { display: none; }
.bj-hands { position: absolute; left: 0; bottom: 54px; transform: translateX(-50%); display: flex; align-items: flex-end; gap: 16px; pointer-events: none; }
.bj-seat.split .bj-hands { --cw: 58px; gap: 22px; }
.bj-hand { position: relative; display: flex; flex-direction: column; align-items: center; transition: opacity .25s, transform .3s; }
.bj-hand .tb-cards { min-height: calc(var(--cw) * 1.4); }
.bj-hand .tb-total { position: absolute; z-index: 30; top: -13px; right: -16px; }
.bj-hand::before { content: ''; position: absolute; inset: -7px -9px; border-radius: 12px; opacity: 0; transition: opacity .25s; box-shadow: 0 0 0 2px var(--you), 0 0 26px 2px rgba(255,178,30,.42); background: rgba(255,178,30,.06); }
.bj-hand.active::before { opacity: 1; }
.bj-seats.playing .bj-hand:not(.active):not(.final) { opacity: .62; }
.bj-tag { position: absolute; z-index: 31; left: 50%; bottom: 10px; transform: translateX(-50%); white-space: nowrap; padding: 5px 11px; border-radius: 9px; font: 800 12.5px/1.1 Inter, sans-serif; letter-spacing: .01em;
  background: rgba(8,10,12,.92); color: #fff; border: 1px solid rgba(255,255,255,.18); box-shadow: 0 10px 24px -8px rgba(0,0,0,.7); animation: tbpop .4s cubic-bezier(.2,.9,.3,1.35); }
.bj-tag small { display: block; font: 700 11px 'IBM Plex Mono', monospace; text-align: center; margin-top: 2px; }
.bj-tag.win { background: var(--tb-win); color: #05261a; border-color: var(--tb-win); }
.bj-tag.bj { background: var(--you); color: var(--you-ink); border-color: var(--you); }
.bj-tag.push { background: #e6e9ef; color: #15171c; border-color: #e6e9ef; }
.bj-tag.bust, .bj-tag.lost { background: rgba(30,8,12,.92); color: #ffb3bd; border-color: rgba(255,90,110,.6); }
.pc.bj-dbl { margin-left: calc(var(--cw) * -.28) !important; transform: rotate(90deg) translateX(8%); z-index: 1; }

/* the result banner sits over the printed lettering */
.bj-table .tb-result { top: 47%; z-index: 40; }

/* ---------- rail under the table ---------- */
.bj-rail { min-height: 80px; display: flex; align-items: center; padding: 12px 16px; border-radius: 16px;
  background: linear-gradient(180deg, #1a1612, #100d0a); border: 1px solid #2c241b; box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 14px 30px -18px rgba(0,0,0,.8); }
.bj-bet, .bj-play { display: flex; align-items: center; gap: 14px; width: 100%; min-width: 0; }
.bj-bet[hidden], .bj-play[hidden] { display: none; }
.bj-betctl { display: flex; gap: 6px; flex-wrap: wrap; }
.bj-betinfo { margin-left: auto; text-align: right; min-width: 92px; }
.bj-betinfo small { display: block; font-size: 11px; color: var(--s-dim); white-space: nowrap; }
.bj-betinfo b { font-size: 20px; font-weight: 700; }
.bj-deal { min-width: 170px; }
.bj-acts { display: flex; gap: 10px; flex-wrap: wrap; }
.bj-acts .tb-act[hidden] { display: none; }
.bj-turn { margin-left: auto; text-align: right; font-size: 12.5px; color: var(--s-dim); line-height: 1.4; min-width: 0; }
.bj-turn b { display: block; color: var(--s-text); font-size: 14px; font-weight: 700; }

/* ---------- side column ---------- */
.bj-side { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.bj-side .tb-paycard { padding: 10px 14px; }
.bj-side .tb-pay { padding: 4px 8px; font-size: 12.5px; }
.bj-side .tb-pay b { font-size: 12.5px; }
.bj-pay-note span, .bj-pay-note b { color: var(--s-faint) !important; }
#edgeTag { cursor: pointer; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.bj-hint { background: var(--s-panel); border: 1px solid var(--s-line); border-radius: 12px; padding: 10px 14px; }
.bj-hint-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.bj-hint-h .s-seg button { padding: 4px 10px; font-size: 12px; }
.bj-hint-b { margin-top: 6px; height: 68px; overflow: hidden; }
.bj-hint-off { font-size: 12px; line-height: 1.45; color: var(--s-dim); }
.bj-hint-play { display: flex; align-items: baseline; gap: 10px; }
.bj-hint-play b { font-size: 20px; font-weight: 900; letter-spacing: -.02em; color: #7fd6ff; }
.bj-hint-play span { font-size: 12px; color: var(--s-dim); }
.bj-evs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-top: 6px; }
.bj-evs div { padding: 4px 6px; border-radius: 7px; background: var(--s-bg); border: 1px solid var(--s-line); }
.bj-evs div.best { border-color: rgba(127,214,255,.6); }
.bj-evs small { display: block; font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--s-dim); }
.bj-evs b { font: 600 11.5px 'IBM Plex Mono', monospace; }
.bj-hint-note { margin-top: 4px; font-size: 10.5px; color: var(--s-faint); }
.tb-act.hint { box-shadow: 0 4px 0 rgba(0,0,0,.45), 0 0 0 2px var(--s-bg), 0 0 0 4px #7fd6ff; }
.bj-side .tb-fair { gap: 7px; padding: 10px 14px; }
.bj-fair-x { margin-left: auto; height: 26px; padding: 0 9px; font-size: 11.5px; }
.bj-side .tb-fair-h { gap: 8px; }
.bj-side .tb-fair-n { order: -1; margin-left: 4px; }
.bj-side .tb-fair-h .s-label { order: -2; }
.bj-hist-w { background: var(--s-panel); border: 1px solid var(--s-line); border-radius: 12px; padding: 10px 14px 6px; }
.bj-hist-w .tb-hist { min-height: 87px; }
.bj-hist-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.bj-hist-n { font-size: 11px; color: var(--s-dim); }
.bj-hist-w .tb-hist-row { padding: 5px 0; }

/* operator drawer extras */
.bj-fixed { margin-top: 14px; }
.bj-fixed h4 { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--s-dim); margin-bottom: 6px; }
.bj-fixed li { list-style: none; position: relative; padding: 4px 0 4px 14px; font-size: 12.5px; color: var(--s-text); line-height: 1.4; }
.bj-fixed li::before { content: ''; position: absolute; left: 0; top: 11px; width: 5px; height: 5px; border-radius: 1px; background: var(--you); }
.bj-drawer-foot { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.bj-lock { margin-top: 10px; font-size: 12px; color: var(--you); }

/* embed and TV wall: let the table fill the screen */
body.dk-embed .bj-table, .dk-stage:fullscreen .bj-table { height: max(520px, calc(100vh - 56px - 36px - 42px - 92px - 12px)); }

/* feed */
#feed .pc-tag { margin: 0 2px; }

@media (max-width: 1240px) {
  .bj-screen { grid-template-columns: minmax(0, 1fr) 272px; }
  .bj-table { height: 560px; }
  .bj-table > .tb-felt { --cw: 64px; }
  .bj-deal { min-width: 140px; }
}
@media (max-width: 1060px) {
  .bj-screen { grid-template-columns: minmax(0, 1fr); }
  .bj-hint-b { height: auto; min-height: 60px; }
  .bj-side { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
}
@media (max-width: 760px) {
  .bj-bet { flex-wrap: wrap; }
  .bj-betinfo { margin-left: 0; text-align: left; }
  .bj-deal { flex: 1; }
  .bj-play { flex-wrap: wrap; }
  .bj-turn { margin-left: 0; text-align: left; flex-basis: 100%; }
}
@media (max-width: 640px) {
  .dk-screen.bj-screen { padding: 10px; }
  .bj-table { height: 450px; --rail: 16px; }
  .bj-table > .tb-felt { --cw: 44px; }
  .bj-print .tb-print.big { font-size: 12.5px; letter-spacing: .12em; }
  .bj-print .tb-print.sub { font-size: 7px; letter-spacing: .16em; }
  .bj-tray { transform: translateX(-50%) scale(.6); transform-origin: 50% 0; }
  .bj-discard { left: 7%; top: 8px; transform: scale(.66); transform-origin: 0 0; }
  .bj-shoe { right: 6%; top: 8px; transform: scale(.66); transform-origin: 100% 0; }
  .bj-dealer { top: 48px; }
  .bj-dmeta { left: calc(100% + 8px); }
  .bj-dmeta .tb-who { display: none; }
  .bj-seat[data-s="0"] { --x: 79%; --y: 60%; }
  .bj-seat[data-s="2"] { --x: 21%; --y: 60%; }
  .bj-seat .tb-spot { --spot: 54px; }
  .bj-seat .tb-spot .tb-spot-l { font-size: 8px; letter-spacing: .1em; }
  .bj-seat .tb-stack { --chip: 32px; --ct: 3px; }
  .bj-seat-n { top: 34px; font-size: 9px; }
  .bj-hands { bottom: 36px; gap: 8px; }
  .bj-seat.split .bj-hands { --cw: 36px; gap: 10px; }
  .bj-xstake { left: 34px; --chip: 28px; }
  .bj-hand .tb-total { top: -11px; right: -10px; height: 22px; min-width: 30px; padding: 0 7px; font-size: 11.5px; }
  .bj-tag { font-size: 11px; padding: 4px 8px; bottom: 4px; }
  .bj-rail { padding: 10px; }
  .bj-bet { gap: 10px; }
  .bj-betctl { width: 100%; }
  .bj-betctl .tb-mini { flex: 1; justify-content: center; }
  .bj-acts { width: 100%; gap: 8px; }
  .bj-acts .tb-act { flex: 1 1 40%; }
  .bj-side { grid-template-columns: 1fr; }
  .bj-table .tb-result { min-width: 200px; padding: 10px 16px 12px; }
  .bj-table .tb-result b { font-size: 20px; }
}
