/* Poker Game - UI aligned with Blackjack */
/* Blackjack foundation loaded via index.html: _variables, base, layout, modals, components-actions, leaderboard, modern-theme, chat, responsive, viewport-scale, mobile fixes */

/* ===== POKER-SPECIFIC VARIABLES (override blackjack where needed) ===== */
:root {
  --poker-felt: var(--felt-green, #0a5f20);
  --poker-accent: var(--gold, #ffd700);
  --poker-text: #fff;
  --poker-border: #333;
  --poker-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.hidden { display: none; }

/* ===== POKER LAYOUT OVERRIDES (layout.css targets .game-table; poker uses .poker-table) ===== */
@media (min-width: 1024px) {
  .game-main .poker-table {
    width: 100%;
    max-width: 1000px;
    margin: 50px auto 30px;
  }
}

@media (max-width: 1023px) {
  .game-main {
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .game-main .poker-table {
    height: 700px;
    min-height: 700px;
    max-height: 700px;
    flex: none;
  }
}

@media (max-width: 600px) {
  .game-main .poker-table {
    height: 560px;
    min-height: 560px;
    max-height: 560px;
    --table-width: min(95vw, 400px);
    --table-height: 480px;
  }
}

/* ===== HUD BUTTON ID MAPPING (poker uses different IDs than blackjack) ===== */
#join-game-btn,
#join-game-btn-mobile {
  background: var(--zl-accent, #2e7d32);
  color: white;
  border-color: var(--zl-accent, #2e7d32);
}
#join-game-btn:hover:not(:disabled),
#join-game-btn-mobile:hover:not(:disabled) {
  background: rgba(46, 125, 50, 0.9);
  transform: translateY(-1px);
}

#leave-game-btn,
#leave-game-btn-mobile {
  background: var(--zl-border-color, #444);
  color: var(--zl-text-light, #f0f0f0);
  border-color: var(--zl-border-color, #444);
}
#leave-game-btn:hover:not(:disabled),
#leave-game-btn-mobile:hover:not(:disabled) {
  background: #555;
  transform: translateY(-1px);
}

#confirm-bet {
  padding: 12px 24px;
  border: 1px solid var(--zl-accent, #2e7d32);
  border-radius: 10px;
  background: var(--zl-accent, #2e7d32);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
}
#confirm-bet:hover {
  background: rgba(46, 125, 50, 0.9);
  transform: translateY(-1px);
}

/* ===== POKER TABLE DESIGN ===== */
/* Oval racetrack shape with padded rail - classic poker table */
.poker-table {
  --table-width: 1000px;
  --table-height: 520px;
  --rail-width: 18px;
  width: var(--table-width);
  height: var(--table-height);
  margin: 50px auto 30px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.3s ease-out, height 0.3s ease-out;
}

/* Padded rail (outer pill shape) */
.poker-table::before {
  content: '';
  position: absolute;
  inset: calc(-1 * var(--rail-width));
  background: linear-gradient(145deg, #2a1810 0%, #1a0f0a 50%, #0d0805 100%);
  border-radius: 9999px;
  box-shadow: 
    inset 0 2px 4px rgba(255,255,255,0.08),
    0 6px 24px rgba(0,0,0,0.5),
    0 0 0 2px rgba(0,0,0,0.4);
  z-index: 0;
}

/* Playing surface (felt pill shape) */
.poker-table::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--poker-felt) 0%, color-mix(in srgb, var(--poker-felt) 92%, black) 50%, var(--poker-felt) 100%);
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 2px,
    rgba(255,255,255,0.02) 2px,
    rgba(255,255,255,0.02) 4px
  ), linear-gradient(135deg, var(--poker-felt) 0%, color-mix(in srgb, var(--poker-felt) 92%, black) 50%, var(--poker-felt) 100%);
  border-radius: 9999px;
  box-shadow: 
    inset 0 2px 6px rgba(255,255,255,0.05),
    inset 0 -1px 4px rgba(0,0,0,0.2),
    0 0 0 3px var(--poker-accent);
  z-index: 1;
}

.poker-table > * {
  position: relative;
  z-index: 2;
}

/* ===== POKER TABLE ELEMENTS ===== */
.dealer-position {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.dealer-chip {
  width: 32px;
  height: 32px;
  background: linear-gradient(145deg, rgba(255,255,255,0.25), rgba(255,255,255,0.1));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: rgba(255,255,255,0.95);
  margin: 0 auto 2px;
  font-size: 0.85rem;
  border: 2px solid rgba(255,255,255,0.3);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  animation: dealerPulse 2s ease-in-out infinite;
}

@keyframes dealerPulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
  50% { box-shadow: 0 2px 12px rgba(212,175,55,0.4); }
}

.dealer-label {
  color: rgba(255,255,255,0.5);
  font-weight: normal;
  font-size: 0.65rem;
}



/* ===== COMMUNITY CARDS AREA ===== */
.community-cards-area {
  position: absolute;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 5;
  background: rgba(0,0,0,0.08);
  padding: 16px 24px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.2);
  width: calc((70px + 10px) * 5 - 10px + 48px);
}

.pot-display {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.pot-label {
  color: rgba(255,255,255,0.85);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0;
}

.pot-amount {
  color: #ffd700;
  font-size: 1.5rem;
  font-weight: bold;
  text-shadow: 0 0 12px rgba(212,175,55,0.4), 0 1px 3px rgba(0,0,0,0.8);
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
}

.community-cards {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 12px 0;
  min-height: var(--card-height, 88px);
  align-items: center;
  position: relative;
  padding: 8px 0;
  width: calc((70px + 10px) * 5 - 10px);
  flex-wrap: nowrap;
}

/* Poker cards and placeholders - same size as player cards, override blackjack cards.css */
.poker-table .community-cards .card,
.poker-table .community-cards .card-placeholder,
.poker-table .player-cards .card {
  width: 70px !important;
  height: 98px !important;
  min-width: 70px !important;
  min-height: 98px !important;
  max-width: 70px !important;
  max-height: 98px !important;
  flex-shrink: 0 !important;
}

.card::before,
.card::after {
  font-size: var(--card-index-size, 1rem) !important;
}

.card .suit {
  font-size: var(--card-suit-size, 1.5rem) !important;
}

/* Smooth transitions for card replacements - DISABLED for now */



/* Card positions and placeholders */
.card-position {
  display: flex;
  justify-content: center;
  align-items: center;
  width: var(--card-width, 60px);
  height: var(--card-height, 88px);
  flex-shrink: 0;
}

.community-cards .card-placeholder {
  background: rgba(255,255,255,0.05);
  border: 2px dashed rgba(255,255,255,0.2);
  border-radius: 8px;
  opacity: 0.6;
}

.game-phase {
  color: rgba(255,255,255,0.95);
  font-weight: 600;
  font-size: 1rem;
  margin-top: 10px;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* Turn timer - centered on table when active */
.turn-timer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 15;
  display: none;
  background: rgba(0,0,0,0.5);
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.2);
}

.timer-bar {
  width: 220px;
  height: 10px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 6px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}

.timer-fill {
  height: 100%;
  background: #4CAF50;
  width: 100%;
  transition: width 1s linear, background 0.3s ease;
  border-radius: 5px;
}

.timer-text {
  text-align: center;
  color: white;
  font-size: 14px;
  font-weight: bold;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  letter-spacing: 0.5px;
}

/* ===== PLAYER SEATS ===== */
.player-seats {
  position: absolute;
  width: 100%;
  height: 100%;
}

.player-seat {
  position: absolute;
  width: 120px;
  text-align: center;
  z-index: 10;
}

.player-seat.occupied {
  z-index: 20;
}

.seat-number {
  display: none;
}

.player-info {
  background: rgba(0,0,0,0.55);
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 6px;
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 0.75rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.player-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(145deg, #3a5a3a, #2d472d);
  border: 2px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: bold;
  color: rgba(255,255,255,0.9);
  margin-bottom: 6px;
  flex-shrink: 0;
}

.player-seat.current-turn .player-avatar {
  box-shadow: 0 0 0 3px var(--poker-accent), 0 0 16px rgba(212,175,55,0.5);
  animation: turnGlow 1.5s ease-in-out infinite;
}

.player-seat.folded .player-info {
  opacity: 0.6;
}

.player-seat.folded .player-avatar {
  filter: grayscale(0.7);
}

@keyframes turnGlow {
  0%, 100% { box-shadow: 0 0 0 3px var(--poker-accent), 0 0 16px rgba(212,175,55,0.5); }
  50% { box-shadow: 0 0 0 3px var(--poker-accent), 0 0 24px rgba(212,175,55,0.7); }
}

.player-name {
  color: #fff;
  font-weight: bold;
  font-size: 0.9rem;
  margin-bottom: 4px;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.player-name.bot-badge::after {
  content: ' (Bot)';
  font-size: 0.7rem;
  font-weight: normal;
  color: var(--rarity-common);
  opacity: 0.9;
}

.player-chips {
  color: #ffd700;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 3px;
  text-shadow: 0 1px 1px rgba(0,0,0,0.5);
}

.player-bet {
  color: #ffd700;
  font-size: 0.85rem;
  font-weight: bold;
  text-shadow: 0 1px 1px rgba(0,0,0,0.5);
}

.player-status {
  color: rgba(255,255,255,0.95);
  font-size: 0.8rem;
  font-style: italic;
  text-shadow: 0 1px 1px rgba(0,0,0,0.5);
}

.player-cards {
    display: flex;
  gap: 5px;
  justify-content: center;
  position: relative;
  min-height: 88px;
}

/* Player cards: dimensions set above with community cards for consistency */
.poker-table .player-cards .card {
  position: relative;
}

/* ===== SEAT POSITIONS ===== */
/* Players positioned around the curved edge of the player side */

/* Dynamic positioning based on player count - will be set by JavaScript */
.seat-1 { 
  position: absolute;
  bottom: var(--seat-1-bottom, 20px);
  left: var(--seat-1-left, 50%);
  transform: translateX(-50%);
}

.seat-2 { 
  position: absolute;
  bottom: var(--seat-2-bottom, 20px);
  left: var(--seat-2-left, 50%);
  transform: translateX(-50%);
}

.seat-3 { 
  position: absolute;
  bottom: var(--seat-3-bottom, 20px);
  left: var(--seat-3-left, 50%);
  transform: translateX(-50%);
}

.seat-4 { 
  position: absolute;
  bottom: var(--seat-4-bottom, 20px);
  left: var(--seat-4-left, 50%);
  transform: translateX(-50%);
}

.seat-5 { 
  position: absolute;
  bottom: var(--seat-5-bottom, 20px);
  left: var(--seat-5-left, 50%);
  transform: translateX(-50%);
}

.seat-6 { 
  position: absolute;
  bottom: var(--seat-6-bottom, 20px);
  left: var(--seat-6-left, 50%);
  transform: translateX(-50%);
}

.seat-7 { 
  position: absolute;
  bottom: var(--seat-7-bottom, 20px);
  left: var(--seat-7-left, 50%);
  transform: translateX(-50%);
}

.seat-8 { 
  position: absolute;
  bottom: var(--seat-8-bottom, 20px);
  left: var(--seat-8-left, 50%);
  transform: translateX(-50%);
}

.seat-9 { 
  position: absolute;
  bottom: var(--seat-9-bottom, 20px);
  left: var(--seat-9-left, 50%);
  transform: translateX(-50%);
}

/* Unused seats - fully hidden to avoid black spot on table */
.player-seat.seat-unused {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* ===== POKER BETTING CONTROLS (differs from blackjack: quick-bet 1/2 Pot, Pot, All In) ===== */
#betting-controls.betting-controls {
  flex-direction: column;
  padding: 16px 24px 16px 40px;
  border: 2px solid var(--poker-accent);
}

.quick-bet-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.quick-bet-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255,152,0,0.3);
  color: var(--poker-accent);
  border: 1px solid var(--poker-accent);
  transition: all 0.2s;
}

.quick-bet-btn:hover {
  background: rgba(255,152,0,0.5);
  transform: translateY(-1px);
}

.quick-bet-btn:active {
  transform: scale(0.98);
}

.bet-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bet-label {
  font-size: 0.9rem;
  color: var(--poker-accent);
}

#bet-amount {
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  text-align: center;
  background: #333;
  color: #fff;
  width: 100px;
}

