/* Poker Night: a home game under a lamp. */

@font-face {
  font-family: 'Barlow Semi Condensed';
  src: url('/fonts/barlow-semi-condensed-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow Semi Condensed';
  src: url('/fonts/barlow-semi-condensed-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow Semi Condensed';
  src: url('/fonts/barlow-semi-condensed-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow Semi Condensed';
  src: url('/fonts/barlow-semi-condensed-latin-800-normal.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy: #142038;
  --navy-raised: #18264a;
  --navy-deep: #0f1a30;
  --line: rgba(241, 235, 223, 0.12);
  --felt: #6e1a26;
  --felt-lit: #8c2633;
  --felt-edge: #551420;
  --rail: #2b0e14;
  --amber: #ffc35a;
  --amber-soft: rgba(255, 195, 90, 0.3);
  --cream: #f1ebdf;
  --slate: #9aa6bd;
  --card: #fbfaf6;
  --ink: #1c1a22;
  --suit-red: #c41e3a;
  --suit-blue: #1f63c6;
  --suit-green: #1d7a43;
  --chip: #2b6cb0;
  --up: #8fd6a3;
  --down: #ff9a8c;
  --plate: rgba(10, 16, 30, 0.9);
  --font: 'Barlow Semi Condensed', 'Arial Narrow', system-ui, sans-serif;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  background: #101a30;
}

body {
  font-family: var(--font);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.45;
  color: var(--cream);
  background: radial-gradient(120% 90% at 50% 20%, #1a2a4c 0%, var(--navy) 55%, #101a30 100%) no-repeat;
  -webkit-font-smoothing: antialiased;
  font-variant-emoji: text;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.sprites {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.sr-only,
.offscreen {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------------------
   Buttons and fields */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 17px;
  line-height: 1.1;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 120ms, border-color 120ms, transform 80ms;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-lamp {
  background: var(--amber);
  color: var(--ink);
}

.btn-lamp:hover:not(:disabled) {
  background: #ffd07a;
}

.btn-call {
  background: var(--cream);
  color: var(--ink);
}

.btn-call:hover:not(:disabled) {
  background: #fff;
}

.btn-fold {
  background: transparent;
  color: var(--cream);
  border-color: rgba(241, 235, 223, 0.35);
}

.btn-fold:hover:not(:disabled) {
  border-color: var(--cream);
}

.btn-quiet {
  background: rgba(241, 235, 223, 0.08);
  color: var(--cream);
  border-color: rgba(241, 235, 223, 0.14);
}

.btn-quiet:hover:not(:disabled) {
  background: rgba(241, 235, 223, 0.14);
}

.btn-small {
  min-height: 38px;
  padding: 7px 14px;
  font-size: 15px;
}

.btn-wide {
  width: 100%;
}

.link-button {
  background: none;
  border: 0;
  padding: 4px 6px;
  color: var(--slate);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-button:hover {
  color: var(--cream);
}

.link-button.danger:hover {
  color: var(--down);
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field > span {
  font-size: 14px;
  font-weight: 600;
  color: rgba(241, 235, 223, 0.82);
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(241, 235, 223, 0.18);
  background: rgba(10, 16, 30, 0.55);
  color: var(--cream);
  font-size: 17px;
  font-weight: 600;
}

input::placeholder {
  color: rgba(241, 235, 223, 0.4);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(255, 195, 90, 0.22);
}

input[type='number'] {
  font-variant-numeric: tabular-nums;
}

select option {
  background: var(--navy);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  cursor: pointer;
}

.check input {
  width: 20px;
  min-height: 20px;
  height: 20px;
  accent-color: var(--amber);
}

/* ---------------------------------------------------------------------------
   Lobby */

.lobby {
  max-width: 1120px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 40px 28px 48px;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  grid-template-areas:
    'head join'
    'felt felt';
  align-content: center;
  column-gap: 56px;
  row-gap: 40px;
}

.lobby-head {
  grid-area: head;
  align-self: end;
}

.brand {
  margin: 0;
  font-size: clamp(60px, 7.6vw, 112px);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.lede {
  margin: 16px 0 0;
  max-width: 34ch;
  font-size: 20px;
  color: var(--slate);
}

.lobby-felt {
  grid-area: felt;
  position: relative;
  display: grid;
  place-items: center;
  min-height: 500px;
  padding: 56px 120px;
  border: 16px solid var(--rail);
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 36%, var(--felt-lit) 0%, var(--felt) 58%, var(--felt-edge) 100%);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.05),
    inset 0 12px 40px rgba(0, 0, 0, 0.35),
    0 40px 90px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.lobby-felt::after {
  content: '';
  position: absolute;
  inset: 9%;
  border-radius: 50%;
  border: 1px solid rgba(255, 222, 180, 0.1);
  pointer-events: none;
}

.lobby-lamp {
  position: absolute;
  left: 50%;
  top: -18%;
  width: 110%;
  aspect-ratio: 1;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(255, 200, 120, 0.22), rgba(255, 200, 120, 0.06) 60%, transparent);
  pointer-events: none;
}

.create-form {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 14px;
}

.create-form h2,
.create-form .btn-wide {
  grid-column: 1 / -1;
}

.create-form .field-row {
  display: contents;
}

.create-form h2 {
  margin: 0 0 2px;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
}

.create-form .btn-wide {
  margin-top: 6px;
  min-height: 52px;
  font-size: 19px;
}

.join-box {
  grid-area: join;
  align-self: end;
  display: grid;
  gap: 12px;
  max-width: 460px;
}

.join-box h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.join-code {
  display: flex;
  gap: 8px;
}

.join-code input {
  flex: 1;
}

.recent h3 {
  margin: 10px 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--slate);
}

.recent ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.recent-link {
  font-weight: 700;
  font-size: 17px;
  text-underline-offset: 3px;
}

.recent-code {
  color: var(--slate);
  font-size: 14px;
  letter-spacing: 0.04em;
}

/* ---------------------------------------------------------------------------
   Game layout */

.game {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

/* Fixed rows, so a hidden banner never shifts the layout. */
.topbar {
  grid-row: 1;
}

.conn-banner {
  grid-row: 2;
}

.game-body {
  grid-row: 3;
}

.dock {
  grid-row: 4;
}

.topbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 26, 48, 0.7);
}

.home-link {
  font-weight: 800;
  font-size: 21px;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.table-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  line-height: 1.2;
}

.table-name {
  font-weight: 700;
  font-size: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-meta {
  font-size: 14px;
  color: var(--slate);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.panel-toggle {
  display: none;
}

.badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--amber);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
}

.conn-banner {
  padding: 6px 12px;
  background: #5b2a12;
  color: #ffe2c2;
  font-weight: 600;
  font-size: 14px;
  text-align: center;
}

.game-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  min-height: 0;
}

.stage {
  position: relative;
  min-height: 0;
  padding: 22px 22px 10px;
}

.table-area {
  --seat-w: 118px;
  --seat-h: 54px;
  --board-cw: clamp(40px, 4.4vw, 62px);
  position: relative;
  width: 100%;
  height: 100%;
}

/* ---------------------------------------------------------------------------
   The felt and the lamp */

.felt {
  position: absolute;
  border-radius: 50%;
  border: 14px solid var(--rail);
  background: radial-gradient(ellipse at 50% 46%, var(--felt-lit) 0%, var(--felt) 60%, var(--felt-edge) 100%);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.05),
    inset 0 10px 40px rgba(0, 0, 0, 0.35),
    0 30px 80px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

/* The printed betting line on the cloth. */
.felt::after {
  content: '';
  position: absolute;
  inset: 13%;
  border-radius: 50%;
  border: 1px solid rgba(255, 222, 180, 0.11);
  pointer-events: none;
}

.lamp {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 78%;
  aspect-ratio: 1.15;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 204, 128, 0.3), rgba(255, 204, 128, 0.1) 55%, transparent 100%);
  opacity: 0.55;
  transform: translate(-50%, -50%);
  transition:
    transform 700ms cubic-bezier(0.25, 0.8, 0.25, 1),
    opacity 400ms ease;
}

.lamp.lit {
  opacity: 1;
}

.felt-center {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 10%;
  text-align: center;
}

.pot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 14px 4px 8px;
  border-radius: 999px;
  background: rgba(10, 16, 30, 0.45);
  font-weight: 700;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.side-pots {
  font-size: 14px;
  color: rgba(241, 235, 223, 0.78);
  white-space: pre;
  font-variant-numeric: tabular-nums;
}

.side-pots:empty {
  display: none;
}

.board {
  --cw: var(--board-cw);
  display: flex;
  gap: clamp(3px, 0.5vw, 7px);
  min-height: calc(var(--board-cw) * 1.4);
}

.felt-message {
  max-width: 34ch;
  min-height: 1.4em;
  font-size: 16px;
  font-weight: 600;
  color: var(--cream);
}

/* ---------------------------------------------------------------------------
   Cards */

.card {
  position: relative;
  flex: none;
  width: var(--cw);
  height: calc(var(--cw) * 1.4);
  border-radius: calc(var(--cw) * 0.1);
  background: var(--card);
  color: var(--ink);
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.25),
    0 4px 10px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  user-select: none;
  transition:
    transform 200ms ease,
    filter 200ms ease,
    box-shadow 200ms ease;
}

.card-sm {
  --cw: 30px;
}

.card-board {
  --cw: var(--board-cw);
}

.card-lg {
  --cw: 56px;
}

.card .rank {
  position: absolute;
  left: 8%;
  top: 2%;
  font-weight: 700;
  font-size: calc(var(--cw) * 0.5);
  line-height: 1;
  letter-spacing: -0.04em;
}

.card .pip-small {
  position: absolute;
  left: 9%;
  top: 40%;
  width: calc(var(--cw) * 0.27);
  height: calc(var(--cw) * 0.27);
  fill: currentColor;
}

.card .pip-big {
  position: absolute;
  right: 7%;
  bottom: 6%;
  width: calc(var(--cw) * 0.5);
  height: calc(var(--cw) * 0.5);
  fill: currentColor;
}

/* Small cards only need the rank and one clear suit. */
.card-sm .rank {
  font-size: calc(var(--cw) * 0.56);
}

.card-sm .pip-small {
  display: none;
}

.card-sm .pip-big {
  left: 50%;
  right: auto;
  bottom: 7%;
  width: calc(var(--cw) * 0.48);
  height: calc(var(--cw) * 0.48);
  transform: translateX(-50%);
}

.suit-h,
.suit-d {
  color: var(--suit-red);
}

.suit-s,
.suit-c {
  color: var(--ink);
}

.four-color .suit-d {
  color: var(--suit-blue);
}

.four-color .suit-c {
  color: var(--suit-green);
}

.card.back {
  background-color: var(--felt);
  background-image:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.11) 0 1.5px, transparent 1.5px 6px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.11) 0 1.5px, transparent 1.5px 6px);
  border: 2px solid var(--card);
}

