/* style.css - Poker Game Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@700&display=swap');

:root {
  --bg-dark: #0a0f0a;
  --bg-felt: #1a3a1a;
  --felt-gradient: radial-gradient(ellipse at center, #1e4020 0%, #163018 50%, #0f2210 100%);
  --gold: #c9a227;
  --gold-light: #f0c040;
  --gold-dark: #9a7b1a;
  --red: #e03030;
  --red-dark: #a00000;
  --white: #f5f5f0;
  --gray: #888;
  --bg-panel: rgba(0,0,0,0.6);
  --border-gold: 1px solid rgba(201,162,39,0.4);
  --card-bg: #fff;
  --card-red: #cc1111;
  --card-black: #111;
  --text-muted: #aaa;
  --chip-1: #fff;
  --chip-5: #e03030;
  --chip-10: #3366cc;
  --chip-25: #336633;
  --chip-100: #222;
  --chip-500: #7b2d8b;
}

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

html, body {
  width: 100%; height: 100%;
  background: var(--bg-dark);
  color: var(--white);
  font-family: 'Inter', sans-serif;
  overflow: hidden;
}

body { overflow-y: auto; }

/* ─── Screens ─────────────────────────────────────────────── */
.screen { display: none; }
.screen.active { display: flex; }

/* ─── Lobby Screen ────────────────────────────────────────── */
#lobby-screen {
  min-height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, #1a2e1a 0%, #050a05 100%);
  padding: 20px;
}

.lobby-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.5rem, 8vw, 5rem);
  color: var(--gold);
  text-shadow: 0 0 40px rgba(201,162,39,0.5), 0 2px 8px rgba(0,0,0,0.8);
  letter-spacing: 2px;
  margin-bottom: 8px;
  text-align: center;
}

.lobby-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 48px;
  text-align: center;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.lobby-box {
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(201,162,39,0.3);
  border-radius: 16px;
  padding: 36px;
  width: 100%;
  max-width: 440px;
  backdrop-filter: blur(10px);
}

.lobby-tabs {
  display: flex;
  margin-bottom: 28px;
  border-bottom: 1px solid rgba(201,162,39,0.2);
}

.lobby-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.5px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.lobby-tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  color: var(--white);
  font-size: 1rem;
  padding: 12px 16px;
  transition: border-color 0.2s;
  font-family: 'Inter', sans-serif;
}

.form-input:focus {
  outline: none;
  border-color: rgba(201,162,39,0.6);
  background: rgba(255,255,255,0.1);
}

.form-input::placeholder { color: rgba(255,255,255,0.25); }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: #000;
}
.btn-primary:hover { background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%); transform: translateY(-1px); box-shadow: 0 4px 20px rgba(201,162,39,0.3); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: rgba(255,255,255,0.1);
  color: var(--white);
  border: 1px solid rgba(255,255,255,0.2);
}
.btn-secondary:hover { background: rgba(255,255,255,0.15); }

.rooms-list {
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 20px;
}

.room-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.room-card:hover {
  border-color: rgba(201,162,39,0.5);
  background: rgba(201,162,39,0.08);
}

.room-info { flex: 1; }
.room-name { font-weight: 600; font-size: 0.95rem; margin-bottom: 3px; }
.room-meta { color: var(--text-muted); font-size: 0.8rem; }
.room-badge {
  background: rgba(201,162,39,0.2);
  color: var(--gold);
  border: 1px solid rgba(201,162,39,0.3);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.empty-rooms {
  text-align: center;
  color: var(--text-muted);
  padding: 30px;
  font-size: 0.9rem;
}

/* ─── Game Screen ─────────────────────────────────────────── */
#game-screen {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #050a05;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(0,0,0,0.8);
  border-bottom: var(--border-gold);
  flex-shrink: 0;
  z-index: 10;
}

.header-left { display: flex; align-items: center; gap: 16px; }
.header-logo { font-family: 'Playfair Display', serif; color: var(--gold); font-size: 1.3rem; }
.room-id-display { color: var(--text-muted); font-size: 0.8rem; }
.room-id-display span { color: var(--gold); font-weight: 600; letter-spacing: 2px; }

.header-right { display: flex; align-items: center; gap: 12px; }
.header-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--white);
  font-size: 0.8rem;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}
