/* ==========================================================================
   Texas Hold'em
   ========================================================================== */

:root {
  --pk-rail: #2a1b12;
  --pk-seat-bg: rgba(9, 13, 18, 0.82);
  --pk-seat-border: rgba(233, 240, 248, 0.14);
}

:root[data-theme='realistic'] {
  --pk-rail: #4a2f1c;
}

#pkScreen {
  overflow: hidden;
}

/**
 * The seats are sized against the table rather than in fixed pixels.
 *
 * The interface-size slider applies `zoom`, which shrinks the table's box in
 * CSS pixels — so fixed-width seats grow relative to the felt and spill off the
 * edge at 125% and above. Container query units keep every seat a constant
 * fraction of the table at any scale.
 */
.pk-table {
  position: relative;
  height: 100%;
  min-height: 0;
  padding: 10px;
  background: var(--felt-lo);
  container-type: size;
  container-name: pktable;
}

.pk-felt {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.pk-arc-text {
  fill: var(--rail);
  opacity: 0.34;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.34em;
  font-family: var(--font);
}

.pk-arc-sub {
  fill: var(--rail);
  opacity: 0.22;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.22em;
  font-family: var(--font);
}

/* --------------------------------------------------------------------------
   Centre: pot, board, status
   -------------------------------------------------------------------------- */

.pk-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(3px, 1.6cqh, 10px);
  width: min(560px, 58%);
}

.pk-pot {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 14px;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid var(--rail);
  border-radius: 999px;
}

.pk-pot-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-weight: 700;
  color: var(--rail);
}

