/* =====================================================================
   FlopHouse — Modern Premium
   ===================================================================== */

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

:root {
  /* Base */
  --bg:          #0a0b0f;
  --bg-2:        #0e1015;
  --surface:     rgba(255,255,255,0.045);
  --surface-2:   rgba(255,255,255,0.07);
  --border:      rgba(255,255,255,0.09);
  --border-2:    rgba(255,255,255,0.14);

  /* Gold accent */
  --gold:        #d8b878;
  --gold-bright: #f1d49b;
  --gold-deep:   #a8884a;
  --gold-glow:   rgba(216,184,120,0.35);

  /* Text */
  --text:        #ecedf1;
  --text-dim:    #9b9da7;
  --text-faint:  #5e6069;

  /* Felt */
  --felt-1:      #1f3b33;
  --felt-2:      #16271f;
  --felt-3:      #0c1611;

  /* Semantic */
  --win:         #74e0a8;
  --danger:      #ec7a7a;
  --info:        #7aa7e0;
  --card-red:    #d94f63;
  --card-ink:    #23262f;

  /* Motion */
  --ease:        cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);

  /* Shadows */
  --shadow-sm:   0 1px 2px rgba(0,0,0,0.5);
  --shadow-md:   0 8px 30px rgba(0,0,0,0.45), 0 1px 2px rgba(0,0,0,0.6);
  --shadow-lg:   0 24px 70px rgba(0,0,0,0.6);
  --shadow-card: 0 6px 16px rgba(0,0,0,0.55), 0 1px 3px rgba(0,0,0,0.7);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
          Helvetica, Arial, system-ui, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Background orbs ---------- */
.bg-orbs {
  position: fixed; inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
}
.orb-1 { width: 480px; height: 480px; background: #1c3b30; top: -160px; left: -120px;
         animation: drift1 26s var(--ease) infinite alternate; }
.orb-2 { width: 420px; height: 420px; background: #2a2418; bottom: -180px; right: -120px;
         animation: drift2 32s var(--ease) infinite alternate; }
.orb-3 { width: 360px; height: 360px; background: #16243a; top: 40%; left: 55%;
         animation: drift3 38s var(--ease) infinite alternate; }
@keyframes drift1 { to { transform: translate(120px, 80px) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-100px, -60px) scale(1.1); } }
@keyframes drift3 { to { transform: translate(-80px, 60px) scale(0.9); } }

/* ---------- Screens ---------- */
.screen { display: none; width: 100%; height: 100%; position: relative; z-index: 1; }
.screen.active { display: flex; }

/* ---------- Glass card primitive ---------- */
.glass-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  backdrop-filter: blur(28px) saturate(1.5);
  -webkit-backdrop-filter: blur(28px) saturate(1.5);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.06);
}

/* =====================================================================
   LOBBY
   ===================================================================== */
#screen-lobby {
  align-items: safe center;
  justify-content: safe center;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.lobby-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  width: 100%;
  max-width: 380px;
  padding: 32px 20px;
  animation: rise 0.6s var(--ease-out) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.brand { text-align: center; }
.logo {
  font-size: 2.9rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(180deg, #fff 0%, var(--gold) 130%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 30px var(--gold-glow));
}
.logo span { color: transparent; background: linear-gradient(180deg, var(--gold-bright), var(--gold-deep));
             -webkit-background-clip: text; background-clip: text; }
.tagline {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

.lobby-card {
  padding: 28px 26px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field { display: flex; flex-direction: column; gap: 7px; }
.field label, .eyebrow {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* Inputs */
input[type="text"] {
  width: 100%;
  padding: 13px 15px;
  background: rgba(0,0,0,0.32);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.97rem;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s;
}
input[type="text"]:focus {
  border-color: var(--gold-deep);
  box-shadow: 0 0 0 4px var(--gold-glow);
  background: rgba(0,0,0,0.45);
}
input[type="text"]::placeholder { color: var(--text-faint); }

.code-input {
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  flex: 1;
}

.join-row { display: flex; gap: 10px; }

.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-faint);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-2), transparent);
}

.footnote { font-size: 0.74rem; color: var(--text-faint); }