.card.deal {
  animation: deal 300ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes deal {
  from {
    opacity: 0;
    transform: translateY(-12px) rotate(-5deg) scale(0.9);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.board.showdown .card:not(.best) {
  filter: brightness(0.55) saturate(0.7);
}

.card.best {
  transform: translateY(-4px);
  box-shadow:
    0 0 0 2px var(--amber),
    0 8px 18px rgba(0, 0, 0, 0.35);
}

.mucked .card {
  filter: brightness(0.5) saturate(0.5);
}

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

.seats {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.seat {
  position: absolute;
  width: var(--seat-w);
  min-height: var(--seat-h);
  transform: translate(-50%, -50%);
  pointer-events: auto;
  display: grid;
  place-items: center;
  z-index: 2;
}

.plate {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: var(--seat-h);
  padding: 6px 8px 9px;
  border-radius: 14px;
  border: 1px solid rgba(241, 235, 223, 0.14);
  background: var(--plate);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  text-align: center;
  transition:
    border-color 200ms,
    box-shadow 200ms,
    opacity 200ms;
}

.seat.empty .plate,
.seat.empty .seat-cards {
  display: none;
}

.plate-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--slate);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plate-stack {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.plate-stack.status {
  font-size: 15px;
  color: var(--slate);
}

.seat.you .plate {
  background: #0c1830;
  border-color: rgba(255, 195, 90, 0.4);
}

.seat.you .plate-name {
  color: var(--cream);
}

.seat.active .plate {
  border-color: var(--amber);
  box-shadow:
    0 0 0 2px var(--amber),
    0 0 30px rgba(255, 195, 90, 0.38);
}

.seat.folded .plate,
.seat.out .plate {
  opacity: 0.5;
}

.seat.away .plate {
  opacity: 0.6;
}

.seat.winner .plate {
  border-color: var(--amber);
  box-shadow: 0 0 0 1px var(--amber);
}

.plate-timer {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 3px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  opacity: 0;
  overflow: hidden;
}

.plate-timer.running {
  opacity: 1;
}

.plate-timer i {
  display: block;
  height: 100%;
  background: var(--amber);
  transform-origin: left center;
}

.plate-timer.low i {
  background: #ff7b6b;
}

.seat-cards {
  position: absolute;
  z-index: 0;
  bottom: calc(100% - 12px);
  left: 50%;
  display: flex;
  gap: 2px;
  transform: translateX(-50%);
}

.seat.cards-below .seat-cards {
  top: calc(100% + 3px);
  bottom: auto;
}

.seat.side-left .seat-cards {
  top: 50%;
  bottom: auto;
  left: calc(100% + 4px);
  transform: translateY(-50%);
}

.seat.side-right .seat-cards {
  top: 50%;
  bottom: auto;
  left: auto;
  right: calc(100% + 4px);
  transform: translateY(-50%);
}

.seat-tag {
  position: absolute;
  z-index: 2;
  top: calc(100% - 7px);
  max-width: 150%;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seat.cards-below .seat-tag {
  top: auto;
  bottom: calc(100% - 7px);
}

.seat-tag.hand-name {
  background: var(--amber);
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

.sit-button {
  width: 100%;
  min-height: var(--seat-h);
  border-radius: 14px;
  border: 1.5px dashed rgba(241, 235, 223, 0.4);
  background: rgba(10, 16, 30, 0.35);
  color: var(--cream);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}

.sit-button:hover {
  border-color: var(--amber);
  color: var(--amber);
}

/* A bot's seat can be taken: the whole plate becomes the button. */
.seat.can-take .sit-button {
  position: absolute;
  inset: 0;
  z-index: 3;
  min-height: 44px;
  border-color: transparent;
  background: transparent;
}

.seat.can-take .sit-button:hover,
.seat.can-take .sit-button:focus-visible {
  border-color: var(--amber);
}

.seat.empty:not(.can-sit)::before {
  content: '';
  width: 64%;
  height: calc(var(--seat-h) * 0.62);
  border-radius: 12px;
  border: 1px dashed rgba(241, 235, 223, 0.1);
}

.bet {
  position: absolute;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px 3px 4px;
  border-radius: 999px;
  background: rgba(10, 16, 30, 0.6);
  font-weight: 700;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.bet.won {
  background: var(--amber);
  color: var(--ink);
  font-weight: 800;
  animation: pop 420ms cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.chip-icon {
  position: relative;
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: conic-gradient(
    #fff 0 11%,
    var(--chip) 11% 25%,
    #fff 25% 36%,
    var(--chip) 36% 50%,
    #fff 50% 61%,
    var(--chip) 61% 75%,
    #fff 75% 86%,
    var(--chip) 86% 100%
  );
}

.chip-icon::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--chip);
  border: 1px solid rgba(255, 255, 255, 0.55);
}

.dealer-button {
  position: absolute;
  z-index: 4;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  font-weight: 800;
  font-size: 14px;
  transform: translate(-50%, -50%);
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.4),
    inset 0 -2px 0 rgba(0, 0, 0, 0.14);
  transition:
    left 450ms ease,
    top 450ms ease;
  pointer-events: none;
}

/* ---------------------------------------------------------------------------
   The dock */

.dock {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: 'hand controls';
  align-items: center;
  gap: 12px 20px;
  min-height: 96px;
  padding: 12px 22px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--navy-deep);
  transition: box-shadow 200ms;
}

body.your-turn .dock {
  box-shadow: inset 0 3px 0 var(--amber);
}

.dock-hand {
  grid-area: hand;
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.hero-cards {
  display: flex;
  gap: 5px;
}

.hero-cards:empty {
  display: none;
}

.dock-status {
  min-width: 0;
}

.hero-hand {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.15;
}

.hero-hand:empty {
  display: none;
}

.dock-message {
  font-size: 16px;
  color: var(--slate);
}

body.your-turn .dock-message {
  color: var(--amber);
  font-weight: 700;
}

.actions,
.seat-controls {
  grid-area: controls;
}

.actions {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.action-buttons .btn {
  min-width: 118px;
  min-height: 52px;
  font-size: 18px;
}

body.acting .action-buttons .btn {
  opacity: 0.6;
  pointer-events: none;
}

.raise-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.raise-controls.short .presets,
.raise-controls.short .raise-input {
  display: none;
}

.presets {
  display: flex;
  gap: 6px;
}

.preset {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(241, 235, 223, 0.2);
  background: transparent;
  color: var(--cream);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
}

.preset:hover {
  border-color: rgba(241, 235, 223, 0.5);
}

.preset.selected {
  border-color: var(--amber);
  color: var(--amber);
}

.raise-input {
  display: flex;
  align-items: center;
  gap: 10px;
}

#raise-slider {
  width: 190px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--amber);
  box-shadow: none;
}

#raise-amount {
  width: 104px;
  min-height: 40px;
  padding: 6px 10px;
  text-align: right;
}

.seat-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.seat-controls:empty {
  display: none;
}

/* ---------------------------------------------------------------------------
   Side panel */

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid var(--line);
  background: #111c34;
}

.panel-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 12px 0;
  border-bottom: 1px solid var(--line);
}

.panel-tab {
  padding: 10px 8px 9px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--slate);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}

