/* Display: the level card, the table and the room's at-a-glance facts. */

body.projector-mode {
  overflow: hidden;
}

.control-grid {
  display: grid;
  grid-template-columns: minmax(600px, 36fr) minmax(0, 64fr);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas:
    "clock side"
    "timeline timeline";
  gap: var(--s-5) var(--s-8);
  height: calc(calc(100 * var(--vh)) - var(--topbar-h));
  height: calc(calc(100 * var(--dvh)) - var(--topbar-h));
  padding: var(--s-5) var(--page-gutter) var(--s-5);
}

/* Clock column */
.hero-clock {
  grid-area: clock;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  min-width: 0;
  min-height: 0;
}

.level-stack {
  position: relative;
  flex: 1;
  min-height: 0;
  container-type: size;
}

/* A poker card is 63 × 88 mm: the level card keeps that portrait ratio. */
.level-card,
.level-card-back {
  --card-ratio: 0.716;
  --card-w: min(calc(100cqw - 28px), calc((100cqh - 18px) * var(--card-ratio)));
  position: absolute;
  top: 0;
  left: 50%;
  width: var(--card-w);
  aspect-ratio: var(--card-ratio);
  border-radius: var(--r-card);
  transform: translateX(calc(-50% - 7px));
}

.level-card-back {
  top: 6px;
  transform: translateX(calc(-50% + 10px)) rotate(4deg);
  transform-origin: 30% 100%;
  border: 7px solid var(--card-edge);
  background-color: var(--card-back);
  background-image:
    repeating-linear-gradient(45deg, transparent 0 9px, var(--navy-line) 9px 10px),
    repeating-linear-gradient(-45deg, transparent 0 9px, var(--navy-line) 9px 10px);
  box-shadow: inset 0 0 0 6px var(--card-back), inset 0 0 0 7px var(--navy-line), var(--lift-2);
}

:root[data-theme-mode="dark"] .level-card-back {
  box-shadow: inset 0 0 0 6px var(--card-back), inset 0 0 0 7px var(--navy-line), var(--lift-3);
}

.level-card {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 7cqw 9cqw 6cqw;
  border: 1px solid var(--rule);
  background: var(--face);
  box-shadow: var(--lift-3);
}

.level-card::before {
  content: "";
  position: absolute;
  inset: 2.2cqw;
  border: 1px solid var(--rule);
  border-radius: calc(var(--r-card) - 6px);
  pointer-events: none;
}

.level-card.deal {
  animation: card-deal var(--t-deal) var(--ease-out) both;
}

@keyframes card-deal {
  from {
    opacity: 0;
    transform: translateX(calc(-50% + 40px)) translateY(18px) rotate(4deg);
  }
}

/* Index corners */
.card-index {
  position: absolute;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 0.6cqw;
  color: var(--ink);
  line-height: 1;
}

.card-index b {
  font: 600 7.4cqw / 1 var(--font-display);
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.card-index .suit {
  width: 5cqw;
  height: 5cqw;
}

/* As on printed cards, a lone 6 or 9 is underlined so the inverted corner still reads. */
.card-index b.turnable {
  text-decoration: underline;
  text-decoration-thickness: 0.6cqw;
  text-underline-offset: 0.8cqw;
}

.card-index-top {
  top: 5cqw;
  left: 5.4cqw;
}

.card-index-bottom {
  right: 5.4cqw;
  bottom: 5cqw;
  transform: rotate(180deg);
}

.card-index:has(.suit.red) b {
  color: var(--red);
}

/* Card body */
.clock-primary {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  min-height: 0;
  text-align: center;
}

.level-card-head {
  display: flex;
  align-items: center;
  gap: 2.4cqw;
  font-size: max(13px, 3.4cqw);
}

.level-title {
  color: var(--ink);
  font-weight: 650;
}

.level-state {
  color: var(--ink-3);
  font-weight: 550;
}

.level-state::before {
  content: "·";
  margin-right: 2.4cqw;
  color: var(--ink-3);
}

.level-card.is-running .level-state {
  display: none;
}

.level-card.is-paused .level-state {
  color: var(--red);
}

.mobile-control-status {
  display: none;
}

.timer {
  margin: 1cqw 0 2cqw;
  font: 200 min(40cqw, calc(220cqw / var(--chars, 5))) / 0.92 var(--font-display);
  letter-spacing: -0.045em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: color var(--t-base) var(--ease-out);
}

.level-card.is-paused .timer,
.level-card.is-idle .timer {
  color: var(--ink-2);
}

.timer.low {
  color: var(--amber);
}

.timer.critical {
  color: var(--red);
}

.timer.pause-timer {
  color: var(--accent);
}

.blind-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 3cqw;
  width: 100%;
  padding-top: 3.4cqw;
  border-top: 1px solid var(--rule);
}