#bet-amount:focus {
  outline: 2px solid var(--poker-accent);
}

.close-betting-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #ff4444;
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-betting-btn:hover {
  background: #ff6666;
}

/* ===== POKER ACTION BAR (action-buttons wrapper + poker action colors) ===== */
.action-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

#fold-btn { background: #f44336; color: #fff; border-color: #f44336; }
#check-btn { background: #2196F3; color: #fff; border-color: #2196F3; }
#call-btn { background: #4CAF50; color: #fff; border-color: #4CAF50; }
#raise-btn { background: #FF9800; color: #fff; border-color: #FF9800; }
#allin-btn { background: #9C27B0; color: #fff; border-color: #9C27B0; }

/* Card base from blackjack cards.css; poker-table overrides below for size */

/* ===== SKIN THEME SUPPORT ===== */
.card[data-card-skin] {
  background: var(--card-bg);
}

/* ===== DEALING ANIMATION ===== */
@keyframes dealCard {
  0% {
    transform: translateY(-40px) scale(0.85);
    opacity: 0;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.card.dealing {
  animation: dealCard 0.4s ease-out forwards;
}

/* Chip movement toward pot (visual feedback) */
.chip-fly {
  position: fixed;
  bottom: 140px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffd700, #b8860b);
  border: 2px solid rgba(255,255,255,0.4);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  z-index: 999;
  pointer-events: none;
  animation: chipToPot 0.5s ease-out forwards;
}

@keyframes chipToPot {
  0% {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateX(-50%) translateY(-180px) scale(0.4);
    opacity: 0;
  }
}

.pot-display.pot-updated {
  animation: potPulse 0.6s ease-out;
}

@keyframes potPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.pot-display.pot-won {
  animation: potWinGlow 1.2s ease-out;
}

@keyframes potWinGlow {
  0%, 100% {
    box-shadow: none;
    filter: brightness(1);
  }
  30% {
    box-shadow: 0 0 24px rgba(212,175,55,0.8), 0 0 48px rgba(76,175,80,0.5);
    filter: brightness(1.3);
  }
  70% {
    box-shadow: 0 0 16px rgba(212,175,55,0.5);
    filter: brightness(1.15);
  }
}

/* Turn timer fade-in */
.turn-timer.timer-visible {
  animation: timerFadeIn 0.3s ease-out;
}

@keyframes timerFadeIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ===== SHOWDOWN ELEMENTS ===== */
.showdown-card {
  border: 3px solid var(--poker-accent);
  box-shadow: 0 0 20px var(--poker-accent);
  transform: scale(1.1);
}

.hand-rank-label {
  display: block;
  background: rgba(0,0,0,0.9);
  color: var(--poker-accent);
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 0.9rem;
  margin-top: 10px;
  border: 2px solid var(--poker-accent);
  text-align: center;
}

.winning-indicator {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--win, #4CAF50);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: bold;
  z-index: 10;
  white-space: nowrap;
}

.winning-label {
  text-align: center;
  margin-bottom: 5px;
}

.winning-cards-highlight {
  display: flex;
  gap: 5px;
  justify-content: center;
  margin-top: 10px;
}

.winning-highlight {
  transform: scale(1.1) !important;
  box-shadow: 0 0 12px var(--poker-accent), 0 0 4px rgba(212, 175, 55, 0.8);
  border: 2px solid var(--poker-accent);
  border-radius: 4px;
  z-index: 5;
}



@keyframes winningGlow {
  0% {
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.4);
  }
  100% {
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.6);
  }
}