.pk-pot-value {
  font-family: var(--font-num);
  font-size: 17px;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.pk-board {
  display: flex;
  gap: clamp(4px, 0.8cqw, 7px);
  min-height: clamp(44px, 15cqh, 74px);
  align-items: center;
}

.pk-board .card {
  width: clamp(30px, min(5.2cqw, 12cqh), 52px);
  height: auto;
  aspect-ratio: 5 / 7;
  flex-shrink: 0;
}

.pk-board .card.pk-winning {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  box-shadow: 0 0 18px -2px rgba(237, 199, 90, 0.7);
}

.pk-status {
  padding: 4px 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
  min-height: 20px;
}

/* --------------------------------------------------------------------------
   Seats
   -------------------------------------------------------------------------- */

.pk-seats {
  position: absolute;
  inset: 0;
}

.pk-seat {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(2px, 0.8cqh, 4px);
  width: clamp(88px, 14cqw, 138px);
  transition: opacity 0.25s var(--ease);
}

.pk-seat.folded {
  opacity: 0.42;
}

.pk-seat.out {
  opacity: 0.25;
}

.pk-seat-cards {
  display: flex;
  gap: 3px;
  min-height: clamp(30px, 9cqh, 48px);
  align-items: flex-end;
}

.pk-seat-cards .card {
  width: clamp(22px, 3.4cqw, 34px);
  height: auto;
  aspect-ratio: 5 / 7;
  flex-shrink: 0;
}

/* Bounded by the table's height as well as its width: at large interface
   scales the table is short, and width alone would let the hero's cards grow
   up into the community cards. */
.pk-seat.hero .pk-seat-cards .card {
  width: clamp(30px, min(5.2cqw, 11cqh), 52px);
  height: auto;
  aspect-ratio: 5 / 7;
}

.pk-seat.hero {
  width: clamp(112px, 17cqw, 172px);
}

.pk-seat-cards.folded {
  filter: grayscale(1);
}

.pk-seat-plate {
  width: 100%;
  padding: clamp(2px, 0.9cqh, 5px) clamp(5px, 1cqw, 10px);
  background: var(--pk-seat-bg);
  border: 1px solid var(--pk-seat-border);
  border-radius: var(--radius-sm);
  text-align: center;
  backdrop-filter: blur(3px);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.pk-seat.acting .pk-seat-plate {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 20px -4px rgba(74, 222, 128, 0.7);
}

.pk-seat.winner .pk-seat-plate {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 0 24px -4px rgba(237, 199, 90, 0.8);
}

.pk-seat-name-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.pk-seat-name {
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pk-seat-style {
  font-size: 8.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  white-space: nowrap;
}

.pk-seat-stack {
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.pk-seat.all-in .pk-seat-stack {
  color: var(--danger);
}

.pk-seat-hand {
  margin-top: 2px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pk-seat-action {
  position: absolute;
  bottom: -19px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.pk-seat-action.raise {
  background: rgba(242, 85, 90, 0.16);
  border-color: rgba(242, 85, 90, 0.45);
  color: #ff9a9d;
}

.pk-seat-action.fold {
  opacity: 0.7;
}

.pk-seat-action.blind {
  background: rgba(90, 169, 247, 0.14);
  border-color: rgba(90, 169, 247, 0.4);
  color: #9ccbfb;
}

.pk-dealer-button {
  position: absolute;
  right: -10px;
  top: 50%;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f4f6fa;
  color: #16202e;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.6);
}

/* --- Committed chips in front of a seat --- */

.pk-bet {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
}

.pk-bet-chips {
  position: relative;
  width: 40px;
  height: 26px;
}

.pk-bet-amount {
  font-family: var(--font-num);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Odds panel
   -------------------------------------------------------------------------- */

.pk-odds {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 186px;
  padding: 10px 12px;
  background: rgba(9, 13, 18, 0.88);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(4px);
}

.pk-odds-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
}

.pk-odds-row.sub {
  border-top: 1px solid var(--border-soft);
  margin-top: 3px;
  padding-top: 5px;
}

.pk-odds-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 700;
  color: var(--text-faint);
  white-space: nowrap;
}

.pk-odds-value {
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-align: right;
}

.pk-odds-sub {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-dim);
  text-align: right;
}

.pk-odds-sub.good {
  color: var(--accent);
}

.pk-odds-sub.bad {
  color: var(--danger);
}

/* --------------------------------------------------------------------------
   Controls
   -------------------------------------------------------------------------- */

.pk-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  flex-wrap: wrap;
  width: 100%;
}

.pk-raise {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 232px;
  max-width: 320px;
  flex: 1;
}

.pk-raise-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.pk-raise-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--text-faint);
}

.pk-raise-value {
  font-family: var(--font-num);
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.pk-raise-presets {
  display: flex;
  gap: 5px;
}

.pk-raise-presets .btn {
  flex: 1;
  padding: 4px 6px;
  font-size: 11px;
}

.pk-buttons {
  display: flex;
  gap: 9px;
}

.pk-buttons .btn.action {
  min-width: 108px;
}

.pk-fold {
  border-color: rgba(242, 85, 90, 0.4);
}

.pk-fold:hover:not(:disabled) {
  background: rgba(242, 85, 90, 0.14);
}

/* --- Between hands --- */

.pk-next {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.pk-result {
  min-width: 96px;
  font-family: var(--font-num);
  font-size: 20px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pk-result.win {
  color: var(--accent);
}

.pk-result.lose {
  color: var(--danger);
}

.pk-result.push {
  color: var(--text-dim);
}

/* --------------------------------------------------------------------------
   Opponent style list (settings + stats panels)
   -------------------------------------------------------------------------- */

.pk-style-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.pk-style-row {
  display: grid;
  grid-template-columns: 74px 96px 1fr;
  align-items: baseline;
  gap: 9px;
  padding: 7px 10px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}

.pk-style-name {
  font-size: 13px;
  font-weight: 650;
}

.pk-style-tag {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
}

.pk-style-hint {
  font-size: 12px;
  color: var(--text-dim);
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.pk-toast {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  font-size: 13px;
  box-shadow: var(--shadow-md);
}

/* --------------------------------------------------------------------------
   Tighter layout on small screens
   -------------------------------------------------------------------------- */

/* Seat and card sizes are handled by the container queries above; these
   breakpoints only need to deal with the fixed-size furniture. */
@media (max-width: 900px) {
  .pk-center {
    width: 74%;
  }

  .pk-odds {
    width: 158px;
    top: 8px;
    right: 8px;
  }
}

@media (max-width: 640px) {
  .pk-buttons .btn.action {
    min-width: 84px;
  }

  .pk-raise {
    min-width: 180px;
  }

  .pk-arc-text,
  .pk-arc-sub {
    display: none;
  }
}
