:root {
  --felt-deep: #083a24;
  --felt: #0e8f4f;
  --felt-lit: #2ee38a;
  --rail: #ffd86b;
  --rail-glow: #7dffd2;
  --gold: #ffd36a;
  --gold-soft: #fff0b3;
  --gold-dim: #d4a63a;
  --ink: #1a0a2e;
  --cream: #fff8ea;
  --muted: #e4d4ff;
  --fold: #e1263d;
  --call: #14c9a0;
  --call-blue: #2f8cff;
  --raise: #ffd36a;
  --night-1: #3b0d6e;
  --night-2: #1a0a3c;
  --night-3: #0b0520;
  --pink: #ff5aaa;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  --font-display: "Cinzel", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --font-ui: "Nunito", "Segoe UI", system-ui, sans-serif;
  --radius: 18px;
  --safe-b: max(12px, env(safe-area-inset-bottom));
  --safe-t: max(8px, env(safe-area-inset-top));
  --board-gap: clamp(3px, 1vw, 10px);
  --opp-card-w: clamp(16px, 4.6vw, 28px);
  --hero-card-w: clamp(40px, min(13.5vw, 7.5svh), 60px);
  --avatar: clamp(34px, 9.5vw, 64px);
}

html { height: 100%; }

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--night-3);
  color: var(--cream);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100svh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 12% 88%, rgba(255, 80, 170, 0.5), transparent 42%),
    radial-gradient(circle at 92% 10%, rgba(80, 170, 255, 0.42), transparent 40%),
    radial-gradient(circle at 50% -10%, #7a3ae0 0%, var(--night-1) 32%, var(--night-2) 62%, var(--night-3) 100%);
  background-attachment: fixed;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
img, svg { display: block; max-width: 100%; }
.hidden { display: none !important; }

#app {
  min-height: 100svh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── Logo ── */
.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  text-align: center;
  color: var(--gold-soft);
}
.logo-mark {
  width: min(240px, 78vw);
  height: auto;
  filter: drop-shadow(0 8px 18px rgba(255, 90, 180, 0.35));
}
.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.95rem;
  color: var(--gold-soft);
  text-shadow: 0 0 12px rgba(255, 211, 106, 0.45);
}