/* Blackjack-style announcement (appears at top of table) */
.blackjack-announcement {
  position: absolute;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--poker-accent);
  color: white;
  padding: 12px 24px;
  border-radius: 25px;
  font-weight: bold;
  font-size: 1.1rem;
  border: 2px solid white;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  z-index: 100;
  animation: fadeIn 0.5s ease-out;
}

.announcement-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.announcement-icon {
  font-size: 24px;
}

.announcement-text {
  font-size: 1.1rem;
  font-weight: bold;
}

.announcement-amount {
  font-size: 0.9rem;
  opacity: 0.9;
}

.dealer-announcement {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.9);
  color: var(--poker-accent);
  padding: 15px 25px;
  border-radius: 25px;
  font-weight: bold;
  font-size: 1.2rem;
  border: 3px solid var(--poker-accent);
  animation: bounce 0.5s ease-out;
  z-index: 1000;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.next-hand-btn {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--poker-accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.next-hand-btn:hover {
  background: var(--poker-accent-hover, #0056b3);
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

/* ===== RESPONSIVE DESIGN ===== */
/* Tablet: layout.css handles grid at 1023px; poker-table height from Phase 1.5 overrides */
@media (max-width: 900px) {
  .game-sidebar-left {
    max-height: 120px;
    overflow: hidden;
  }
  
  .game-sidebar-left.collapsed {
    max-height: 44px;
  }
  
  .player-seat {
    width: 90px;
  }
  
  /* Action bar: larger touch targets (min 44px) */
  .action-btn {
    min-height: 44px;
    min-width: 70px;
    padding: 12px 18px;
  }
  
  .action-bar {
    width: min(90vw, 480px);
    padding: 14px;
  }
  
  .poker-table .community-cards .card,
  .poker-table .community-cards .card-placeholder,
  .poker-table .player-cards .card {
    width: 50px !important;
    height: 70px !important;
    min-width: 50px !important;
    min-height: 70px !important;
    max-width: 50px !important;
    max-height: 70px !important;
  }
  
  .community-cards-area {
    padding: 10px 14px;
    width: calc(50px * 5 + 10px * 4 + 28px);
  }
  
  .community-cards {
    width: calc(50px * 5 + 10px * 4);
  }
  
  .pot-amount {
    font-size: 1.1rem;
  }
}

/* Mobile: layout.css + Phase 1.5 handle poker-table; poker-specific overrides */
@media (max-width: 600px) {
  .player-seat {
    width: 75px;
  }
  
  /* Action bar: full-width, bottom sheet style */
  .action-bar {
    left: 0;
    right: 0;
    width: 100%;
    transform: none;
    bottom: 0;
    border-radius: 16px 16px 0 0;
    padding: 16px 12px 24px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
  }
  
  .action-buttons {
    gap: 8px;
    align-items: stretch;
  }
  
  .action-btn {
    flex: 1;
    min-height: 48px;
    min-width: 0;
    padding: 14px 12px;
    font-size: 0.95rem;
  }
  
  /* Betting controls: bottom sheet on mobile */
  #betting-controls {
    bottom: 80px;
    left: 8px;
    right: 8px;
    width: auto;
    transform: none;
    max-width: 100%;
  }
  
  .quick-bet-btn {
    min-height: 44px;
    padding: 10px 14px;
  }
  
  .poker-table .community-cards .card,
  .poker-table .community-cards .card-placeholder,
  .poker-table .player-cards .card {
    width: 42px !important;
    height: 59px !important;
    min-width: 42px !important;
    min-height: 59px !important;
    max-width: 42px !important;
    max-height: 59px !important;
  }
  
  .community-cards {
    gap: 6px;
    width: calc(42px * 5 + 6px * 4);
  }
  
  .community-cards-area {
    width: calc(42px * 5 + 6px * 4 + 28px);
    padding: 10px 14px;
  }
  
  .player-info {
    padding: 6px 8px;
    font-size: 0.7rem;
  }
  
  .player-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
  }
  
  .chip-fly {
    bottom: 100px;
  }
  
  @keyframes chipToPot {
    0% {
      transform: translateX(-50%) translateY(0) scale(1);
      opacity: 1;
    }
    100% {
      transform: translateX(-50%) translateY(-120px) scale(0.4);
      opacity: 0;
    }
  }
}

/* ===== WAITING LIST & LEADERBOARD ===== */
/* Layout from blackjack layout.css + modern-theme.css: left=waiting, right=leaderboard+chat, grid 200px 1fr 280px */
/* No position:fixed overrides - use sidebar layout. Ensure leaderboard matches blackjack size. */
@media (min-width: 1024px) {
  .game-sidebar-right .leaderboard {
    height: 420px;
    max-height: 420px;
  }
}

/* ===== LOADING STATES ===== */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
  justify-content: center;
  height: 100vh;
  background: #111;
}