.blind-box {
  display: grid;
  gap: 0.8cqw;
}

.blind-box span {
  color: var(--ink-3);
  font-size: max(12px, 3cqw);
  font-weight: 550;
}

.blind-box strong {
  font: 400 min(25cqw, calc(74cqw / var(--chars, 4))) / 1 var(--font-display);
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.blind-divider .suit {
  width: 4.4cqw;
  height: 4.4cqw;
  color: var(--ink-3);
}

.blind-divider .suit.red {
  color: var(--red);
}

.level-card-foot {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 1.6cqw;
  padding-top: 3.4cqw;
  border-top: 1px solid var(--rule);
  text-align: center;
}

.next-level {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2.4cqw;
  font-size: max(15px, 4.6cqw);
}

.next-level span {
  color: var(--ink-3);
  font-size: 0.72em;
  font-weight: 600;
}

.next-level strong {
  font-weight: 550;
  font-variant-numeric: tabular-nums;
}

.reentry-banner {
  text-wrap: balance;
  color: var(--accent);
  font-size: max(12px, 3cqw);
  font-weight: 550;
  font-variant-numeric: tabular-nums;
}

.reentry-banner.closed {
  color: var(--ink-3);
}

.level-progress {
  position: absolute;
  left: 2.2cqw;
  right: 2.2cqw;
  bottom: 2.2cqw;
  z-index: 2;
  height: 3px;
  overflow: hidden;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.level-progress i {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 900ms linear;
}

.level-card.is-paused .level-progress i,
.level-card.is-idle .level-progress i {
  background: var(--ink-3);
}

/* Level change and last-seconds signals */
.level-change-notice {
  position: absolute;
  top: 5.4cqw;
  left: 50%;
  z-index: 3;
  display: flex;
  align-items: baseline;
  gap: 1.6cqw;
  padding: 1.4cqw 3cqw;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--ink-inverse);
  font-size: max(12px, 3.2cqw);
  white-space: nowrap;
  transform: translateX(-50%);
  animation: notice-in 360ms var(--ease-out) both, notice-out 400ms var(--ease-out) 4.6s forwards;
}

.level-change-notice span {
  opacity: 0.7;
}

@keyframes notice-in {
  from {
    opacity: 0;
    transform: translate(-50%, -6px);
  }
}

@keyframes notice-out {
  to {
    opacity: 0;
  }
}

.level-end-countdown {
  position: absolute;
  top: 5.4cqw;
  left: 50%;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 2cqw;
  padding: 1cqw 3cqw 1cqw 1cqw;
  border-radius: var(--r-pill);
  background: var(--red);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -6px);
  transition: opacity var(--t-base) var(--ease-out), transform var(--t-base) var(--ease-out);
}

:root[data-theme-mode="dark"] .level-end-countdown {
  color: #2a0a10;
}

.level-end-countdown.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.level-end-countdown.paused {
  background: var(--ink-3);
}

.level-countdown-ring {
  display: grid;
  place-items: center;
  width: max(30px, 7.4cqw);
  height: max(30px, 7.4cqw);
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--red) 0 60%, transparent 61%),
    conic-gradient(currentColor var(--countdown-progress, 100%), rgba(255, 255, 255, 0.28) 0);
}

.level-end-countdown.paused .level-countdown-ring {
  background:
    radial-gradient(circle, var(--ink-3) 0 60%, transparent 61%),
    conic-gradient(currentColor var(--countdown-progress, 100%), rgba(255, 255, 255, 0.28) 0);
}

.level-countdown-ring strong {
  font-size: max(14px, 3.6cqw);
  font-variant-numeric: tabular-nums;
}

.level-countdown-copy {
  display: grid;
  text-align: left;
  font-size: max(11px, 2.8cqw);
  line-height: 1.2;
}

.level-countdown-copy span {
  font-weight: 650;
}

.level-countdown-copy small {
  opacity: 0.85;
}

/* Control bar: every group on one line under the card, each sized to its content */
.display-control-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-2);
}

.control-toggle {
  flex: none;
  min-width: 132px;
  min-height: 52px;
  padding: 0 var(--s-5) 0 var(--s-4);
  border-radius: var(--r-md);
  font-size: var(--text-lg);
}

.control-toggle .icon {
  width: 20px;
  height: 20px;
}

.control-group {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--face);
}

