:root {
  --bg: #0c0f14;
  --panel: #151a22;
  --gold: #e8c872;
  --gold-d: #c4a04a;
  --felt: #0b5c38;
  --felt-2: #08462b;
  --rail: #3d2914;
  --rail-hi: #5c3d1e;
  --text: #eef2f7;
  --muted: #8b95a8;
  --red: #e74c3c;
  --green: #2ecc71;
  --blue: #3498db;
  --font: "Roboto", system-ui, sans-serif;
  --cond: "Roboto Condensed", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(ellipse at top, #1a2030 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
}
button, input { font: inherit; }
button { cursor: pointer; border: 0; }
.muted { color: var(--muted); }
.err { color: var(--red); }
.hint { color: var(--muted); font-size: 0.85rem; }
.view { display: none; min-height: 100vh; }
.view.active { display: block; }
.tab { display: none; padding: .75rem 1rem 1rem; max-width: 1200px; margin: 0 auto; }
.tab.active { display: block; }
.tab.tab-table { max-width: 1100px; padding-bottom: .5rem; }
.section-title { margin: 1.25rem 0 .5rem; font-family: var(--cond); color: var(--gold); letter-spacing: .04em; font-size: 1.05rem; }

/* Login */
#view-login {
  display: none;
  place-items: center;
  min-height: 100vh;
}
#view-login.active { display: grid; }
.login-box {
  width: min(400px, 94vw);
  background: var(--panel);
  border: 1px solid #2a3344;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.logo { font-family: var(--cond); font-size: 1.8rem; letter-spacing: .04em; }
.logo span { color: var(--gold); }
.logo.sm { font-size: 1.15rem; }
.sub { color: var(--muted); margin: .4rem 0 1.2rem; }
.login-box input {
  width: 100%;
  margin-bottom: .65rem;
  padding: .75rem .9rem;
  border-radius: 8px;
  border: 1px solid #2a3344;
  background: #0c1018;
  color: var(--text);
}
.btn {
  padding: .85rem 1.25rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 1rem;
  background: #2a3344;
  color: var(--text);
  min-height: 48px;
}
.btn.big {
  padding: 1rem 1.45rem;
  font-size: 1.08rem;
  min-height: 52px;
  min-width: 7.5rem;
}
.btn.gold {
  background: linear-gradient(180deg, var(--gold), var(--gold-d));
  color: #1a1408;
}
.btn.green { background: linear-gradient(180deg, #3ddc84, #1fa85a); color: #06210f; }
.btn.danger { background: linear-gradient(180deg, #ff6b6b, #c0392b); color: #fff; }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid #2a3344; }
.btn.large { padding: 1rem 1.4rem; font-size: 1.05rem; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* Top bar */
.bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
  justify-content: space-between;
  padding: .65rem 1rem;
  background: #0a0d12;
  border-bottom: 1px solid #1e2633;
  position: sticky; top: 0; z-index: 30;
}
.bar-mid { display: flex; gap: .35rem; flex-wrap: wrap; }
.tab-btn {
  background: transparent;
  color: var(--muted);
  padding: .45rem .85rem;
  border-radius: 6px;
  font-weight: 500;
}
.tab-btn.active { background: #1e2633; color: var(--gold); }
.bar-right { display: flex; align-items: center; gap: .6rem; }

/* Discord join: table-only session (no lobby menu) */
body.discord-embed #bar-nav { display: none !important; }
body.discord-embed #btn-logout { display: none !important; }
body.discord-embed #btn-discord-leave { display: inline-flex !important; }
body.discord-embed #pk-leave { display: none !important; }
body.discord-embed #pk-share { display: none !important; }
body.discord-embed #view-login { display: none !important; }
body.discord-embed .tab:not(#tab-poker) { display: none !important; }
body.discord-embed #tab-poker.tab { display: block !important; }
#btn-discord-leave {
  background: linear-gradient(180deg, #ff6b6b, #c0392b);
  color: #fff;
  font-weight: 800;
  min-height: 40px;
  padding: .45rem 1rem;
}
/* Must stay hidden until Leave — .left-done used to force display:grid and overrode [hidden] */
#view-left,
#view-left[hidden],
.left-done[hidden] {
  display: none !important;
}
#view-left.active:not([hidden]),
.left-done.active:not([hidden]) {
  display: grid !important;
  min-height: 100vh;
  place-items: center;
  padding: 1.5rem;
}
.left-card {
  max-width: 420px;
  background: var(--panel);
  border: 1px solid #2a3344;
  border-radius: 14px;
  padding: 1.5rem 1.6rem;
  text-align: center;
}
.left-card h2 {
  margin: 0 0 .75rem;
  font-family: var(--cond);
  color: var(--gold);
}
.left-card p { margin: .4rem 0; line-height: 1.45; }
.chips-pill {
  background: #1a1510;
  border: 1px solid var(--gold-d);
  color: var(--gold);
  padding: .35rem .75rem;
  border-radius: 999px;
  font-weight: 700;
  font-family: var(--cond);
}

/* Lobby */
.lobby-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.lobby-card {
  background: var(--panel);
  border: 1px solid #2a3344;
  border-radius: 12px;
  padding: 1.2rem;
  display: flex; flex-direction: column; gap: .5rem;
}
.lobby-card .lc-top {
  font-family: var(--cond);
  font-size: 1.3rem;
  color: var(--gold);
  letter-spacing: .06em;
}
.lc-felt {
  height: 80px;
  border-radius: 40px;
  background: radial-gradient(ellipse, var(--felt), var(--felt-2));
  border: 6px solid var(--rail);
  margin: .4rem 0;
}
.lc-felt.bj { border-radius: 12px; }

/* ===== PokerStars-like table ===== */
.table-wrap { display: grid; gap: .55rem; }
.table-wrap.fit {
  min-height: 0;
}
.ps-table {
  position: relative;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  aspect-ratio: 16 / 10;
  min-height: min(52vh, 420px);
  max-height: 58vh;
}
.ps-rail {
  position: absolute; inset: 0;
  border-radius: 50% / 45%;
  background: linear-gradient(145deg, var(--rail-hi), var(--rail) 40%, #2a1c0e);
  box-shadow: 0 20px 50px rgba(0,0,0,.55), inset 0 2px 0 rgba(255,255,255,.08);
}
.ps-felt {
  position: absolute;
  inset: 18px;
  border-radius: 50% / 45%;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255,255,255,.06), transparent 50%),
    radial-gradient(ellipse at center, #0e6b42 0%, var(--felt) 45%, var(--felt-2) 100%);
  border: 3px solid #062a1a;
  box-shadow: inset 0 0 40px rgba(0,0,0,.35);
  /* visible so board/deck/chat are not clipped */
  overflow: visible;
}
.ps-logo {
  position: absolute;
  left: 50%; top: 28%;
  transform: translate(-50%, -50%);
  font-family: var(--cond);
  letter-spacing: .2em;
  font-size: clamp(.7rem, 1.6vw, .95rem);
  color: rgba(255,255,255,.18);
  pointer-events: none;
}
.ps-guild {
  position: absolute;
  left: 50%;
  top: 12%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: .4rem;
  z-index: 6;
  background: rgba(0,0,0,.4);
  border: 1px solid rgba(232,200,114,.35);
  border-radius: 999px;
  padding: .2rem .55rem .2rem .25rem;
  max-width: 70%;
}
.ps-guild img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.25);
}
.ps-guild span {
  font-size: .78rem;
  font-weight: 700;
  color: #f5e6b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.seat-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.35);
  display: block;
  margin: 0 auto 2px;
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.ps-seat.you .seat-avatar {
  border-color: #5aa8ff;
}
.ps-blinds {
  position: absolute;
  left: 50%; top: 34%;
  transform: translateX(-50%);
  font-size: .72rem;
  color: rgba(232,200,114,.55);
  letter-spacing: .12em;
}
.ps-pot {
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(232,200,114,.35);
  color: var(--gold);
  font-weight: 700;
  font-family: var(--cond);
  padding: .25rem .75rem;
  border-radius: 999px;
  font-size: .9rem;
  position: static;
  transform: none;
  left: auto;
  top: auto;
}
.ps-board-row {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: .55rem;
  z-index: 8;
  pointer-events: none;
}
.ps-board {
  position: relative;
  left: auto;
  top: auto;
  transform: none;
  display: flex;
  gap: .35rem;
  z-index: 8;
  min-height: 64px;
  min-width: 140px;
  justify-content: center;
}
.ps-deck {
  position: relative;
  width: 48px;
  height: 64px;
  flex-shrink: 0;
}
.ps-deck .deck-card {
  position: absolute;
  left: 0;
  top: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,.45);
}
.ps-deck .deck-2 {
  left: 3px;
  top: -3px;
  opacity: .92;
}
.ps-msg {
  position: absolute;
  left: 50%; bottom: 16%;
  transform: translateX(-50%);
  color: #f5e6b8;
  font-size: .85rem;
  text-align: center;
  text-shadow: 0 2px 6px #000;
  max-width: 70%;
  z-index: 5;
}

/* Seats around oval — % positions */
.ps-seat {
  position: absolute;
  width: 120px;
  transform: translate(-50%, -50%);
  z-index: 6;
  text-align: center;
}
/* 6-max positions */
.ps-seat[data-seat="0"] { left: 50%; top: 88%; }   /* bottom you-ish */
.ps-seat[data-seat="1"] { left: 12%; top: 70%; }
.ps-seat[data-seat="2"] { left: 12%; top: 32%; }
.ps-seat[data-seat="3"] { left: 50%; top: 14%; }
.ps-seat[data-seat="4"] { left: 88%; top: 32%; }
.ps-seat[data-seat="5"] { left: 88%; top: 70%; }

.ps-seat .seat-frame {
  background: rgba(10,12,16,.82);
  border: 2px solid #2a3344;
  border-radius: 10px;
  padding: .35rem .4rem .45rem;
  min-height: 72px;
  overflow: visible;
}
.ps-seat.acting {
  z-index: 12;
}
.ps-seat.acting .seat-frame {
  border-color: #ffe08a !important;
  border-width: 3px;
  box-shadow:
    0 0 0 3px rgba(255, 214, 80, .55),
    0 0 22px rgba(255, 200, 40, .7),
    0 0 40px rgba(255, 180, 0, .35);
  animation: actpulse 0.85s ease-in-out infinite alternate;
  background: rgba(40, 32, 8, .92);
}
.ps-seat.acting.you .seat-frame {
  border-color: #fff3b0 !important;
  box-shadow:
    0 0 0 3px rgba(255, 230, 120, .7),
    0 0 28px rgba(255, 210, 60, .85),
    0 0 48px rgba(80, 160, 255, .35);
}
@keyframes actpulse {
  from { filter: brightness(1); transform: scale(1); }
  to { filter: brightness(1.12); transform: scale(1.03); }
}
.turn-badge {
  position: absolute;
  left: 50%;
  top: -10px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #ffe08a, var(--gold-d));
  color: #1a1408;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .06em;
  padding: .15rem .4rem;
  border-radius: 999px;
  white-space: nowrap;
  z-index: 14;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
/* Hero seat — distinct cool tint so you always spot yourself at bottom */
.ps-seat.you .seat-frame {
  border-color: #5aa8ff;
  background: linear-gradient(180deg, rgba(30, 70, 120, .92), rgba(12, 28, 48, .9));
  box-shadow: 0 0 0 1px rgba(90, 168, 255, .35), inset 0 0 18px rgba(60, 140, 220, .12);
}
.ps-seat.you:not(.acting) .seat-frame {
  border-width: 2px;
}
.ps-seat.folded .seat-frame { opacity: .45; }
.ps-seat.you.folded .seat-frame { opacity: .55; }
.ps-seat.empty .seat-frame {
  border-style: dashed;
  opacity: .55;
  color: var(--muted);
  font-size: .8rem;
  display: grid;
  place-items: center;
  min-height: 64px;
}
.seat-name {
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.seat-name .ai-tag {
  color: #7fdbff;
  font-size: .65rem;
  margin-left: .2rem;
}
.seat-stack {
  font-family: var(--cond);
  color: var(--gold);
  font-size: .85rem;
}
/* Bet chips pile between seat and pot */
.seat-wager {
  position: absolute;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  z-index: 9;
  pointer-events: none;
}
.seat-wager .seat-bet {
  position: static;
  transform: none;
  left: auto;
  font-size: .78rem;
  font-weight: 800;
  color: #fff;
  background: rgba(0,0,0,.55);
  border: 1px solid rgba(232,200,114,.45);
  padding: .12rem .45rem;
  border-radius: 999px;
  white-space: nowrap;
}
.seat-wager .seat-bet-chips {
  display: flex;
  justify-content: center;
  gap: 1px;
  min-height: 16px;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.5));
}
/* Point wager toward center of table */
.ps-seat[data-seat="0"] .seat-wager { top: -42px; transform: translateX(-50%); }
.ps-seat[data-seat="1"] .seat-wager,
.ps-seat[data-seat="2"] .seat-wager { left: auto; right: -36px; top: 40%; transform: none; }
.ps-seat[data-seat="3"] .seat-wager { bottom: -42px; top: auto; transform: translateX(-50%); }
.ps-seat[data-seat="4"] .seat-wager,
.ps-seat[data-seat="5"] .seat-wager { left: -36px; top: 40%; transform: none; }

/* Timer under acting seat frame */
.seat-timer {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: .3rem;
  justify-content: center;
  background: rgba(0,0,0,.55);
  border: 1px solid rgba(232,200,114,.5);
  border-radius: 999px;
  padding: .2rem .45rem;
  font-size: .72rem;
  font-weight: 800;
  color: var(--gold);
  min-width: 88px;
}
.seat-timer .seat-timer-bar {
  flex: 1;
  height: 8px;
  background: #1e2633;
  border-radius: 999px;
  overflow: hidden;
  min-width: 40px;
}
.seat-timer .seat-timer-fill {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #2ecc71, var(--gold), #e74c3c);
  transform-origin: left center;
  transform: scaleX(1);
  transition: transform .1s linear;
  font-style: normal;
}
.seat-timer.urgent {
  color: #ff6b6b;
  border-color: #e74c3c;
  box-shadow: 0 0 10px rgba(231,76,60,.45);
}
.seat-timer.ai {
  color: #7fdbff;
  border-color: rgba(127,219,255,.5);
}

.seat-cards {
  display: flex;
  justify-content: center;
  gap: 2px;
  margin-top: 2px;
  min-height: 36px;
}
.dealer-btn {
  position: absolute;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #eee;
  color: #111;
  font-size: .65rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  border: 2px solid #333;
  z-index: 7;
}
.ps-seat[data-seat="0"] .dealer-btn { right: 4px; top: -8px; }
.ps-seat[data-seat="1"] .dealer-btn,
.ps-seat[data-seat="2"] .dealer-btn { right: -6px; top: -6px; }
.ps-seat[data-seat="3"] .dealer-btn { left: 4px; bottom: -8px; top: auto; }
.ps-seat[data-seat="4"] .dealer-btn,
.ps-seat[data-seat="5"] .dealer-btn { left: -6px; top: -6px; }

/* Cards */
.card {
  width: 42px;
  height: 58px;
  border-radius: 5px;
  background: linear-gradient(160deg, #fff, #f0ece4);
  color: #111;
  font-weight: 700;
  font-size: .72rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2px 3px;
  box-shadow: 0 3px 8px rgba(0,0,0,.4);
  position: relative;
}
.card.red { color: #c0392b; }
.card.back {
  background: repeating-linear-gradient(135deg, #1a3a6b 0 6px, #122a4d 6px 12px);
  border: 1px solid #c9a227;
  color: transparent;
}
.card.board {
  width: 48px;
  height: 66px;
  font-size: .8rem;
}
.card .big {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  opacity: .9;
}

.ps-controls {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  background: var(--panel);
  border: 1px solid #2a3344;
  border-radius: 10px;
  padding: .65rem .8rem;
}
.action-bar { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.raise-box { color: var(--muted); font-size: .85rem; display: flex; align-items: center; gap: .35rem; }
.raise-box input {
  width: 90px;
  padding: .4rem .5rem;
  border-radius: 6px;
  border: 1px solid #2a3344;
  background: #0c1018;
  color: var(--text);
}
.status-line { color: var(--muted); font-size: .85rem; margin-left: auto; }

/* Blackjack — semicircle casino table */
.bj-table {
  max-width: 960px;
  margin: 0 auto;
  position: relative;
  min-height: min(52vh, 440px);
  max-height: 58vh;
  aspect-ratio: 16 / 10;
  box-shadow: 0 20px 50px rgba(0,0,0,.5);
}
.bj-rail {
  position: absolute;
  inset: 0;
  border-radius: 50% 50% 12% 12% / 55% 55% 12% 12%;
  background: linear-gradient(145deg, var(--rail-hi), var(--rail) 40%, #2a1c0e);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.08);
}
.bj-felt {
  position: absolute;
  inset: 16px;
  border-radius: 48% 48% 10% 10% / 52% 52% 10% 10%;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255,255,255,.07), transparent 45%),
    radial-gradient(ellipse at center, #0e6b42 0%, var(--felt) 50%, var(--felt-2) 100%);
  border: 3px solid #062a1a;
  overflow: hidden;
}
.bj-arc {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 38%;
  height: 42%;
  border: 2px dashed rgba(232,200,114,.22);
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
  pointer-events: none;
}
.bj-dealer {
  position: absolute;
  left: 50%;
  top: 10%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 4;
}
.bj-insure {
  position: absolute;
  left: 50%;
  top: 36%;
  transform: translateX(-50%);
  font-size: .65rem;
  letter-spacing: .12em;
  color: rgba(232,200,114,.45);
  font-family: var(--cond);
  white-space: nowrap;
  z-index: 2;
}
.bj-msg {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translateX(-50%);
  color: #f5e6b8;
  font-size: .85rem;
  text-shadow: 0 2px 6px #000;
  z-index: 3;
  text-align: center;
  max-width: 70%;
}
.seat-label {
  font-family: var(--cond);
  letter-spacing: .15em;
  color: rgba(255,255,255,.5);
  font-size: .75rem;
  margin-bottom: .35rem;
}
.cards { display: flex; justify-content: center; gap: .3rem; flex-wrap: wrap; min-height: 48px; }
.val { color: var(--gold); font-weight: 700; margin-top: .25rem; font-size: .85rem; }
.bj-seats {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6%;
  display: flex;
  justify-content: center;
  gap: clamp(.35rem, 1.5vw, .85rem);
  padding: 0 4%;
  z-index: 5;
}
.bj-seat {
  flex: 1 1 0;
  max-width: 150px;
  min-width: 90px;
  background: transparent;
  border: 0;
  padding: 0;
  text-align: center;
}
.bj-circle {
  background: rgba(10,12,16,.78);
  border: 2px solid #2a3344;
  border-radius: 14px;
  padding: .4rem .35rem .5rem;
  min-height: 110px;
}
.bj-circle.empty-c {
  border-style: dashed;
  opacity: .5;
  color: var(--muted);
  display: grid;
  place-items: center;
  min-height: 90px;
  font-size: .8rem;
}
.bj-seat.you .bj-circle { border-color: #4a90d9; }
.bj-seat.acting .bj-circle {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(232,200,114,.35);
}
.bj-bet-pill {
  display: inline-block;
  margin: .15rem 0;
  padding: .1rem .45rem;
  border-radius: 999px;
  background: rgba(0,0,0,.4);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
}
.chip {
  padding: .4rem .7rem;
  border-radius: 999px;
  background: #1e2633;
  color: var(--muted);
  font-weight: 600;
}
.chip.active, .chip:hover {
  background: linear-gradient(180deg, var(--gold), var(--gold-d));
  color: #1a1408;
}

/* Bank */
.bank-panel {
  max-width: 520px;
  background: var(--panel);
  border: 1px solid #2a3344;
  border-radius: 12px;
  padding: 1.4rem;
}
.bank-bal {
  font-family: var(--cond);
  font-size: 2.2rem;
  color: var(--green);
  margin: .5rem 0 1rem;
}
.ledger { display: grid; gap: .35rem; max-height: 280px; overflow: auto; }
.ledger-row {
  display: flex; justify-content: space-between; gap: .5rem;
  padding: .5rem .6rem;
  background: #0c1018;
  border-radius: 6px;
  font-size: .88rem;
}
.pos { color: var(--green); font-weight: 700; }
.neg { color: #ff8a80; font-weight: 700; }

#toast {
  position: fixed;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  background: #1a2030;
  border: 1px solid var(--gold-d);
  color: var(--text);
  padding: .65rem 1.1rem;
  border-radius: 999px;
  z-index: 50;
  max-width: 90vw;
}

@media (max-width: 700px) {
  .ps-table, .bj-table {
    min-height: 48vh;
    max-height: 52vh;
    aspect-ratio: auto;
    height: 52vh;
  }
  .ps-seat { width: 96px; }
  .card { width: 34px; height: 48px; font-size: .62rem; }
  .card.board { width: 38px; height: 52px; }
  .ps-deck { width: 40px; height: 52px; }
  .seat-name { font-size: .68rem; }
  .action-row { width: 100%; }
  .bet-inline { flex: 1 1 100%; }
  .create-form { grid-template-columns: 1fr; }
}

/* Stake lobby + timer + raise slider + pre-action */
.btn.big { padding: 1rem 1.45rem; font-size: 1.08rem; min-height: 52px; min-width: 7.5rem; }
.stake-lobby { max-width: 900px; margin: 0 auto; }
.stake-lobby h2 { font-family: var(--cond); color: var(--gold); letter-spacing: .06em; }
.stake-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .85rem; margin-top: 1rem; }
.stake-card { background: var(--panel); border: 1px solid #2a3344; border-radius: 12px; padding: 1.15rem; cursor: pointer; transition: border-color .15s, transform .12s; }
.stake-card:hover { border-color: var(--gold-d); transform: translateY(-2px); }
.stake-card h3 { margin: 0 0 .35rem; font-family: var(--cond); color: var(--gold); font-size: 1.35rem; }
.stake-card p { margin: 0 0 .75rem; color: var(--muted); font-size: .9rem; }
.stake-card .meta { font-size: .8rem; color: var(--muted); margin-bottom: .75rem; }
.table-meta { max-width: 960px; margin: 0 auto .5rem; display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.tier-badge { background: linear-gradient(180deg, var(--gold), var(--gold-d)); color: #1a1408; font-weight: 800; padding: .3rem .7rem; border-radius: 6px; font-family: var(--cond); }
.timer {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 180px;
  font-weight: 700;
  color: var(--gold);
  background: rgba(0,0,0,.35);
  border: 1px solid #3a4558;
  border-radius: 999px;
  padding: .35rem .7rem;
}
.timer-label { font-size: .75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.timer-bar { flex: 1; height: 12px; background: #1e2633; border-radius: 999px; overflow: hidden; min-width: 70px; }
.timer-bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #2ecc71, var(--gold), #e74c3c);
  transform-origin: left center;
  transform: scaleX(1);
  transition: transform .1s linear;
  font-style: normal;
}
.timer.urgent { color: #ff6b6b; border-color: #e74c3c; box-shadow: 0 0 12px rgba(231,76,60,.35); }
.ai-think {
  margin-left: auto;
  color: #7fdbff;
  font-weight: 700;
  font-size: .9rem;
  padding: .35rem .75rem;
  background: rgba(127,219,255,.1);
  border: 1px solid rgba(127,219,255,.35);
  border-radius: 999px;
  animation: thinkpulse 1s ease infinite alternate;
}
@keyframes thinkpulse { from { opacity: .7; } to { opacity: 1; } }
.ps-seat.thinking .seat-frame {
  border-color: #7fdbff;
  box-shadow: 0 0 0 2px rgba(127,219,255,.3);
}
.seat-act { font-size: .65rem; color: var(--muted); }
.pre-bar { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; width: 100%; padding: .35rem 0; border-top: 1px solid #1e2633; }
.pre-label { color: var(--muted); font-size: .85rem; }
.pre-btn.active { outline: 2px solid var(--gold); box-shadow: 0 0 0 2px rgba(232,200,114,.25); }
.raise-panel { display: flex; flex-direction: column; gap: .35rem; min-width: min(280px, 100%); background: #0c1018; border: 1px solid #2a3344; border-radius: 10px; padding: .55rem .7rem; }
.raise-row { display: flex; align-items: center; gap: .6rem; }
.raise-val { font-family: var(--cond); font-size: 1.2rem; color: var(--gold); font-weight: 700; min-width: 4rem; }
#pk-slider { width: 100%; height: 28px; accent-color: var(--gold); cursor: pointer; }
.raise-ticks { display: flex; gap: .35rem; }
.raise-ticks .tick { flex: 1; padding: .35rem; border-radius: 6px; background: #1e2633; color: var(--muted); font-size: .8rem; font-weight: 600; border: 0; cursor: pointer; }
.raise-ticks .tick:hover { color: var(--gold); }

.ps-pot-wrap {
  position: absolute;
  left: 50%;
  top: 34%;
  transform: translateX(-50%);
  z-index: 7;
  text-align: center;
}
.pot-chips { display: flex; justify-content: center; gap: 2px; min-height: 18px; margin-bottom: 4px; flex-wrap: wrap; max-width: 120px; }
/* Realistic multi-color chip stacks */
.chip-piles {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  min-height: 20px;
}
.chip-pile {
  position: relative;
  width: 22px;
  height: 18px;
}
.chip-pile.sm { width: 16px; height: 14px; }
.chip-token {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 20px;
  height: 20px;
  margin-left: -10px;
  border-radius: 50%;
  border: 2px dashed rgba(255,255,255,.55);
  box-shadow:
    0 1px 0 rgba(0,0,0,.35),
    0 2px 3px rgba(0,0,0,.4),
    inset 0 1px 2px rgba(255,255,255,.35);
  transform: translateY(calc(var(--i, 0) * -3px));
  display: grid;
  place-items: center;
  z-index: calc(var(--i, 0) + 1);
}
.chip-token.sm {
  width: 14px;
  height: 14px;
  margin-left: -7px;
  transform: translateY(calc(var(--i, 0) * -2px));
  font-size: .4rem;
}
.chip-token em {
  font-style: normal;
  font-size: .42rem;
  font-weight: 800;
  color: rgba(255,255,255,.95);
  text-shadow: 0 1px 1px rgba(0,0,0,.7);
  line-height: 1;
  pointer-events: none;
}
.chip-token.sm em { font-size: .32rem; }
/* Denomination colors */
.chip-token.c-white {
  background: radial-gradient(circle at 30% 28%, #fff, #e8e8e8 50%, #b0b0b0);
  border-color: rgba(80,80,80,.45);
  color: #222;
}
.chip-token.c-white em { color: #222; text-shadow: none; }
.chip-token.c-red {
  background: radial-gradient(circle at 30% 28%, #ff7a7a, #c0392b 55%, #7a1810);
}
.chip-token.c-blue {
  background: radial-gradient(circle at 30% 28%, #7ec8ff, #2471a3 55%, #0e3d66);
}
.chip-token.c-green {
  background: radial-gradient(circle at 30% 28%, #7dffa0, #1e8449 55%, #0b3d22);
}
.chip-token.c-black {
  background: radial-gradient(circle at 30% 28%, #666, #1a1a1a 55%, #000);
  border-color: rgba(232,200,114,.55);
}
.chip-token.c-purple {
  background: radial-gradient(circle at 30% 28%, #d7a0ff, #6c3483 55%, #3b1760);
}
.chip-token.c-pink {
  background: radial-gradient(circle at 30% 28%, #ffb6d9, #d4508f 55%, #8a2458);
}
.pot-chips.chip-piles,
#pk-pot-chips.chip-piles {
  min-height: 28px;
  margin-bottom: 2px;
}
.seat-bet-chips { display: flex; justify-content: center; gap: 1px; margin-top: 2px; }
.ps-seat.winner .seat-frame {
  border-color: #f1c40f !important;
  box-shadow: 0 0 0 3px rgba(241,196,15,.45), 0 0 28px rgba(241,196,15,.65);
  animation: winpulse 0.85s ease infinite alternate;
  z-index: 8;
}
@keyframes winpulse {
  from { filter: brightness(1); box-shadow: 0 0 0 3px rgba(241,196,15,.4), 0 0 18px rgba(241,196,15,.4); }
  to { filter: brightness(1.3); box-shadow: 0 0 0 4px rgba(241,196,15,.6), 0 0 32px rgba(241,196,15,.75); }
}
.card.deal-in {
  animation: dealIn 0.4s cubic-bezier(.2,.8,.2,1) both;
}
.card.board.deal-in {
  animation: dealBoard 0.45s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes dealIn {
  from { opacity: 0; transform: translate(-50px, -70px) rotate(-18deg) scale(.55); }
  to { opacity: 1; transform: none; }
}
@keyframes dealBoard {
  from { opacity: 0; transform: translateY(-40px) rotateY(70deg) scale(.6); }
  to { opacity: 1; transform: none; }
}
.flying-chip {
  position: fixed; width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff3c4, #c4a04a 55%, #8a6a28);
  border: 2px dashed rgba(255,255,255,.5);
  box-shadow: 0 2px 6px rgba(0,0,0,.45);
  z-index: 80; pointer-events: none;
  transition: transform .7s cubic-bezier(.2,.8,.2,1), opacity .7s;
}
.flying-chip.c-white { background: radial-gradient(circle at 30% 28%, #fff, #bbb); }
.flying-chip.c-red { background: radial-gradient(circle at 30% 28%, #ff7a7a, #c0392b); }
.flying-chip.c-blue { background: radial-gradient(circle at 30% 28%, #7ec8ff, #2471a3); }
.flying-chip.c-green { background: radial-gradient(circle at 30% 28%, #7dffa0, #1e8449); }
.flying-chip.c-black { background: radial-gradient(circle at 30% 28%, #555, #111); }
.flying-chip.c-purple { background: radial-gradient(circle at 30% 28%, #d7a0ff, #6c3483); }
.seat-bet-chips {
  display: flex;
  justify-content: center;
  gap: 1px;
  margin-top: 2px;
  min-height: 14px;
}
.pot-chips {
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.45));
}

/* Compact controls — one row */
.ps-controls.compact {
  max-width: 960px;
  margin: 0 auto;
  gap: .45rem;
  padding: .45rem .5rem .6rem;
}
.ctrl-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
  width: 100%;
}
.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  flex: 1;
}
.bet-inline {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex: 1 1 200px;
  min-width: 180px;
  background: #0c1018;
  border: 1px solid #2a3344;
  border-radius: 10px;
  padding: .3rem .5rem;
}
.bet-inline #pk-slider {
  flex: 1;
  min-width: 80px;
  height: 28px;
  accent-color: var(--gold);
}
.bet-inline .raise-val {
  font-family: var(--cond);
  color: var(--gold);
  font-weight: 700;
  min-width: 3.2rem;
  font-size: 1rem;
}
.pre-inline {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  align-items: center;
}
.pre-inline .pre-btn.active {
  outline: 2px solid var(--gold);
}
.chat-row input {
  flex: 1;
  min-width: 120px;
  padding: .55rem .75rem;
  border-radius: 8px;
  border: 1px solid #2a3344;
  background: #0c1018;
  color: var(--text);
}
.btn.sm { min-height: 36px; padding: .4rem .7rem; font-size: .85rem; min-width: auto; }

/* Chat bubble on seat */
.chat-bubble {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translateX(-50%);
  background: #1a2030;
  border: 1px solid var(--gold-d);
  color: var(--text);
  font-size: .72rem;
  padding: .3rem .5rem;
  border-radius: 8px;
  max-width: 140px;
  white-space: normal;
  word-break: break-word;
  z-index: 12;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
  animation: bubbleIn .2s ease;
  pointer-events: none;
}
.chat-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--gold-d);
}
@keyframes bubbleIn {
  from { opacity: 0; transform: translateX(-50%) translateY(4px); }
  to { opacity: 1; transform: translateX(-50%); }
}
.ps-seat .seat-frame { position: relative; }

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 1rem;
}
.modal[hidden] { display: none !important; }
.modal-card {
  width: min(400px, 94vw);
  background: var(--panel);
  border: 1px solid #2a3344;
  border-radius: 14px;
  padding: 1.25rem 1.35rem;
  box-shadow: 0 24px 60px rgba(0,0,0,.55);
}
.modal-card h3 {
  margin: 0 0 .5rem;
  font-family: var(--cond);
  color: var(--gold);
}
.modal-card input {
  width: 100%;
  margin: .5rem 0 1rem;
  padding: .7rem .85rem;
  border-radius: 8px;
  border: 1px solid #2a3344;
  background: #0c1018;
  color: var(--text);
}
.modal-actions {
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* Create table form */
.create-panel {
  margin-top: 1.25rem;
  background: var(--panel);
  border: 1px solid #2a3344;
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
}
.create-panel h3 {
  margin: 0 0 .75rem;
  font-family: var(--cond);
  color: var(--gold);
}
.create-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .65rem;
  margin-bottom: .85rem;
}
.create-form label {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-size: .8rem;
  color: var(--muted);
}
.create-form input[type="number"],
.create-form input[type="text"],
.create-form input[type="password"],
.create-form input:not([type]) {
  padding: .55rem .65rem;
  border-radius: 8px;
  border: 1px solid #2a3344;
  background: #0c1018;
  color: var(--text);
  font-size: .95rem;
}
.create-form .check-label {
  flex-direction: row;
  align-items: center;
  gap: .45rem;
  margin-top: 1.2rem;
}
.stake-card.custom { border-color: #3a4a66; }