.about {
  margin-top: 28px;
  max-width: 520px;
  text-align: left;
  color: var(--text-faint);
  font-size: 0.82rem;
  line-height: 1.55;
}
.about h2 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-soft, #cbd5cf);
  margin: 0 0 8px;
  letter-spacing: 0.01em;
}
.about p { margin: 0 0 8px; }
.about strong { color: var(--text-soft, #d8e3dc); font-weight: 600; }

/* ---------- Buttons ---------- */
.btn {
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 650;
  cursor: pointer;
  transition: transform 0.12s var(--ease), box-shadow 0.2s var(--ease),
              background 0.2s var(--ease), filter 0.2s, border-color 0.2s;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-lg { padding: 14px 22px; font-size: 0.98rem; }

.btn-primary {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold-deep));
  color: #1c1407;
  box-shadow: 0 6px 22px var(--gold-glow), inset 0 1px 0 rgba(255,255,255,0.4);
}
.btn-primary:hover { filter: brightness(1.07); box-shadow: 0 8px 30px var(--gold-glow), inset 0 1px 0 rgba(255,255,255,0.5); }

.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-2);
  backdrop-filter: blur(10px);
}
.btn-ghost:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.22); }

.btn-danger {
  background: rgba(236,122,122,0.14);
  color: var(--danger);
  border-color: rgba(236,122,122,0.3);
}
.btn-danger:hover { background: rgba(236,122,122,0.22); }

.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; filter: none; }

/* =====================================================================
   WAITING ROOM
   ===================================================================== */
#screen-waiting { align-items: center; justify-content: center; }

.waiting-wrap {
  width: 100%;
  max-width: 440px;
  padding: 28px 20px;
  animation: rise 0.6s var(--ease-out) both;
}
.waiting-card {
  padding: 30px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.big-code {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: inherit;
  font-size: 3.2rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: var(--gold-bright);
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-2);
  border-radius: 16px;
  padding: 14px 22px 14px 28px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.12s;
  text-shadow: 0 0 28px var(--gold-glow);
}
.big-code:hover { border-color: var(--gold-deep); box-shadow: 0 0 0 4px var(--gold-glow); }
.big-code:active { transform: scale(0.98); }
.copy-hint {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-shadow: none;
}
.big-code.copied .copy-hint { color: var(--win); }

.share-hint { font-size: 0.78rem; color: var(--text-faint); }

.player-list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-top: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.player-count {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 9px;
  color: var(--gold);
  letter-spacing: 0;
}

.player-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}
.player-list-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.9rem;
  animation: rise 0.35s var(--ease-out) both;
}
.player-list-item .avatar { width: 30px; height: 30px; font-size: 0.72rem; }
.player-list-item .ai-badge {
  margin-left: auto;
  font-size: 0.62rem; font-weight: 600;
  color: var(--info);
  background: rgba(122,167,224,0.12);
  border: 1px solid rgba(122,167,224,0.25);
  padding: 2px 8px; border-radius: 20px;
  letter-spacing: 0.06em;
}
.waiting-msg { font-size: 0.78rem; color: var(--text-faint); }

/* ---------- Avatar ---------- */
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
  color: #fff;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), var(--shadow-sm);
  overflow: hidden;
}
.avatar-emoji {
  background: linear-gradient(160deg, #2b3445, #141822);
  padding: 4px;
}
.avatar-emoji img {
  width: 100%; height: 100%;
  display: block;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

/* =====================================================================
   GAME SCREEN
   ===================================================================== */
#screen-game {
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ---------- Top bar ---------- */
.top-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  z-index: 40;
}
.room-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 7px 14px;
  backdrop-filter: blur(20px);
}
.room-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--text-faint);
}
.room-code {
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--gold-bright);
}
.icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 40px; height: 40px;
  font-size: 1rem;
  cursor: pointer;
  backdrop-filter: blur(20px);
  transition: background 0.2s, border-color 0.2s, transform 0.12s;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-2); }
.icon-btn:active { transform: scale(0.94); }
.icon-sound-on { display: none; }
.icon-btn.on .icon-sound-on  { display: inline; }
.icon-btn.on .icon-sound-off { display: none; }

/* ---------- Table area ---------- */
.table-area {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex: 1;
  padding: 96px 150px 130px;
}