.control-group button {
  min-height: 44px;
  border-color: transparent;
  background: transparent;
  border-radius: var(--r-sm);
}

.control-group .icon-button {
  width: 42px;
  min-width: 42px;
}

.control-group button:hover:not(:disabled) {
  background: var(--face-3);
  border-color: transparent;
}

.control-group button.danger {
  color: var(--ink-2);
}

.control-group button.danger:hover:not(:disabled) {
  background: var(--red-soft);
  color: var(--red);
}

.control-group-icon {
  display: grid;
  place-items: center;
  width: 28px;
  color: var(--ink-3);
}

.break-button {
  width: 38px;
  min-width: 38px;
  padding: 0;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.break-exit {
  padding: 0 var(--s-3);
  color: var(--accent);
}

/* Table column */
.control-side {
  grid-area: side;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: var(--s-4);
  min-width: 0;
  min-height: 0;
}

.projection-table {
  position: relative;
  min-height: 0;
  container-type: size;
  display: grid;
  place-items: center;
}

/* Poker table, shared by Setup and Display */
.poker-table-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 8.6;
  user-select: none;
}

.live-table {
  --table-w: min(100cqw, calc(100cqh * 16 / 8.6));
  width: var(--table-w);
  height: min(100cqh, calc(var(--table-w) * 11 / 16));
  aspect-ratio: auto;
}

.poker-table-surface {
  position: absolute;
  inset: 13% 9%;
  display: grid;
  place-items: center;
}

.poker-table-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

:root[data-theme-mode="light"] .mobile-poker-art-dark {
  display: none;
}

:root[data-theme-mode="light"] .mobile-poker-art-light {
  display: block;
}

/* The table: printed like the card back in both themes — cream edge, navy rail,
   felt with the back's diamond lattice. The lattice is CSS so the stretched table never distorts it. */
.poker-table-print {
  display: block;
  filter: drop-shadow(0 22px 34px rgba(4, 10, 22, 0.5));
}

:root[data-theme-mode="light"] .poker-table-print {
  filter: drop-shadow(0 18px 30px rgba(40, 32, 18, 0.28));
}

.poker-table-felt {
  position: absolute;
  inset: calc(40 / 620 * 100%) calc(40 / 1200 * 100%);
  border-radius: calc(270 / 1120 * 100%) / 50%;
  background:
    radial-gradient(ellipse at 50% 46%, transparent 52%, rgba(6, 14, 28, 0.42) 100%),
    repeating-linear-gradient(45deg, transparent 0 15px, rgba(244, 238, 226, 0.075) 15px 16px),
    repeating-linear-gradient(-45deg, transparent 0 15px, rgba(244, 238, 226, 0.075) 15px 16px);
  pointer-events: none;
}

/* The felt is always the navy back, so what is printed on it reads in the dark palette. */
:root[data-theme-mode="light"] .poker-table-content {
  --ink: #f4eee2;
  --ink-2: #c9cfda;
  --ink-3: #a3adc0;
  --rule: rgba(244, 238, 226, 0.16);
  --rule-strong: rgba(244, 238, 226, 0.3);
  --face-2: rgba(244, 238, 226, 0.08);
  --face-3: rgba(244, 238, 226, 0.12);
  --red: #ff6b73;
  color: var(--ink);
}

/* Seats are cards laid on the table: a lifted face with a cream edge in the dark theme. */
:root:not([data-theme-mode="light"]) .poker-table-wrap .player-seat {
  border-color: rgba(233, 225, 207, 0.42);
  background: #1a3157;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), 0 18px 34px -12px rgba(0, 0, 0, 0.7);
}

:root:not([data-theme-mode="light"]) .poker-table-wrap .player-seat.out {
  border-color: rgba(233, 225, 207, 0.32);
  background: rgba(10, 22, 40, 0.92);
  box-shadow: none;
}

:root[data-theme-mode="light"] .poker-table-wrap .player-seat {
  border-color: #d9cdb6;
  box-shadow: 0 2px 4px rgba(40, 32, 18, 0.12), 0 16px 30px -12px rgba(10, 20, 40, 0.5);
}

:root[data-theme-mode="light"] .poker-table-wrap .player-seat.out {
  background: #efe9dc;
  border-color: #b9ab90;
}

.poker-table-content {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 4px;
  width: min(46%, 300px);
  text-align: center;
}

/* Display: the prize pool on the left of the felt, the invitation large on the right,
   both kept inside the free felt between the seats (x 30%–70% of the table). */
.poker-table-content.with-invitation {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc((30% - 9%) / 0.82);
  right: calc((100% - 70% - 9%) / 0.82);
  width: auto;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3cqw;
  text-align: left;
}