.loading-spinner {
    width: 50px;
    height: 50px;
  border: 4px solid #333;
  border-top: 4px solid var(--poker-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
  color: var(--poker-text);
  font-size: 1.2rem;
  font-weight: bold;
}

/* Chat panel from blackjack chat.css, mobile-chat-fix.css, layout.css */

/* ===== MESSAGE STYLES ===== */
.error-message,
.success-message,
.info-message {
    position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  padding: 15px 25px;
  border-radius: 8px;
  font-weight: bold;
  z-index: 999;
  animation: fadeIn 0.3s ease-out;
  max-width: 90%;
  text-align: center;
}

.error-message {
  background: var(--lose);
  color: white;
}

.success-message {
  background: var(--win);
  color: white;
}

.info-message {
  background: var(--push);
  color: white;
}

/* Leaderboard & chat from blackjack leaderboard.css, chat.css, layout.css */

/* ===== SHOP MODAL CSS (from blackjack shop.css; poker overrides if needed) ===== */
.skins-modal-content {
  max-width: 940px;
  max-height: 90vh;
  text-align: left;
  background: #1a1a1a;
  border-radius: 12px;
  padding: 20px;
  overflow-y: auto;
  position: relative;
}

.skins-balance {
  margin: 8px 0 14px;
  opacity: .9;
  color: #fff;
  font-size: 16px;
}

.skins-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.skin-card.v2 {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 12px;
}

.skin-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.skin-preview3d {
  flex: 0 0 auto;
}

.card3d {
  position: relative;
  width: 120px;
  height: 160px;
  perspective: 1000px;
  transform-style: preserve-3d;
  transition: transform 0.6s;
}

.card3d.flipped {
  transform: rotateY(180deg);
}

.card3d .face,
.card3d .back {
  position: absolute;
    width: 100%;
    height: 100%;
  backface-visibility: hidden;
  border-radius: 8px;
  overflow: hidden;
}

.card3d .back {
  transform: rotateY(180deg);
}

.card-container {
  width: 100%;
  height: 100%;
}

.preview-toolbar {
  margin-top: 8px;
  text-align: center;
}

.flip-btn {
  background: #333;
  color: #fff;
  border: 0;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}

.flip-btn:hover {
  background: #555;
}

.skin-content {
  flex: 1 1 auto;
}

.skin-info-compact {
  margin-bottom: 8px;
}

.skin-name {
  font-weight: 800;
  margin-bottom: 4px;
  font-size: 14px;
}

.skin-meta {
    display: flex;
  gap: 8px;
    align-items: center;
  margin-bottom: 8px;
}

.skin-rarity.pill {
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.skin-cost {
  font-size: 12px;
}

.badges {
  margin-bottom: 8px;
}

.badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  margin-right: 4px;
}

.badge.equipped {
  background: #4caf50;
  color: #fff;
}

.badge.owned {
  background: #2196f3;
  color: #fff;
}

.skin-actions button {
  padding: 6px 12px;
  border: 0;
  border-radius: 4px;
  font-weight: 700;
  cursor: pointer;
}

.skin-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.skin-actions .equipped {
  background: #4caf50;
  color: #fff;
}

.skin-actions .equip {
  background: #2196f3;
  color: #fff;
}

.skin-actions .buy {
  background: #ff9800;
  color: #fff;
}

.skin-actions .buy:hover:not(:disabled) {
  background: #f57c00;
}

/* ===== CASES CSS ===== */
.cases-block {
  margin: 12px 0 4px;
}

.cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.case-card {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 12px;
    display: flex;
  gap: 12px;
    align-items: center;
}

.case-icon {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  position: relative;
  flex: 0 0 auto;
}

.case-icon.gold {
  background: linear-gradient(45deg, #b8860b, #ffd700);
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .2);
}

.case-icon.skins {
  background: linear-gradient(45deg, #2196f3, #9c27b0);
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .2);
}

.case-icon:before {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .25);
}

