/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0e0e1a;
  color: #e0e0e0;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.hidden { display: none !important; }

/* ── Header ── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: linear-gradient(180deg, #1a2035, #141828);
  border-bottom: 1px solid #2a3050;
  height: 48px;
  flex-shrink: 0;
  z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 8px; }
.header-center { font-size: 14px; color: #aaa; }
.header-right { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.logo { height: 28px; }
.brand { font-weight: 700; font-size: 16px; color: #e94560; letter-spacing: 0.5px; }

.header-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #ccc;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
}
.header-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }

.status-dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot.connected { background: #4caf50; box-shadow: 0 0 6px #4caf50; }
.status-dot.disconnected { background: #f44336; }

#hand-number { color: #888; font-size: 12px; }

/* ══════════════════════════════════════════
   LOBBY
   ══════════════════════════════════════════ */
#lobby {
  flex: 1;
  overflow-y: auto;
  padding: 32px 24px;
}

.lobby-hero {
  text-align: center;
  margin-bottom: 32px;
}
.lobby-logo { height: 64px; margin-bottom: 12px; }
.lobby-title {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}
.lobby-subtitle {
  font-size: 14px;
  color: #888;
  margin-top: 6px;
}

/* Filters */
.lobby-filters {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.filter-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: #999;
  padding: 6px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.filter-btn:hover { background: rgba(255,255,255,0.1); color: #ccc; }
.filter-btn.active {
  background: rgba(76,175,80,0.15);
  border-color: #4caf50;
  color: #4caf50;
}

/* Table grid */
.lobby-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  max-width: 960px;
  margin: 0 auto;
}

.lobby-loading {
  grid-column: 1 / -1;
  text-align: center;
  color: #666;
  padding: 40px;
  font-size: 14px;
}

.lobby-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: #555;
  padding: 60px 20px;
}
.lobby-empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.3; }
.lobby-empty h3 { color: #777; margin-bottom: 8px; }

/* Table card */
.table-card {
  background: linear-gradient(135deg, #1a2235, #151c2e);
  border: 1px solid #2a3555;
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.table-card:hover {
  border-color: #4caf50;
  box-shadow: 0 4px 20px rgba(76,175,80,0.15);
  transform: translateY(-2px);
}
.table-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #4caf50, #2e7d32);
  opacity: 0;
  transition: opacity 0.2s;
}
.table-card:hover::before { opacity: 1; }

.table-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.table-card-id {
  font-weight: 700;
  font-size: 15px;
  color: #fff;
}
.table-card-variant {
  font-size: 11px;
  color: #4caf50;
  background: rgba(76,175,80,0.12);
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.table-card-body {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #888;
}
.table-card-stat { text-align: center; }
.table-card-stat-value {
  font-size: 16px;
  font-weight: 600;
  color: #ccc;
  display: block;
}
.table-card-stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; }

.table-card-players {
  display: flex;
  gap: 4px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.table-card-player-chip {
  font-size: 10px;
  color: #aaa;
  background: rgba(255,255,255,0.05);
  padding: 2px 6px;
  border-radius: 3px;
}

.table-card-action {
  margin-top: 12px;
  text-align: center;
  font-size: 12px;
  color: #4caf50;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ══════════════════════════════════════════
   TABLE PICKER DROPDOWN
   ══════════════════════════════════════════ */
.picker-dropdown {
  position: fixed;
  top: 48px;
  right: 16px;
  background: #1a2235;
  border: 1px solid #2a3555;
  border-radius: 8px;
  width: 260px;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 200;
}
.picker-header {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #2a3555;
}
.picker-list { padding: 4px; }
.picker-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: #ccc;
  transition: background 0.1s;
}
.picker-item:hover { background: rgba(255,255,255,0.06); }
.picker-item-id { font-weight: 600; }
.picker-item-info { font-size: 11px; color: #666; }
.picker-item.current { color: #4caf50; background: rgba(76,175,80,0.08); }

/* ══════════════════════════════════════════
   TABLE
   ══════════════════════════════════════════ */
#table-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  min-height: 0;
  background: #0a0a0a;
  overflow: visible;
}

/* Config-driven layout: 900×474 fixed coordinate system.
   All positions from layout-config.js, applied by applyLayout() in app.js.
   CSS transform: scale() applied via JS to fit the container. */
#felt {
  position: relative;
  width: 900px;
  height: 474px;
  border-radius: 0;
  border: none;
  box-shadow: none;
  overflow: visible;
  transform-origin: center center;
}

/* Carpet background layer — positioned by applyLayout() via CSS vars */
#felt::before {
  content: '';
  position: absolute;
  left: var(--carpet-left);
  top: var(--carpet-top);
  width: var(--carpet-w);
  height: var(--carpet-h);
  background: url('/assets/table-2c/carpet.svg') center/contain no-repeat;
  opacity: 0.3;
  border-radius: 12px;
  z-index: 0;
  pointer-events: none;
}

/* Table SVG layer — positioned by applyLayout() via CSS vars */
#felt::after {
  content: '';
  position: absolute;
  left: var(--table-left);
  top: var(--table-top);
  width: var(--table-w);
  height: var(--table-h);
  background: url('/assets/table-2c/table.svg') center/contain no-repeat;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
  z-index: 2;
  pointer-events: none;
}

/* ── Table Banner (288x80 affiliate banner on felt) ── */
#table-banner {
  position: absolute;
  /* Positioned by applyLayout() */
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 3;
  opacity: 0.5;
}
#table-banner img {
  height: auto;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

