.table-area { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 12px; min-height: 0; }

.felt {
  position: relative;
  background: radial-gradient(120% 120% at 50% 0%, var(--felt) 0%, var(--felt2) 70%);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;

  min-height: clamp(360px, 54vh, 600px);
  display: grid;
  gap: 14px;
  align-content: start;

  min-width: 0;
  overflow-y: auto;
}

.yamaline { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; }
.turnbadge { width: max-content; z-index: 5; }
.badge {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--dim);
  background: rgba(0, 0, 0, .35);
}


.center { display: grid; gap: 12px; justify-items: stretch; width: 100%; margin: 0 auto; }

.field { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-start; min-height: 74px; max-width: 100%; }

.field { perspective: 900px; }


#felt.deal-clip { overflow: visible; }
.seat.deal-clip { overflow: visible; }
.yama { display: flex; gap: 6px; align-items: center; color: var(--dim); font-size: 12px; }


.yama-pile { position: relative; display: flex; align-items: center; opacity: 0; transform: translateY(6px); }
.yama-pile.in { opacity: 1; transform: none; transition: opacity .18s ease, transform .18s ease; }

.yama-pile .ycards { --step: 3px; --shift: calc(var(--step) * 5); position: relative; width: calc(48px + var(--shift)); height: 74px; margin-right: var(--shift); }
.yama-pile .ycards .hfcard {
  --px: 0px; --py: 0px; --rz: 0deg;
  position: absolute; left: 0; top: 0;
  z-index: var(--zi, 1);
  box-shadow: -2px 3px 5px rgba(0, 0, 0, .4);
  transform: translate(var(--px), var(--py)) rotate(var(--rz));
}
.yama-pile .ycards .hfcard.in { transform: translate(var(--px), var(--py)) rotate(var(--rz)); }

.yama-pile .ycards .hfcard:nth-child(2)  { --px: var(--step);           --py: calc(var(--step) * -.5);  --rz: -.6deg; --zi: 2; }
.yama-pile .ycards .hfcard:nth-child(3)  { --px: calc(var(--step) * 2); --py: calc(var(--step) * -1);   --rz: .5deg;  --zi: 3; }
.yama-pile .ycards .hfcard:nth-child(4)  { --px: calc(var(--step) * 3); --py: calc(var(--step) * -1.5); --rz: -.4deg; --zi: 4; }
.yama-pile .ycards .hfcard:nth-child(5)  { --px: calc(var(--step) * 4); --py: calc(var(--step) * -2);   --rz: .7deg;  --zi: 5; }
.yama-pile .ycards .hfcard:nth-child(n + 6) { --px: var(--shift); --py: calc(var(--shift) * -.5); --rz: -.3deg; --zi: calc(var(--layers, 8)); }

.yama-pile .ycards .hfcard:last-child { box-shadow: none; }

@media (max-width: 540px), (max-height: 560px) {
  .yama-pile .ycards { --step: 2px; --shift: calc(var(--step) * 5); width: calc(36px + var(--shift)); height: 56px; margin-right: var(--shift); }
}

.scoreline { display: flex; align-items: center; justify-content: center; gap: 16px; }

.stageline { color: var(--gold); font-size: 13px; min-height: 18px; }

.seats { display: grid; gap: 10px; justify-items: center; }

.seats-bot { order: -1; }
.seats-you { order: 1; }


.seat {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);

  padding: 9px 12px;
  background: rgba(0, 0, 0, .25);
  display: grid;
  
  grid-template-areas:
    "who who"
    "hand taken";
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  column-gap: 14px;
  row-gap: 6px;

  overflow-x: hidden;
}
.seat .who { grid-area: who; }
.seat .handcol { grid-area: hand; min-width: 0; position: relative; }

.seat .takencol { grid-area: taken; min-width: 48px; }
.handprobe { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.seat.active { border-color: var(--gold); }
.seat .who {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--ink);
}


.seat .cards { display: flex; flex-wrap: nowrap; gap: 5px; }

.seats-you .cards.you-hand { flex-wrap: wrap; row-gap: 7px; }
.seat.folded .cards { gap: calc(0px - var(--ovr, 0px)); padding-top: 4px; padding-bottom: calc(var(--ch, 0px) - var(--cardH, 0px)); }
.seat.folded .cards .hfcard {
  flex: none; width: var(--cw); height: var(--ch);
  z-index: calc(var(--i, 0) + 1);
}
.seat.folded .cards .hfcard.in { transform: translateX(calc(-1px * var(--i, 0) * var(--ovr, 0px))) scale(var(--sc, 1)); }


.seats-you .seat { grid-template-columns: minmax(0, 1fr) minmax(48px, max-content); }


.seats-bot .handcol { --cardH: 50px; }
.seats-you .handcol { --cardH: 74px; }
.seats-bot .handcol .hfcard { width: 32px; height: 50px; border-radius: 6px; }