.case-icon:after {
  content: '';
  position: absolute;
  top: 22px;
  left: 50%;
  width: 20px;
  height: 16px;
  transform: translateX(-50%);
  border-radius: 4px;
  background: #333;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .1) inset;
}

.case-info {
  flex: 1 1 auto;
}

.case-name {
  font-weight: 800;
}

.case-price {
  font-size: 12px;
  opacity: .85;
  margin-top: 4px;
}

.case-actions {
  display: flex;
  gap: 8px;
}

.case-open {
  background: #1976d2;
    color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 800;
    cursor: pointer;
}

/* ===== CAROUSEL CSS ===== */
.carousel-wrap {
  position: relative;
  height: 120px;
  overflow: hidden;
  border: 1px solid #333;
  border-radius: 10px;
  background: #0b0b0b;
  margin: 12px 0;
}

.carousel-wrap.hidden {
  display: none;
}

.carousel-track {
  display: flex;
  gap: 8px;
  position: absolute;
  left: 0;
  top: 0;
  height: 120px;
  will-change: transform;
  padding: 10px 6px;
}

.drop-item {
  width: 120px;
  height: 100px;
  border-radius: 8px;
  background: #111;
  border: 1px solid #333;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  overflow: hidden;
}

.pointer {
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 14px solid gold;
  transform: translateX(-50%);
  z-index: 3;
}