.table-centre-info {
  display: grid;
  justify-items: start;
  gap: 4px;
  min-width: 0;
}

.with-invitation .table-prize-details {
  max-width: 280px;
}

.with-invitation .table-centre-detail {
  white-space: nowrap;
}

@container (max-width: 720px) {
  .with-invitation .table-centre-detail {
    display: none;
  }
}

.table-centre-label {
  color: var(--ink-3);
  font-size: var(--text-xs);
  font-weight: 600;
}

.poker-table-content > strong,
.table-centre-info > strong {
  font: 300 clamp(1.75rem, 4.2cqw, 3rem) / 1 var(--font-display);
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.table-centre-detail {
  color: var(--ink-2);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.table-prize-details {
  display: grid;
  width: 100%;
  margin-top: var(--s-2);
}

.table-prize-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: var(--s-2);
  padding: 5px 0;
  border-top: 1px solid var(--rule);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  text-align: left;
}

.table-prize-share {
  color: var(--ink-3);
}

.table-prize-row strong {
  font-weight: 650;
}

.table-money-status {
  margin-top: 4px;
  color: var(--red);
  font-size: var(--text-xs);
  font-weight: 650;
}

.table-late-player-button {
  min-height: 34px;
  margin-top: 4px;
  font-size: var(--text-sm);
}

/* Seats */
.player-seat {
  position: absolute;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  width: min(19%, 176px);
  min-width: 124px;
  padding: 8px 10px 9px;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--face);
  box-shadow: var(--lift-2);
  transform: translate(-50%, -50%);
  transition: box-shadow var(--t-base) var(--ease-out), opacity var(--t-base) var(--ease-out);
}

.player-seat.seat-just-moved {
  animation: seat-settle 520ms var(--ease-out);
}

@keyframes seat-settle {
  from {
    box-shadow: 0 0 0 3px var(--accent), var(--lift-2);
  }
}

.seat-drag-handle {
  position: absolute;
  top: 6px;
  right: 4px;
  width: 24px;
  min-width: 24px;
  min-height: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  cursor: grab;
  opacity: 0;
  touch-action: none;
}

.player-seat:hover .seat-drag-handle,
.seat-drag-handle:focus-visible,
.editor-table .seat-drag-handle {
  opacity: 1;
}

.editor-table .seat-drag-handle {
  position: static;
  order: 3;
}

.seat-drag-handle .icon {
  width: 16px;
  height: 16px;
}

.player-seat-heading {
  grid-column: 1 / -1;
  padding-right: 20px;
}

.live-table {
  container-type: size;
}

.live-table .player-seat {
  --seat-w: 21%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 2px 4px;
  width: min(var(--seat-w), 250px);
  min-width: 136px;
  padding: 10px 8px 9px 12px;
  border-radius: var(--r-lg);
}

.live-table[data-seat-count="9"] .player-seat,
.live-table[data-seat-count="10"] .player-seat {
  --seat-w: 19.5%;
}

.live-table[data-seat-count="11"] .player-seat,
.live-table[data-seat-count="12"] .player-seat {
  --seat-w: 17.5%;
}

.live-table .player-seat-name {
  font-size: clamp(var(--text-lg), 2.05cqw, 1.625rem);
  letter-spacing: -0.015em;
}

.live-table .player-seat-meta {
  font-size: clamp(var(--text-sm), 1.45cqw, var(--text-lg));
}

.live-table .player-seat-status {
  color: var(--ink);
  font-weight: 600;
}

.live-table .player-finish-result {
  justify-content: flex-start;
  font-size: clamp(var(--text-sm), 1.4cqw, var(--text-lg));
}

.live-table .player-finish-result strong {
  font-size: inherit;
  font-weight: 650;
}

.live-table .player-reentry-badge,
.live-table .seat-itm-label {
  min-height: 0;
  padding: 0.15em 0.5em;
  font-size: clamp(var(--text-xs), 1.15cqw, var(--text-md));
}

.live-table .seat-itm-label {
  padding: 0;
  font-weight: 650;
}

.live-table .player-seat-heading {
  grid-row: 1;
  grid-column: 1 / -1;
}

