* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  /* ========== Felt & Tile Design System ========== */
  
  /* Base colors - casino felt */
  --bg: #1a472a;
  --bg-dark: #0d2818;
  --bg-light: #245738;
  --felt: #2d5a3f;
  --felt-dark: #0f2d1a;
  --felt-light: #2d5a3f;
  --card-bg: #fff;
  
  /* Surface colors - glassmorphism */
  --panel-bg: rgba(0, 0, 0, 0.25);
  --panel-bg-hover: rgba(0, 0, 0, 0.35);
  --surface: rgba(0, 0, 0, 0.25);
  --surface-elevated: rgba(0, 0, 0, 0.35);
  --surface-glass: rgba(26, 71, 42, 0.85);
  --separator: rgba(255, 255, 255, 0.1);
  
  /* Text colors - Apple-style opacity hierarchy */
  --text: #f5f5f5;
  --text-muted: #a8b8a8;
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-tertiary: rgba(255, 255, 255, 0.4);
  
  /* Gold spectrum */
  --gold: #ffd700;
  --gold-light: #ffe44d;
  --gold-dark: #c9a600;
  --gold-dim: #b8960f;
  
  /* Semantic colors */
  --red: #e74c3c;
  --win: #2ecc71;
  --lose: #e74c3c;
  --push: #f1c40f;
  
  /* Spacing scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  
  /* Border radius - Apple-style rounder corners */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(255, 215, 0, 0.3);
  --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.25), 0 1px 3px rgba(0, 0, 0, 0.15);
  --shadow-card-hover: 0 12px 24px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.2);
  --shadow-card-selected: 0 16px 32px rgba(255, 215, 0, 0.25), 0 0 0 3px var(--gold);
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;
}