.table-felt {
  position: relative;
  width: min(760px, 84vw);
  height: min(400px, 44vh);
  border-radius: 50% / 50%;
  background:
    radial-gradient(ellipse 70% 80% at 50% 38%, var(--felt-1) 0%, var(--felt-2) 55%, var(--felt-3) 100%);
  box-shadow:
    inset 0 0 100px rgba(0,0,0,0.6),
    inset 0 2px 1px rgba(255,255,255,0.05),
    0 0 0 2px rgba(216,184,120,0.18),
    0 0 0 12px #14161c,
    0 0 0 13px rgba(216,184,120,0.12),
    0 40px 90px rgba(0,0,0,0.7);
}
.felt-sheen {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(ellipse 60% 50% at 50% 22%, rgba(255,255,255,0.07), transparent 70%);
  pointer-events: none;
}

/* ---------- Felt center ---------- */
.felt-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.phase-pill {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 14px;
}
.community-cards {
  display: flex;
  gap: 7px;
  align-items: center;
  min-height: 84px;
}

/* ---------- Pot ---------- */
.pot-zone {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pot-chips { display: flex; align-items: center; height: 30px; }
.pot-amount {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
}
.pot-label {
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--text-faint);
}
#display-pot {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--gold-bright);
  text-shadow: 0 0 20px var(--gold-glow);
}
.pot-zone.pot-pulse { animation: potpulse 0.6s var(--ease); }
@keyframes potpulse {
  0%, 100% { transform: scale(1); }
  40%       { transform: scale(1.16); }
}

/* ---------- Chip token (top-down circular) ---------- */
.chip-stack {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  flex-shrink: 0;
}
.chip-stack-lg { width: 28px; height: 28px; }

.chip-token {
  --chip-face: #c8c8c8;
  --chip-edge: #6e6e72;
  --chip-spoke: rgba(255,255,255,0.92);
  position: relative;
  width: 100%; height: 100%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 38%, rgba(255,255,255,0.35), rgba(255,255,255,0) 55%),
    radial-gradient(circle at 50% 50%, var(--chip-face) 0 52%, var(--chip-edge) 52% 100%);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.4),
    inset 0 -1px 1px rgba(0,0,0,0.45),
    inset 0 1px 1px rgba(255,255,255,0.35),
    0 1px 2px rgba(0,0,0,0.6);
}
/* dashed-edge spokes that wrap the rim (classic clay chip look) */
.chip-token::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  background:
    conic-gradient(
      var(--chip-spoke) 0 10deg, transparent 10deg 45deg,
      var(--chip-spoke) 45deg 55deg, transparent 55deg 90deg,
      var(--chip-spoke) 90deg 100deg, transparent 100deg 135deg,
      var(--chip-spoke) 135deg 145deg, transparent 145deg 180deg,
      var(--chip-spoke) 180deg 190deg, transparent 190deg 225deg,
      var(--chip-spoke) 225deg 235deg, transparent 235deg 270deg,
      var(--chip-spoke) 270deg 280deg, transparent 280deg 315deg,
      var(--chip-spoke) 315deg 325deg, transparent 325deg 360deg);
  -webkit-mask: radial-gradient(circle, transparent 50%, #000 51% 70%, transparent 71%);
          mask: radial-gradient(circle, transparent 50%, #000 51% 70%, transparent 71%);
  opacity: 0.85;
}
/* inner face ring */
.chip-token::after {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, rgba(255,255,255,0.18), rgba(0,0,0,0.18));
  border: 1px dashed rgba(255,255,255,0.45);
}

/* a single chip peeking from behind for "stack" feel */
.chip-back {
  position: absolute;
  inset: 0;
  transform: translate(-4px, 2px) scale(0.96);
  opacity: 0.85;
  filter: brightness(0.85);
}