.header-btn:hover { background: rgba(255,255,255,0.15); }
.header-btn.danger { color: #ff8080; }

/* Main game area */
.game-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

/* Poker Table */
.table-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(28px, 8vh, 80px) clamp(14px, 6vw, 100px);
  position: relative;
  min-width: 0;
  min-height: 0;
}

.poker-table {
  width: 100%;
  max-width: min(900px, 100%);
  aspect-ratio: 2 / 1;
  max-height: min(62vh, calc(100dvh - 260px));
  background: var(--felt-gradient);
  border-radius: 50%;
  border: 12px solid #3d2d0a;
  box-shadow:
    0 0 0 3px #5a4010,
    0 0 0 6px #3d2d0a,
    inset 0 4px 20px rgba(0,0,0,0.4),
    0 20px 60px rgba(0,0,0,0.8);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Seat container covers the full table area */
#seat-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#seat-container .player-seat {
  pointer-events: auto;
}

/* Player seats around the table */
.player-seat {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 2;
}

/* Seat positions - oval layout */
.seat-0 { bottom: -15%; left: 50%; transform: translateX(-50%); }
.seat-1 { bottom: -7%; left: 10%; }
.seat-2 { top: 35%; left: -10%; transform: translateY(-50%); }
.seat-3 { top: -15%; left: 26%; }
.seat-4 { top: -15%; right: 26%; }
.seat-5 { top: 35%; right: -10%; transform: translateY(-50%); }
.seat-6 { bottom: -7%; right: 10%; }

.player-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  position: relative;
  transition: all 0.3s;
}

.player-seat.is-turn .player-avatar {
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(201,162,39,0.7);
  animation: pulse-gold 1.5s ease-in-out infinite;
}

.player-seat.is-turn .player-info {
  border-color: rgba(201,162,39,0.65);
  box-shadow: 0 0 18px rgba(201,162,39,0.35);
}