/* ── Lobby ── */
#lobby {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(var(--safe-t) + 1.25rem) 1.25rem calc(var(--safe-b) + 1rem);
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}
.lobby-hero { margin: 1rem 0 0.5rem; }
.tagline {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.free-badge {
  margin-top: 0.85rem;
  border: 1px solid rgba(255, 211, 106, 0.55);
  color: var(--gold-soft);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 0.28rem 0.9rem;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 800;
}
.lobby-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  margin-top: 1.6rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 18px;
  padding: 0.95rem 1.4rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: transform 0.16s cubic-bezier(.2,1.4,.3,1), filter 0.15s ease;
}
.btn:active { transform: scale(0.96) translateY(2px); }
.btn-gold {
  background: linear-gradient(180deg, #ffe9a0 0%, var(--gold) 46%, #e09a1a 100%);
  color: var(--ink);
  box-shadow: 0 5px 0 #b06a10, 0 10px 22px rgba(255, 80, 170, 0.28);
}
.btn-gold:hover { filter: brightness(1.06); }
.btn-ghost {
  border: 2px solid rgba(255, 211, 106, 0.5);
  color: var(--gold-soft);
  background: rgba(255, 255, 255, 0.08);
}
.btn-danger {
  background: linear-gradient(180deg, #ff8b8b 0%, #ff3b55 48%, #c41432 100%);
  color: #fff;
  box-shadow: 0 4px 0 #8a1024, 0 7px 14px rgba(180, 0, 40, 0.28);
}
.btn-call {
  background: linear-gradient(180deg, #7df0d4 0%, #1ec9a0 40%, #2f8cff 100%);
  color: #fff;
  text-shadow: 0 1px 0 rgba(0,0,0,0.2);
  box-shadow: 0 4px 0 #155a8a, 0 7px 14px rgba(20, 80, 200, 0.28);
}
.btn-raise {
  background: linear-gradient(180deg, #fff0b0 0%, var(--gold) 46%, #e09a1a 100%);
  color: var(--ink);
  box-shadow: 0 4px 0 #b06a10, 0 7px 14px rgba(255, 180, 40, 0.28);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.opp-picker {
  margin-top: 1.4rem;
  width: 100%;
  text-align: center;
}
.opp-picker label {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
  font-weight: 800;
}
.seg {
  display: flex;
  border: 2px solid rgba(255, 211, 106, 0.45);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
}
.seg button {
  flex: 1;
  padding: 0.55rem 0.4rem;
  color: var(--muted);
  font-weight: 800;
}
.seg button[aria-pressed="true"] {
  background: linear-gradient(180deg, #ffe9a0, var(--gold));
  color: var(--ink);
}

.stats {
  width: 100%;
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}
.stat {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 211, 106, 0.28);
  border-radius: 18px;
  padding: 0.8rem 0.7rem 0.7rem;
  text-align: center;
  backdrop-filter: blur(8px);
}
.stat b {
  display: block;
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--gold-soft);
  font-weight: 700;
}
.stat span {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.reset-link {
  margin-top: 0.9rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: underline;
  background: none;
  font-weight: 700;
}

.site-footer {
  margin-top: auto;
  padding-top: 1.6rem;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.site-footer strong { color: var(--gold-soft); font-weight: 800; }

/* ── Overlays ── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 4, 28, 0.82);
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  overflow: auto;
}
.overlay .sheet {
  background: linear-gradient(180deg, #4a1d86, #1d0a40);
  border: 2px solid rgba(255, 211, 106, 0.45);
  border-radius: 24px 24px 16px 16px;
  padding: 1.2rem 1.2rem 1.4rem;
  width: min(560px, 100%);
  max-height: min(86dvh, 800px);
  overflow: auto;
  box-shadow: var(--shadow), 0 0 30px rgba(255, 90, 180, 0.2);
  margin-bottom: var(--safe-b);
}
.sheet h2 {
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  color: var(--gold-soft);
  margin: 0 0 0.8rem;
  font-size: 1.25rem;
}
.sheet h3 {
  margin: 1rem 0 0.35rem;
  font-size: 0.95rem;
  color: var(--gold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sheet p, .sheet li { color: var(--cream); }
.sheet ol, .sheet ul { padding-left: 1.15rem; margin: 0.25rem 0 0.5rem; }
.sheet li { margin: 0.25rem 0; }
.ranks { columns: 2; gap: 0.4rem; font-size: 0.92rem; }
.close-row { margin-top: 1rem; display: flex; justify-content: flex-end; }

@media (min-width: 640px) {
  .overlay { align-items: center; }
  .overlay .sheet { border-radius: 24px; }
}

/* ── Table screen ── */
#table-screen {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100svh;
  min-height: 0;
  overflow: hidden;
  padding-top: var(--safe-t);
  box-sizing: border-box;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.7rem;
  min-height: 48px;
  flex: 0 0 auto;
}
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255, 211, 106, 0.45);
  color: var(--gold-soft);
  background: rgba(255, 255, 255, 0.1);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  flex: 0 0 auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.topbar .wordmark { flex: 1; text-align: center; font-size: 0.82rem; }
.chip-pill {
  border: 2px solid rgba(255, 211, 106, 0.55);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-weight: 800;
  color: var(--ink);
  font-size: 0.88rem;
  background: linear-gradient(180deg, #fff0b0, var(--gold));
  white-space: nowrap;
  box-shadow: 0 3px 0 #b06a10;
}

.table-stage {
  flex: 1 1 auto;
  position: relative;
  min-height: 0;
  min-width: 0;
  margin: 0 0.2rem;
}
.table {
  position: absolute;
  inset: 4px 6px 4px;
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(0, 1fr) minmax(0, max-content);
  grid-template-rows: minmax(min-content, auto) minmax(min-content, 1fr) minmax(0, auto);
  grid-template-areas:
    "top top top"
    "left board right"
    "hero hero hero";
  align-items: stretch;
  gap: 2px 4px;
  padding: 12px 12px max(20px, 3.6vh);
  min-height: 0;
  border-radius: 50% / 44%;
  background:
    radial-gradient(ellipse at 50% 22%, rgba(255,255,255,0.28) 0%, rgba(255,255,255,0) 36%),
    radial-gradient(ellipse at 50% 42%, #39d87a 0%, #12a053 42%, #087a3e 78%, #04542b 100%);
  border: 7px solid var(--rail);
  box-shadow:
    0 0 0 3px #fff6c8,
    0 0 16px 4px rgba(125, 255, 210, 0.7),
    0 0 36px 10px rgba(255, 90, 180, 0.28),
    inset 0 16px 28px rgba(255, 255, 255, 0.16),
    inset 0 -20px 30px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}
.table::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: inherit;
  border: 2px solid rgba(255, 255, 255, 0.18);
  pointer-events: none;
  z-index: 1;
  box-shadow: inset 0 0 18px rgba(0, 40, 20, 0.25);
}
.table-brand {
  grid-area: board;
  justify-self: center;
  align-self: center;
  font-family: var(--font-display);
  letter-spacing: 0.28em;
  font-size: clamp(0.5rem, 2.4vw, 0.85rem);
  color: rgba(255, 255, 255, 0.16);
  text-transform: uppercase;
  pointer-events: none;
  white-space: nowrap;
  z-index: 0;
  transform: translateY(-36%);
}

.seat-zone {
  display: flex;
  min-width: 0;
  min-height: 0;
  z-index: 2;
  overflow: visible;
}
.seat-zone-top {
  grid-area: top;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 0;
  padding: 2px clamp(16px, 6.5vw, 40px) 0;
  z-index: 3;
  overflow: visible;
}
.opp-row {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(10px, 4vw, 28px);
  min-width: 0;
  min-height: 0;
}
.opp-row:empty { display: none; }
.opp-row-shoulders {
  justify-content: space-between;
  padding: 0 clamp(8px, 5vw, 36px);
  margin-top: 2px;
}
.opp-row .seat {
  flex: 0 0 auto;
}
.seat-zone-left {
  grid-area: left;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0 1px 0 0;
  max-width: 22vw;
}
.seat-zone-right {
  grid-area: right;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0 0 0 1px;
  max-width: 22vw;
}
.seat-zone-hero {
  grid-area: hero;
  justify-content: center;
  align-items: flex-end;
  padding-bottom: 14px;
  overflow: visible;
  min-height: 0;
  z-index: 3;
}
.seat.hero { max-height: none; }

.board {
  grid-area: board;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  z-index: 5;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 4px 4px 2px;
  box-sizing: border-box;
  overflow: hidden;
  min-height: min-content;
}
.community .card {
  max-height: 100%;
}
.community {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: var(--board-gap);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  flex: 0 1 auto;
}
.pot-label {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-ui);
  font-weight: 800;
  color: var(--ink);
  font-size: clamp(0.72rem, 2.8vw, 0.95rem);
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #fff6c4, #ffd36a);
  border: 2px solid #fff;
  border-radius: 999px;
  padding: 0.15rem 0.7rem 0.15rem 0.4rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 0 0 auto;
  box-shadow: 0 3px 0 #b06a10, 0 6px 14px rgba(0,0,0,0.25);
  z-index: 6;
}
.pot-chips {
  width: 18px;
  height: 16px;
  flex: 0 0 auto;
  background:
    radial-gradient(circle at 50% 70%, #2f8cff 40%, #1a5ad4 41%) center 6px / 14px 14px no-repeat,
    radial-gradient(circle at 50% 70%, #ff4d6d 40%, #c41432 41%) center 3px / 14px 14px no-repeat,
    radial-gradient(circle at 50% 70%, #fff 40%, #d0d0d0 41%) center 0 / 14px 14px no-repeat;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.3));
}
.street-label {
  font-size: clamp(0.58rem, 2vw, 0.7rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.75);
  font-weight: 800;
  flex: 0 0 auto;
}

/* Seats */
.seat {
  position: relative;
  width: auto;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
  min-width: 0;
}
.seat.hero { width: auto; max-width: 96%; }
.seat-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}
.seat-ident {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}
.seat.hero {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: center;
  gap: 0.4rem;
}
.seat.hero .seat-cards { order: 1; margin: 0; }
.seat.hero .seat-ident {
  order: 2;
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas:
    "avatar bubble"
    "avatar meta";
  align-items: end;
  column-gap: 0.35rem;
  row-gap: 1px;
}
.seat.hero .avatar-wrap { grid-area: avatar; }
.seat.hero .action-bubble {
  grid-area: bubble;
  position: static;
  left: auto;
  top: auto;
  transform: none;
  margin: 0;
  justify-self: start;
}
.seat.hero .seat-meta {
  grid-area: meta;
  margin-top: 0;
  align-items: flex-start;
}
.avatar-wrap {
  position: relative;
  width: var(--avatar);
  height: var(--avatar);
  flex: 0 0 auto;
}
.avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #fff6c8;
  box-shadow: 0 3px 8px rgba(0,0,0,0.35);
  background: #2a1a62;
}
.avatar svg { width: 100%; height: 100%; }
.timer-ring {
  position: absolute;
  inset: -5px;
  width: calc(100% + 10px);
  height: calc(100% + 10px);
  transform: rotate(-90deg);
  pointer-events: none;
}
.timer-bg, .timer-fg {
  fill: none;
  stroke-width: 2.4;
}
.timer-bg { stroke: rgba(255,255,255,0.28); }
.timer-fg {
  stroke: #7dffd2;
  stroke-linecap: round;
  stroke-dasharray: 97.4;
  stroke-dashoffset: 97.4;
}
.seat.to-act .timer-fg {
  stroke: #ffe566;
  animation: timerDrain 9s linear forwards;
}
.seat.to-act .avatar {
  box-shadow: 0 0 0 2px #ffe566, 0 0 14px rgba(125, 255, 210, 0.85);
}
@keyframes timerDrain {
  to { stroke-dashoffset: 0; }
}
.seat-cards {
  display: flex;
  gap: 2px;
  min-height: 0;
}
.seat:not(.hero) {
  padding-top: 0.7rem;
  padding-bottom: 1px;
}
.seat:not(.hero) .seat-cards {
  position: absolute;
  left: 50%;
  top: calc(0.7rem + var(--avatar) * 0.55);
  transform: translateX(-50%);
  margin: 0;
  z-index: 1;
  pointer-events: none;
}
.seat:not(.hero) .avatar-wrap { z-index: 2; }
.seat:not(.hero) .card {
  margin-left: -8px;
  transform: rotate(10deg);
  box-shadow: 0 2px 4px rgba(0,0,0,0.35);
}
.seat:not(.hero) .card:first-child { margin-left: 0; transform: rotate(-10deg); z-index: 1; }

.seat.hero .seat-cards { gap: 8px; margin: 0; align-self: end; }
.seat-meta {
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 0;
  max-width: 100%;
}
.seat-name {
  font-weight: 800;
  font-size: clamp(0.58rem, 2.3vw, 0.75rem);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  white-space: nowrap;
  overflow: visible;
  background: rgba(20, 8, 48, 0.82);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 999px;
  padding: 0.08rem 0.45rem;
}
.seat-chips {
  font-size: clamp(0.58rem, 2.2vw, 0.75rem);
  color: var(--gold-soft);
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  white-space: nowrap;
}
.seat.hero .seat-chips { font-size: clamp(0.55rem, 2vw, 0.7rem); white-space: normal; max-width: 4.4rem; line-height: 1.15; text-align: left; }
.seat.folded { opacity: 0.5; }
.seat.folded .seat-cards { filter: grayscale(0.6); }
.seat.folded .avatar { filter: grayscale(0.5) brightness(0.8); }
.seat.winner .avatar {
  box-shadow: 0 0 0 2px var(--gold), 0 0 16px rgba(255, 211, 106, 0.9);
}
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0;
  background: var(--gold);
  color: var(--ink);
  padding: 0 0.2rem;
  flex: 0 0 auto;
}
.badge.sb, .badge.bb { background: #eee8d0; }
.action-bubble {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 8, 48, 0.92);
  color: var(--gold-soft);
  border: 1px solid var(--gold-dim);
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 0.08rem 0.4rem;
  white-space: nowrap;
  z-index: 5;
}
.seat-pos-left .action-bubble,
.seat-pos-right .action-bubble { left: 50%; transform: translateX(-50%); }

/* Cards */
.card {
  --this-card-w: var(--opp-card-w);
  width: var(--this-card-w);
  aspect-ratio: 5 / 7;
  height: auto;
  border-radius: 6px;
  background: linear-gradient(180deg, #fffdf6, #f3ead2);
  color: #161616;
  position: relative;
  box-shadow: 0 3px 0 rgba(0,0,0,0.15), 0 6px 10px rgba(0,0,0,0.28);
  border: 1px solid rgba(0, 0, 0, 0.12);
  font-family: var(--font-ui);
  font-size: calc(var(--this-card-w) * 0.3);
  font-weight: 800;
  user-select: none;
  flex: 0 0 auto;
}
.card.red { color: #e1182c; }
.card-rank {
  position: absolute;
  top: 0.12em;
  left: 0.18em;
  font-weight: 800;
  font-size: 1.15em;
  line-height: 1;
}
.card-suit {
  position: absolute;
  top: 1.22em;
  left: 0.18em;
  font-size: 1em;
  line-height: 1;
}
.card-suit-lg {
  position: absolute;
  right: 0.12em;
  bottom: 0.02em;
  font-size: 1.45em;
  line-height: 1;
  opacity: 0.95;
}
.card.back {
  background:
    radial-gradient(circle at 50% 50%, rgba(255,211,106,0.35), transparent 50%),
    repeating-linear-gradient(45deg, #3b1d78 0 5px, #2a125c 5px 10px);
  border: 1px solid #f0d36a;
  box-shadow: inset 0 0 0 2px #1a0a3c, 0 3px 6px rgba(0, 0, 0, 0.4);
}
.card.back::after {
  content: "♠";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--gold);
  font-size: 1.5em;
  opacity: 0.9;
}
.card.placeholder {
  background: rgba(255, 255, 255, 0.12);
  border: 1px dashed rgba(255, 255, 255, 0.3);
  box-shadow: none;
}
.card.winner-card {
  box-shadow: 0 0 0 2px var(--gold), 0 0 14px rgba(255, 211, 106, 0.9);
}
.community .card {
  --this-card-w: clamp(32px, min(12.5vw, 9svh), 68px);
  width: min(var(--this-card-w), calc((100% - 4 * var(--board-gap)) / 5));
  flex: 0 1 auto;
  min-width: 0;
  max-width: calc((100% - 4 * var(--board-gap)) / 5);
  border-radius: 8px;
}
.seat.hero .card {
  --this-card-w: var(--hero-card-w);
  border-radius: 10px;
}

.card.deal-in { animation: dealIn 0.42s cubic-bezier(.2,1.4,.3,1) both; }
.card.flip-in { animation: flipIn 0.5s cubic-bezier(.2,1.3,.3,1) both; }

@keyframes dealIn {
  from { opacity: 0; transform: translateY(-22px) scale(0.7) rotate(-12deg); }
  to { opacity: 1; transform: none; }
}
@keyframes flipIn {
  0% { transform: rotateY(90deg) scale(0.85); opacity: 0.2; }
  60% { transform: rotateY(-8deg) scale(1.04); opacity: 1; }
  100% { transform: none; opacity: 1; }
}

html.preview .card.deal-in,
html.preview .card.flip-in,
html.preview .seat.to-act .timer-fg { animation: none; }
html.preview .seat.to-act .timer-fg { stroke-dashoffset: 40; }

/* Action bar */
.action-bar {
  flex: 0 0 auto;
  padding: 0.2rem 0.65rem calc(var(--safe-b) + 0.22rem);
  background: linear-gradient(180deg, transparent, rgba(12, 4, 32, 0.88) 22%);
  z-index: 8;
  min-width: 0;
}
.action-status {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  min-height: 0;
  margin-bottom: 0.15rem;
  font-weight: 700;
}
.action-status strong { color: var(--gold-soft); }
.preset-row {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin-bottom: 0.22rem;
}
.preset {
  border-radius: 999px;
  padding: 0.18rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  background: linear-gradient(180deg, #fff, #e8dcff);
  box-shadow: 0 3px 0 #7a5ab0;
}
.preset:active { transform: translateY(1px); }
.preset-allin {
  background: linear-gradient(180deg, #ffb0c8, #ff5aaa);
  color: #fff;
  box-shadow: 0 3px 0 #a02060;
}
.raise-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.22rem;
}
.raise-row input[type="range"] {
  flex: 1;
  accent-color: var(--gold);
  min-width: 0;
  height: 1.4rem;
}
.raise-amt {
  min-width: 4.5rem;
  text-align: right;
  font-weight: 800;
  color: var(--gold-soft);
  font-size: 0.95rem;
}
.action-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}
.action-row .btn {
  padding: 0.62rem 0.35rem;
  letter-spacing: 0.04em;
  font-size: 0.86rem;
  border-radius: 18px;
}
.action-row.four { grid-template-columns: 1fr 1.15fr 1.15fr; }
.sub-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.2rem;
}
.linkish {
  font-size: 0.75rem;
  color: var(--muted);
  text-decoration: underline;
  font-weight: 700;
  flex: 0 0 auto;
}
.free-note {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  flex: 0 0 auto;
}
.react-tray {
  display: flex;
  gap: 0.15rem;
  justify-content: center;
  flex: 1;
}
.react-tray button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  font-size: 1rem;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: transform 0.16s cubic-bezier(.2,1.6,.3,1);
}
.react-tray button:active { transform: scale(1.25); }

.hand-end {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  align-items: stretch;
}
.hand-end .btn {
  padding: 0.55rem 0.35rem;
  font-size: 0.8rem;
  white-space: nowrap;
}
.winner-banner {
  text-align: center;
  color: var(--gold-soft);
  font-family: var(--font-display);
  letter-spacing: 0.04em;
}

.history {
  flex: 0 1 auto;
  max-height: min(28vh, 9rem);
  overflow: auto;
  background: rgba(20, 8, 48, 0.7);
  border: 1px solid rgba(255, 211, 106, 0.28);
  border-radius: 14px;
  padding: 0.55rem 0.7rem;
  margin: 0.35rem 0.7rem 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.history h3 {
  margin: 0 0 0.3rem;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}
.history li { margin: 0.15rem 0; }
.history ul { list-style: none; padding: 0; margin: 0; }
.refill-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 0.5rem;
}

/* FX: flying chips, emojis, confetti, banners */
#fx-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  overflow: hidden;
}
.fly-chip {
  position: fixed;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #2f8cff 40%, #1548a8);
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  z-index: 21;
  will-change: transform, opacity;
}
.fly-chip.c1 { background: radial-gradient(circle at 35% 30%, #fff, #ff4d6d 40%, #b01030); }
.fly-chip.c2 { background: radial-gradient(circle at 35% 30%, #fff, #ffd36a 40%, #c48910); }
.float-emoji {
  position: fixed;
  font-size: 1.8rem;
  pointer-events: none;
  z-index: 22;
  animation: floatUp 1.05s cubic-bezier(.2,.8,.2,1) forwards;
}
@keyframes floatUp {
  0% { transform: translate(-50%, 0) scale(0.6); opacity: 0; }
  20% { transform: translate(-50%, -12px) scale(1.2); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--drift, 0px)), -90px) scale(1); opacity: 0; }
}
.win-banner {
  position: relative;
  left: auto;
  top: auto;
  transform: none;
  z-index: 8;
  flex: 0 0 auto;
  background: linear-gradient(180deg, #fff6c4, #ffd36a);
  color: var(--ink);
  font-weight: 800;
  font-size: clamp(0.7rem, 2.5vw, 0.95rem);
  padding: 0.32rem 0.7rem;
  border-radius: 14px;
  border: 2px solid #fff;
  box-shadow: 0 4px 0 #b06a10, 0 8px 18px rgba(0,0,0,0.28);
  text-align: center;
  max-width: 100%;
  width: auto;
  margin: 0 auto 0.35rem;
  animation: popIn 0.35s cubic-bezier(.2,1.5,.3,1);
  pointer-events: none;
  line-height: 1.3;
}
@keyframes popIn {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.confetti {
  position: fixed;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  top: -12px;
  left: var(--x);
  background: var(--c);
  animation: confettiFall var(--dur) linear forwards;
  z-index: 24;
  pointer-events: none;
}
@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(640deg); opacity: 0.2; }
}

@media (max-width: 360px) {
  .table { inset: 3px 3px 3px; border-width: 5px; padding: 14px 20px 18px; gap: 1px 2px; }
  .table-stage { margin: 0 0.05rem; }
  .action-row .btn { padding: 0.7rem 0.2rem; font-size: 0.78rem; letter-spacing: 0.02em; }
  .action-row { gap: 0.32rem; }
  .react-tray button { width: 26px; height: 26px; font-size: 0.85rem; }
  .seat-zone-top { padding: 4px 28px 0; }
  .opp-row-shoulders { padding: 0 10px; }
  .free-note { font-size: 0.6rem; max-width: 7.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  :root { --avatar: clamp(26px, 8.5vw, 34px); --hero-card-w: clamp(30px, 11vw, 38px); }
  .seat-zone-hero { padding-bottom: 8px; }
  .seat.hero { column-gap: 0.35rem; }
  .community .card { --this-card-w: clamp(28px, 10.5vw, 36px); }
  .street-label { display: none; }
  .board { gap: 0.15rem; padding: 2px; }
  .seat:not(.hero) { padding-top: 0.45rem; }
  .pot-label { font-size: 0.72rem; padding: 0.1rem 0.5rem; }
  .action-status { font-size: 0.72rem; margin-bottom: 0.08rem; }
  .action-bar { padding: 0.12rem 0.5rem calc(var(--safe-b) + 0.15rem); }
}

@media (min-width: 720px) {
  .table { inset: 12px 10%; border-width: 10px; padding: 12px 18px 22px; }
  .community .card { --this-card-w: clamp(44px, 4.2vw, 58px); }
  .topbar .wordmark { font-size: 1.05rem; }
  .seat-zone-left, .seat-zone-right { max-width: 18vw; }
  .opp-row-shoulders { padding: 0 8%; justify-content: space-around; gap: 20%; }
  .board { padding-bottom: 10px; }
  :root { --avatar: 64px; --hero-card-w: clamp(48px, 5vw, 60px); }
}

/* Short viewports (landscape phones, iOS toolbar) */
@media (max-height: 500px) {
  .topbar { min-height: 34px; padding: 0.12rem 0.45rem; }
  .icon-btn { width: 30px; height: 30px; }
  .action-bar { padding: 0.12rem 0.5rem calc(var(--safe-b) + 0.12rem); }
  .action-status { min-height: 0; font-size: 0.72rem; margin-bottom: 0.08rem; }
  .action-row .btn { padding: 0.42rem 0.3rem; font-size: 0.75rem; border-radius: 14px; }
  .preset-row { margin-bottom: 0.15rem; }
  .preset { padding: 0.15rem 0.5rem; font-size: 0.68rem; }
  .raise-row { margin-bottom: 0.12rem; }
  .sub-actions { margin-top: 0.08rem; }
  .react-tray { display: none; }
  .table { inset: 2px 8px 2px; border-width: 4px; padding: 2px 10px 8px; border-radius: 46% / 42%; }
  .street-label { display: none; }
  .seat-zone-hero { padding-bottom: 4px; overflow: visible; }
  :root {
    --hero-card-w: clamp(22px, 6.5svh, 30px);
    --avatar: clamp(20px, 6svh, 28px);
    --board-gap: 3px;
  }
  .community .card { --this-card-w: clamp(18px, 5.2vh, 28px); }
  .seat-zone-top {
    max-height: none;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-evenly;
    align-items: flex-start;
    padding: 6px 8% 0;
    gap: 10px;
  }
  .opp-row { display: contents; }
  .seat:not(.hero) { padding-top: 0.3rem; }
  .seat:not(.hero) .seat-chips,
  .seat:not(.hero) .seat-cards { display: none; }
  .seat:not(.hero) .seat-name { font-size: 0.55rem; padding: 0.04rem 0.3rem; }
  .board { padding-top: 0; gap: 0.15rem; }
  .pot-label { font-size: 0.72rem; }
  .win-banner { font-size: 0.68rem; padding: 0.16rem 0.5rem; margin-bottom: 0.2rem; border-width: 2px; box-shadow: 0 2px 0 #b06a10, 0 4px 10px rgba(0,0,0,0.28); }
}

@media (prefers-reduced-motion: reduce) {
  .card.deal-in, .card.flip-in, .fly-chip, .float-emoji, .confetti, .win-banner, .seat.to-act .timer-fg, .btn {
    animation: none;
    transition: none;
  }
}