.live-table .player-seat-meta {
  grid-row: 2;
  grid-column: 1;
  flex-direction: row;
  align-items: baseline;
  justify-content: flex-start;
  gap: 0.4em;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.live-table .player-seat-money::before {
  content: "·";
  margin-right: 0.4em;
  color: var(--ink-3);
}

.live-table .player-seat-actions {
  display: contents;
}

.live-table .seat-action-out {
  grid-row: 2;
  grid-column: 2;
}

.live-table .seat-action-reentry,
.live-table [data-action="restore-player"] {
  grid-row: 2;
  grid-column: 3;
}

.live-table .seat-action-undo {
  grid-row: 3;
  grid-column: 3;
}

.live-table .player-seat-badges {
  grid-row: 3;
  grid-column: 1 / 3;
}

.live-table .player-finish-result,
.live-table .seat-itm-label {
  grid-column: 1 / -1;
}

.seat-action-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.live-table .seat-action {
  flex: none;
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--ink-2);
}

.live-table .seat-action:hover:not(:disabled),
.live-table .seat-action:focus-visible {
  border-color: var(--rule);
  background: var(--face-2);
  color: var(--ink);
}

.live-table .seat-action .icon {
  width: 18px;
  height: 18px;
}

.live-table .seat-action-out:hover:not(:disabled) {
  color: var(--red);
}


@container (max-width: 760px) {
  .live-table .player-seat-money {
    display: none;
  }

  .live-table .player-seat-meta {
    font-size: var(--text-xs);
  }

  .live-table .seat-action {
    width: 30px;
    min-width: 30px;
    min-height: 30px;
  }

  .live-table .seat-action .icon {
    width: 16px;
    height: 16px;
  }
}

@container (max-width: 820px) {
  .table-prize-details,
  .table-late-player-button {
    display: none;
  }
}

.player-seat-name {
  overflow: hidden;
  font-size: var(--text-md);
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.player-seat-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px var(--s-2);
  font-size: var(--text-xs);
  line-height: 1.3;
}

.player-seat-status {
  color: var(--ink-2);
  font-weight: 550;
}

.player-seat-money {
  color: var(--ink-2);
  font-weight: 550;
  font-variant-numeric: tabular-nums;
}

.player-seat-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.player-reentry-badge,
.seat-itm-label {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 6px;
  border-radius: var(--r-xs);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: var(--text-2xs);
  font-weight: 600;
}

.seat-itm-label {
  align-self: flex-start;
  background: none;
  padding: 0;
  color: var(--red);
}

.player-seat-actions {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}

.seat-action {
  flex: 1;
  gap: 4px;
  min-height: 28px;
  padding: 0 6px;
  border-color: var(--rule);
  border-radius: var(--r-xs);
  font-size: var(--text-xs);
  font-weight: 600;
}

.seat-action .icon {
  width: 14px;
  height: 14px;
}

.seat-action-out:hover:not(:disabled) {
  border-color: var(--red-line);
  background: var(--red-soft);
  color: var(--red);
}

.seat-action-undo {
  flex: 0 0 30px;
  padding: 0;
}

/* Eliminated: nothing disappears, it cancels */
.player-seat.out {
  border-style: dashed;
  border-color: var(--rule-strong);
  background: var(--face-2);
  box-shadow: none;
}

.player-seat.out .player-seat-name {
  color: var(--ink-3);
  text-decoration: line-through;
  text-decoration-color: var(--ink-3);
}

.player-seat.out .player-seat-status,
.player-seat.out .player-seat-money {
  color: var(--ink-3);
}

.player-finish-result {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2);
  font-size: var(--text-xs);
}

.player-finish-result strong {
  font-size: var(--text-md);
  font-variant-numeric: tabular-nums;
}

.player-seat.itm {
  border-color: color-mix(in srgb, var(--green) 40%, var(--rule));
}

/* Drag and drop between seats */
.seat-insert-zone {
  position: absolute;
  z-index: 3;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 1px dashed var(--accent);
  border-radius: 50%;
  background: var(--face);
  color: var(--accent);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.8);
  transition: opacity var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}

.seat-insert-zone .icon {
  width: 14px;
  height: 14px;
}

.seat-reorder-active .seat-insert-zone {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.seat-insert-zone.seat-insert-target {
  background: var(--accent);
  color: var(--accent-ink);
  border-style: solid;
  transform: translate(-50%, -50%) scale(1.2);
}

.player-seat.seat-drag-source {
  opacity: 0.35;
}

:root .poker-table-wrap .player-seat.seat-swap-target {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent), var(--lift-2);
}

.player-seat.seat-drag-ghost {
  position: fixed;
  z-index: 100;
  margin: 0;
  opacity: 0.86;
  transform: rotate(-2deg);
  box-shadow: var(--lift-3);
  pointer-events: none;
}

/* Footer: invitation and statistics */
.display-footer {
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}