.panel-tab[aria-selected='true'] {
  color: var(--cream);
  border-bottom-color: var(--amber);
}

.panel-close {
  display: none;
  margin-left: auto;
  padding: 8px;
  border: 0;
  background: none;
  color: var(--slate);
  font-weight: 600;
  cursor: pointer;
}

.panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px;
}

.panel-body[data-panel='feed'] {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 0;
  padding: 12px 16px;
  list-style: none;
  font-size: 15px;
  line-height: 1.4;
}

.feed li {
  padding: 2px 0;
  overflow-wrap: anywhere;
}

.feed-log {
  color: var(--slate);
}

.feed-hand {
  margin-top: 10px;
  padding-top: 8px !important;
  border-top: 1px solid var(--line);
  color: var(--cream);
  font-weight: 700;
}

.feed-board {
  color: var(--cream);
}

.feed-win {
  color: var(--amber);
  font-weight: 600;
}

.feed-chat {
  color: var(--cream);
}

.feed-name {
  font-weight: 700;
  color: #ffd796;
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}

.chat-form input {
  flex: 1;
  min-height: 40px;
  padding: 8px 10px;
  font-size: 16px;
}

.panel-note {
  margin: 0 0 12px;
  color: var(--slate);
  font-size: 14px;
}

.ledger {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  margin-bottom: 12px;
}