.chip-white  { --chip-face: #f4f4f4; --chip-edge: #2a2a2a; --chip-spoke: #2a2a2a; }
.chip-red    { --chip-face: #d6404c; --chip-edge: #5a1218; --chip-spoke: #ffffff; }
.chip-green  { --chip-face: #2e9d63; --chip-edge: #0e3a23; --chip-spoke: #ffffff; }
.chip-blue   { --chip-face: #3877c4; --chip-edge: #122a4a; --chip-spoke: #ffffff; }
.chip-purple { --chip-face: #7a4cb8; --chip-edge: #2b144d; --chip-spoke: #ffffff; }
.chip-black  { --chip-face: #2a2c33; --chip-edge: #050608; --chip-spoke: #ffffff; }
.chip-gold   { --chip-face: var(--gold-bright); --chip-edge: #5a4416; --chip-spoke: #2a1f08; }

/* Chip-fly FX layer (above everything) */
#fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
}
.fly-chip {
  position: fixed;
  width: 22px; height: 22px;
  border-radius: 50%;
  animation: chip-fly 0.7s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
}
@keyframes chip-fly {
  0%   { transform: translate(0, 0)             scale(1)   rotate(0deg);   opacity: 1; }
  60%  { transform: translate(calc(var(--dx) * 0.55), calc(var(--dy) * 0.55 - 18px)) scale(1.06) rotate(180deg); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.85) rotate(360deg); opacity: 0.85; }
}

/* =====================================================================
   SEATS
   ===================================================================== */
.seat {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 172px;
  transition: opacity 0.35s var(--ease);
}
.seat-0 { bottom: -94px;  left: 50%;     transform: translateX(-50%); }
.seat-1 { bottom: -58px;  left: 2%;  }
.seat-2 { top: 50%;       left: -184px;  transform: translateY(-50%); }
.seat-3 { top: -58px;     left: 2%;  }
.seat-4 { top: -94px;     left: 50%;     transform: translateX(-50%); }
.seat-5 { top: -58px;     right: 2%; }
.seat-6 { top: 50%;       right: -184px; transform: translateY(-50%); }
.seat-7 { bottom: -58px;  right: 2%; }

/* Hole cards */
.seat-hole-cards { display: flex; gap: 3px; min-height: 56px; }

/* Player card (glass nameplate) */
.seat-plate {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px 10px 6px 6px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-md);
  width: 100%;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease),
              background 0.25s var(--ease);
}
.seat-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.seat-name-row { display: flex; align-items: center; gap: 4px; }
.seat-name {
  font-size: 0.84rem;
  font-weight: 650;
  max-width: 110px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tag {
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 1px 4px;
  border-radius: 5px;
  flex-shrink: 0;
}
.tag-ai {
  background: none;
  padding: 0;
  font-size: 0.72rem;
  line-height: 1;
  cursor: default;
}
.tag-me { background: var(--gold-glow); color: var(--gold-bright); }
.tag-out {
  background: rgba(180, 40, 40, 0.35);
  color: #ff9b9b;
  border: 1px solid rgba(255, 120, 120, 0.5);
  letter-spacing: 0.06em;
}
.seat-chips {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

/* Bet display (chips + amount) floating toward table */
.seat-bet {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,0.6);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px 3px 3px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
  animation: betpop 0.3s var(--ease-out) both;
}
@keyframes betpop {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}

/* Position/blind chips — anchored to seat-plate, overlapping the avatar's upper edge */
.seat-badges {
  position: absolute;
  top: -12px;
  left: 26px;
  display: flex;
  z-index: 4;
  pointer-events: none;
}
.seat-badge {
  display: inline-flex;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.55));
  margin-left: -8px;    /* overlap when 2+ chips */
}
.seat-badge:first-child { margin-left: 0; }
.chip-svg { display: block; }

/* States */
.seat.active-turn .seat-plate {
  border-color: var(--gold);
  background: rgba(216,184,120,0.1);
  box-shadow: 0 0 0 1px var(--gold), 0 0 28px var(--gold-glow), var(--shadow-md);
}
.seat.active-turn .avatar { animation: avatarpulse 1.6s var(--ease) infinite; }
@keyframes avatarpulse {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 0 0 0 var(--gold-glow); }
  50%       { box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 0 0 5px transparent, 0 0 14px var(--gold-glow); }
}

.seat.folded { opacity: 0.32; }
.seat.folded .seat-hole-cards { filter: grayscale(1); }

.seat.all-in .seat-plate { border-color: rgba(236,138,68,0.5); }
.seat.all-in .seat-chips { color: #f0a868; }

/* Lobby live stats pill */
.lobby-stats {
  margin-top: 14px; text-align: center;
  font-size: 0.82rem; color: rgba(255,255,255,0.55);
  letter-spacing: 0.02em;
}
.lobby-stats:empty { display: none; }

/* Quick reactions — floating trigger button */
.reactions-btn {
  position: fixed; right: 22px; bottom: 22px; z-index: 80;
  width: 56px; height: 56px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, #2d6a4f, #1b4332);
  color: #fff; font-size: 1.5rem; cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.15);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.reactions-btn:hover  { transform: translateY(-2px) scale(1.04); box-shadow: 0 12px 28px rgba(0,0,0,0.5); }
.reactions-btn:active { transform: translateY(0)    scale(0.98); }
.reactions-btn.cooldown { opacity: 0.5; pointer-events: none; }

/* Quick reactions — popover panel */
.reactions-panel {
  position: fixed; right: 22px; bottom: 90px; z-index: 81;
  width: min(380px, calc(100vw - 44px));
  max-height: 60vh; overflow-y: auto;
  background: rgba(20, 26, 30, 0.96);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55);
  backdrop-filter: blur(14px);
  padding: 14px;
  animation: reactions-pop 0.16s ease-out;
}
.reactions-panel.hidden { display: none; }
@keyframes reactions-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.reactions-panel-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; font-size: 0.82rem; font-weight: 600;
  color: rgba(255,255,255,0.7); letter-spacing: 0.05em; text-transform: uppercase;
}
.reactions-close {
  background: none; border: none; color: rgba(255,255,255,0.6);
  font-size: 1rem; cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.reactions-close:hover { background: rgba(255,255,255,0.08); color: #fff; }

.reactions-category-label {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: rgba(255,255,255,0.45);
  margin: 10px 4px 6px;
}
.reactions-category-label:first-child { margin-top: 2px; }

.reactions-grid {
  display: flex; flex-direction: column; gap: 2px;
}
.reactions-row {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px;
  margin-bottom: 8px;
}
.reaction-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.06);
  color: #e8eef0; font-size: 0.85rem; cursor: pointer;
  text-align: left; transition: background 0.12s ease, transform 0.12s ease;
}
.reaction-chip:hover  { background: rgba(255,255,255,0.10); }
.reaction-chip:active { transform: scale(0.97); }
.reaction-chip .emoji { font-size: 1.1rem; }
.reaction-chip .text  { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Connection banner (host down etc.) */
.connection-banner {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%);
  z-index: 90; padding: 10px 18px; border-radius: 999px;
  background: rgba(170, 60, 60, 0.92); color: #fff;
  font-size: 0.92rem; font-weight: 600; letter-spacing: 0.02em;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  backdrop-filter: blur(6px);
}
.connection-banner.hidden { display: none; }

/* Offline (disconnected) seat — dim & label */
.seat.offline                       { filter: grayscale(0.7) brightness(0.85); }
.seat.offline .seat-plate           { border-color: rgba(140,140,150,0.45); }
.seat.offline .seat-name::after     { content: ' · offline'; opacity: 0.7; font-size: 0.78em; font-weight: 400; }

/* Turn timer — sits on the active human's seat for the full 15s window.
   Calm/subtle for the first 7s, urgent red tick-tock in the final 8s. */
.turn-timer {
  position: absolute;
  top: -18px;
  right: -18px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: rgba(245, 245, 245, 0.92);
  background: radial-gradient(circle at 35% 30%, #4a525e, #1f242c);
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
  z-index: 6;
  pointer-events: none;
  transition: background 0.4s var(--ease), color 0.4s var(--ease),
              border-color 0.4s var(--ease), transform 0.25s var(--ease);
}
.turn-timer.urgent {
  width: 44px;
  height: 44px;
  font-size: 1.2rem;
  color: #fff;
  background: radial-gradient(circle at 35% 30%, #f3675a, #b3271b);
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 4px 12px rgba(180, 30, 20, 0.6), 0 0 0 4px rgba(255, 80, 60, 0.18);
  animation: turn-tick 1s ease-in-out infinite;
}
@keyframes turn-tick {
  0%, 100% { transform: scale(1);    box-shadow: 0 4px 12px rgba(180, 30, 20, 0.6), 0 0 0 4px rgba(255, 80, 60, 0.18); }
  50%      { transform: scale(1.15); box-shadow: 0 6px 18px rgba(220, 50, 35, 0.85), 0 0 0 8px rgba(255, 80, 60, 0.32); }
}

/* Busted: human stays seated as a spectator. No cards, grayed out, persistent. */
.seat.busted                        { filter: grayscale(1) brightness(0.7); opacity: 0.7; }
.seat.busted .seat-plate            { border-color: rgba(160,60,60,0.45); background: rgba(40,20,20,0.55); }
.seat.busted .seat-hole-cards       { display: none; }
.seat.busted .seat-chips            { color: #c47878; }

.seat.showdown .seat-plate {
  border-color: var(--win);
  box-shadow: 0 0 0 1px var(--win), 0 0 30px rgba(116,224,168,0.3), var(--shadow-md);
}
.seat.showdown .card { box-shadow: 0 0 16px rgba(116,224,168,0.4), var(--shadow-card); }

/* Winner emphasis at showdown */
.seat.winner .seat-plate {
  border-color: var(--gold);
  background: rgba(216,184,120,0.18);
  box-shadow: 0 0 0 2px var(--gold), 0 0 36px var(--gold-glow), var(--shadow-md);
  animation: winner-pulse 1.6s var(--ease) infinite;
}
.seat.winner .card {
  box-shadow: 0 0 22px var(--gold-glow), 0 0 6px var(--gold), var(--shadow-card);
  animation: winner-card-bob 1.6s var(--ease) infinite;
}
.seat.loser { opacity: 0.55; }
.seat.loser .card { filter: saturate(0.7) brightness(0.85); }

@keyframes winner-pulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--gold), 0 0 30px var(--gold-glow), var(--shadow-md); }
  50%      { box-shadow: 0 0 0 2px var(--gold), 0 0 50px var(--gold-glow), var(--shadow-md); }
}
@keyframes winner-card-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}