/* Invitation: printed on the felt, the QR as large as the table allows */
.clock-invitation {
  min-width: 0;
}

.display-join-card {
  display: grid;
  justify-items: center;
  gap: var(--s-2);
}

.display-join-qr {
  display: grid;
  place-items: center;
  width: clamp(104px, min(24cqw, 44cqh - 44px), 320px);
  aspect-ratio: 1;
  padding: 4%;
  border-radius: var(--r-md);
  background: #f4f0e6;
  box-shadow: var(--lift-2);
}

.display-join-qr img {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.display-join-qr-fallback {
  color: #102c3a;
  font-size: 40px;
}

.display-join-copy {
  display: grid;
  justify-items: center;
  gap: 0;
  min-width: 0;
  text-align: center;
}

.display-join-kicker {
  color: var(--ink-2);
  font-size: clamp(var(--text-xs), 1.1cqw, var(--text-md));
  font-weight: 600;
}

.display-join-code {
  font: 600 clamp(var(--text-lg), 2.4cqw, var(--text-3xl)) / 1.15 var(--font-mono);
  letter-spacing: 0.14em;
  margin-right: -0.14em;
}

.display-join-copy small {
  display: none;
}

.display-secondary {
  position: relative;
  flex: none;
  display: flex;
  align-items: flex-end;
}

.display-secondary > summary {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 40px;
  padding: 0 var(--s-3);
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: background-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}

.display-secondary > summary:hover {
  background: var(--face-3);
  color: var(--ink);
}

.display-secondary .display-stats-icon {
  width: 18px;
  height: 18px;
}

.display-secondary .disclosure-chevron {
  display: none;
}

.display-stats-label-open,
.display-secondary[open] .display-stats-label-closed {
  display: none;
}

.display-secondary[open] .display-stats-label-open {
  display: inline;
}

.display-secondary[open] > summary {
  background: var(--face-3);
  color: var(--ink);
}

.stats-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + var(--s-3));
  z-index: 20;
  display: grid;
  gap: var(--s-4);
  width: min(620px, calc(calc(100 * var(--vw)) - 2 * var(--page-gutter)));
  padding: var(--s-5);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  background: var(--face);
  box-shadow: var(--lift-3);
  animation: pop-in 200ms var(--ease-out);
  transform-origin: bottom right;
}

.stats-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stats-panel-head h2 {
  font-size: var(--text-lg);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--rule);
}

.stats-grid .stat-box {
  padding: var(--s-3) var(--s-3) var(--s-3) 0;
  border-bottom: 1px solid var(--rule);
}

.stats-grid .stat-box > span {
  font-size: var(--text-xs);
}

.stats-grid .stat-box > strong {
  font-size: var(--text-xl);
}

.stats-grid .stat-alert > strong {
  color: var(--red);
}



/* Mobile table (rendered below 760 px) */
.mobile-poker-table {
  display: grid;
  gap: var(--s-4);
}

.mobile-poker-felt {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 0;
}

.mobile-poker-art {
  grid-column: 1 / -1;
  grid-row: 1;
  justify-self: center;
  width: min(100%, 300px);
  height: 132px;
  object-fit: fill;
}

.mobile-poker-art-light {
  display: none;
}

.mobile-table-centre {
  grid-column: 1 / -1;
  grid-row: 1;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 2px;
  margin-bottom: var(--s-2);
  text-align: center;
}

.mobile-table-centre span {
  color: var(--ink-3);
  font-size: var(--text-xs);
  font-weight: 600;
}

.mobile-table-centre strong {
  font: 300 2.25rem / 1 var(--font-display);
  letter-spacing: -0.035em;
}

.mobile-table-centre small,
.mobile-table-centre em {
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-style: normal;
}

.mobile-seat-token {
  position: static;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--face);
  font-size: var(--text-sm);
  transform: none;
}

.mobile-seat-token i {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--ink-2);
}

.mobile-seat-token strong {
  overflow: hidden;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mobile-seat-token.out {
  border-style: dashed;
  background: transparent;
  color: var(--ink-3);
}

.mobile-seat-token.out strong {
  font-weight: 500;
  text-decoration: line-through;
}

.mobile-seat-token.out i {
  background: var(--ink-3);
}

.mobile-table-state {
  display: flex;
  justify-content: center;
  gap: var(--s-4);
  color: var(--ink-2);
  font-size: var(--text-sm);
}

.mobile-table-state strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.mobile-table-state .money,
.mobile-table-state .bubble {
  color: var(--red);
  font-weight: 650;
}

.mobile-table-payouts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--face);
}

