/* The table is the surface. Readouts belong to their seat, not to panels. */
body[data-screen="game"]::before {
  background-position: 58% 46%; background-size: cover;
  filter: saturate(.74) brightness(.79);
}
body[data-screen="game"]::after {
  background: linear-gradient(180deg,#1218114a 0%,#13191438 35%,#1117118c 68%,#101510f0 100%);
}
.game {
  --linen: #f5efe1; --light-ink: #d5d6c4; --cool-ink: #c2ccbe;
  --card-width: clamp(37px,11vw,56px); --own-card-width: clamp(42px,12vw,57px);
  --seat-card-width: clamp(20px,5.5vw,29px);
  --surface-width: 560px; --rack-width: 520px;
  width: 100%; max-width: 1440px; grid-template-columns: minmax(0,1fr);
  padding: 8px clamp(10px,3vw,30px) max(16px,env(safe-area-inset-bottom));
  align-content: center; color: var(--linen); font-variant-numeric: tabular-nums;
}
.game .table-meta {
  width: min(calc(100% - 8px),var(--surface-width)); min-height: 22px;
  margin: 0 0 12px; gap: 4px 12px; color: var(--light-ink);
  font: 500 11px/1.4 var(--sans); letter-spacing: -.01em;
  text-shadow: 0 1px 4px #10130e;
}
.game .table-meta-left { flex-wrap: wrap; gap: 4px 12px; }
.game .table-meta :is(.table-tag,.room-tag,.meta-blinds,.meta-count,.room-code,.meta-pill,.admission-tag) {
  padding: 0; border: 0; border-radius: 0; background: none; color: inherit; font-weight: 500;
}
.game .table-meta .eyebrow { color: var(--linen); font-size: 11px; letter-spacing: .01em; }
.game .table-meta .eyebrow::before { content: none; }

.game .table {
  --rail: clamp(9px,2.5vw,15px); --curve: 47% / 27%;
  --upper-x: 22%; --upper-y: 24%; --lower-x: 18.5%; --lower-y: 68%;
  --top-y: 12%; --bottom-y: 84.75%; --board-y: 47.25%;
  width: min(100%,var(--surface-width)); max-width: none;
  height: clamp(470px,64svh,582px); border-radius: var(--curve);
  border: 1px solid #78614b;
  background: var(--wood-grain) center / 540px 220px, linear-gradient(158deg,#695140,#493428 41%,#4c382b 72%,#38281f);
  background-blend-mode: soft-light,normal;
  box-shadow: inset 0 1px 1px #d0a47e42,inset 0 -2px 2px #1c151276,0 4px 0 #291f18,0 12px 18px #0a0e0a80,0 23px 45px #080c084f;
}
.game .table::before {
  inset: var(--rail); border: 1px solid #19281f; border-radius: inherit;
  background: var(--felt-grain) center / 118px 118px,radial-gradient(ellipse at 43% 37%,#354e40,#293e32 68%,#213327);
  background-blend-mode: soft-light,normal;
  box-shadow: 0 -1px 3px #17140f94,0 1px 1px #aa82633d,inset 0 2px 8px #111e1563;
}
.game .table::after, .game .felt-shine { display: none; }

/* The five public cards occupy a clear, uninterrupted band across the felt. */
.game .board, .game .board:has(.pot) {
  inset: var(--board-y) auto auto 50%; width: max-content; max-width: 86%;
  gap: 4px; z-index: 1; transform: translate(-50%,-50%);
}
.game .board .board-label, .game .board:has(.pot) .board-label {
  margin: 0; min-width: 0; min-height: 0; padding: 0; border: 0;
  background: none; box-shadow: none; text-shadow: none; color: #c6d0c2;
  font: 600 clamp(10px,2.7vw,12px)/1.3 var(--sans); letter-spacing: .06em;
}
.game .pot {
  min-width: 0; margin: 0 0 5px; padding: 0; gap: .42em; border: 0;
  background: none; box-shadow: none; color: #d0d6c9;
  font: 560 clamp(12px,3.2vw,15px)/1.15 var(--sans); letter-spacing: -.01em;
}
.game .pot :is(strong,b,.pot-amount) { color: #fbf4e5; font: 600 clamp(22px,5.6vw,27px)/1 Georgia,serif; letter-spacing: -.045em; }
.game .board-cards { gap: clamp(4px,1.15vw,7px); }
.game .card {
  background: linear-gradient(140deg,#fcf9ed,#f0e9d9); color: #252b25;
  padding: calc(var(--w) * .086); border: 1px solid #dfd6c3;
  border-radius: max(3px,calc(var(--w)*.067));
  box-shadow: inset 0 1px 0 #fffdf7,0 1px 0 #c6bdab,0 3px 5px #10180f66;
  text-shadow: none; font-family: Georgia,"Times New Roman",serif; font-weight: 700;
}
.game .card.red { color: #aa3e39; }
.game .card .rank { font-size: calc(var(--w)*.33); letter-spacing: -.07em; }
.game .card .suit { font-size: calc(var(--w)*.235); }
.game .card .card-mark { inset: auto 9% 7% auto; font-size: calc(var(--w)*.55); transform: none; }
.game .card.empty { background: #2037293d; border: 1px solid #b7c9ad38; box-shadow: inset 0 1px 3px #19271a26; }
.game .card.empty::before { content: none; }
.game .card.back {
  padding: 0; border: 1.5px solid #d9cbb1; color: transparent;
  background: #523b36 url('/ridge.svg') center / 83% auto no-repeat;
  box-shadow: inset 0 0 0 1px #8c756457,0 2px 3px #14201680;
}
.game .card:is(.back,.empty) > * { visibility: hidden; }
.game .card.best-five:not(.back):not(.empty) { translate: 0 -3px; box-shadow: 0 1px 0 #ddd2bb,0 5px 7px #1120167a; }
.game .card.not-best:not(.back):not(.empty) { filter: saturate(.7) brightness(.83); }

/* Position is a visual slot; the real seat index still belongs to the player. */
.game .seat {
  --rack: clamp(77px,23vw,126px); --bank-w: clamp(32px,9.5vw,42px);
  width: var(--rack); max-width: none; min-width: 0; padding: 0;
  display: grid; grid-template-columns: minmax(0,1fr); grid-auto-flow: row;
  align-items: center; justify-items: center; gap: 3px 0;
  top: var(--seat-y); left: var(--seat-x); transform: translate(-50%,-50%);
  line-height: 1.22; text-shadow: 0 1px 3px #1720186b; color: var(--linen);
}
.game .seat.pos0 { --seat-x: 50%; --seat-y: var(--bottom-y); --rack: clamp(122px,34vw,180px); }
.game .seat.pos1 { --seat-x: var(--lower-x); --seat-y: var(--lower-y); }
.game .seat.pos2 { --seat-x: var(--upper-x); --seat-y: var(--upper-y); }
.game .seat.pos3 { --seat-x: 50%; --seat-y: var(--top-y); }
.game .seat.pos4 { --seat-x: calc(100% - var(--upper-x)); --seat-y: var(--upper-y); }
.game .seat.pos5 { --seat-x: calc(100% - var(--lower-x)); --seat-y: var(--lower-y); }
.game .table:not(:has(.pos3,.pos1,.pos5)) { --upper-x: 28%; --upper-y: 21%; }
.game .table:not(:has(.pos1,.pos2,.pos4,.pos5)) { --top-y: 17.5%; }
.game .seat .pocket, .game .seat.own .pocket {
  grid-area: 1 / 1; justify-self: center; gap: 0; margin: 0 0 2px;
  position: relative; width: max-content; max-width: 100%;
}
.game .pocket .card:nth-child(1):not(.empty) { transform: rotate(-7deg); }
.game .pocket .card:nth-child(2):not(.empty) { transform: rotate(5deg); }
.game .pocket .card + .card { margin-left: calc(var(--seat-card-width)*-.32); }
.game .own .pocket .card + .card { margin-left: calc(var(--own-card-width)*-.17); }
.game .seat .seat-identity {
  grid-area: 2 / 1; display: grid; grid-template-columns: auto minmax(0,auto);
  align-items: center; justify-items: center; justify-content: center;
  max-width: 100%; width: max-content; gap: 1px 3px; text-align: center;
}
.game .player-name { grid-area: 1 / 2; color: var(--linen); font-size: clamp(12px,3.1vw,15px); font-weight: 680; line-height: 1.25; letter-spacing: -.035em; }
.game .seat-identity:not(:has(.dealer-mark)) .player-name { grid-column: 1/-1; }
.game .dealer-mark {
  grid-area: 1/1; display: inline-block; width: 1.05em; height: 1.05em;
  overflow: hidden; border: 1px solid #dad1b2; border-radius: 50%;
  font-size: 13px; text-indent: -200%; white-space: nowrap; color: transparent;
  background: #665747 url('/ridge.svg') center / 87% auto no-repeat;
}
.game .stack { grid-area: 2/1/3/-1; gap: 0; color: #d3d9cd; font: 550 clamp(11px,2.9vw,14px)/1.25 var(--sans); letter-spacing: .015em; }
.game .stack::before, .game .wager::before { content: none; }
.game .seat .bank-stack {
  position: absolute; grid-area: auto; left: calc(50% + var(--seat-card-width)*.94 + 3px);
  top: calc(var(--seat-card-width)*1.28); bottom: auto; transform: translateY(-100%); width: var(--bank-w); max-width: var(--bank-w); line-height: 0;
  pointer-events: none;
}
.game .seat.own .bank-stack { --bank-w: clamp(46px,13vw,58px); left: calc(50% + var(--own-card-width)*1.02 + 4px); top: calc(var(--own-card-width)*1.25); }
.game .seat:is(.pos4,.pos5) .bank-stack { left: auto; right: calc(50% + var(--seat-card-width)*.94 + 3px); }
.game .seat:has(.pocket:empty) .bank-stack { grid-area: auto; position: static; grid-row: 1; transform: none; }
.game .seat .bank-stack .chip-stack { width: min(var(--bank-w),var(--single)); }
.game .seat .bank-stack .chip-cols-2 { width: min(var(--bank-w),var(--double)); }
.game .seat .bank-stack .chip-cols-3 { width: var(--bank-w); }
.game .bank-stack :is(img,svg) { max-width: 100%; height: auto; }
.game .acting-flag { grid-column: 1/-1; color: #e9c8a1; font: 600 10px/1.2 var(--sans); letter-spacing: .02em; }
.game .seat.acting .player-name { text-decoration: underline; text-decoration-color: #d7b998; text-underline-offset: 3px; }
.game .seat.folded .pocket { opacity: .48; }
.game .seat.folded .player-name { color: #c1cabe; }
.game .last-action, .game .hand-caption { grid-column: 1/-1; grid-row: auto; margin: 0; font: 500 10px/1.24 var(--sans); color: #d0d7c9; text-shadow: none; }
.game .own .hand-caption { width: max-content; max-width: 145%; color: #efdec0; font-size: clamp(11px,3vw,14px); font-weight: 600; }
.game .seat.own .last-action { margin: 0; }
.game .seat.vacant { width: auto; background: none; box-shadow: none; border: 0; color: #c6cebc; opacity: .67; font-size: 11px; }
.game .vacant .avatar { display: none; }

/* Commitments point toward the pot, separate from chips a player owns. */
.game .seat:is(.pos0,.pos1,.pos2,.pos3,.pos4,.pos5) .wager {
  --bet-x: 50%; --bet-y: calc(100% + 6px); --bet-pull: -50%;
  position: absolute; top: var(--bet-y); left: var(--bet-x); right: auto; bottom: auto;
  margin: 0; padding: 0; transform: translateX(var(--bet-pull)); display: flex; align-items: center;
  gap: 3px; border: 0; background: none; border-radius: 0; box-shadow: none;
  color: #f5e6c9; font: 650 clamp(10px,2.7vw,13px)/1.15 var(--sans); white-space: nowrap;
}
.game .seat:is(.pos1,.pos2) .wager { --bet-x: calc(100% + 7px); --bet-y: 75%; --bet-pull: 0%; }
.game .seat:is(.pos4,.pos5) .wager { --bet-x: -7px; --bet-y: 75%; --bet-pull: -100%; flex-direction: row-reverse; }
.game .seat.pos0 .wager { --bet-y: -24px; }
/* A one-pixel destination lets a sweep or payout start from an empty ledger. */
.game .seat .wager:empty, .game .seat .bank-stack:empty { display: block; width: 1px; height: 1px; visibility: hidden; }
.game .seat .wager :is(img,svg) { width: clamp(16px,4.5vw,24px); height: auto; }

/* The payout stays on the felt. Only the optional ledger opens a paper sheet. */
.game .table-outcome {
  width: 100%; max-width: 100%; overflow: visible;
  padding: 4px 2px 2px; color: #ebe8d8; font: 560 12px/1.4 var(--sans);
  text-align: center; overflow-wrap: anywhere; text-shadow: none;
}
.game .board:has(.hu-pots[open]) { z-index: 5; }
.game .table-outcome :is(h2,h3,strong) { color: #fff2d5; font-size: 1.03em; font-weight: 670; }
.game .table-outcome :is(small,summary) { color: var(--cool-ink); font-size: .91em; }
.game .table-outcome summary { cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.game .table:has(.table-outcome:not(:empty)) { --board-y: 47.6%; --lower-y: 72%; }

.game .hand-caption .hu-hand, .game .table-outcome .hu-result, .game .show-below .hu-reveal {
  display: block; margin: 0; padding: 0; color: inherit; font: inherit; border: 0; border-radius: 0; background: none; box-shadow: none; text-align: center; animation: none;
}
.game .hand-caption .hu-hand-detail { color: var(--cool-ink); font: inherit; }
.game .table-outcome .hu-recipient { justify-content: center; }
.game .table-outcome .hu-award { display: block; color: var(--light-ink); }
.game .table-outcome .hu-pots { margin: 1px auto 0; border: none; }
.game .table-outcome .hu-pots > summary { margin: 0 auto; }
.game .pot:empty { width: 1px; height: 1px; margin: 0; }
.game .table[data-phase="lobby"] .board .board-label { font: 650 clamp(20px,4vw,30px)/1.3 var(--serif); letter-spacing: -.055em; color: var(--linen); }
.game .table .pot { align-items: center; }
.game .controls {
  width: min(100%,var(--rack-width)); padding: 0 4px; gap: 9px; margin-top: 24px;
  color: var(--linen); text-align: center;
}
.game .decision-heading, .game .turn-copy {
  display: flex; align-items: baseline; justify-content: center; flex-wrap: wrap;
  gap: 4px 10px; margin: 0; padding: 0; border: 0; background: none;
  font: 680 clamp(17px,4.5vw,22px)/1.3 var(--serif); letter-spacing: -.055em;
  color: var(--linen); text-shadow: 0 1px 7px #12180f;
}
.game .decision-heading :is(h2,h3,p,strong) { margin: 0; font: inherit; }
.game #clock {
  min-width: 0; padding: 0; border: 0; border-radius: 0; background: none;
  color: #c7c9b7; font: 550 12px/1.25 var(--sans); letter-spacing: 0; vertical-align: baseline;
}
.game #clock.urgent { color: #f4bab0; }
.game .action-row { justify-content: center; gap: 6px; }
.game .controls .btn {
  min-width: 0; min-height: 44px; border: 1px solid #b9b9a45e; border-radius: 5px;
  background: #252c24; box-shadow: none; color: #eeeadd;
  font: 650 14px/1.3 var(--sans); letter-spacing: -.025em;
}
.game .action-row > .btn { min-height: 47px; padding: 8px 4px; flex: 1 1 0; font-size: clamp(14px,3.6vw,17px); white-space: normal; }
.game .action-row > .btn:only-child { flex: 0 1 280px; }
.game .controls .btn.primary { border-color: #e5ddc7; background: #e5ddc7; color: #273025; }
.game .controls .btn:not(:disabled):not([aria-disabled="true"]):hover { color: #fff6e4; border-color: #c4c3ad; background: #384137; box-shadow: none; }
.game .controls .btn.primary:not(:disabled):not([aria-disabled="true"]):hover { color: #20281f; background: #f2ecd9; border-color: #f2ecd9; }
.game .controls .btn.quiet { background: none; color: var(--light-ink); border-color: transparent; font-weight: 500; }
.game .controls .btn:disabled { opacity: .64; }
.game .table-note { color: #c3c9b9; font-size: 11px; font-weight: 450; }
.game .raise-panel, .game .show-below { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px 8px; width: 100%; margin: 0; padding: 6px 0; border: 0; border-radius: 0; color: var(--light-ink); background: none; font: 550 12px/1.5 var(--sans); }
.game .raise-panel input[type="number"] { width: 80px; min-height: 44px; border-color: #c7c9b785; background: #1c261c; }
.game .raise-panel input[type="range"] { accent-color: #d4d4b8; }
.game .show-below > :is(p,small,strong) { margin: 0; }
.game .show-below:empty, .game .table-outcome:empty, .game .decision-heading:empty { display: none; }

@media (min-width: 660px) {
  .game {
    --surface-width: 1150px; --rack-width: 510px;
    --card-width: clamp(43px,5.3vw,69px); --own-card-width: clamp(47px,5vw,67px);
    --seat-card-width: clamp(23px,2.5vw,34px);
    padding: 10px clamp(30px,6.5vw,100px) 22px;
  }
  .game .table { --rail: clamp(13px,1.5vw,20px); --curve: 49% / 48%; --upper-x: 23%; --upper-y: 23%; --lower-x: 16.5%; --lower-y: 68%; --top-y: 11%; --bottom-y: 83.5%; height: clamp(425px,59svh,568px); }
  .game .table-meta { margin-bottom: 16px; font-size: 12px; }
  .game .seat { --rack: clamp(90px,13vw,150px); --bank-w: 44px; }
  .game .seat.pos0 { --rack: clamp(158px,19vw,204px); }
  .game .board, .game .board:has(.pot) { gap: 7px; }
  .game .pot { margin-bottom: 4px; }
  .game .seat.pos0 .wager { --bet-x: calc(50% - var(--own-card-width)*1.22); --bet-y: 40%; --bet-pull: -100%; }
  .game .seat .seat-identity { column-gap: 5px; }
  .game .controls { gap: 10px; margin-top: 26px; }
  .game .action-row { gap: 8px; }
  .game .table-outcome { font-size: 13px; }
}
@media (max-width: 659px) {
  .game .seat:is(.pos1,.pos2,.pos4,.pos5) .wager { --bet-x: 50%; --bet-y: calc(100% + 4px); --bet-pull: -50%; flex-direction: row; }
  .game .seat .wager :is(svg,img) { width: auto; max-width: 30px; max-height: 18px; }
}
@media (max-width: 350px) {
  .game .table { --lower-y: 68%; --bottom-y: 85.5%; }
  .game .seat.pos1 .wager { --bet-x: 30%; }
  .game .seat.pos5 .wager { --bet-x: 70%; }
}
@media (max-width: 659px) and (max-height: 715px) {
  .game .table { height: 470px; }
  .game .controls { margin-top: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  .game .card, .game .seat, .game .wager, .game .table-outcome { animation: none; transition: none; }
}