.ledger th {
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
  color: var(--slate);
  font-size: 14px;
  font-weight: 600;
  text-align: right;
}

.ledger th:first-child {
  text-align: left;
}

.ledger td {
  padding: 8px 4px;
  border-bottom: 1px solid rgba(241, 235, 223, 0.06);
}

.ledger .num {
  text-align: right;
}

.ledger-name {
  font-weight: 600;
}

.ledger-left {
  color: var(--slate);
  font-weight: 500;
}

.ledger .up {
  color: var(--up);
  font-weight: 700;
}

.ledger .down {
  color: var(--down);
  font-weight: 700;
}

.settings-group {
  display: grid;
  gap: 10px;
  margin-bottom: 26px;
}

.settings-group h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.settings-form {
  display: grid;
  gap: 10px;
}

.settings-form .field > span {
  font-size: 13px;
}

.settings-form input,
.settings-form select {
  min-height: 40px;
  padding: 7px 10px;
  font-size: 16px;
}

.settings-form .btn {
  justify-self: start;
}

/* Checkboxes keep their own size inside the settings form. */
.settings-form .check {
  min-height: 44px;
}

.settings-form .check input {
  flex: none;
  min-height: 20px;
  padding: 0;
}

.stats-title {
  margin: 22px 0 8px;
  font-size: 18px;
  font-weight: 700;
}