.mobile-table-payouts span {
  display: grid;
  gap: 2px;
  padding: var(--s-3);
  text-align: center;
}

.mobile-table-payouts span + span {
  border-left: 1px solid var(--rule);
}

.mobile-table-payouts small {
  color: var(--ink-3);
  font-size: var(--text-xs);
}

.mobile-table-payouts strong {
  font-size: var(--text-lg);
  font-variant-numeric: tabular-nums;
}

.mobile-player-roster {
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--face);
}

.mobile-player-roster > summary {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 52px;
  padding: 0 var(--s-4);
  font-weight: 600;
}

.mobile-player-roster > summary span {
  flex: 1;
}

.mobile-player-roster > summary strong {
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.mobile-player-list {
  display: grid;
}

.mobile-player-row {
  display: grid;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--rule);
}

.mobile-player-copy {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px var(--s-3);
}

.mobile-player-copy .player-seat-meta {
  gap: var(--s-2);
}

.mobile-player-copy small {
  color: var(--ink-2);
  font-size: var(--text-xs);
}

.mobile-player-row.out .player-seat-name {
  color: var(--ink-3);
  text-decoration: line-through;
}

.mobile-player-row.out .player-seat-status {
  color: var(--ink-3);
}

.mobile-player-row .seat-action {
  min-height: 40px;
}

.mobile-add-player {
  min-height: 48px;
}

.mobile-player-row .seat-action-label {
  position: static;
  width: auto;
  height: auto;
  clip: auto;
}

/* Podium: the first three finishers are foil-stamped cards with a medal pinned to the corner.
   The seat redefines its own ink and rules so everything printed on it reads on the foil. */
.podium-1 {
  --podium-a: var(--podium-1-a);
  --podium-b: var(--podium-1-b);
  --podium-ink: var(--podium-1-ink);
}

.podium-2 {
  --podium-a: var(--podium-2-a);
  --podium-b: var(--podium-2-b);
  --podium-ink: var(--podium-2-ink);
}

.podium-3 {
  --podium-a: var(--podium-3-a);
  --podium-b: var(--podium-3-b);
  --podium-ink: var(--podium-3-ink);
}

.podium {
  --podium-foil: linear-gradient(135deg, var(--podium-a), var(--podium-b));
  --medal-size: 40px;
}

.seat-medal {
  position: absolute;
  z-index: 3;
  top: calc(var(--medal-size) * -0.42);
  left: calc(var(--medal-size) * -0.3);
  width: var(--medal-size);
  height: var(--medal-size);
  pointer-events: none;
}

/* The ribbon: card-back navy with a cream stripe, tucked behind the disc */
.seat-medal::before {
  content: "";
  position: absolute;
  bottom: 50%;
  left: 21%;
  width: 58%;
  height: 86%;
  border: 1px solid rgba(244, 238, 226, 0.75);
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(90deg, var(--navy) 0 38%, var(--card-edge) 38% 62%, var(--navy) 62%);
}

.seat-medal-disc {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.55), transparent 46%),
    var(--podium-foil);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--podium-ink) 45%, transparent),
    0 2px 6px rgba(4, 10, 22, 0.35);
  color: var(--podium-ink);
  font: 650 calc(var(--medal-size) * 0.46) / 1 var(--font-display);
  font-variant-numeric: tabular-nums;
}

/* The engraved inner ring */
.seat-medal-disc::after {
  content: "";
  position: absolute;
  inset: 14%;
  border: 1px solid color-mix(in srgb, var(--podium-ink) 38%, transparent);
  border-radius: 50%;
}

.medal-arriving .seat-medal {
  animation: medal-stamp 220ms var(--ease-out) both;
  animation-delay: var(--medal-arrival-offset, 0ms);
}

@keyframes medal-stamp {
  from {
    opacity: 0;
    transform: scale(1.4);
  }
}

/* Desktop seats */
:root .live-table.poker-table-wrap .player-seat.podium {
  --ink: var(--podium-ink);
  --ink-2: color-mix(in srgb, var(--podium-ink) 84%, var(--podium-a));
  --ink-3: color-mix(in srgb, var(--podium-ink) 72%, var(--podium-a));
  --rule: color-mix(in srgb, var(--podium-ink) 24%, transparent);
  --face-2: rgba(255, 255, 255, 0.34);
  --red: var(--podium-ink);
  --medal-size: clamp(32px, 3.4cqw, 48px);
  border: 1px solid color-mix(in srgb, var(--podium-ink) 38%, var(--podium-b));
  background: var(--podium-foil);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), 0 18px 34px -12px rgba(0, 0, 0, 0.7);
  color: var(--podium-ink);
}