@keyframes pulse-gold {
  0%, 100% {
    box-shadow: 0 0 8px rgba(201,162,39,0.5), 0 0 0 0 rgba(201,162,39,0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(201,162,39,1), 0 0 0 8px rgba(201,162,39,0.1);
  }
}

.player-seat.is-me .player-avatar { border-color: #4a9eff; }
.player-seat.folded { transition: opacity 0.4s; }
.player-seat.folded .player-avatar { opacity: 0.35; filter: grayscale(0.6); transition: all 0.4s; }
.player-seat { transition: filter 0.3s; }
.player-seat.empty .player-avatar {
  border-style: dashed;
  opacity: 0.3;
  font-size: 1rem;
  color: var(--text-muted);
}

.player-info {
  text-align: center;
  background: rgba(0,0,0,0.75);
  border-radius: 8px;
  padding: 4px 10px;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.1);
  min-width: 80px;
}

.player-name {
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
}

.player-chips-display {
  font-size: 0.7rem;
  color: var(--gold);
  font-weight: 500;
  transition: color 0.3s;
}

/* Highlight chips when they change */
@keyframes chipsChange {
  0%   { color: #fff; transform: scale(1.2); }
  100% { color: var(--gold); transform: scale(1); }
}

.player-chips-display.chips-changed {
  animation: chipsChange 0.5s ease-out;
}

.player-bet-display {
  position: absolute;
  background: rgba(0,0,0,0.8);
  border: 1px solid rgba(201,162,39,0.4);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.7rem;
  color: var(--gold);
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  animation: betPopIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes betPopIn {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* Position bet displays near seats */
.seat-0 .player-bet-display { bottom: 80px; }
.seat-1 .player-bet-display { top: 0; right: -60px; }
.seat-2 .player-bet-display { top: 0; right: -60px; }
.seat-3 .player-bet-display { bottom: -20px; }
.seat-4 .player-bet-display { bottom: -20px; }
.seat-5 .player-bet-display { top: 0; left: -60px; }
.seat-6 .player-bet-display { top: 0; left: -60px; }

/* Dealer button */
.dealer-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  color: #000;
  font-size: 0.65rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #aaa;
  position: absolute;
  top: -4px;
  right: -4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.turn-seat-badge {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #000;
  border: 1px solid rgba(255,255,255,0.55);
  border-radius: 999px;
  font-size: 0.58rem;
  letter-spacing: 0.8px;
  font-weight: 800;
  padding: 2px 8px;
  white-space: nowrap;
  text-transform: uppercase;
  box-shadow: 0 4px 10px rgba(0,0,0,0.45);
}

/* Hole cards on seat */
.seat-cards {
  display: flex;
  gap: 3px;
}

.pocket-card {
  width: 28px;
  height: 38px;
  border-radius: 4px;
  background: #1a1460;
  border: 1px solid rgba(255,255,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  transition: all 0.3s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.pocket-card.revealed {
  background: var(--card-bg);
  color: var(--card-black);
  border: 1px solid #ddd;
}

.pocket-card.revealed.red { color: var(--card-red); }

/* Center area */
.table-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  z-index: 4;
  position: relative;
}

.turn-indicator {
  background: rgba(201,162,39,0.14);
  border: 1px solid rgba(201,162,39,0.55);
  color: var(--gold-light);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  box-shadow: 0 0 16px rgba(201,162,39,0.25);
  animation: turnIndicatorPulse 1.15s ease-in-out infinite;
}

@keyframes turnIndicatorPulse {
  0%, 100% { transform: scale(1); opacity: 0.95; }
  50% { transform: scale(1.05); opacity: 1; }
}

.pot-display {
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(201,162,39,0.3);
  border-radius: 20px;
  padding: 6px 20px;
  font-size: 0.85rem;
  color: var(--gold);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pot-label { color: var(--text-muted); font-size: 0.75rem; font-weight: 400; }

/* Community cards */
.community-cards {
  display: flex;
  gap: 8px;
  align-items: center;
}

.community-card {
  width: 54px;
  height: 76px;
  border-radius: 8px;
  background: var(--card-bg);
  border: 2px solid #ddd;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 5px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.6), 0 1px 3px rgba(0,0,0,0.3);
  transition: transform 0.3s;
  animation: dealCard 0.4s ease-out;
  position: relative;
}

.community-card.placeholder {
  background: rgba(255,255,255,0.05);
  border: 2px dashed rgba(255,255,255,0.1);
  box-shadow: none;
  animation: none;
}

@keyframes dealCard {
  from { transform: scale(0.7) translateY(-20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

/* ── 3D flip animation for community cards ── */
@keyframes cardFlipIn {
  0%   { transform: perspective(400px) rotateY(90deg) scale(0.8); opacity: 0; }
  40%  { transform: perspective(400px) rotateY(-10deg) scale(1.05); opacity: 1; }
  70%  { transform: perspective(400px) rotateY(5deg) scale(1.06); box-shadow: 0 0 24px rgba(201,162,39,0.35), 0 4px 16px rgba(0,0,0,0.6); }
  100% { transform: perspective(400px) rotateY(0deg) scale(1); opacity: 1; box-shadow: 0 4px 16px rgba(0,0,0,0.6), 0 1px 3px rgba(0,0,0,0.3); }
}

.community-card.card-flip-in {
  animation: cardFlipIn 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* ── Pocket card deal animation at seats ── */
@keyframes pocketDealIn {
  0%   { transform: translateY(-60px) rotate(-12deg) scale(0.5); opacity: 0; }
  60%  { transform: translateY(4px) rotate(2deg) scale(1.05); opacity: 1; }
  80%  { transform: translateY(-2px) rotate(-1deg) scale(1); }
  100% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
}

.pocket-card.deal-in {
  animation: pocketDealIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ── My cards sidebar deal animation ── */
@keyframes myCardDealIn {
  0%   { transform: translateY(40px) rotate(8deg) scale(0.6); opacity: 0; }
  60%  { transform: translateY(-6px) rotate(-2deg) scale(1.08); opacity: 1; }
  80%  { transform: translateY(3px) rotate(1deg) scale(1); }
  100% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
}

.my-card.my-card-deal-in {
  animation: myCardDealIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ── Pot bump animation ── */
@keyframes potBump {
  0%   { transform: scale(1); color: var(--gold); }
  30%  { transform: scale(1.35); color: var(--gold-light); }
  60%  { transform: scale(0.95); }
  100% { transform: scale(1); color: var(--gold); }
}

.pot-bump {
  animation: potBump 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.community-card .card-rank {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  color: inherit;
}

.community-card .card-suit {
  font-size: 0.85rem;
  line-height: 1;
}

.community-card.red { color: var(--card-red); }
.community-card.black { color: var(--card-black); }

/* center suit symbol */
.community-card .card-center-suit {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.6rem;
  opacity: 0.15;
}

/* ─── Sidebar ─────────────────────────────────────────────── */
.game-sidebar {
  width: 280px;
  background: rgba(0,0,0,0.7);
  border-left: var(--border-gold);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-height: 0;
  overflow-y: auto;
}

.sidebar-section {
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-weight: 600;
}

/* My hand */
.my-cards {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 10px;
}

.my-card {
  width: 62px;
  height: 88px;
  border-radius: 8px;
  background: var(--card-bg);
  border: 2px solid #ddd;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
  transition: transform 0.3s;
  position: relative;
  animation: dealCard 0.4s ease-out;
}

.my-card:hover { transform: translateY(-4px) scale(1.05); }
.my-card.red { color: var(--card-red); }
.my-card.black { color: var(--card-black); }
.my-card.face-down { background: #1a1460; border-color: rgba(255,255,255,0.3); }

.my-card .card-rank { font-size: 1.2rem; font-weight: 700; line-height: 1; }
.my-card .card-suit { font-size: 1rem; line-height: 1; }
.my-card .card-center-suit {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  opacity: 0.12;
}

.hand-name-display {
  text-align: center;
  font-size: 0.82rem;
  color: var(--gold);
  font-weight: 600;
  min-height: 20px;
}

/* Actions */
#action-panel { display: none; }
#action-panel.visible { display: block; }

.game-status-text {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 8px 0;
  min-height: 24px;
}

.game-status-text.highlight { color: var(--gold); font-weight: 600; }

.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.action-btn {
  border: none;
  border-radius: 8px;
  padding: 12px 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.3px;
}

.action-btn:hover { transform: translateY(-1px); }
.action-btn:active { transform: translateY(0); }

.btn-fold { background: rgba(180,30,30,0.3); color: #ff8080; border: 1px solid rgba(180,30,30,0.5); }
.btn-fold:hover { background: rgba(180,30,30,0.5); }

.btn-check { background: rgba(50,150,50,0.3); color: #80d080; border: 1px solid rgba(50,150,50,0.5); }
.btn-check:hover { background: rgba(50,150,50,0.5); }

.btn-call { background: rgba(50,100,200,0.3); color: #80a8ff; border: 1px solid rgba(50,100,200,0.5); }
.btn-call:hover { background: rgba(50,100,200,0.5); }

.btn-raise { background: rgba(180,140,0,0.3); color: var(--gold-light); border: 1px solid rgba(180,140,0,0.5); grid-column: 1/-1; }
.btn-raise:hover { background: rgba(180,140,0,0.5); }

.btn-allin { background: rgba(150,0,200,0.3); color: #d080ff; border: 1px solid rgba(150,0,200,0.5); grid-column: 1/-1; }
.btn-allin:hover { background: rgba(150,0,200,0.5); }

.btn-rebuy { background: rgba(80,180,255,0.25); color: #80c8ff; border: 1px solid rgba(80,180,255,0.5); grid-column: 1/-1; }
.btn-rebuy:hover { background: rgba(80,180,255,0.45); }

.raise-controls {
  display: none;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.raise-controls.visible { display: flex; }

.raise-input {
  flex: 1;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(201,162,39,0.4);
  border-radius: 6px;
  color: var(--white);
  font-size: 0.9rem;
  padding: 8px 12px;
  font-family: 'Inter', sans-serif;
}

.raise-input:focus { outline: none; border-color: var(--gold); }

.btn-confirm-raise {
  background: var(--gold);
  color: #000;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}
.btn-confirm-raise:hover { background: var(--gold-light); }

/* Chip quick buttons */
.chip-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.chip-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--white);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}
.chip-btn:hover { background: rgba(201,162,39,0.2); border-color: rgba(201,162,39,0.4); }

/* Action log */
.action-log {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.action-entry {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

.action-entry .player-label { color: var(--white); font-weight: 600; flex-shrink: 0; }
.action-entry .action-label { color: #aaddaa; }
.action-entry .amount-label { color: var(--gold); font-weight: 600; }
.action-entry.system { color: rgba(201,162,39,0.7); font-style: italic; }

/* Players list in sidebar */
.players-list-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.player-row.is-turn-row {
  background: rgba(201,162,39,0.14);
  border: 1px solid rgba(201,162,39,0.45);
  border-radius: 8px;
  padding: 8px 8px;
  margin: 2px 0;
  box-shadow: 0 0 12px rgba(201,162,39,0.2);
}

.player-row:last-child { border-bottom: none; }
.player-row-avatar { font-size: 1.1rem; width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,0.08); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.player-row-info { flex: 1; min-width: 0; }
.player-row-name { font-size: 0.82rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-row-chips { font-size: 0.72rem; color: var(--gold); }
.player-row-status { font-size: 0.7rem; color: var(--text-muted); }
.status-folded { color: #cc6060; }
.status-allin { color: #cc80ff; }
.status-active { color: #80d080; }
.is-you-badge { background: rgba(74,158,255,0.2); color: #4a9eff; border: 1px solid rgba(74,158,255,0.3); border-radius: 4px; padding: 1px 5px; font-size: 0.65rem; flex-shrink: 0; }

/* Start game button */
.start-game-area {
  padding: 16px;
  border-top: var(--border-gold);
}

#start-game-btn {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #000;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.5px;
  font-family: 'Inter', sans-serif;
}
#start-game-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
#start-game-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ─── Waiting Room ─────────────────────────────────────────── */
#waiting-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 100;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 24px;
  backdrop-filter: blur(6px);
}

#waiting-overlay.visible {
  display: flex;
}

.waiting-box {
  background: rgba(0,0,0,0.8);
  border: 1px solid rgba(201,162,39,0.3);
  border-radius: 20px;
  padding: 48px 36px;
  text-align: center;
  max-width: 400px;
  width: 90%;
}

.waiting-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  color: var(--gold);
  margin-bottom: 12px;
}

.waiting-subtitle { color: var(--text-muted); margin-bottom: 32px; font-size: 0.95rem; }

.room-code-display {
  background: rgba(201,162,39,0.08);
  border: 1px solid rgba(201,162,39,0.3);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 28px;
}

.room-code-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 2px; margin-bottom: 8px; }
.room-code-value { font-size: 2.5rem; font-weight: 700; color: var(--gold); letter-spacing: 8px; font-family: monospace; }

.waiting-players {
  margin-bottom: 28px;
}

.waiting-player-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 0.9rem;
}

.waiting-player-item:last-child { border-bottom: none; }
.waiting-player-dot { width: 8px; height: 8px; border-radius: 50%; background: #50cc50; flex-shrink: 0; }

/* ─── Phase Banner ─────────────────────────────────────────── */
.phase-banner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.8rem, 5vw, 3rem);
  color: var(--gold);
  text-shadow: 0 0 30px rgba(201,162,39,0.8), 0 2px 8px rgba(0,0,0,0.9);
  font-weight: 700;
  letter-spacing: 6px;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 20;
  white-space: nowrap;
  animation: phaseBannerAnim 1.4s ease-out forwards;
}

@keyframes phaseBannerAnim {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  20%  { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  50%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  80%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.1); }
}

/* ─── Toast ───────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.toast {
  background: rgba(0,0,0,0.9);
  border: 1px solid rgba(201,162,39,0.4);
  color: var(--white);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  animation: toastIn 0.3s ease-out, toastOut 0.3s ease-in 2.7s forwards;
  max-width: 320px;
  text-align: center;
}

.toast.error { border-color: rgba(200,50,50,0.6); color: #ff9090; }
.toast.success { border-color: rgba(50,180,50,0.6); color: #90d090; }

@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* ─── Loading ─────────────────────────────────────────────── */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  flex-direction: column;
  gap: 20px;
  transition: opacity 0.4s;
}

#loading-overlay.hidden { opacity: 0; pointer-events: none; }

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(201,162,39,0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: var(--text-muted); font-size: 0.9rem; }

/* ─── Responsive ──────────────────────────────────────────── */

/* Tablet / small desktop: stack game main vertically, show sidebar below table */
@media (max-width: 768px) {
  .game-main {
    flex-direction: column;
  }

  .table-area {
    flex: 1;
    min-height: 0;
    padding: clamp(44px, 10vh, 75px) 16px;
  }

  .poker-table {
    aspect-ratio: 1.4 / 1;
    max-height: min(52vh, calc(100dvh - 340px));
    width: 100%;
  }

  .player-avatar {
    width: 46px;
    height: 46px;
    font-size: 1.2rem;
  }

  .player-info {
    min-width: 74px;
    padding: 3px 8px;
  }

  .player-name { max-width: 78px; }

  .seat-0 { bottom: -13%; }
  .seat-2, .seat-5 { top: 37%; }

  .game-sidebar {
    display: flex;
    width: 100%;
    border-left: none;
    border-top: var(--border-gold);
    flex: 0 0 auto;
    max-height: 45vh;
    overflow-y: auto;
  }

  .seat-2.empty, .seat-5.empty { display: none; }
  .lobby-box { padding: 24px 20px; }
}

/* Mobile phones */
@media (max-width: 480px) {
  .lobby-title { font-size: 2.5rem; }
  .community-card { width: 42px; height: 60px; }
  .my-card { width: 52px; height: 74px; }

  /* Compact header */
  .game-header {
    flex-wrap: wrap;
    padding: 6px 10px;
    gap: 6px;
  }

  .header-logo { font-size: 1rem; }
  .room-id-display { font-size: 0.72rem; }
  .header-btn { font-size: 0.72rem; padding: 5px 10px; }

  /* More space for table on very small screens */
  .table-area { padding: 70px 16px; }

  .poker-table {
    aspect-ratio: 1.2 / 1;
    max-height: min(48vh, calc(100dvh - 330px));
  }

  .player-avatar {
    width: 42px;
    height: 42px;
    font-size: 1.05rem;
  }

  .player-info {
    min-width: 66px;
    padding: 2px 6px;
  }

  .player-name {
    font-size: 0.68rem;
    max-width: 70px;
  }

  .player-chips-display { font-size: 0.64rem; }

  .seat-cards .pocket-card {
    width: 22px;
    height: 31px;
    font-size: 0.5rem;
  }

  .seat-0 { bottom: -12%; }
  .seat-1 { left: 8%; }
  .seat-6 { right: 8%; }
  .seat-2 { left: -8%; }
  .seat-5 { right: -8%; }

  /* Slightly more sidebar room on phone */
  .game-sidebar { max-height: 48vh; }
}

@media (max-height: 760px) {
  .table-area {
    padding: 22px 16px;
  }

  .poker-table {
    max-height: min(56vh, calc(100dvh - 220px));
  }
}

/* Scrollbars */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(201,162,39,0.3); border-radius: 2px; }

/* Phase indicator */
.phase-badge {
  background: rgba(201,162,39,0.15);
  border: 1px solid rgba(201,162,39,0.3);
  color: var(--gold);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  padding: 4px 12px;
  border-radius: 10px;
  font-weight: 600;
}

/* Blind badges */
.blind-badge {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.55rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  bottom: -2px;
  left: -2px;
}
.sb-badge { background: #3366cc; color: #fff; }
.bb-badge { background: #cc6600; color: #fff; }

/* Folded hand indicator */
.folded-text {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}

/* Connection indicator */
.connection-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #50cc50;
  display: inline-block;
  margin-right: 6px;
}

.my-chips-big {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 4px;
}

.my-chips-label {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 14px;
}

.all-in-badge {
  background: rgba(200,0,255,0.2);
  color: #e080ff;
  border: 1px solid rgba(200,0,255,0.3);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.65rem;
  font-weight: 700;
}

/* ─── Lobby Content Layout ───────────────────────────────── */
.lobby-content {
  display: flex;
  flex-direction: row;
  gap: 24px;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  max-width: 900px;
}

/* ─── Leaderboard Panel ──────────────────────────────────── */
.leaderboard-panel {
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(201,162,39,0.3);
  border-radius: 16px;
  padding: 24px 20px;
  width: 100%;
  max-width: 340px;
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}

.lb-header {
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(201,162,39,0.2);
}

.lb-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.5px;
}

.lb-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 8px;
  margin-bottom: 4px;
  transition: background 0.15s;
}

.lb-row:hover {
  background: rgba(255,255,255,0.04);
}

.lb-me {
  background: rgba(201,162,39,0.1);
  border: 1px solid rgba(201,162,39,0.25);
}

.lb-rank {
  font-size: 0.95rem;
  font-weight: 700;
  min-width: 28px;
  text-align: center;
  color: var(--text-muted);
}

.lb-player {
  flex: 1;
  min-width: 0;
}

.lb-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.lb-chips {
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.lb-positive { color: #50cc80; }
.lb-negative { color: #cc5050; }

.lb-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 16px;
  font-size: 0.85rem;
}

/* ─── Browse Tab Enhancements ────────────────────────────── */
.room-badge-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.room-status-badge {
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.7rem;
  font-weight: 600;
}

.room-status-badge.playing {
  background: rgba(80,180,255,0.15);
  color: #80c8ff;
  border: 1px solid rgba(80,180,255,0.3);
}

.room-playing {
  border-color: rgba(80,180,255,0.25);
}

.room-playing:hover {
  border-color: rgba(80,180,255,0.5);
  background: rgba(80,180,255,0.06);
}

.browse-legend {
  display: flex;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  gap: 6px;
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.waiting-dot { background: rgba(201,162,39,0.7); }
.playing-dot { background: rgba(80,180,255,0.7); }

/* ─── Rebuy Hint ─────────────────────────────────────────── */
.rebuy-hint {
  background: rgba(80,180,255,0.1);
  border: 1px solid rgba(80,180,255,0.25);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.8rem;
  color: #80c8ff;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rebuy-hint-icon {
  font-size: 1rem;
  font-weight: 700;
}

/* ─── Responsive: stack panels on small screens ──────────── */
@media (max-width: 820px) {
  .lobby-content {
    flex-direction: column;
    align-items: center;
  }
  .leaderboard-panel {
    max-width: 440px;
    width: 100%;
  }
}

/* ─── Best Hand Card Highlight ───────────────────────────────── */
.best-card {
  box-shadow: 0 0 0 2px var(--gold), 0 0 12px rgba(201,162,39,0.5) !important;
  z-index: 2;
  position: relative;
}

.my-card.best-card {
  transform: translateY(-6px) scale(1.04);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* ─── Show/Muck Buttons ──────────────────────────────────────── */
.btn-show-hand {
  background: rgba(50,180,50,0.25);
  color: #80e080;
  border: 1px solid rgba(50,180,50,0.5);
  grid-column: 1/-1;
}
.btn-show-hand:hover { background: rgba(50,180,50,0.45); }

.btn-muck-hand {
  background: rgba(180,50,50,0.25);
  color: #e08080;
  border: 1px solid rgba(180,50,50,0.5);
  grid-column: 1/-1;
}
.btn-muck-hand:hover { background: rgba(180,50,50,0.45); }

/* ─── Hand Rankings Modal ─────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 500;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
}
.modal-overlay.visible { display: flex; }

.modal-box {
  background: rgba(10,12,10,0.97);
  border: 1px solid rgba(201,162,39,0.35);
  border-radius: 16px;
  padding: 28px;
  max-width: 480px;
  width: 92%;
  max-height: 90vh;
  overflow-y: auto;
  animation: winnerPop 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  color: var(--gold);
}

.modal-close {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--white);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}
.modal-close:hover { background: rgba(255,255,255,0.18); }

.rankings-list { display: flex; flex-direction: column; gap: 6px; }

.rank-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  border-left: 3px solid transparent;
  background: rgba(255,255,255,0.04);
  transition: background 0.15s;
}
.rank-item:hover { background: rgba(255,255,255,0.08); }

.rank-num {
  font-size: 0.7rem;
  color: var(--text-muted);
  width: 16px;
  text-align: center;
  flex-shrink: 0;
  padding-top: 2px;
}

.rank-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 3px;
}

.rank-name {
  font-size: 0.88rem;
  font-weight: 600;
}

.rank-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.rank-example {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: monospace;
  letter-spacing: 1px;
  flex-shrink: 0;
  padding-top: 2px;
}

/* rank colours */
.rank-royal { border-left-color: #ffd700; } .rank-royal .rank-name { color: #ffd700; }
.rank-sf    { border-left-color: #ff8c00; } .rank-sf    .rank-name { color: #ff8c00; }
.rank-4k    { border-left-color: #cc44ff; } .rank-4k    .rank-name { color: #cc44ff; }
.rank-fh    { border-left-color: #4488ff; } .rank-fh    .rank-name { color: #4488ff; }
.rank-fl    { border-left-color: #44ccff; } .rank-fl    .rank-name { color: #44ccff; }
.rank-st    { border-left-color: #44ff88; } .rank-st    .rank-name { color: #44ff88; }
.rank-3k    { border-left-color: #88ff44; } .rank-3k    .rank-name { color: #88ff44; }
.rank-2p    { border-left-color: #ffee44; } .rank-2p    .rank-name { color: #ffee44; }
.rank-1p    { border-left-color: #ffaa44; } .rank-1p    .rank-name { color: #ffaa44; }
.rank-hc    { border-left-color: #888;    } .rank-hc    .rank-name { color: #aaa; }