.result-box {
  margin-top: 8px;
  font-weight: 800;
  min-height: 1.2em;
}

/* ===== RARITY FRAMES ===== */
.rarity-common {
  box-shadow: 0 0 0 2px #9e9e9e inset;
}

.rarity-uncommon {
  box-shadow: 0 0 0 2px #4caf50 inset;
}

.rarity-rare {
  box-shadow: 0 0 0 2px #2196f3 inset;
}

.rarity-epic {
  box-shadow: 0 0 0 2px #9c27b0 inset;
}

.rarity-legendary {
  box-shadow: 0 0 0 2px #f44336 inset;
}

.rarity-special {
  box-shadow: 0 0 0 2px #ffd700 inset;
}

.rarity-mega-jackpot {
  box-shadow: 0 0 0 2px #ffd700 inset;
}

/* ===== MINI SKIN PREVIEW ===== */
.skin-mini {
  position: relative;
        width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.skin-mini .stack {
  position: relative;
  width: 60px;
  height: 88px;
}

.skin-mini .card-back,
.skin-mini .card {
  position: absolute;
  left: 0;
  top: 0;
  width: 60px;
  height: 88px;
  border-radius: 8px;
}

.skin-mini .card-back {
  transform: rotate(-6deg) translate(-6px, 6px);
}

.skin-mini .label {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 4px;
  font-size: 10px;
  line-height: 1.1;
  text-align: center;
  font-weight: 700;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== SKIN THEME SUPPORT ===== */
.skin-theme[data-skin="classic"] .card-container {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
}

.skin-theme[data-skin="ocean"] .card-container {
  background: linear-gradient(135deg, #1e3a8a, #3b82f6);
  border: 1px solid #1d4ed8;
}

.skin-theme[data-skin="fire"] .card-container {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  border: 1px solid #b91c1c;
}

.skin-theme[data-skin="ice"] .card-container {
  background: linear-gradient(135deg, #0ea5e9, #38bdf8);
  border: 1px solid #0284c7;
}

.skin-theme[data-skin="lightning"] .card-container {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  border: 1px solid #d97706;
}

.skin-theme[data-skin="earth"] .card-container {
  background: linear-gradient(135deg, #78350f, #a16207);
  border: 1px solid #92400e;
}

.skin-theme[data-skin="steel"] .card-container {
  background: linear-gradient(135deg, #374151, #6b7280);
  border: 1px solid #1f2937;
}

.skin-theme[data-skin="gold"] .card-container {
  background: linear-gradient(135deg, #b45309, #f59e0b);
  border: 1px solid #92400e;
}

.skin-theme[data-skin="crystal"] .card-container {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border: 1px solid #6d28d9;
}

.skin-theme[data-skin="leather"] .card-container {
  background: linear-gradient(135deg, #92400e, #a16207);
  border: 1px solid #78350f;
}

.skin-theme[data-skin="neon"] .card-container {
  background: linear-gradient(135deg, #059669, #10b981);
  border: 1px solid #047857;
}

.skin-theme[data-skin="vintage"] .card-container {
  background: linear-gradient(135deg, #7c2d12, #a16207);
  border: 1px solid #451a03;
}

.skin-theme[data-skin="cyber"] .card-container {
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  border: 1px solid #1e3a8a;
}

.skin-theme[data-skin="royal"] .card-container {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border: 1px solid #6d28d9;
}

.skin-theme[data-skin="shadow"] .card-container {
  background: linear-gradient(135deg, #1f2937, #374151);
  border: 1px solid #111827;
}

.skin-theme[data-skin="sunset"] .card-container {
  background: linear-gradient(135deg, #dc2626, #f59e0b);
  border: 1px solid #b91c1c;
}

.skin-theme[data-skin="desert"] .card-container {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  border: 1px solid #b45309;
}

.skin-theme[data-skin="mountain"] .card-container {
  background: linear-gradient(135deg, #374151, #6b7280);
  border: 1px solid #1f2937;
}

.skin-theme[data-skin="obsidian"] .card-container {
  background: linear-gradient(135deg, #1f2937, #374151);
  border: 1px solid #111827;
}

.skin-theme[data-skin="nature"] .card-container {
  background: linear-gradient(135deg, #059669, #10b981);
  border: 1px solid #047857;
}

.skin-theme[data-skin="polska_gora"] .card-container {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  border: 1px solid #b91c1c;
}

/* ===== PHASE 7: OPTIONAL ENHANCEMENTS ===== */
/* 4-color deck: hearts red, diamonds blue, clubs green, spades black */
.poker-table[data-deck="four-color"] .card[data-suit="diamonds"],
.poker-table[data-deck="four-color"] .card[data-suit="diamonds"]::before,
.poker-table[data-deck="four-color"] .card[data-suit="diamonds"]::after,
.poker-table[data-deck="four-color"] .card[data-suit="diamonds"] .suit {
  color: #2563eb !important;
}
.poker-table[data-deck="four-color"] .card[data-suit="clubs"],
.poker-table[data-deck="four-color"] .card[data-suit="clubs"]::before,
.poker-table[data-deck="four-color"] .card[data-suit="clubs"]::after,
.poker-table[data-deck="four-color"] .card[data-suit="clubs"] .suit {
  color: #16a34a !important;
}
.poker-table[data-deck="four-color"] .card[data-suit="hearts"],
.poker-table[data-deck="four-color"] .card[data-suit="hearts"]::before,
.poker-table[data-deck="four-color"] .card[data-suit="hearts"]::after,
.poker-table[data-deck="four-color"] .card[data-suit="hearts"] .suit {
  color: #c13131 !important;
}
.poker-table[data-deck="four-color"] .card[data-suit="spades"],
.poker-table[data-deck="four-color"] .card[data-suit="spades"]::before,
.poker-table[data-deck="four-color"] .card[data-suit="spades"]::after,
.poker-table[data-deck="four-color"] .card[data-suit="spades"] .suit {
  color: #222 !important;
}

/* Table themes - alternate felt colors */
.poker-table[data-theme="dark"] {
  --poker-felt: #0d1b2a;
  background: linear-gradient(135deg, #0d1b2a 0%, #1b263b 50%, #0d1b2a 100%);
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 2px,
    rgba(255,255,255,0.02) 2px,
    rgba(255,255,255,0.02) 4px
  ), linear-gradient(135deg, #0d1b2a 0%, #1b263b 50%, #0d1b2a 100%);
}

.poker-table[data-theme="classic"] {
  --poker-felt: #0a5f20;
}

/* Settings toggle button */
.poker-settings-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: background 0.2s;
}

.poker-settings-btn:hover {
  background: rgba(255,255,255,0.25);
}

.poker-settings-popover {
  position: fixed;
  top: 70px;
  right: 20px;
  background: rgba(30,30,30,0.98);
  border: 1px solid #444;
  border-radius: 12px;
  padding: 16px;
  min-width: 220px;
  z-index: 1001;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.poker-settings-popover.hidden {
  display: none;
}

.poker-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.poker-settings-row:last-child {
  margin-bottom: 0;
}

.poker-settings-toggle {
  width: 44px;
  height: 24px;
  background: #444;
  border-radius: 12px;
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
}

.poker-settings-toggle.on {
  background: var(--poker-accent);
}

.poker-settings-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.poker-settings-toggle.on::after {
  transform: translateX(20px);
}