.host-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.player-admin {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.admin-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(241, 235, 223, 0.06);
}

.admin-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-where {
  color: var(--slate);
  font-weight: 500;
}

/* ---------------------------------------------------------------------------
   Dialogs, toasts */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 12, 24, 0.74);
  backdrop-filter: blur(4px);
}

.dialog {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 26px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #15223f;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.dialog h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
}

.dialog-info {
  margin: 0;
  color: var(--slate);
}

.dialog-link {
  color: var(--slate);
  font-size: 15px;
  text-align: center;
  text-underline-offset: 3px;
}

.toasts {
  position: fixed;
  left: 50%;
  bottom: 130px;
  z-index: 60;
  display: grid;
  gap: 8px;
  width: min(440px, calc(100% - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  padding: 10px 14px;
  border-radius: 10px;
  border-left: 3px solid var(--amber);
  background: #22345a;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  overflow-wrap: anywhere;
  pointer-events: auto;
  animation: toast-in 200ms ease-out;
  transition: opacity 300ms;
}

.toast-error {
  border-left-color: #ff7b6b;
}

.toast.leaving {
  opacity: 0;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ---------------------------------------------------------------------------
   Smaller screens */

@media (max-width: 960px) {
  .lobby {
    grid-template-columns: 1fr;
    grid-template-areas:
      'head'
      'felt'
      'join';
    padding: 36px 20px 48px;
    row-gap: 28px;
  }

  .brand {
    white-space: normal;
    font-size: clamp(56px, 15vw, 96px);
  }

  .lobby-felt {
    min-height: 0;
    padding: 56px 36px;
    border-radius: 160px / 120px;
  }

  .lobby-felt::after {
    inset: 18px;
    border-radius: 140px / 100px;
  }

  .game-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    width: min(380px, 100%);
    transform: translateX(100%);
    visibility: hidden;
    transition:
      transform 240ms ease,
      visibility 0s linear 240ms;
    box-shadow: -20px 0 50px rgba(0, 0, 0, 0.45);
  }

  body.panel-open .panel {
    transform: none;
    visibility: visible;
    transition: transform 240ms ease;
  }

  .panel-toggle,
  .panel-close {
    display: inline-flex;
  }
}

@media (max-width: 720px) {
  .table-area {
    --seat-w: 88px;
    --seat-h: 46px;
    --board-cw: clamp(30px, 8.6vw, 46px);
  }

  .stage {
    padding: 12px 8px 6px;
  }

  .card-sm {
    --cw: 25px;
  }

  .card-lg {
    --cw: 46px;
  }

  .plate {
    padding: 4px 6px 8px;
    border-radius: 12px;
  }

  .plate-name {
    font-size: 13px;
  }

  .plate-stack {
    font-size: 15px;
  }

  .plate-stack.status {
    font-size: 13px;
  }

  .seat-tag {
    font-size: 12px;
    padding: 0 7px;
  }

  .bet {
    font-size: 13px;
    padding: 2px 7px 2px 3px;
  }

  .chip-icon {
    width: 13px;
    height: 13px;
  }

  .chip-icon::after {
    inset: 2.5px;
  }

  .dealer-button {
    width: 22px;
    height: 22px;
    font-size: 12px;
  }

  .felt {
    border-width: 9px;
  }

  .pot {
    font-size: 16px;
  }

  .felt-message {
    font-size: 14px;
  }

  .topbar {
    gap: 10px;
    padding: 8px 12px;
  }

  .home-link {
    display: none;
  }

  .table-name {
    font-size: 16px;
  }

  .table-meta {
    font-size: 13px;
  }

  .dock {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      'hand'
      'controls';
    gap: 10px;
    min-height: 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  }

  .hero-hand {
    font-size: 17px;
  }

  .dock-message {
    font-size: 15px;
  }

  .actions {
    justify-items: stretch;
  }

  .action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr 1.25fr;
  }

  .action-buttons .btn {
    min-width: 0;
    padding: 8px 6px;
    font-size: 17px;
  }

  .raise-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .presets {
    justify-content: space-between;
    overflow-x: auto;
  }

  .preset {
    padding: 5px 9px;
    font-size: 13px;
  }

  #raise-slider {
    flex: 1;
    width: auto;
  }

  .seat-controls {
    justify-content: stretch;
  }

  .seat-controls .btn {
    flex: 1;
  }

  .toasts {
    bottom: 170px;
  }
}

@media (max-width: 420px) {
  .table-area {
    --seat-w: 78px;
  }

  .topbar-actions .btn {
    padding: 6px 10px;
    font-size: 14px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .lobby-felt {
    padding: 40px 20px;
    border-width: 12px;
    border-radius: 40px;
  }

  .lobby-felt::after {
    inset: 10px;
    border-radius: 30px;
  }

  .create-form {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 640px) and (min-width: 721px) {
  .table-area {
    --seat-w: 104px;
    --seat-h: 48px;
    --board-cw: clamp(34px, 6vh, 50px);
  }

  .stage {
    padding: 10px 16px 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
  }
}