/* ── Decorative Plants (from Flash room_mc) ── */
.plant {
  position: absolute;
  width: 50px;
  height: auto;
  pointer-events: none;
  z-index: 1;
  opacity: 0.7;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
}
/* Bottom-right corner plants */
#plant-br  { bottom: 2%;  right: 5%;  transform: rotate(0deg); width: 65px; }
#plant-br2 { bottom: 5%;  right: 3%;  transform: rotate(35deg); width: 55px; }
/* Top-right corner plants */
#plant-tr  { top: 2%;     right: 3%;  transform: rotate(-100deg) scaleX(-1); width: 40px; }
#plant-tr2 { top: 5%;     right: 6%;  transform: rotate(-60deg); width: 35px; }
/* Top-left corner plants */
#plant-tl  { top: 2%;     left: 3%;   transform: rotate(100deg); width: 50px; }
#plant-tl2 { top: 6%;     left: 1%;   transform: rotate(50deg) scaleX(-1); width: 35px; }
/* Bottom-left corner plants */
#plant-bl  { bottom: 2%;  left: 7%;   transform: rotate(0deg) scaleX(-1); width: 60px; }
#plant-bl2 { bottom: 6%;  left: 3%;   transform: rotate(-30deg) scaleX(-1); width: 45px; }

/* ── Community Cards ── */
#community-cards {
  position: absolute;
  /* Positioned by applyLayout() */
  transform: translate(-50%, -50%);
  display: flex;
  gap: 6px;
  z-index: 5;
}

.card-slot {
  width: 52px;
  height: 72px;
  border-radius: 5px;
  border: 1px dashed rgba(255,255,255,0.08);
}

.card-slot.dealt { border: none; }

/* ── Pot ── */
#pot-display {
  position: absolute;
  /* Positioned by applyLayout() */
  transform: translate(-50%, 0);
  text-align: center;
  z-index: 5;
}

#pot-amount {
  background: rgba(0,0,0,0.6);
  color: #ffd700;
  font-weight: 700;
  font-size: 14px;
  padding: 4px 14px;
  border-radius: 14px;
  display: none;
  border: 1px solid rgba(255,215,0,0.2);
  backdrop-filter: blur(4px);
}
#pot-amount.visible { display: inline-flex; align-items: center; gap: 4px; }
.pot-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.pot-separator {
  margin: 0 8px;
  opacity: 0.4;
}
.pot-chips {
  display: flex;
  gap: 2px;
  margin-right: 2px;
}
.pot-chip {
  width: 18px;
  height: 18px;
}
.pot-chip img {
  width: 100%;
  height: 100%;
}

/* ── Round Indicator ── */
#round-indicator {
  position: absolute;
  top: 48%;
  left: 50%;
  transform: translate(-50%, 0);
  z-index: 2;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.3);
}