.seats-bot .handcol .hfcard .mname { font-size: 9px; }
.seats-bot .handcol .hfcard .glyph { font-size: 10px; bottom: 3px; }
.seats-bot .handcol .hfcard .pts { font-size: 8px; top: 5px; right: 3px; }


.takencol {
  display: grid;
  grid-template-columns: minmax(0, max-content);
  justify-items: end;
  align-content: start;
  gap: 4px;
  min-width: 0;
}
.takencol .hfcard {
  --o: 4px; --sc: 1; --i: 0;
  flex: none;
  border-radius: 4px;
  box-shadow: -1px 2px 4px rgba(0, 0, 0, .45);
}

.seats-you .takencol .hfcard { width: 24px; height: 37px; }
.seats-bot .takencol .hfcard { width: 16px; height: 25px; }
.takencol .hfcard .mname { font-size: 8px; }
.takencol .hfcard .glyph { font-size: 8px; bottom: 2px; }
.takencol .hfcard .pts { font-size: 7px; top: 3px; right: 2px; }
.takencol .hfcard .band { height: 3px; }


.takenrow {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}
.taken-group {
  position: relative;
  display: flex;
  align-items: center;
  flex: none;
  padding-left: 2px;
}
.taken-group:first-child { margin-left: 5px; }
.taken-group:not(:last-child) { margin-right: 5px; }
.taken-group .stack {
  position: relative;
  width: calc(var(--cw, 0px) + var(--shift, 0px));
  height: var(--cardH, 22px);
}
.taken-group .stack .hfcard {
  --kx: 0px; --ky: 0px; --rz: 0deg;
  position: absolute; left: 0; top: 0;
  z-index: calc(var(--i, 0) + 1);
}

.taken-group .stack .hfcard.in { transform: translate(var(--kx), var(--ky)) rotate(var(--rz)) scale(var(--sc, 1)); }

.taken-group .stack .hfcard:nth-child(2) { --kx: var(--o); --ky: calc(var(--o) * -.5); --rz: -.6deg; }
.taken-group .stack .hfcard:nth-child(3) { --kx: calc(var(--o) * 2); --ky: calc(var(--o) * -1); --rz: .5deg; }
.taken-group .stack .hfcard:nth-child(4) { --kx: calc(var(--o) * 3); --ky: calc(var(--o) * -1.5); --rz: -.4deg; }
.taken-group .stack .hfcard:nth-child(5) { --kx: calc(var(--o) * 4); --ky: calc(var(--o) * -2); --rz: .7deg; }
.taken-group .stack .hfcard:nth-child(n + 6) { --kx: calc(var(--o) * 5); --ky: calc(var(--o) * -2.5); --rz: -.3deg; }
.taken-group .stack .hfcard:last-child { box-shadow: none; }



.takenspread {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  min-width: 0;
  max-width: 100%;
  flex-shrink: 1;
  overflow: hidden;
}
.takenspread.folded { gap: calc(0px - var(--ovr, 0px)); }
.takenspread .hfcard { z-index: calc(var(--i, 0) + 1); }
.takenspread.folded .hfcard {
  flex: none;
  width: var(--cw); height: var(--ch);
}
.takenspread.folded .hfcard.in { transform: translateX(calc(-1px * var(--i, 0) * var(--ovr, 0px))) scale(var(--sc, 1)); }


.takenspread.wrap {
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.takenspread.wrap .spreadrow {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  max-width: 100%;
}
.takenspread.wrap.folded .spreadrow { gap: calc(0px - var(--ovr, 0px)); }

.takenspread.wrap.folded .hfcard { transform-origin: top center; }
.takenspread.wrap.folded .hfcard.in { transform: translateX(calc(-1px * max(0, var(--i, 0) - var(--p, 0)) * var(--ovr, 0px))) scale(var(--sc, 1)); }

@media (max-width: 540px), (max-height: 560px) {
  
  .seats-bot .handcol { --cardH: 42px; }
  .seats-you .handcol { --cardH: 56px; }
  .seats-bot .handcol .hfcard { width: 27px; height: 42px; }
  .seats-you .handcol .hfcard { width: 36px; height: 56px; }
  
  .seats-bot .takencol .hfcard { width: 13px; height: 21px; }
  .seats-you .takencol .hfcard { width: 18px; height: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .seat .who button { transition: none; }
}

.actionbar { min-height: 48px; display: flex; align-items: center; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; max-height: 30vh; overflow-y: auto; }
.actions button {
  background: var(--bg2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 13px;
  font: inherit;
  cursor: pointer;
}
.actions button:disabled { opacity: .45; cursor: not-allowed; }
.actions button.koi { border-color: var(--koi); color: var(--koi); }
.actions button.stop { border-color: var(--call); color: var(--call); }