:root[data-theme-mode="light"] .live-table.poker-table-wrap .player-seat.podium {
  box-shadow: 0 2px 4px rgba(40, 32, 18, 0.16), 0 16px 30px -12px rgba(10, 20, 40, 0.5);
}

:root .live-table.poker-table-wrap .player-seat.podium.seat-swap-target {
  box-shadow: 0 0 0 3px var(--accent), var(--lift-2);
}

/* The printed inner frame of a large card, inset on the foil */
.live-table .player-seat.podium::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid color-mix(in srgb, var(--podium-ink) 22%, transparent);
  border-radius: calc(var(--r-lg) - 4px);
  pointer-events: none;
}

.live-table .player-seat.podium .player-seat-heading {
  padding-left: calc(var(--medal-size) * 0.62 - 8px);
}

.player-seat.podium.out .player-seat-name,
.mobile-seat-token.podium.out strong {
  color: var(--podium-ink);
  text-decoration: none;
}

.mobile-player-row.podium.out .player-seat-name {
  color: var(--ink);
  text-decoration: none;
}

.live-table .player-seat-prize {
  grid-row: 2;
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  gap: 0.45em;
  min-width: 0;
  white-space: nowrap;
}

.live-table .player-seat-prize .player-seat-place {
  color: var(--ink-2);
  font-size: clamp(var(--text-sm), 1.45cqw, var(--text-lg));
  font-weight: 650;
}

.live-table .player-seat-prize strong {
  overflow: hidden;
  font: 300 clamp(1.5rem, 2.7cqw, 2.25rem) / 1 var(--font-display);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
}

.live-table .player-seat.paid:not(.podium) .player-seat-prize strong {
  color: var(--green);
}

.live-table .player-seat.paid .player-seat-meta,
.live-table .player-seat.paid .seat-action-out,
.live-table .player-seat.paid .seat-action-reentry,
.live-table .player-seat.paid [data-action="restore-player"] {
  grid-row: 3;
}

.live-table .player-seat.paid .seat-action-undo,
.live-table .player-seat.paid .player-seat-badges {
  grid-row: 4;
}

@container (max-width: 760px) {
  .live-table .player-seat-prize strong {
    font-size: var(--text-xl);
  }
}

/* Phones: foil tokens, named payouts and marked roster rows */
.mobile-seat-token.podium {
  --medal-size: 22px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-content: center;
  column-gap: 6px;
  padding: 4px 8px;
  border: 1px solid color-mix(in srgb, var(--podium-ink) 38%, var(--podium-b));
  background: var(--podium-foil);
  color: var(--podium-ink);
}

.mobile-seat-token .seat-medal,
.mobile-player-row .seat-medal {
  position: relative;
  top: auto;
  left: auto;
  flex: none;
}

.mobile-seat-token .seat-medal {
  grid-row: span 2;
}

.mobile-seat-token .seat-medal::before,
.mobile-player-row .seat-medal::before {
  display: none;
}

.mobile-seat-token .seat-medal-disc,
.mobile-player-row .seat-medal-disc {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--podium-ink) 45%, transparent);
}

.mobile-seat-prize {
  font-size: var(--text-xs);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.mobile-table-payouts {
  overflow: hidden;
}

.mobile-table-payouts span.podium {
  background: var(--podium-foil);
  color: var(--podium-ink);
}

.mobile-table-payouts span.podium small {
  color: color-mix(in srgb, var(--podium-ink) 78%, var(--podium-a));
}

.mobile-table-payouts em {
  overflow: hidden;
  font-size: var(--text-xs);
  font-style: normal;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mobile-player-row.podium {
  --medal-size: 24px;
  box-shadow: inset 4px 0 0 var(--podium-b);
}

.mobile-player-row .seat-medal {
  align-self: center;
}

.mobile-player-copy .player-seat-prize {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.mobile-player-copy .player-seat-place {
  color: var(--ink-2);
  font-size: var(--text-xs);
}

.mobile-player-copy .player-seat-prize strong {
  font-size: var(--text-md);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* Once every paid place is known, the prize recap links to the settlement plan in Setup */
.settlement-link {
  gap: 6px;
  min-height: 34px;
  padding: 0 var(--s-2);
  font-size: var(--text-sm);
  font-weight: 600;
}

.settlement-link .icon {
  width: 16px;
  height: 16px;
}

.table-settlement-link {
  margin: 2px 0 0 calc(var(--s-2) * -1);
  color: var(--ink);
}

.mobile-settlement-link {
  justify-self: center;
  min-height: 44px;
}