html {
  background-color: var(--bg-light, #245738);
  background-image: radial-gradient(ellipse at top, var(--bg-light, #245738) 0%, var(--bg, #1a472a) 50%, var(--bg-dark, #0d2818) 100%);
  background-attachment: fixed;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', Roboto, sans-serif;
  background: radial-gradient(ellipse at top, var(--bg-light) 0%, var(--bg) 50%, var(--bg-dark) 100%);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Felt texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  z-index: 0;
}

.game-container {
  max-width: 500px;
  margin: 0 auto;
  padding: 1rem;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* PWA standalone mode - add safe area padding at top for notch/dynamic island */
@media (display-mode: standalone) {
  .game-container {
    padding-top: max(1rem, env(safe-area-inset-top, 1rem));
  }
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

header h1 {
  font-size: 1.5rem;
}

.chips {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0.25) 100%);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--gold);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  border: 1px solid rgba(255, 215, 0, 0.2);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.05);
  transition: all var(--transition-base);
}

.chips:hover {
  border-color: rgba(255, 215, 0, 0.4);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.chip-icon {
  font-size: 1.25rem;
}

/* 3D Casino Chip (visual chip component) */
.casino-chip {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  position: relative;
  /* 3D effect layers */
  background: 
    radial-gradient(circle at 30% 30%, rgba(255,255,255,0.3) 0%, transparent 50%),
    linear-gradient(145deg, var(--chip-color, #e74c3c) 0%, var(--chip-color-dark, #c0392b) 100%);
  border: 3px dashed rgba(255,255,255,0.4);
  box-shadow: 
    0 4px 8px rgba(0,0,0,0.3),
    0 2px 4px rgba(0,0,0,0.2),
    inset 0 -3px 6px rgba(0,0,0,0.2),
    inset 0 3px 6px rgba(255,255,255,0.15);
}

.casino-chip::before {
  content: '';
  position: absolute;
  inset: 4px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
}

/* Chip color variants */
.casino-chip.red {
  --chip-color: #e74c3c;
  --chip-color-dark: #c0392b;
}

.casino-chip.blue {
  --chip-color: #3498db;
  --chip-color-dark: #2980b9;
}

.casino-chip.green {
  --chip-color: #27ae60;
  --chip-color-dark: #1e8449;
}

.casino-chip.black {
  --chip-color: #2c3e50;
  --chip-color-dark: #1a252f;
}

.casino-chip.gold {
  --chip-color: #f1c40f;
  --chip-color-dark: #d4ac0d;
  color: #1a1a1a;
  text-shadow: 0 1px 0 rgba(255,255,255,0.3);
}

/* Small chip variant */
.casino-chip.small {
  width: 32px;
  height: 32px;
  font-size: 0.625rem;
  border-width: 2px;
}

/* Sections */
section {
  margin-bottom: 1rem;
}

section h2 {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-align: center;
}

/* Hand containers */
.dealer-hands,
.player-hands {
  display: flex;
  align-items: flex-start; /* Align hand boxes at top */
  gap: 0.75rem;
  width: 100%;
  padding: 0 1rem;
  box-sizing: border-box;
}

.hand-container {
  position: relative;
  min-width: 0; /* Allow flex shrinking */
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Proportional widths: high hand (5 cards) wider than low hand (2 cards) */
#dealer-high-container,
#player-high-container {
  flex: 5;
}

#dealer-low-container,
#player-low-container {
  flex: 2;
}

.hand-container.hidden {
  display: none;
}

.hand-container label {
  display: block;
  width: 100%;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  text-align: center;
}

.hand-container label span {
  color: var(--gold);
}

/* Dealer hand rank labels - yellow for visibility */
.dealer-hand-rank {
  color: var(--gold);
  font-weight: 600;
}

/* Hand comparison result indicators */
.hand-result {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  margin-top: 0.25rem;
  min-height: 1.5rem;
  width: 100%; /* Fill container width */
  box-sizing: border-box;
  /* Hidden by default - shown via .visible class */
  display: none;
}

/* Show when has content - more reliable than :empty in Safari */
.hand-result.visible {
  display: block;
}

.hand-result.win {
  background: rgba(39, 174, 96, 0.3);
  color: var(--win);
  border: 1px solid var(--win);
}

.hand-result.lose {
  background: rgba(192, 57, 43, 0.3);
  color: var(--lose);
  border: 1px solid var(--lose);
}

.hand-result.tie {
  background: rgba(243, 156, 18, 0.3);
  color: var(--push);
  border: 1px solid var(--push);
}

/* Highlight winning/losing hand containers */
.hand-container.winner .hand {
  border-color: var(--win);
  box-shadow: 0 0 8px rgba(39, 174, 96, 0.5);
}

.hand-container.loser .hand {
  border-color: var(--lose);
  box-shadow: 0 0 8px rgba(192, 57, 43, 0.5);
}

.hand {
  display: flex;
  justify-content: center;
  gap: 4px;
  min-height: 80px;
  width: 100%;
  box-sizing: border-box;
  background: var(--surface-elevated);
  border-radius: var(--radius-lg);
  padding: 0.5rem;
  border: 2px solid var(--separator);
  transition: all var(--transition-base);
  overflow: hidden;
}

.hand.player-high,
.hand.player-low,
.hand.unassigned {
  border-color: rgba(255, 255, 255, 0.2);
  cursor: pointer;
}

.hand.highlight {
  border-color: var(--gold);
  background: rgba(255, 215, 0, 0.08);
}

.hand.highlight::after {
  content: 'Tap to place here';
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--gold);
  white-space: nowrap;
}

/* Unassigned cards */
.unassigned-area {
  margin-top: 1rem;
}

.unassigned-area.hidden {
  display: none;
}

.unassigned-area label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  text-align: center;
}

.unassigned {
  flex-wrap: wrap;
  min-height: 80px;
}

/* Cards - Apple-polished design */
.card {
  width: 48px;
  height: 68px;
  background: linear-gradient(145deg, #ffffff 0%, #f8f8f8 100%);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  user-select: none;
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.06);
  position: relative;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-card-hover), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.card:active {
  transform: scale(0.97);
}

.card.selected {
  transform: translateY(-10px);
  box-shadow: var(--shadow-card-selected), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  border-color: var(--gold);
}

/* Quick-select mode: cards marked for low hand */
.card.selected-for-low {
  border-color: var(--win);
}

/* Hand assignment badges (HIGH/LOW) */
.hand-badge {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  font-weight: bold;
  background: rgba(0,0,0,0.7);
  padding: 1px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  white-space: nowrap;
}

.low-badge {
  color: var(--win);
}

.high-badge {
  color: var(--text-muted);
}

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

.card.black {
  color: #1a1a1a;
}

.card.joker {
  background: linear-gradient(135deg, #9b59b6, #3498db);
  color: white;
  font-size: 0.7rem;
}

/* Unified card rank/suit classes */
.card .card-rank,
.card .rank {  /* Legacy support */
  font-size: 1rem;
  line-height: 1;
}

.card .card-suit,
.card .suit {  /* Legacy support */
  font-size: 0.8rem;
  line-height: 1;
}

/* Large card variant (Blackjack) */
.card.card-large {
  width: 60px;
  height: 84px;
  border-radius: var(--radius-sm);
  font-size: 1.2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.card.card-large .card-rank {
  font-size: 1.4rem;
}

.card.card-large .card-suit {
  font-size: 1.2rem;
  margin-top: -0.2rem;
}

.card.card-large.face-down {
  background: linear-gradient(135deg, #9b2335 0%, #722f37 50%, #4a1c24 100%);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
  color: transparent;
}

.card.face-down {
  background: linear-gradient(135deg, #9b2335 0%, #722f37 50%, #4a1c24 100%);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
  color: transparent;
}

/* Dealer cards hidden initially */
.dealer-high .card,
.dealer-low .card {
  cursor: default;
}

/* Result display */
.result-display {
  text-align: center;
  padding: 1rem;
  border-radius: var(--radius-sm);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.result-display.hidden {
  display: none;
}

.result-display.win {
  background: var(--win);
}

.result-display.lose {
  background: var(--lose);
}

.result-display.push {
  background: var(--push);
}

/* Fortune bonus text glow on result backgrounds */
.result-display.win .bonus-win,
.result-display.lose .bonus-win {
  color: var(--gold);
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.7), 0 0 20px rgba(255, 215, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.5);
}

.result-display.push .bonus-win {
  color: #e65c00; /* Warm orange - visible on yellow background */
  text-shadow: 0 0 8px rgba(230, 92, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Controls */
.controls {
  padding-top: 1rem;
  position: relative;
  z-index: 1;
}

.bet-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  position: relative;
  z-index: 2;
}

.bet-controls.hidden {
  display: none;
}

.bet-controls label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.bet-btn {
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--gold);
  background: transparent;
  color: var(--gold);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  min-height: 40px;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: rgba(0,0,0,0.1);
  box-shadow: var(--shadow-sm);
}

.bet-btn:hover {
  background: rgba(255, 215, 0, 0.1);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), 0 0 12px rgba(255, 215, 0, 0.2);
}

.bet-btn.active {
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 50%, var(--gold-dark) 100%);
  color: #1a1a1a;
  text-shadow: 0 1px 0 rgba(255,255,255,0.2);
  box-shadow: var(--shadow-md), 0 0 16px rgba(255, 215, 0, 0.3);
}

.custom-bet-wrapper {
  display: flex;
  align-items: center;
  border: 2px solid rgba(255, 215, 0, 0.5);
  border-radius: var(--radius-sm);
  padding: 0 0.5rem;
  min-height: 40px;
  background: transparent;
  transition: all 0.15s;
}

.custom-bet-wrapper:focus-within {
  border-color: var(--gold);
  background: rgba(255, 215, 0, 0.1);
}

.custom-bet-wrapper.filled {
  background: var(--gold);
  border-color: var(--gold);
}

.custom-bet-wrapper.filled .custom-bet-prefix,
.custom-bet-wrapper.filled .custom-bet-input {
  color: #1a1a1a;
}

.custom-bet-prefix {
  color: var(--gold);
  font-size: 0.875rem;
  font-weight: 500;
}

.custom-bet-input {
  width: 45px;
  padding: 0.5rem 0.25rem;
  border: none;
  background: transparent;
  color: var(--gold);
  font-size: 0.875rem;
  text-align: left;
  -webkit-appearance: none;
  -moz-appearance: textfield;
}

.custom-bet-input:focus {
  outline: none;
}

.custom-bet-input::placeholder {
  color: rgba(255, 215, 0, 0.5);
}

.custom-bet-wrapper.filled .custom-bet-input::placeholder {
  color: rgba(0, 0, 0, 0.4);
}

/* Hide number input spinners */
.custom-bet-input::-webkit-outer-spin-button,
.custom-bet-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.action-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.btn {
  padding: 1rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.3px;
  cursor: pointer;
  transition: all var(--transition-base);
  min-height: 48px;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: rgba(0,0,0,0.1);
  position: relative;
  box-shadow: var(--shadow-sm);
}

.btn.primary {
  background: linear-gradient(145deg, var(--gold) 0%, #e6c200 100%);
  color: #1a1a1a;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 215, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn.primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.btn.secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--separator);
}

.btn.secondary:hover {
  background: var(--surface-elevated);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn.secondary:active {
  transform: translateY(0);
}

.btn.hidden {
  display: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Instructions */
.instructions {
  text-align: center;
  padding: 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.instructions .small {
  font-size: 0.75rem;
  margin-top: 0.5rem;
}

.instructions a {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.instructions a:hover {
  color: #ffe44d;
}

/* How to Play link container (survives innerHTML updates to instructions) */
.how-to-play-link-container {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin: 0;
  padding: 0 1rem 0.5rem;
}

.how-to-play-link-container a {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.how-to-play-link-container a:hover {
  color: #ffe44d;
}

/* Insurance controls */
.insurance-controls {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 0.75rem;
}

.insurance-controls .btn {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

/* Error state */
.hand.error {
  border-color: var(--red) !important;
  animation: shake 0.3s;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Chips button */
.chips {
  border: none;
  cursor: pointer;
}

.chips-plus {
  margin-left: 0.25rem;
  opacity: 0.6;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  /* iOS Safari safe area support */
  padding-top: max(1rem, env(safe-area-inset-top, 1rem));
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: var(--bg);
  border-radius: var(--radius-xl);
  max-width: 400px;
  width: 100%;
  max-height: calc(90vh - env(safe-area-inset-top, 0px));
  overflow-y: auto;
  margin-top: env(safe-area-inset-top, 0px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--separator);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  /* Extra top padding for iOS Safari safe area */
  padding-top: max(1rem, env(safe-area-inset-top, 1rem));
  border-bottom: 1px solid rgba(255,255,255,0.1);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}

.modal-header h2 {
  font-size: 1.25rem;
  color: var(--gold);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.75rem;
  cursor: pointer;
  /* Larger tap target for mobile */
  padding: 0.5rem;
  margin: -0.5rem;
  line-height: 1;
}

.modal-content {
  padding: 1.25rem;
}

/* Edit Name Modal (inline popup) */
.edit-name-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

.edit-name-content {
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  max-width: 320px;
  width: 100%;
}

.edit-name-content h3 {
  color: var(--gold);
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.edit-name-content input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #fff;
  color: #1a1a1a;
  font-size: 1rem;
  margin-bottom: 1rem;
}

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

.edit-name-buttons {
  display: flex;
  gap: 0.75rem;
}

.edit-name-buttons .btn {
  flex: 1;
}

.info-actions {
  margin-top: 1rem;
  text-align: center;
}

.info-actions.hidden {
  display: none;
}

.chip-balance {
  text-align: center;
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
  color: var(--text-muted);
}

.chip-balance strong {
  color: var(--gold);
}

/* Buy options */
.buy-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.buy-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: rgba(255,255,255,0.05);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
}

.buy-option:hover,
.buy-option.selected {
  border-color: var(--gold);
  background: rgba(255,215,0,0.1);
}

.buy-chips {
  font-weight: 600;
}

.buy-price {
  font-weight: 700;
  color: var(--gold);
}

.buy-bonus {
  font-size: 0.75rem;
  background: var(--win);
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

/* Premium purchase section */
.premium-purchase-section {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: var(--radius-sm);
}

.premium-purchase-section h3 {
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  color: #a78bfa;
}

.premium-option {
  border-color: rgba(167, 139, 250, 0.4);
  width: 100%;
}

.premium-option:hover {
  border-color: #a78bfa;
  background: rgba(167, 139, 250, 0.15);
}

.premium-option.purchased {
  opacity: 0.5;
  pointer-events: none;
}

.premium-purchased {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #4ade80;
}

.premium-purchased.hidden {
  display: none;
}

/* Promo section */
.promo-section {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
}

.promo-section p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.promo-input {
  display: flex;
  gap: 0.5rem;
}

.promo-input input {
  flex: 1;
  padding: 0.6rem 0.75rem;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.3);
  color: var(--text);
  font-size: 1rem;
}

.promo-input button {
  padding: 0.6rem 1rem;
  background: var(--gold);
  color: #1a1a1a;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
}

.promo-message {
  margin-top: 0.5rem;
  font-size: 0.875rem;
}

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

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

/* Payment buttons */
.payment-methods {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pay-btn {
  padding: 1rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.pay-btn:hover {
  opacity: 0.9;
}

.pay-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.stripe-btn {
  background: #635bff;
  color: #fff;
}

.payment-note {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 0.5rem;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.back-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.3);
  border: none;
  border-radius: 50%;
  color: #ffd700;
  font-size: 1.5rem;
  font-weight: 300;
  text-decoration: none;
  transition: background 0.2s, transform 0.1s;
}

.back-btn:hover {
  background: rgba(255,255,255,0.15);
}

.back-btn:active {
  transform: scale(0.95);
}

.version-link {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 16px;
  color: #ffd700;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.version-link:hover {
  background: rgba(255, 215, 0, 0.25);
  border-color: rgba(255, 215, 0, 0.5);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(0,0,0,0.3);
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-btn {
  width: 40px;
  height: 40px;
  border: 2px solid rgba(255,255,255,0.3);
  background: rgba(0,0,0,0.3);
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-btn.logged-in {
  border-color: var(--gold);
}

.auth-avatar {
  font-size: 1.25rem;
}

.auth-avatar.emoji-avatar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.25rem;
  border: 2px solid var(--gold);
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Auth Menu */
.auth-menu {
  position: fixed;
  top: 60px;
  right: 1rem;
  background: #1a1a2e;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  z-index: 200;
  overflow: hidden;
}

.auth-menu.hidden {
  display: none;
}

.auth-menu-item {
  display: block;
  width: 100%;
  padding: 0.875rem 1.25rem;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  text-align: left;
}

.auth-menu-item:hover {
  background: rgba(255,255,255,0.1);
}

/* Footer */
footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: auto;
}

footer p {
  margin: 0.25rem 0;
}

footer a {
  color: var(--gold);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

.tip-dealer a {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background: rgba(255,215,0,0.1);
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.tip-dealer a:hover {
  background: rgba(255,215,0,0.2);
  text-decoration: none;
}

.version {
  font-size: 0.7rem;
  opacity: 0.5;
}

.copyright {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.7;
  margin: 0.25rem 0;
}

/* Leaderboard */
.modal-large {
  max-width: 500px;
}

.leaderboard-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab-btn {
  flex: 1;
  padding: 0.75rem;
  border: 2px solid rgba(255,255,255,0.2);
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(255,215,0,0.1);
}

.leaderboard-list {
  max-height: 50vh;
  overflow-y: auto;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: background 0.2s;
}

.leaderboard-row:hover {
  background: rgba(255,255,255,0.08);
}

.leaderboard-row.me {
  background: rgba(255,215,0,0.1);
  border: 1px solid rgba(255,215,0,0.3);
}

.leaderboard-row .rank {
  min-width: 2rem;
  text-align: center;
  font-weight: 600;
}

.leaderboard-row .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.emoji-avatar-small {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  font-size: 1.1rem;
}

.avatar-letter-small {
  font-size: 1rem;
  font-weight: 700;
  color: #000;
  text-transform: lowercase;
}

.leaderboard-row .name {
  flex: 1;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-row .chips {
  font-weight: 600;
  color: var(--gold);
  background: none;
  padding: 0;
}

.leaderboard-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
}

.leaderboard-empty .btn {
  margin-top: 1rem;
}

.leaderboard-signin-prompt {
  text-align: center;
  padding: 1rem;
  margin-top: 0.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.leaderboard-signin-prompt p {
  margin-bottom: 0.75rem;
}

.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

/* Profile - Back to Leaderboard button */
.back-to-leaderboard {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  background-color: var(--panel-bg) !important;
  border: 1px solid var(--border-color, rgba(255, 215, 0, 0.3));
  border-radius: var(--radius-sm);
  color: var(--gold, #ffd700);
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.2s, border-color 0.2s;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  /* Safari button reset */
  -webkit-border-radius: var(--radius-sm);
  background-image: none;
}

.back-to-leaderboard:hover,
.back-to-leaderboard:focus {
  background-color: var(--panel-bg-hover) !important;
  border-color: var(--gold, #ffd700);
  outline: none;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem 1.25rem;
  background: var(--panel-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--gold);
}

/* Emoji avatar */
.profile-avatar.emoji-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  font-size: 2rem;
}

.avatar-emoji {
  font-size: 2rem;
  line-height: 1;
}

.avatar-letter {
  font-size: 1.75rem;
  font-weight: 700;
  color: #000;
  text-transform: lowercase;
}

.profile-avatar-wrapper {
  position: relative;
}

.edit-avatar-btn {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: var(--bg);
  border: 2px solid var(--gold);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* Emoji picker backdrop */
.emoji-picker-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
}

/* Emoji picker */
.emoji-picker {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  z-index: 1001; /* Above backdrop */
  width: min(320px, 90vw);
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

.emoji-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.emoji-picker-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}

.emoji-option {
  background: transparent;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 1.75rem;
  padding: 0.4rem;
  cursor: pointer;
  transition: all 0.15s;
}

.emoji-option:hover {
  background: rgba(255,255,255,0.08);
  transform: scale(1.1);
}

.emoji-option.selected {
  background: rgba(255,215,0,0.15);
  border-color: var(--gold);
}

.emoji-option:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Avatar preview in picker */
.avatar-preview-section {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  border: 3px solid rgba(255,255,255,0.2);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Picker sections */
.picker-section {
  margin-bottom: 0.75rem;
}

.picker-section label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Color grid */
.color-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}

.color-option {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 3px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}

.color-option:hover {
  transform: scale(1.08);
}

.color-option.selected {
  border-color: white;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.2);
}

/* Save button in picker */
.picker-save-btn {
  width: 100%;
  margin-top: 0.5rem;
}

.profile-info h3 {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.member-since {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--panel-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
}

.stat {
  text-align: center;
  padding: 0.75rem 0.5rem;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
}

.stat-value {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Detailed stats section */
.profile-stats-detailed {
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--panel-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-row .stat-icon {
  font-size: 1rem;
  width: 28px;
  flex-shrink: 0;
}

.stat-row .stat-label {
  flex: 1;
  text-transform: none;
  font-size: 0.9rem;
  color: var(--text);
}

.stat-row .stat-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gold);
}

/* Per-game stats section */
.profile-game-stats {
  margin-bottom: 1rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
}

.favorite-game {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: var(--radius-sm);
}

.favorite-game .stat-icon {
  font-size: 1.25rem;
  margin-right: 0.5rem;
}

.favorite-game .stat-label {
  flex: 1;
  text-transform: none;
  font-size: 0.9rem;
  color: var(--gold);
}

.favorite-game .stat-value {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.game-stat-row {
  display: flex;
  align-items: center;
  padding: 0.4rem 0;
}

.game-stat-row .game-icon {
  font-size: 1rem;
  width: 24px;
}

.game-stat-row .game-name {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text);
}

.game-stat-row .game-record {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.profile-achievements {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: var(--panel-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
}

.profile-achievements h4 {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.achievements-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.achievement {
  font-size: 1.5rem;
  padding: 0.25rem;
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, opacity 0.15s;
}

.achievement.earned {
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.3);
}

.achievement.locked {
  opacity: 0.5;
  filter: grayscale(0.3);
}

.achievement:hover {
  background: rgba(255,255,255,0.1);
  transform: scale(1.1);
  opacity: 1;
}

.achievement.earned:hover {
  background: rgba(255, 215, 0, 0.25);
}

.achievement:active {
  transform: scale(0.95);
}

.no-achievements {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Achievement Tooltip */
.achievement-tooltip {
  position: fixed;
  background: #1a1a2e;
  border: 1px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  z-index: 400;
  text-align: center;
  min-width: 150px;
  max-width: 220px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(-5px);
  transition: opacity 0.2s, transform 0.2s;
}

.achievement-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.achievement-tooltip-icon {
  font-size: 2rem;
  margin-bottom: 0.25rem;
}

.achievement-tooltip-name {
  font-weight: 700;
  color: var(--gold);
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.achievement-tooltip-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Achievement Notification */
.achievement-notification {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: 2px solid var(--gold);
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 20px rgba(255, 215, 0, 0.2);
}

.achievement-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.achievement-notification .achievement-icon {
  font-size: 2.5rem;
}

.achievement-notification .achievement-text {
  font-size: 0.9rem;
  color: var(--text);
}

.achievement-notification .achievement-text strong {
  display: block;
  color: var(--gold);
  font-size: 1.1rem;
}

/* Achievement Groups (for landing page) */
.achievement-group {
  margin-bottom: 1rem;
}

.achievement-group-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.achievement-group-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* How to Play */
.how-to-play {
  max-height: 60vh;
  overflow-y: auto;
}

.how-to-play h3 {
  color: var(--gold);
  margin: 1.25rem 0 0.5rem;
  font-size: 1rem;
}

.how-to-play h3:first-child {
  margin-top: 0;
}

.how-to-play p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.how-to-play ul,
.how-to-play ol {
  margin-left: 1.25rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.how-to-play li {
  margin-bottom: 0.35rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1a1a2e;
  color: var(--text);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  z-index: 300;
  opacity: 0;
  transition: all 0.3s ease;
  font-weight: 500;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Coming Soon Modal */
.modal-small {
  max-width: 320px;
}

.coming-soon-content {
  text-align: center;
}

.coming-soon-content p {
  margin-bottom: 0.75rem;
  color: var(--text-muted);
}

.coming-soon-tip {
  font-size: 0.9rem;
}

.promo-codes-list {
  background: rgba(255,255,255,0.05);
  padding: 1rem;
  border-radius: var(--radius-sm);
  margin: 1rem 0;
  font-size: 0.95rem;
  line-height: 1.8;
}

.promo-codes-list code {
  background: rgba(255,215,0,0.2);
  color: var(--gold);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-family: monospace;
}

.coming-soon-content .btn {
  width: 100%;
  margin-top: 0.5rem;
}

/* Responsive */
/* Mobile card sizing - prevent overflow in hand containers */
@media (max-width: 480px) {
  .dealer-hands,
  .player-hands {
    gap: 0.5rem;
    padding: 0 0.5rem;
  }
  
  .hand {
    gap: 2px;
    padding: 0.375rem;
  }
  
  .card {
    width: 42px;
    height: 60px;
    font-size: 0.85rem;
  }
  
  .card .rank {
    font-size: 0.95rem;
  }
  
  .card .suit {
    font-size: 0.75rem;
  }
}

@media (max-width: 380px) {
  .card {
    width: 36px;
    height: 52px;
    font-size: 0.8rem;
  }
  
  .card .rank {
    font-size: 0.9rem;
  }
  
  .card .suit {
    font-size: 0.7rem;
  }
  
  .profile-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}


/* PWA Install Banner */
#pwa-install-banner {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  flex: 1;
  text-align: left;
  padding: 0;
}

.pwa-banner-icon {
  font-size: 1.5rem;
}

.pwa-banner-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.pwa-banner-text strong {
  font-size: 0.95rem;
}

.pwa-banner-text span:last-child {
  font-size: 0.8rem;
  opacity: 0.9;
}

.pwa-banner-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pwa-banner-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Offset game container when banner is shown */
#pwa-install-banner + .game-container,
body:has(#pwa-install-banner) .game-container {
  padding-top: calc(1rem + 52px);
}

/* PWA Instructions Modal */
.pwa-instructions {
  text-align: center;
}

.pwa-intro {
  font-size: 1rem;
  margin-bottom: 1.25rem;
  color: var(--text-muted);
}

.pwa-benefits {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.pwa-benefit {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.benefit-icon {
  font-size: 1.2rem;
}

.pwa-steps {
  text-align: left;
  margin-bottom: 1.5rem;
}

.pwa-step {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.pwa-step:last-child {
  margin-bottom: 0;
}

.step-number {
  width: 28px;
  height: 28px;
  background: var(--gold);
  color: var(--bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.pwa-step p {
  padding-top: 0.25rem;
  line-height: 1.4;
}

.share-icon,
.add-icon {
  display: inline-block;
  background: rgba(255, 255, 255, 0.15);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  vertical-align: middle;
}

.pwa-note {
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.3);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

.pwa-dismiss {
  width: 100%;
}

/* ========== FORTUNE BONUS ========== */

.bonus-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.bonus-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.bonus-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  font-size: 0.85rem;
}

.bonus-toggle:hover {
  background: rgba(255, 215, 0, 0.15);
  border-color: rgba(255, 215, 0, 0.5);
}

.bonus-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
  cursor: pointer;
}

.bonus-label {
  font-size: 0.9rem;
  color: var(--gold);
}

.bonus-amount {
  font-weight: bold;
}

.bonus-help-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.2s ease;
}

.bonus-help-btn:hover {
  background: var(--gold);
  color: var(--bg);
}

/* Active Bet Display (shown during play) */
.active-bet-display {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: var(--radius-sm);
  margin: 0.5rem 0;
  font-size: 0.95rem;
}

.active-bet-main {
  color: var(--text);
  font-weight: 600;
}

.active-bet-bonus {
  color: var(--gold);
  font-weight: 600;
}

.active-bet-envy {
  color: #a78bfa;
  font-weight: 600;
}

.active-bet-display.hidden {
  display: none;
}

.active-bet-bonus.hidden,
.active-bet-envy.hidden,
.active-bet-insurance.hidden {
  display: none;
}

/* Fortune Bonus Bet Selector */
.bonus-bet-selector {
  display: flex;
  gap: 0.5rem;
  margin-left: 0.75rem;
}

.bonus-bet-selector.hidden {
  display: none;
}

.bonus-bet-btn {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--gold);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-weight: 500;
}

.bonus-bet-btn:hover {
  background: rgba(255, 215, 0, 0.15);
  border-color: var(--gold);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.15);
}

.bonus-bet-btn.active {
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
  color: var(--bg);
  font-weight: 600;
  border-color: var(--gold);
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

/* Fortune Bet Selector */
.fortune-bet-selector {
  display: flex;
  gap: 0.35rem;
  margin-left: 0.5rem;
}

.fortune-bet-selector.hidden {
  display: none;
}

.fortune-bet-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--gold);
  cursor: pointer;
  transition: all 0.2s ease;
}

.fortune-bet-btn:hover {
  background: rgba(255, 215, 0, 0.15);
  border-color: var(--gold);
}

.fortune-bet-btn.active {
  background: var(--gold);
  color: var(--bg);
  font-weight: bold;
}

/* Envy Bet Selector */
.envy-bet-selector {
  display: flex;
  gap: 0.35rem;
  margin-left: 0.5rem;
}

.envy-bet-selector.hidden {
  display: none;
}

.envy-bet-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border: 1px solid rgba(167, 139, 250, 0.4);
  border-radius: var(--radius-sm);
  background: transparent;
  color: #a78bfa;
  cursor: pointer;
  transition: all 0.2s ease;
}

.envy-bet-btn:hover {
  background: rgba(167, 139, 250, 0.15);
  border-color: #a78bfa;
}

.envy-bet-btn.active {
  background: #a78bfa;
  color: var(--bg);
  font-weight: bold;
}

/* Fortune Bonus Modal */
.fortune-bonus-content {
  text-align: center;
}

.fortune-intro {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--gold);
}

.tier-header {
  font-size: 0.95rem;
  margin: 1rem 0 0.5rem 0;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
}

.tier-header.envy-tier {
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.15);
}

.tier-header.bonus-tier {
  color: var(--gold);
  background: rgba(255, 215, 0, 0.15);
}

.fortune-paytable {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.fortune-paytable th {
  background: rgba(255, 215, 0, 0.2);
  padding: 0.6rem;
  text-align: left;
  border-bottom: 2px solid var(--gold);
}

.fortune-paytable th:last-child {
  text-align: right;
}

.fortune-paytable td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.fortune-paytable td:last-child {
  text-align: right;
  font-weight: bold;
  color: var(--gold);
}

.fortune-paytable tr.jackpot td {
  background: rgba(255, 215, 0, 0.15);
  color: var(--gold);
}

.fortune-paytable tr.jackpot td:first-child {
  font-weight: bold;
}

.fortune-paytable tr.premium td {
  background: rgba(255, 215, 0, 0.08);
}

.fortune-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}

.fortune-odds {
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.7;
}

/* Bonus result in result display */
.bonus-win {
  display: block;
  font-size: 0.9rem;
  color: var(--gold);
  margin-top: 0.25rem;
}

/* Hide bonus during game phases */
.bonus-controls.hidden {
  display: none;
}

/* ========== BONUS CELEBRATION ========== */

.emoji-confetti {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.confetti-emoji {
  position: absolute;
  top: -50px;
  animation: confetti-fall 2.5s ease-out forwards;
  opacity: 0;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(0) rotate(0deg) scale(1);
    opacity: 1;
  }
  25% {
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg) scale(0.5);
    opacity: 0;
  }
}

/* Bonus win text styling improvement */
.bonus-win {
  display: block;
  font-size: 0.95rem;
  color: var(--gold);
  margin-top: 0.5rem;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
  animation: bonus-glow 0.5s ease-in-out 3;
}

@keyframes bonus-glow {
  0%, 100% {
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
  }
  50% {
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.4);
  }
}

/* Bottom close button for modals on mobile */
.modal-close-bottom {
  margin-top: 1rem;
  width: 100%;
}

/* Done button for modal (mobile-friendly close alternative) */
.modal-done-btn {
  display: block;
  width: 100%;
  margin-top: 1.5rem;
  padding: 0.75rem;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.modal-done-btn:hover {
  background: rgba(255,255,255,0.15);
}

/* Profile Edit Name */
.profile-name-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.edit-name-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  opacity: 0.6;
  padding: 0.25rem;
  transition: opacity 0.2s;
}

.edit-name-btn:hover {
  opacity: 1;
}

.edit-name-input {
  font-size: 1.1rem;
  padding: 0.35rem 0.5rem;
  border: 2px solid var(--gold);
  border-radius: var(--radius-sm);
  background: var(--felt);
  color: var(--text);
  width: 150px;
  font-weight: 600;
}

.edit-name-input:focus {
  outline: none;
  border-color: #fff;
}

.save-name-btn,
.cancel-name-btn {
  background: var(--felt);
  border: 1px solid var(--text-muted);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem 0.5rem;
  margin-left: 0.25rem;
}

.save-name-btn {
  color: var(--win);
  border-color: var(--win);
}

.cancel-name-btn {
  color: var(--lose);
  border-color: var(--lose);
}

.save-name-btn:hover {
  background: var(--win);
  color: white;
}

.cancel-name-btn:hover {
  background: var(--lose);
  color: white;
}

/* ========== SESSION STATS ========== */

.session-stats-bar {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  padding: 0.75rem 1rem;
  margin-top: 1rem;
  background: var(--panel-bg-hover);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.session-stats-bar .stat-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.session-stats-bar .stat-item.profit {
  color: var(--win);
}

.session-stats-bar .stat-item.loss {
  color: var(--lose);
}

.session-stats-bar .stat-help {
  font-size: 0.75rem;
  opacity: 0.6;
  cursor: help;
  margin-left: 0.25rem;
}

/* ========== SETTINGS MODAL ========== */

.settings-content {
  padding: 0.75rem 0;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  margin: 0.75rem 0;
  background: var(--panel-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
}

.setting-row label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.setting-section {
  padding: 1rem 1.25rem;
  margin: 0.75rem 0;
  background: var(--panel-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
}

.setting-section-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.2);
  transition: 0.3s;
  border-radius: var(--radius-xl);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--gold);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(24px);
}

/* Theme Options */
.theme-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.theme-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem;
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
  font-size: 0.75rem;
}

.theme-btn:hover {
  border-color: rgba(255, 255, 255, 0.4);
}

.theme-btn.active {
  border-color: var(--gold);
  background: rgba(255, 215, 0, 0.1);
}

.theme-preview {
  width: 40px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.theme-preview.classic {
  background: linear-gradient(135deg, #1a472a, #2d5a3c);
}

.theme-preview.midnight {
  background: linear-gradient(135deg, #152238, #1e3a5f);
}

.theme-preview.royal {
  background: linear-gradient(135deg, #2a1a3a, #4a2a5e);
}

.theme-preview.vegas {
  background: linear-gradient(135deg, #351a1a, #5a2a2a);
}

/* ========== TABLE THEMES ========== */

/* Classic (default) - already defined in :root */

/* Midnight Blue - rich navy, similar brightness to classic */
[data-theme="midnight"] {
  --bg: #1a3a5a;
  --bg-light: #2a4a6a;
  --bg-dark: #0a2040;
  --felt: #2a4a6a;
  --panel-bg: rgba(42, 74, 106, 0.6);
  --panel-bg-hover: rgba(42, 74, 106, 0.8);
  --border-color: rgba(100, 150, 200, 0.3);
}

/* Royal Purple - elegant purple, similar brightness to classic */
[data-theme="royal"] {
  --bg: #3a2a5a;
  --bg-light: #4a3a6a;
  --bg-dark: #2a1a4a;
  --felt: #4a3a6a;
  --panel-bg: rgba(74, 58, 106, 0.6);
  --panel-bg-hover: rgba(74, 58, 106, 0.8);
  --border-color: rgba(150, 120, 200, 0.3);
}

/* Vegas Red - warm burgundy, similar brightness to classic */
[data-theme="vegas"] {
  --bg: #4a2a2a;
  --bg-light: #5a3a3a;
  --bg-dark: #3a1a1a;
  --felt: #5a3a3a;
  --panel-bg: rgba(90, 58, 58, 0.6);
  --panel-bg-hover: rgba(90, 58, 58, 0.8);
  --border-color: rgba(200, 150, 150, 0.3);
}

/* ========== CARD ANIMATIONS ========== */

/* Card deal animation */
@keyframes cardDeal {
  0% {
    opacity: 0;
    transform: translateY(-50px) rotate(-10deg) scale(0.5);
  }
  60% {
    opacity: 1;
    transform: translateY(5px) rotate(2deg) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotate(0) scale(1);
  }
}

.card.dealing {
  animation: cardDeal 0.3s ease-out forwards;
}

/* Stagger animation for multiple cards */
.hand .card:nth-child(1).dealing { animation-delay: 0s; }
.hand .card:nth-child(2).dealing { animation-delay: 0.05s; }
.hand .card:nth-child(3).dealing { animation-delay: 0.1s; }
.hand .card:nth-child(4).dealing { animation-delay: 0.15s; }
.hand .card:nth-child(5).dealing { animation-delay: 0.2s; }
.hand .card:nth-child(6).dealing { animation-delay: 0.25s; }
.hand .card:nth-child(7).dealing { animation-delay: 0.3s; }

/* Card flip animation for dealer reveal */
@keyframes cardFlip {
  0% {
    transform: rotateY(180deg);
  }
  100% {
    transform: rotateY(0deg);
  }
}

.card.flipping {
  animation: cardFlip 0.4s ease-out forwards;
  transform-style: preserve-3d;
}

/* Card hover lift effect */
.card:not(.card-back) {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:not(.card-back):hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

/* Card selection pulse */
.card.selected {
  animation: cardPulse 0.5s ease-in-out infinite alternate;
}

@keyframes cardPulse {
  0% {
    box-shadow: 0 0 0 3px var(--gold);
  }
  100% {
    box-shadow: 0 0 10px 5px var(--gold);
  }
}

/* Win/Lose hand highlight animation */
@keyframes winPulse {
  0%, 100% {
    box-shadow: inset 0 0 0 2px var(--win);
  }
  50% {
    box-shadow: inset 0 0 15px 2px var(--win);
  }
}

@keyframes losePulse {
  0%, 100% {
    box-shadow: inset 0 0 0 2px var(--lose);
  }
  50% {
    box-shadow: inset 0 0 10px 2px var(--lose);
  }
}

.hand-container.win-highlight {
  animation: winPulse 1s ease-in-out 2;
}

.hand-container.lose-highlight {
  animation: losePulse 1s ease-in-out 2;
}

/* Chip animation on bet change */
@keyframes chipBounce {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.chips.updating {
  animation: chipBounce 0.2s ease-out;
}

/* ========== PREMIUM THEMES ========== */

.theme-btn.locked {
  opacity: 0.5;
  cursor: not-allowed;
  position: relative;
}

.theme-btn.locked:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.lock-icon {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 0.6rem;
}

.theme-btn.unlocked .lock-icon {
  display: none;
}

.theme-btn.unlocked {
  opacity: 1;
  cursor: pointer;
}

.premium-unlock {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: var(--radius-sm);
  text-align: center;
}

.premium-text {
  margin: 0 0 0.75rem 0;
  color: var(--gold);
  font-weight: 500;
}

.premium-hint {
  margin: 0.5rem 0 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.premium-unlocked {
  margin-top: 1rem;
  padding: 0.75rem;
  background: rgba(76, 175, 80, 0.1);
  border: 1px solid rgba(76, 175, 80, 0.3);
  border-radius: var(--radius-sm);
  text-align: center;
}

.premium-unlocked .premium-text {
  color: var(--win);
  margin: 0;
}

.premium-unlock.hidden,
.premium-unlocked.hidden {
  display: none;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ========== BLACKJACK STYLES ========== */

/* Game navigation */
.game-nav {
  font-size: 1.5rem;
  text-decoration: none;
  margin-right: 0.5rem;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.game-nav:hover {
  opacity: 1;
}

.game-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  color: #ffd700;
  margin: 0.75rem 0;
}

/* Blackjack layout */
.blackjack-dealer,
.blackjack-player {
  padding: 0.5rem 1rem;
  margin-bottom: 0.5rem;
}

/* Use shared .hand-container and .hand styles */
.blackjack-dealer .hand-container,
.blackjack-player .hand-container {
  max-width: 100%;
}

.blackjack-player .hands-row {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.blackjack-player .hands-row .hand-container {
  flex: 1;
  max-width: 200px;
}

/* Blackjack hand boxes - reuse .hand styling */
.hand.blackjack-hand {
  min-height: 90px;
  flex-wrap: wrap;
}

/* Active hand highlight */
.hand-container.active-hand .hand {
  border-color: var(--gold);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

/* Hand total styling */
.hand-total {
  font-weight: 700;
  color: var(--gold);
  font-size: 1rem;
}

.hand-total.bust {
  color: var(--loss);
}

.hand-total.blackjack {
  color: var(--gold);
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

/* Blackjack cards */
.blackjack-card {
  width: 60px;
  height: 84px;
  background: linear-gradient(145deg, #ffffff 0%, #f8f8f8 100%);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: #333;
  box-shadow: var(--shadow-card);
  position: relative;
  flex-shrink: 0;
}

.blackjack-card.red {
  color: #d32f2f;
}

.blackjack-card.face-down {
  background: linear-gradient(135deg, #9b2335 0%, #722f37 50%, #4a1c24 100%);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
  color: transparent;
}

.blackjack-card .card-rank {
  font-size: 1.4rem;
}

.blackjack-card .card-suit {
  font-size: 1.2rem;
  margin-top: -0.2rem;
}

/* Split hand */
.split-hand {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.split-hand.hidden {
  display: none;
}

/* Action buttons */
.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.action-buttons .btn {
  min-width: 70px;
}

.action-buttons .btn.hidden {
  display: none;
}

/* Result display for blackjack */
.result-display.blackjack {
  background: linear-gradient(135deg, var(--gold), #ffeb3b);
  color: #000;
}

.result-display.blackjack::before {
  content: '🎰';
  margin-right: 0.5rem;
}

/* Responsive adjustments for blackjack */
@media (max-width: 400px) {
  .blackjack-card {
    width: 50px;
    height: 70px;
    font-size: 1rem;
  }
  
  .blackjack-card .card-rank {
    font-size: 1.2rem;
  }
  
  .blackjack-card .card-suit {
    font-size: 1rem;
  }
  
  .action-buttons .btn {
    min-width: 60px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }
}

/* Game links in footer */
.game-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.game-link {
  color: var(--gold);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.game-link:hover {
  background: rgba(255, 215, 0, 0.1);
  border-color: var(--gold);
}

/* ========== LANDING PAGE ========== */

.landing-page {
  text-align: center;
}

.landing-page header {
  justify-content: center;
}

.header-center {
  flex: 1;
  text-align: center;
}

.landing-title {
  font-size: 1.5rem;
  margin: 0;
  color: var(--text);
}

.landing-tagline {
  font-size: 1rem;
  margin: 0.25rem 0 0;
  color: var(--gold);
  font-weight: 500;
}

.landing-main {
  padding: 1rem;
}

.landing-subtitle {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

/* Game grid */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.game-card {
  background: var(--surface);
  border: 1px solid var(--separator);
  border-radius: var(--radius-xl);
  padding: var(--space-lg) var(--space-md);
  text-decoration: none;
  color: var(--text);
  transition: all var(--transition-base);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.game-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(255, 215, 0, 0.1) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.game-card:hover {
  border-color: var(--gold);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), 0 0 30px rgba(255, 215, 0, 0.2);
}

.game-card:hover::before {
  opacity: 1;
}

.game-card.coming-soon {
  opacity: 0.5;
  pointer-events: none;
}

.game-icon {
  font-size: 2.75rem;
  margin-bottom: 0.25rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.game-card h2 {
  font-size: 1.1rem;
  margin: 0;
  color: var(--gold);
}

.game-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.3;
}

.game-tag {
  font-size: 0.65rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.1);
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.game-tag.new {
  background: var(--win);
  color: white;
}

.game-tag.beta {
  background: #f59e0b;
  color: #000;
  font-weight: 600;
}

/* Features section */
.landing-features {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.feature {
  text-align: center;
  max-width: 100px;
}

.feature-icon {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 0.25rem;
}

.feature h3 {
  font-size: 0.8rem;
  margin: 0 0 0.25rem 0;
  color: var(--text);
}

.feature p {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin: 0;
}

/* Footer link to landing page */
.other-games-link,
.other-games-link:hover,
.other-games-link:active,
.other-games-link:focus,
.other-games-link:visited {
  display: inline-block;
  color: #1a1a2e;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, var(--gold) 0%, #e6c200 100%);
  border-radius: var(--radius-sm);
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  outline: none;
}

.other-games-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.other-games-link:active {
  transform: translateY(0);
}

/* Cross-promo wrapper for other games link */
.cross-promo {
  text-align: center;
  margin: 1rem 0;
  width: 100%;
  display: flex;
  justify-content: center;
}

/* Disclaimer banner for landing page */
.disclaimer-banner {
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 2rem;
  font-size: 0.9rem;
  color: var(--text);
  text-align: center;
}

/* Try new version link */
.try-new-version {
  font-size: 0.85rem;
  margin: 0.75rem 0;
}

.try-new-version a {
  color: var(--gold);
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.try-new-version a:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Legal links in footer */
.legal-links {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.5rem 0;
}

.legal-links a {
  color: var(--text-muted);
  text-decoration: none;
}

.legal-links a:hover {
  color: var(--gold);
  text-decoration: underline;
}

.legal-disclaimer {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.7;
  margin: 0.25rem 0;
}

/* ========== VIDEO POKER SPECIFIC STYLES ========== */

/* Paytable */
.paytable {
  background: var(--panel-bg);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  overflow-x: auto;
}

.paytable-row {
  display: grid;
  grid-template-columns: 1fr repeat(4, 2.5rem) 3rem; /* Last column wider for 4000 */
  gap: 0.25rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.paytable-row:last-child {
  border-bottom: none;
}

.paytable-row.header {
  font-weight: 600;
  color: var(--gold);
}

.paytable-row .hand-name {
  text-align: left;
  white-space: nowrap;
}

.paytable-row .payout {
  text-align: center;
  padding: 0.15rem;
  border-radius: 3px;
}

.paytable-row .payout.active {
  background: var(--gold);
  color: #1a1a2e;
  font-weight: 600;
}

.paytable-row .payout.bonus {
  color: var(--gold);
  font-weight: 600;
}

.paytable-row.winner {
  background: rgba(39, 174, 96, 0.3);
  border-radius: var(--radius-sm);
}

.paytable-row.winner .hand-name {
  color: var(--win);
  font-weight: 600;
}

/* Video Poker Hand Container */
.vp-hand-container {
  margin: 1rem 0 2.5rem 0; /* Extra bottom margin for HOLD labels */
}

.vp-hand {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

.vp-card-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.vp-card-wrapper .card {
  transition: transform 0.2s;
}

/* Only raise card when actually held, not just on hover */
.vp-card-wrapper.held .card {
  transform: translateY(-8px);
}

/* Desktop hover effect (only when not held) */
@media (hover: hover) {
  .vp-card-wrapper:not(.held):hover .card {
    transform: translateY(-4px);
  }
}

/* Hold Label */
.hold-label {
  position: absolute;
  bottom: -1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.hold-label.active {
  background: var(--gold);
  color: #1a1a2e;
  border-color: var(--gold);
}

/* Coin/Value bet controls */
.coin-bet-row,
.coin-value-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.coin-btn,
.value-btn {
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--gold);
  background: transparent;
  color: var(--gold);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 2.5rem;
}

.coin-btn.active,
.value-btn.active {
  background: var(--gold);
  color: #1a1a2e;
}

.coin-btn:hover:not(.active),
.value-btn:hover:not(.active) {
  background: rgba(255, 215, 0, 0.2);
}

.total-bet {
  text-align: center;
  font-size: 1rem;
  color: var(--gold);
  font-weight: 600;
  margin: 0.5rem 0;
}

/* Empty card slot */
.card.empty {
  background: rgba(255, 255, 255, 0.1);
  border: 2px dashed rgba(255, 255, 255, 0.3);
}

/* Large cards for Video Poker */
.card.card-large {
  width: 60px;
  height: 84px;
  font-size: 1.2rem;
}

@media (max-width: 400px) {
  .card.card-large {
    width: 52px;
    height: 72px;
    font-size: 1rem;
  }
  
  .paytable {
    font-size: 0.75rem;
  }
  
  .paytable-row {
    grid-template-columns: 1fr repeat(5, 2.2rem);
  }
}

/* Fix Video Poker paytable bonus with active highlight */
.paytable-row .payout.bonus.active {
  color: #1a1a2e; /* Dark text on gold background */
}

/* Fix Video Poker bet controls overflow on mobile */
.coin-bet-row,
.coin-value-row {
  flex-wrap: wrap;
  padding: 0 0.5rem;
}

@media (max-width: 380px) {
  .coin-btn,
  .value-btn {
    padding: 0.4rem 0.5rem;
    min-width: 2rem;
    font-size: 0.8rem;
  }
  
  .coin-bet-row label,
  .coin-value-row label {
    font-size: 0.8rem;
    min-width: 50px;
  }
}

/* Video Poker total display inline */
.vp-total {
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 0.75rem;
  font-size: 0.875rem;
}

.vp-total span {
  color: var(--gold);
  font-size: 1rem;
}

/* Stats Info Modal styling */
.stats-info-content .stats-intro {
  margin: 0 0 1rem 0;
  line-height: 1.5;
  color: var(--text, #f0f0f0);
}

.stats-info-content .stats-list {
  padding-left: 1rem;
  margin-bottom: 1rem;
}

.stats-info-content .stats-list p {
  margin: 0 0 0.5rem 0;
  line-height: 1.6;
  color: var(--text, #f0f0f0);
}

.stats-info-content .stats-list p:last-child {
  margin-bottom: 0;
}

.stats-info-content .stats-note-box {
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md, 8px);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.stats-info-content .stats-note-box p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted, #aaa);
  line-height: 1.5;
}

.stats-info-content .reset-stats-btn {
  width: 100%;
  margin-top: 0.5rem;
}

/* Legacy formats (backwards compat) */
.stats-info-content .stats-explanation {
  list-style: none;
  padding: 0 0 0 1rem;
  margin: 0 0 1rem 0;
}

.stats-info-content .stats-explanation li {
  padding: 0.25rem 0;
  line-height: 1.6;
}

.stats-info-content .stats-note {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.stats-info-content .stat-explanation {
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-info-content .stat-explanation:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
}

.stats-info-content .stat-explanation p {
  margin: 0;
  line-height: 1.5;
}

/* ========== BLACKJACK BUST PROBABILITY ========== */
.bust-probability {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.5rem;
  padding: 0.3rem 0.6rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
}

/* Center the bust probability within player hand container */
#player-hand-container {
  text-align: center;
}

.bust-probability.hidden {
  display: none;
}

.bust-label {
  color: var(--text-muted);
}

.bust-percent {
  font-weight: 600;
  min-width: 3rem;
}

.bust-percent.safe { color: #22c55e; }
.bust-percent.caution { color: #eab308; }
.bust-percent.danger { color: var(--lose); }

/* Beta tag for experimental features */
.beta-tag {
  font-size: 0.65rem;
  background: rgba(255, 215, 0, 0.2);
  color: var(--gold);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  margin-left: 0.5rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
}

/* ========== WELCOME TOAST (First Login Bonus) ========== */
.welcome-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.welcome-toast-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, var(--table-felt, #1a472a) 0%, var(--bg-main, #0d1f14) 100%);
  border: 2px solid var(--gold, #ffd700);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.welcome-toast-icon {
  font-size: 2rem;
}

.welcome-toast-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.welcome-toast-text strong {
  color: var(--gold, #ffd700);
  font-size: 1rem;
}

.welcome-toast-text span {
  color: var(--text, #f0f0f0);
  font-size: 0.875rem;
}

.welcome-toast-close {
  background: none;
  border: none;
  color: var(--text-muted, #888);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
  transition: color 0.2s;
}

.welcome-toast-close:hover {
  color: var(--text, #f0f0f0);
}

/* ========== AI Advisor (Vanilla) ========== */
.ai-advisor {
  position: fixed;
  bottom: 100px;
  right: 16px;
  z-index: 100;
}

.ai-advisor-toggle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gold, #ffd700);
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ai-advisor-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.ai-advisor-toggle:active {
  transform: scale(0.95);
}

.ai-advisor-panel {
  position: absolute;
  bottom: 60px;
  right: 0;
  width: 300px;
  max-width: calc(100vw - 32px);
  max-height: 50vh;
  background: var(--bg, #1a472a);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  overflow-y: auto;
  animation: aiSlideUp 0.2s ease;
}

.ai-advisor-panel.hidden {
  display: none;
}

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

.ai-advisor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.1));
}

.ai-advisor-header h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--gold, #ffd700);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-advisor-header .beta-badge {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 6px;
  background: rgba(239, 68, 68, 0.8);
  color: white;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.ai-advisor-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted, #9ca3af);
  font-size: 1.25rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}

.ai-advisor-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text, #fff);
}

.ai-advisor-content {
  padding: 16px;
}

.ai-advisor-signin {
  text-align: center;
  color: var(--text-muted, #9ca3af);
  margin: 0;
}

.ai-advisor-prompts-label {
  margin: 0 0 8px;
  font-size: 0.875rem;
  color: var(--text-muted, #9ca3af);
}

.ai-advisor-prompts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-advisor-prompt {
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  font-size: 0.875rem;
  color: var(--text, #fff);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.ai-advisor-prompt:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--gold, #ffd700);
}

.ai-advisor-prompt:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ai-advisor-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  color: var(--text-muted, #9ca3af);
}

.ai-advisor-spinner {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.ai-advisor-error {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  color: #fca5a5;
  font-size: 0.875rem;
}

.ai-advisor-response {
  margin-top: 12px;
  padding: 12px;
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 8px;
}

.ai-advisor-response p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text, #fff);
}

.ai-advisor-remaining {
  margin: 12px 0 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted, #9ca3af);
}

.ai-advisor-powered-by {
  margin: 16px 0 0;
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-muted, #9ca3af);
  opacity: 0.7;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

@media (max-width: 480px) {
  .ai-advisor {
    bottom: 80px;
    right: 12px;
  }

  .ai-advisor-panel {
    width: calc(100vw - 24px);
    right: -6px;
  }
}