/* ══════════════════════════════════════════
   DEALER CHARACTER (2c vector style)
   ══════════════════════════════════════════ */
#dealer-character {
  position: absolute;
  /* Positioned by applyLayout() */
  z-index: 5;
  pointer-events: none;
}
#dealer-character img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

/* ══════════════════════════════════════════
   SEATS
   ══════════════════════════════════════════ */
/* v12 ANCHOR-POINT containers: width:0, height:0, children overflow visible.
   Flash seat origins are anchor points — children position themselves at
   Flash-local offsets. No bounding box computation needed. */
.seat {
  position: absolute;
  width: 0;
  height: 0;
  text-align: center;
  transition: opacity 0.3s ease;
  z-index: 3;
  overflow: visible;
}

.seat.empty { opacity: 0.85; }

/* Hit area over chair for hover/click (chair is in separate layer) */
.seat.empty::before {
  content: '';
  position: absolute;
  left: var(--hit-left);
  top: var(--hit-top);
  width: var(--hit-w);
  height: var(--hit-h);
  cursor: pointer;
}

/* ── Chair layer (below table surface) ── */
#chair-layer {
  position: absolute;
  top: 0; left: 0;
  width: 900px; height: 474px;
  z-index: 1;
  pointer-events: none;
}
#chair-layer img {
  position: absolute;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.7));
  pointer-events: none;
}

/* Flash info panel: 98×30px from Flash edge data (1958/20 × 607/20) */
/* Positioned absolutely within seat container per Flash data */
.seat-box {
  position: absolute;
  left: var(--box-left);
  top: var(--box-top);
  width: var(--box-w);
  height: var(--box-h);
  background: linear-gradient(180deg, rgba(15,20,35,0.85), rgba(8,12,22,0.92));
  border: 1px solid rgba(60,70,100,0.6);
  border-radius: 5px;
  padding: 2px 4px 3px;
  backdrop-filter: blur(4px);
  z-index: 4;
  overflow: hidden;
  box-sizing: border-box;
}

/* ── Player Avatar (2c hand-drawn vector style) ── */
/* Positioned absolutely within seat container per Flash nesting chain */
/* seat_mc + sex_mc offsets from Flash symbol hierarchy */
.seat-avatar {
  position: absolute;
  left: var(--av-left);
  top: var(--av-top);
  width: var(--av-w);
  height: var(--av-h);
  z-index: 3;
  pointer-events: none;
}
.seat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
}
/* ── Info panel (name + stack) — swaps with action bubble ── */
.seat-info {
  position: relative;
}
.seat-info-about { transition: opacity 0.15s; }
.seat-info-about.hidden-info { display: none; }

