/* Structure of the table. No colours or fonts here except neutral fallbacks: the face sets those
   (--pk-* variables and the .pk-rail / .pk-cloth / .pk-back / .pk-chip-* looks). */
.pk-wrap { container-type: inline-size; width: 100%; }
.pk-table {
  --cw: 6.4cqw; --mycw: 8.6cqw;
  position: relative; width: 100%; aspect-ratio: 16 / 9.6; user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.pk-felt { position: absolute; inset: 9% 7.5% 11%; }
.pk-rail { position: absolute; inset: 0; border-radius: 999px; }
.pk-cloth { position: absolute; inset: 4.6% 3%; border-radius: 999px; overflow: hidden; }
.pk-line { position: absolute; inset: 13% 10%; border-radius: 999px; pointer-events: none; }
.pk-mark { position: absolute; left: 50%; top: 68%; transform: translate(-50%, -50%); pointer-events: none; }
.pk-deck { position: absolute; left: 50%; top: 27%; width: var(--cw); aspect-ratio: 5 / 7; transform: translate(-50%, -50%); }
.pk-center { position: absolute; left: 50%; top: 49%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 1.1cqw; width: 60%; }
.pk-board { display: flex; gap: .8cqw; }
.pk-slot { width: var(--cw); aspect-ratio: 5 / 7; border-radius: calc(var(--cw) * .1); }
.pk-pot { display: flex; align-items: center; gap: .8cqw; min-height: calc(var(--cw) * .9); }
.pk-pot[hidden] { display: flex; visibility: hidden; }
.pk-banner { text-align: center; min-height: 1.3em; max-width: 100%; }
.pk-banner[hidden] { display: block; visibility: hidden; }

/* cards */
.pk-card { position: relative; width: var(--cw); aspect-ratio: 5 / 7; perspective: 700px; flex: none; }
.pk-card-in { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.3, .7, .2, 1); transform: rotateY(180deg); }
.pk-card[data-up="1"] .pk-card-in { transform: rotateY(0deg); }
.pk-front, .pk-back { position: absolute; inset: 0; border-radius: calc(var(--cw) * .1); backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.pk-back { transform: rotateY(180deg); }
.pk-front { background: #fff; color: #111; }
.pk-front.pk-red { color: var(--pk-red, #c0262d); }
.pk-front svg { fill: currentColor; display: block; }
.pk-idx { position: absolute; left: 7%; top: 5%; display: flex; flex-direction: column; align-items: center; line-height: .9; font-size: calc(var(--cw) * .3); }
.pk-idx b { font-weight: 700; letter-spacing: -.04em; }
.pk-idx-suit { width: calc(var(--cw) * .2); height: calc(var(--cw) * .2); margin-top: .12em; }
.pk-idx-b { left: auto; top: auto; right: 7%; bottom: 5%; transform: rotate(180deg); }
.pk-pip { position: absolute; left: 50%; top: 54%; width: 46%; height: auto; aspect-ratio: 1; transform: translate(-50%, -50%); }
.pk-court { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); font-size: calc(var(--cw) * .62); line-height: 1; display: flex; flex-direction: column; align-items: center; }
.pk-court-suit { width: calc(var(--cw) * .26); height: calc(var(--cw) * .26); margin-top: .1em; }

/* seats */
.pk-seat { position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) * 1%); transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; z-index: 2; }
.pk-hole { display: flex; height: calc(var(--cw) * 1.4); margin-bottom: calc(var(--cw) * -.34); position: relative; z-index: 0; }
.pk-hole .pk-card:first-child { transform: rotate(-6deg) translateX(10%); }
.pk-hole .pk-card:last-child { transform: rotate(6deg) translateX(-10%); }
.pk-seat.is-me .pk-hole { height: calc(var(--mycw) * 1.4); }
.pk-seat.is-me .pk-card { width: var(--mycw); }
.pk-seat.is-folded .pk-hole { opacity: .35; filter: saturate(.3); }
.pk-plate { position: relative; z-index: 1; display: grid; justify-items: center; min-width: 15cqw; padding: .55cqw 1.4cqw .75cqw; }
.pk-who, .pk-stack, .pk-note { white-space: nowrap; max-width: 22cqw; overflow: hidden; text-overflow: ellipsis; }
.pk-note:empty { display: none; }
.pk-clock { position: absolute; left: 10%; right: 10%; bottom: 0; height: 3px; overflow: hidden; border-radius: 2px; }
.pk-clock i { display: block; height: 100%; transform-origin: left center; transform: scaleX(0); }
.pk-dealer { position: absolute; right: -2.4cqw; top: 44%; width: 2.6cqw; height: 2.6cqw; min-width: 18px; min-height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: max(9px, 1.25cqw); z-index: 3; }
.pk-dealer[hidden] { display: none; }

/* bets and chips */
.pk-bet { position: absolute; z-index: 1; left: calc((var(--x) + (50 - var(--x)) * .44) * 1%); top: calc((var(--y) + (49 - var(--y)) * .44) * 1%); transform: translate(-50%, -50%); display: flex; align-items: flex-end; gap: .6cqw; }
.pk-bet[hidden] { display: none; }
.pk-chips { position: relative; display: inline-block; width: calc(var(--cw) * .6); height: calc(var(--cw) * .6 * .62 + 7 * var(--cw) * .07); flex: none; }
.pk-chip { position: absolute; left: 0; bottom: calc(var(--i) * var(--cw) * .07); width: 100%; aspect-ratio: 1 / .62; border-radius: 50%; }
.pk-layer { position: absolute; inset: 0; pointer-events: none; z-index: 5; overflow: visible; }
.pk-ghost { position: absolute; transform: translate(-50%, -50%); margin: 0 !important; }
.pk-cta { position: absolute; left: 50%; top: 70%; transform: translate(-50%, -50%); z-index: 4; }
.pk-cta:empty { display: none; }

/* seat positions, wide table */
.pk-table[data-n="2"] [data-pos="0"] { --x: 50; --y: 85; }
.pk-table[data-n="2"] [data-pos="1"] { --x: 50; --y: 13; }
.pk-table[data-n="6"] [data-pos="0"] { --x: 50; --y: 86; }
.pk-table[data-n="6"] [data-pos="1"] { --x: 13; --y: 70; }
.pk-table[data-n="6"] [data-pos="2"] { --x: 13; --y: 29; }
.pk-table[data-n="6"] [data-pos="3"] { --x: 50; --y: 11; }
.pk-table[data-n="6"] [data-pos="4"] { --x: 87; --y: 29; }
.pk-table[data-n="6"] [data-pos="5"] { --x: 87; --y: 70; }

/* phones: the table stands upright */
@container (max-width: 620px) {
  .pk-table { aspect-ratio: 10 / 13.2; --cw: 10.4cqw; --mycw: 14cqw; }
  .pk-felt { inset: 9% 9% 10%; }
  .pk-cloth { inset: 3.4% 4.6%; }
  .pk-line { inset: 10% 13%; }
  .pk-deck { top: 30%; }
  .pk-center { width: 78%; }
  .pk-board { gap: 1.2cqw; }
  .pk-plate { min-width: 23cqw; padding: 1cqw 2cqw 1.3cqw; }
  .pk-who, .pk-stack, .pk-note { max-width: 30cqw; }
  .pk-dealer { right: -3.6cqw; width: 4.6cqw; height: 4.6cqw; font-size: 2.6cqw; }
  .pk-table[data-n="2"] [data-pos="0"] { --x: 50; --y: 86; }
  .pk-table[data-n="2"] [data-pos="1"] { --x: 50; --y: 12; }
  .pk-table[data-n="6"] [data-pos="0"] { --x: 50; --y: 87; }
  .pk-table[data-n="6"] [data-pos="1"] { --x: 15; --y: 67; }
  .pk-table[data-n="6"] [data-pos="2"] { --x: 15; --y: 32; }
  .pk-table[data-n="6"] [data-pos="3"] { --x: 50; --y: 11; }
  .pk-table[data-n="6"] [data-pos="4"] { --x: 85; --y: 32; }
  .pk-table[data-n="6"] [data-pos="5"] { --x: 85; --y: 67; }
  .pk-table[data-n="6"] .pk-seat:not(.is-me) .pk-card { width: calc(var(--cw) * .82); }
  .pk-table[data-n="6"] .pk-seat:not(.is-me) .pk-hole { height: calc(var(--cw) * 1.2); }
}

@media (prefers-reduced-motion: reduce) {
  .pk-card-in { transition: none; }
}