/* Staggered reveal flip for non-folded seats at showdown */
.card.showdown-reveal {
  animation: showdown-reveal 0.55s cubic-bezier(0.4, 0.0, 0.2, 1) both;
}
@keyframes showdown-reveal {
  0%   { transform: rotateY(180deg) scale(0.92); opacity: 0.6; }
  60%  { transform: rotateY(0deg)   scale(1.08); opacity: 1; }
  100% { transform: rotateY(0deg)   scale(1);    opacity: 1; }
}

/* =====================================================================
   SPEECH BUBBLES
   ===================================================================== */
.seat { /* needs to be positioning context for the bubble */ }
.seat-bubble {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #ffffff 0%, #f3f3f7 100%);
  color: #181922;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.25;
  padding: 7px 11px;
  border-radius: 14px;
  white-space: nowrap;
  max-width: 220px;
  box-shadow:
    0 6px 22px rgba(0,0,0,0.55),
    0 0 0 1px rgba(255,255,255,0.1) inset;
  pointer-events: none;
  z-index: 30;
  animation: bubble-in 0.32s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  letter-spacing: 0.01em;
}
.seat-bubble.fade-out {
  animation: bubble-out 0.35s ease forwards;
}
.seat-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border: 7px solid transparent;
}

/* Mood color accents (left bar) */
.seat-bubble.mood-celebrate   { box-shadow: 0 6px 22px rgba(0,0,0,0.55), inset 4px 0 0 #6fd99a; }
.seat-bubble.mood-loseHand    { box-shadow: 0 6px 22px rgba(0,0,0,0.55), inset 4px 0 0 #e07480; }
.seat-bubble.mood-sneaky      { box-shadow: 0 6px 22px rgba(0,0,0,0.55), inset 4px 0 0 #b07ad8; }
.seat-bubble.mood-smug        { box-shadow: 0 6px 22px rgba(0,0,0,0.55), inset 4px 0 0 #d8b878; }
.seat-bubble.mood-annoyed     { box-shadow: 0 6px 22px rgba(0,0,0,0.55), inset 4px 0 0 #f0a868; }
.seat-bubble.mood-confident   { box-shadow: 0 6px 22px rgba(0,0,0,0.55), inset 4px 0 0 #74acea; }
.seat-bubble.mood-committed   { box-shadow: 0 6px 22px rgba(0,0,0,0.55), inset 4px 0 0 #ec8a44; }
.seat-bubble.mood-surprised   { box-shadow: 0 6px 22px rgba(0,0,0,0.55), inset 4px 0 0 #f7d574; }
.seat-bubble.mood-rival       { box-shadow: 0 6px 22px rgba(0,0,0,0.55), inset 4px 0 0 #e0506b; }
.seat-bubble.mood-eliminated  { box-shadow: 0 6px 22px rgba(0,0,0,0.55), inset 4px 0 0 #6a6a72; }

/* Per-seat positioning. Bottom row + side seats: bubble above hole cards. */
/* Bottom-anchored seats: bubble points DOWN, sits above hole cards. */
.seat-0 .seat-bubble,
.seat-1 .seat-bubble,
.seat-7 .seat-bubble,
.seat-2 .seat-bubble,
.seat-6 .seat-bubble {
  bottom: calc(100% + 6px);
}
.seat-0 .seat-bubble::after,
.seat-1 .seat-bubble::after,
.seat-7 .seat-bubble::after,
.seat-2 .seat-bubble::after,
.seat-6 .seat-bubble::after {
  top: 100%;
  border-top-color: #f3f3f7;
}

/* Top-anchored seats: bubble points UP, sits below the plate. */
.seat-3 .seat-bubble,
.seat-4 .seat-bubble,
.seat-5 .seat-bubble {
  top: calc(100% + 6px);
}
.seat-3 .seat-bubble::after,
.seat-4 .seat-bubble::after,
.seat-5 .seat-bubble::after {
  bottom: 100%;
  border-bottom-color: #ffffff;
}

@keyframes bubble-in {
  0%   { opacity: 0; transform: translateX(-50%) scale(0.6) translateY(6px); }
  70%  { opacity: 1; transform: translateX(-50%) scale(1.04) translateY(0); }
  100% { opacity: 1; transform: translateX(-50%) scale(1) translateY(0); }
}
@keyframes bubble-out {
  to { opacity: 0; transform: translateX(-50%) scale(0.9) translateY(-4px); }
}

.seat.my-seat .seat-name { color: var(--gold-bright); }

/* =====================================================================
   CARDS
   ===================================================================== */
.card {
  width: 40px;
  height: 56px;
  border-radius: 7px;
  background: linear-gradient(160deg, #ffffff 0%, #eef0f3 100%);
  box-shadow: var(--shadow-card);
  position: relative;
  user-select: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3px 4px;
  transform-style: preserve-3d;
}
.card .rank {
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}
.card .rank.top  { align-self: flex-start; }
.card .rank.bottom { align-self: flex-end; transform: rotate(180deg); }
.card .suit-small { font-size: 0.58rem; display: block; margin-top: 1px; }
.card .suit-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.3rem;
  line-height: 1;
}

/* Community cards bigger */
.community-cards .card { width: 54px; height: 76px; border-radius: 9px; }
.community-cards .card .rank { font-size: 0.86rem; }
.community-cards .card .suit-center { font-size: 1.7rem; }
.community-cards .card .suit-small { font-size: 0.7rem; }

/* Face-down */
.card.face-down {
  background:
    linear-gradient(135deg, rgba(216,184,120,0.08), transparent),
    repeating-linear-gradient(45deg, #1a2740 0 6px, #16203a 6px 12px);
  border: 1px solid rgba(216,184,120,0.25);
}
.card.face-down::after {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(216,184,120,0.18);
  border-radius: 4px;
  background: radial-gradient(circle at 50% 50%, rgba(216,184,120,0.1), transparent 70%);
}

/* Deal / flip animation */
.card.dealt {
  animation: deal 0.4s var(--ease-out) both;
}
@keyframes deal {
  from { opacity: 0; transform: translateY(-22px) rotateY(-90deg) scale(0.8); }
  to   { opacity: 1; transform: translateY(0) rotateY(0) scale(1); }
}

/* =====================================================================
   ACTION DOCK
   ===================================================================== */
.action-dock {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(12,14,19,0.82);
  border: 1px solid var(--border-2);
  border-radius: 20px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  width: min(460px, 92vw);
  z-index: 60;
  backdrop-filter: blur(24px) saturate(1.4);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.06);
  animation: dockrise 0.35s var(--ease-out) both;
}
.action-dock.hidden { display: none; }
@keyframes dockrise {
  from { opacity: 0; transform: translateX(-50%) translateY(14px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.action-info {
  text-align: center;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  min-height: 14px;
}
.action-buttons { display: flex; gap: 8px; }
.action-buttons .btn { flex: 1; padding: 13px 6px; font-size: 0.86rem; }

.raise-row { display: flex; align-items: center; gap: 11px; }
.raise-row.hidden { display: none; }

#raise-amount {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  border-radius: 4px;
  background: var(--surface-2);
  outline: none;
  cursor: pointer;
}
#raise-amount::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold-deep));
  box-shadow: 0 2px 8px var(--gold-glow), inset 0 1px 0 rgba(255,255,255,0.5);
  cursor: pointer;
}
#raise-amount::-moz-range-thumb {
  width: 18px; height: 18px; border: none;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold-deep));
}
#raise-display {
  min-width: 48px;
  text-align: center;
  color: var(--gold-bright);
  font-weight: 800;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}
#btn-raise-confirm { padding: 10px 16px; }

/* =====================================================================
   TOAST
   ===================================================================== */
.toast {
  position: fixed;
  top: 70px;
  left: 50%;
  z-index: 100;
  background: rgba(12,14,19,0.9);
  border: 1px solid var(--border-2);
  color: var(--gold-bright);
  font-size: 1rem;
  font-weight: 700;
  padding: 13px 26px;
  border-radius: 26px;
  backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translateX(-50%) translateY(-10px) scale(0.96);
  transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-out);
}
.toast.toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}
.toast.hidden { display: none; }

/* ---------- Utility ---------- */
.hidden { display: none !important; }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .table-area { padding: 80px 28px 130px; }
  .table-felt {
    width: min(620px, 92vw);
    height: min(380px, 50vh);
  }
  .seat { width: 110px; }
  .seat-0 { bottom: -82px; }
  .seat-4 { top: -82px; }
  .seat-1 { bottom: -50px; left: 4%; }
  .seat-3 { top: -50px; left: 4%; }
  .seat-5 { top: -50px; right: 4%; }
  .seat-7 { bottom: -50px; right: 4%; }
  .seat-2 { left: -50px; }
  .seat-6 { right: -50px; }
}

/* Narrow phones — side seats sit inside the felt edge to avoid clipping. */
@media (max-width: 480px) {
  .table-area { padding: 70px 6px 140px; }
  .table-felt {
    width: 96vw;
    height: min(440px, 54vh);
    border-radius: 46% / 50%;
  }
  .seat { width: 96px; gap: 3px; }
  .seat-hole-cards { min-height: 46px; }
  .seat-plate { padding: 6px 8px; }

  .seat-0 { bottom: -76px; }
  .seat-4 { top: -76px; }
  .seat-1 { bottom: -46px; left: 2%; }
  .seat-3 { top: -46px; left: 2%; }
  .seat-5 { top: -46px; right: 2%; }
  .seat-7 { bottom: -46px; right: 2%; }
  /* Side seats: tuck onto the felt edge instead of hanging outside */
  .seat-2 { left: -12px; }
  .seat-6 { right: -12px; }

  /* Tighten the action dock and reactions button so they don't crowd seats */
  .action-dock { padding: 10px 12px; }
  .reactions-btn { width: 48px; height: 48px; bottom: 14px; right: 14px; }

  /* Community cards and hole cards smaller so they don't collide with side seats */
  .community-cards { gap: 5px; min-height: 64px; }
  .community-cards .card { width: 44px; height: 62px; border-radius: 7px; }
  .community-cards .card .rank { font-size: 0.72rem; }
  .community-cards .card .suit-center { font-size: 1.35rem; }
  .community-cards .card .suit-small { font-size: 0.58rem; }
  .seat-hole-cards { gap: 2px; min-height: 42px; }
  .seat-hole-cards .card { width: 32px; height: 44px; border-radius: 5px; }
  .seat-hole-cards .card .rank { font-size: 0.58rem; }
  .seat-hole-cards .card .suit-center { font-size: 0.95rem; }
}