/* Action bubble (replaces info for 1.15s like Flash) */
.seat-info-action {
  display: none;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 0;
  min-height: 28px;
  line-height: 28px;
}
.seat-info-action.visible { display: block; }
.seat-info-action.fold   { color: #888; }
.seat-info-action.bet,
.seat-info-action.raise  { color: #e94560; }
.seat-info-action.call   { color: #3ca5f0; }
.seat-info-action.check  { color: #4caf50; }
.seat-info-action.blind  { color: #ff9800; }
.seat-info-action.allin  { color: #e94560; text-shadow: 0 0 6px rgba(233,69,96,0.5); }

/* Active turn: golden glow */
.seat.active-turn .seat-box {
  border-color: #ffd700;
  box-shadow: 0 0 14px rgba(255,215,0,0.35), 0 0 4px rgba(255,215,0,0.2);
  animation: turnPulse 1.5s ease-in-out infinite;
}

/* Winner highlight */
.seat.winner .seat-box {
  border-color: #4caf50;
  box-shadow: 0 0 20px rgba(76,175,80,0.5);
  animation: winPulse 0.5s ease-in-out 4;
}

/* Folded — dimmed, cards gone */
.seat.folded .seat-avatar,
.seat.folded .seat-box {
  opacity: 0.45;
  filter: grayscale(0.5);
}

/* All-in — prominent badge */
.all-in-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #e74c3c;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 5;
  animation: pulse-allin 1.5s ease-in-out infinite;
}

@keyframes pulse-allin {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Sitting out — subdued with overlay text */
.seat.sitting-out .seat-avatar,
.seat.sitting-out .seat-box {
  opacity: 0.35;
  filter: grayscale(0.8);
}

/* LLM model badges — inline with player name */
.model-badge {
  display: inline-block;
  font-size: 7px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  vertical-align: baseline;
  margin-right: 2px;
  line-height: 1;
}
.model-claude { background: #e67e22; color: #fff; }
.model-gpt    { background: #27ae60; color: #fff; }
.model-gemini { background: #3498db; color: #fff; }
.model-ai     { background: #7f8c8d; color: #fff; }

.sitting-out-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.7);
  color: #aaa;
  font-size: 9px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
  z-index: 5;
}

.seat-name {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.2;
}

.seat-stack {
  font-size: 10px;
  color: #d4a843;
  line-height: 1.2;
  font-weight: 600;
}

/* ── Bet chips (between seat and pot) ── */
.seat-bet-area {
  position: absolute;
  display: none;
  align-items: center;
  gap: 3px;
  z-index: 8;
  pointer-events: none;
}
.seat-bet-area.visible { display: flex; }

.bet-chip-stack {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
}
.bet-chip {
  width: 22px;
  height: 22px;
  margin-top: -14px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}
.bet-chip img {
  width: 100%;
  height: 100%;
}
.bet-chip:first-child { margin-top: 0; }

.bet-amount-label {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: rgba(0,0,0,0.6);
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
}

/* Player cards next to seat */
.seat-cards {
  display: flex;
  gap: 3px;
  justify-content: center;
  min-height: 40px;
  z-index: 4;
  position: absolute;
  left: var(--cards-left);
  top: var(--cards-top);
}

/* ── Dealer button ── */
#dealer-button {
  position: absolute;
  width: 23px;
  height: 20px;
  background: url('/assets/ui/dealer-button.svg') center/contain no-repeat;
  color: transparent;
  font-size: 0;
  transition: top 0.5s ease, left 0.5s ease;
  z-index: 15;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}
#dealer-button.hidden { display: none; }

/* Chip fly layer */
#chip-fly-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}

/* Flying chip element */
.chip-fly {
  position: absolute;
  width: 28px;
  height: 28px;
}
.chip-fly img {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

/* ═══ Config-driven layout (layout-config.js) ═══════════════════════ */
/* Seat anchors: inline styles from applyLayout().                     */
/* Children: CSS custom properties set on seat container.              */
/* Edit layout-config.js and refresh to adjust positions.              */

/* ══════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════ */
.card {
  width: 42px;
  height: 58px;
  border-radius: 4px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  position: relative;
}

.card.face-up {
  background: #fff;
  border: 1px solid #bbb;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.card.face-down {
  background: url('/assets/table-2c/card-back.svg') center/cover no-repeat;
  border: 1px solid #8a7a3a;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.card .rank { font-size: 14px; }
.card .suit { font-size: 16px; margin-top: -2px; }
.card.red { color: #cc2222; }
.card.black { color: #1a1a1a; }

/* Community card size */
#community-cards .card {
  width: 52px;
  height: 72px;
  font-size: 16px;
}
#community-cards .card .suit { font-size: 18px; }

/* Seat card size */
.seat-cards .card {
  width: 34px;
  height: 48px;
  font-size: 11px;
}
.seat-cards .card .suit { font-size: 13px; }

/* ── Card dealing animation ── */
.card.dealing {
  opacity: 0;
  transform: scale(0.4);
  transition: none;
}
.card.dealt-in {
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.12s ease-out, transform 0.12s ease-out;
}

/* ── Card flip animation ── */
.card-flip-wrap {
  perspective: 600px;
  display: inline-block;
}
.card.flipping {
  animation: cardFlip 0.35s ease-in-out forwards;
}
@keyframes cardFlip {
  0%   { transform: rotateY(0deg); }
  50%  { transform: rotateY(90deg); }
  100% { transform: rotateY(0deg); }
}

/* ── Flying cards (deal / fold / community animations) ── */
.card-flying {
  position: absolute;
  width: 34px;
  height: 48px;
  pointer-events: none;
  z-index: 25;
  border-radius: 3px;
}
.card-flying.community-flying {
  width: 52px;
  height: 72px;
}

/* ── Community card entrance ── */
.card-slot.dealt .card {
  animation: cardDeal 0.25s ease-out;
}

/* ══════════════════════════════════════════
   ACTION LOG
   ══════════════════════════════════════════ */
#action-log {
  height: 110px;
  flex-shrink: 0;
  background: #0a0d14;
  border-top: 1px solid #1e2535;
  overflow-y: auto;
  padding: 8px 16px;
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

#log-entries {
  display: flex;
  flex-direction: column;
}

.log-entry {
  padding: 2px 0;
  color: #6b7280;
  animation: logSlide 0.15s ease-out;
}
.log-entry .log-time {
  color: #3b4252;
  margin-right: 8px;
}

.log-entry.action-fold { color: #6b7280; }
.log-entry.action-check { color: #4caf50; }
.log-entry.action-call { color: #3282b8; }
.log-entry.action-bet, .log-entry.action-raise { color: #e94560; }
.log-entry.action-blind { color: #ff9800; }
.log-entry.action-winner { color: #ffd700; font-weight: 600; }
.log-entry.action-hand { color: #a78bfa; }
.log-entry.action-round { color: #22d3ee; }
.log-entry.action-chat { color: #f0abfc; }
.log-entry.action-chat .chat-name { color: #c084fc; font-weight: 600; }
.log-entry.action-chat .chat-text { font-style: italic; }

/* ── Chat Speech Bubbles ── */
.chat-bubble {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  background: rgba(0, 0, 0, 0.85);
  color: #f0abfc;
  font-size: 12px;
  font-style: italic;
  padding: 6px 12px;
  border-radius: 12px;
  border: 1px solid rgba(192, 132, 252, 0.3);
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.chat-bubble.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(-8px);
}
.chat-bubble::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.85);
}

/* ══════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════ */
@keyframes cardDeal {
  from { opacity: 0; transform: scale(0.5) translateY(-20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes actionFade {
  0%   { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes winPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(76,175,80,0.4); }
  50%      { box-shadow: 0 0 28px rgba(76,175,80,0.8); }
}

@keyframes turnPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(255,215,0,0.25), 0 0 4px rgba(255,215,0,0.15); }
  50%      { box-shadow: 0 0 18px rgba(255,215,0,0.45), 0 0 6px rgba(255,215,0,0.25); }
}

@keyframes logSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */
/* Responsive: transform:scale() in JS handles all sizing.
   No media query overrides needed — the 900×474 game area scales uniformly. */

@media (max-width: 600px) {
  .lobby-grid { grid-template-columns: 1fr; }
  .lobby-hero { margin-bottom: 20px; }
  .lobby-title { font-size: 22px; }
  .lobby-filters { gap: 4px; }
  .filter-btn { font-size: 11px; padding: 4px 10px; }
}

/* ══════════════════════════════════════════
   PLAYER CONTROLS
   ══════════════════════════════════════════ */

.player-controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(10,10,10,0.98), rgba(10,10,10,0.9));
  border-top: 1px solid #333;
  padding: 12px 20px;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: 800px;
  margin: 0 auto;
}

.ctrl-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s;
  color: #fff;
  position: relative;
}

.ctrl-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.ctrl-btn:active {
  transform: translateY(0);
}

.ctrl-btn .shortcut {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  opacity: 0.5;
  padding: 1px 5px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 3px;
}

.ctrl-fold { background: #c0392b; }
.ctrl-fold:hover { background: #e74c3c; }

.ctrl-check { background: #27ae60; }
.ctrl-check:hover { background: #2ecc71; }

.ctrl-call { background: #2980b9; }
.ctrl-call:hover { background: #3498db; }

.ctrl-raise { background: #f39c12; color: #000; }
.ctrl-raise:hover { background: #f1c40f; }

.ctrl-allin { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.ctrl-allin:hover { background: linear-gradient(135deg, #ff6b6b, #e74c3c); }

.ctrl-raise-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.raise-presets {
  display: flex;
  gap: 6px;
}

.preset-btn {
  padding: 4px 10px;
  font-size: 11px;
  background: #333;
  color: #ccc;
  border: 1px solid #555;
  border-radius: 4px;
  cursor: pointer;
}

.preset-btn:hover { background: #444; color: #fff; }

.raise-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.raise-slider {
  width: 150px;
  accent-color: #f39c12;
}

.raise-amount {
  font-size: 14px;
  font-weight: 600;
  color: #f39c12;
  min-width: 50px;
  text-align: center;
}

/* ── Turn Timer ── */

.turn-timer {
  position: fixed;
  bottom: 68px;
  left: 0;
  right: 0;
  height: 4px;
  z-index: 101;
}

.timer-bar {
  width: 100%;
  height: 100%;
  background: rgba(50,50,50,0.5);
}

.timer-fill {
  height: 100%;
  background: #4caf50;
  transition: width 0.05s linear;
}

.timer-fill.timer-urgent {
  background: #e74c3c;
}

/* ── Seat "Sit" Button (for empty seats in player mode) ── */

.seat.empty .seat-sit-btn {
  display: none;
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  padding: 6px 16px;
  background: rgba(39,174,96,0.9);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  z-index: 5;
}

.seat.empty:hover .seat-sit-btn {
  display: block;
}

.seat.empty .seat-sit-btn:hover {
  background: #2ecc71;
  transform: translate(-50%, -50%) scale(1.05);
}

/* ── Player's Hole Cards (larger, face-up) ── */

.seat.my-seat .seat-cards .card {
  width: 42px;
  height: 60px;
  font-size: 14px;
}

.seat.my-seat {
  z-index: 10;
}

/* ── Auth Banner ── */

.auth-banner {
  position: fixed;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,20,30,0.9);
  border: 1px solid #444;
  border-radius: 8px;
  padding: 8px 20px;
  z-index: 50;
  font-size: 13px;
  color: #aaa;
  backdrop-filter: blur(4px);
}

.auth-banner a {
  color: #4caf50;
  cursor: pointer;
  text-decoration: underline;
}

/* ── Modal ── */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-content {
  background: #1a1a2e;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 24px;
  min-width: 320px;
  max-width: 420px;
}

.modal-small {
  min-width: 260px;
  max-width: 320px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
  color: #e0e0e0;
}

.modal-close {
  background: none;
  border: none;
  color: #888;
  font-size: 24px;
  cursor: pointer;
}

.modal-close:hover { color: #fff; }

.modal-tabs {
  display: flex;
  gap: 0;
}

.modal-tab {
  background: none;
  border: none;
  color: #888;
  font-size: 16px;
  font-weight: 600;
  padding: 6px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}

.modal-tab:hover { color: #ccc; }
.modal-tab.active { color: #e0e0e0; border-bottom-color: #4caf50; }

.modal-form .form-group {
  margin-bottom: 12px;
}

.modal-form label {
  display: block;
  font-size: 13px;
  color: #aaa;
  margin-bottom: 4px;
}

.modal-form input[type="text"],
.modal-form input[type="password"],
.modal-form input[type="email"] {
  width: 100%;
  padding: 8px 12px;
  background: #0e0e1a;
  border: 1px solid #444;
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 14px;
  box-sizing: border-box;
}

.modal-form input:focus {
  outline: none;
  border-color: #4caf50;
}

.form-error {
  color: #e74c3c;
  font-size: 13px;
  margin-bottom: 8px;
}

.form-success {
  color: #4caf50;
  font-size: 13px;
  margin-bottom: 8px;
}

.optional {
  color: #666;
  font-weight: normal;
}

.btn-primary {
  width: 100%;
  padding: 10px;
  background: #4caf50;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:hover { background: #45a049; }

.modal-footer {
  margin-top: 12px;
  text-align: center;
  font-size: 12px;
  color: #666;
}

.buyin-form {
  text-align: center;
}

.avatar-toggle {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
}

.avatar-option {
  background: none;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 4px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
  opacity: 0.5;
}

.avatar-option:hover {
  opacity: 0.8;
  transform: scale(1.05);
}

.avatar-option.selected {
  border-color: #4caf50;
  opacity: 1;
}

.avatar-preview {
  width: 64px;
  height: 64px;
  display: block;
}

.buyin-range {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #888;
  margin-bottom: 8px;
}

.buyin-slider {
  width: 100%;
  accent-color: #4caf50;
}

.buyin-amount {
  font-size: 24px;
  font-weight: 700;
  color: #4caf50;
  margin: 8px 0;
}

.buyin-confirm {
  margin-top: 8px;
}

/* ── Player Name in Header ── */

.player-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #aaa;
}

.player-info .player-name {
  color: #4caf50;
  font-weight: 600;
}

.player-info .logout-btn {
  background: none;
  border: 1px solid #555;
  color: #aaa;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}

.player-info .logout-btn:hover {
  color: #fff;
  border-color: #888;
}

/* ── Leave Table Button ── */

.leave-table-btn {
  padding: 6px 14px;
  background: #c0392b;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.leave-table-btn:hover {
  background: #e74c3c;
}

/* ── Seat Options Panel (Flash-style bottom panel) ── */
.seat-options {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 6px 16px;
  background: rgba(0, 0, 0, 0.7);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.seat-option {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #ccc;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.seat-option:hover {
  color: #fff;
}
.seat-option input[type="checkbox"] {
  accent-color: #4caf50;
  width: 15px;
  height: 15px;
  cursor: pointer;
}
.btn-i-am-back {
  padding: 5px 14px;
  background: #2ecc71;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-i-am-back:hover {
  background: #27ae60;
}

/* ── Showdown winner highlight / dimmed losers ── */
.seat.winner-highlight .seat-cards .card { box-shadow: 0 0 12px 4px gold; }
.seat.winner-highlight .seat-box { box-shadow: 0 0 8px 2px rgba(255, 215, 0, 0.4); }
.seat.dimmed .seat-cards { opacity: 0.35; }
.seat.dimmed .seat-avatar { opacity: 0.5; }
.side-pot-sep { color: #666; margin: 0 6px; }

/* Flash-style community card highlighting at showdown */
.card-slot.winning-card .card { box-shadow: 0 0 10px 3px gold; transform: translateY(-3px); }
.card-slot.dimmed-card .card { opacity: 0.35; filter: brightness(0.6); }

/* Hand description (shown below community cards at showdown) */
.hand-description {
  position: absolute;
  left: 50%; transform: translateX(-50%);
  top: calc(var(--cc-top, 160px) + 70px);
  color: #ffd700;
  font-size: 16px;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.5), 0 1px 3px rgba(0,0,0,0.8);
  text-align: center;
  white-space: nowrap;
  z-index: 20;
  pointer-events: none;
}
.hand-description.hidden { display: none; }

/* ══════════════════════════════════════════
   QUICK-PLAY PRE-ACTION PANEL
   ══════════════════════════════════════════ */
.quick-play-panel {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(0,0,0,0.85);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  z-index: 200;
}
/* Push above seat-options when both visible */
#seat-options:not(.hidden) ~ #quick-play-panel:not(.hidden) {
  bottom: 76px;
}
.qp-row {
  display: flex;
  gap: 6px;
}
.qp-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  color: #ccc;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s, border-color 0.15s;
}
.qp-btn:hover { background: rgba(255,255,255,0.15); }
.qp-btn.selected { background: #e94560; color: #fff; border-color: #e94560; }

/* Time bank */
.timer-timebank { background: #ff9800 !important; }
.timer-fill.timer-expired { background: #666; width: 0% !important; }
.timer-label { font-size: 11px; color: #ff9800; text-align: center; margin-top: 2px; }

/* Show/Muck prompt — rendered in #player-controls */
.show-muck-panel {
  display: flex; gap: 10px; align-items: center; justify-content: center;
  padding: 8px 16px;
}
.sm-label {
  color: #e0d8c8; font-size: 14px; font-weight: 600; margin-right: 6px;
}
.sm-btn {
  padding: 8px 20px; border-radius: 6px; cursor: pointer;
  font-size: 13px; font-weight: 600; border: none;
}
.sm-show { background: #4caf50; color: #fff; }
.sm-muck { background: #666; color: #fff; }
.sm-btn:hover { opacity: 0.85; transform: scale(1.05); }
