/* ============================================================
   Dealer's Duel — Premium Casino Theme
   Commercial-grade dark luxury card game aesthetic
   ============================================================ */

:root {
  --felt: #0b4d2c;
  --felt-dark: #063a1e;
  --felt-mid: #0a5e34;
  --felt-light: #0e6b3a;
  --felt-highlight: #12804a;
  --rail: #3d2008;
  --rail-light: #6b3a10;
  --rail-edge: #1e1005;
  --gold: #d4a84b;
  --gold-light: #f0d68a;
  --gold-bright: #ffe4a0;
  --gold-dark: #a67c2e;
  --gold-deep: #7a5a1e;
  --cream: #faf5e8;
  --card-white: #fffef8;
  --card-shadow: rgba(0,0,0,0.45);
  --red-suit: #c0392b;
  --red-bright: #e74c3c;
  --black-suit: #1a1a1a;
  --bg-dark: #080c06;
  --bg-panel: rgba(6, 18, 10, 0.92);
  --text-primary: #f0ece2;
  --text-dim: #8a9e80;
  --text-muted: #5a6e50;
  --glass: rgba(6, 58, 30, 0.65);
  --glass-border: rgba(212, 168, 75, 0.2);
  --danger: #dc3545;
  --success: #28a745;
  --glow-gold: rgba(212, 168, 75, 0.6);
  --glow-green: rgba(14, 107, 58, 0.5);
}

*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%; width: 100%;
  overflow: hidden;
  font-family: 'Inter', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: 'Playfair Display', serif; font-weight: 900; }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gold-dark); border-radius: 4px; }

/* ============ SCREENS ============ */
.screen {
  display: none;
  position: fixed;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.screen.active { display: flex; }

/* ============ FELT BACKGROUND (shared) ============ */
.felt-bg {
  background:
    radial-gradient(ellipse 120% 80% at 50% 35%, var(--felt-highlight) 0%, var(--felt) 35%, var(--felt-dark) 70%, var(--bg-dark) 100%);
  position: relative;
}
.felt-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  background-size: 256px;
  pointer-events: none;
  z-index: 0;
}

/* ============ LANDING ============ */
#screen-landing {
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#screen-landing, #screen-create, #screen-join, #screen-lobby, #screen-gameover {
  background:
    radial-gradient(ellipse 120% 80% at 50% 35%, var(--felt-highlight) 0%, var(--felt) 35%, var(--felt-dark) 70%, var(--bg-dark) 100%);
}

.landing-container {
  text-align: center;
  padding: 2rem;
  max-width: 440px;
  position: relative;
  z-index: 1;
}

/* Ambient spotlight */
.landing-container::before {
  content: '';
  position: fixed;
  top: -30%;
  left: 50%;
  transform: translateX(-50%);
  width: 80vw;
  height: 60vh;
  background: radial-gradient(ellipse, rgba(212, 168, 75, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.card-fan {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
  perspective: 800px;
}
.fan-card {
  width: 64px;
  height: 92px;
  background: var(--card-white);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--black-suit);
  box-shadow:
    0 4px 12px rgba(0,0,0,0.4),
    0 1px 3px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.8);
  border: 1px solid rgba(0,0,0,0.08);
  position: relative;
  transition: transform 0.5s ease;
}
.fan-1 { transform: rotate(-18deg) translateY(8px) translateX(8px); z-index: 1; }
.fan-2 { transform: rotate(0deg) translateY(-4px); z-index: 3; }
.fan-3 { transform: rotate(18deg) translateY(8px) translateX(-8px); z-index: 1; }
.suit-heart, .suit-diamond { color: var(--red-suit); }
.suit-spade, .suit-club { color: var(--black-suit); }

.game-title {
  font-size: 4rem;
  font-weight: 900;
  background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold) 40%, var(--gold-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 3px 6px rgba(212, 168, 75, 0.3));
  line-height: 1.05;
  letter-spacing: -0.03em;
}
.tagline {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-top: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
}

.landing-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 3rem;
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px 32px;
  border: none;
  border-radius: 14px;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: 0.03em;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  min-height: 52px;
}

.btn-gold {
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 50%, var(--gold-dark) 100%);
  color: #1a1200;
  box-shadow:
    0 4px 0 var(--gold-deep),
    0 6px 20px rgba(212, 168, 75, 0.35),
    inset 0 1px 0 rgba(255,255,255,0.3);
  text-shadow: 0 1px 0 rgba(255,255,255,0.2);
}
.btn-gold:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 0 var(--gold-deep), 0 8px 25px rgba(212, 168, 75, 0.45), inset 0 1px 0 rgba(255,255,255,0.3);
}
.btn-gold:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--gold-deep), 0 3px 10px rgba(212, 168, 75, 0.3), inset 0 1px 0 rgba(255,255,255,0.3);
}

.btn-outline {
  background: rgba(212, 168, 75, 0.08);
  color: var(--gold);
  border: 2px solid var(--gold);
  box-shadow: 0 4px 0 rgba(166, 124, 46, 0.3), inset 0 1px 0 rgba(212, 168, 75, 0.1);
}
.btn-outline:hover { background: rgba(212, 168, 75, 0.15); transform: translateY(-1px); }
.btn-outline:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(166,124,46,0.3); }

.btn-danger {
  background: linear-gradient(180deg, #ef5350, #c62828);
  color: white;
  box-shadow: 0 4px 0 #8b1a1a, 0 6px 15px rgba(220,53,69,0.3);
}
.btn-danger:active { transform: translateY(2px); box-shadow: 0 1px 0 #8b1a1a; }

.btn-sm { padding: 10px 18px; font-size: 0.85rem; border-radius: 10px; min-height: 40px; }

.btn-back {
  background: none;
  border: none;
  color: var(--gold);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.5rem;
  margin-bottom: 1rem;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
}

/* ============ FORMS ============ */
.form-container {
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  z-index: 1;
}
.form-container h2 {
  font-size: 2.2rem;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 2rem;
}
.form-group {
  width: 100%; max-width: 320px;
  margin-bottom: 1.5rem;
}
.form-group label {
  display: block;
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.form-group input {
  width: 100%;
  padding: 16px 18px;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(212, 168, 75, 0.2);
  border-radius: 12px;
  color: var(--cream);
  font-size: 1.1rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.3);
}
.form-group input:focus {
  border-color: var(--gold);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.3), 0 0 12px var(--glow-gold);
}
.room-code-input {
  text-align: center;
  font-size: 2rem !important;
  font-weight: 900;
  letter-spacing: 0.35em;
  font-family: 'Playfair Display', serif !important;
}

/* ============ LOBBY ============ */
#screen-lobby {
  flex-direction: column;
  align-items: center;
  padding: 2rem;
  padding-top: env(safe-area-inset-top, 2rem);
}
.lobby-container {
  width: 100%; max-width: 440px;
  text-align: center;
  position: relative;
  z-index: 1;
}
.lobby-container h2 {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  font-size: 2rem;
  margin-bottom: 1.5rem;
}

.room-code-display {
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid var(--gold);
  border-radius: 18px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 0 30px rgba(212, 168, 75, 0.15), inset 0 1px 0 rgba(212, 168, 75, 0.1);
}
.room-code-display .label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-weight: 700;
}
.room-code-display .code {
  display: block;
  font-family: 'Playfair Display', serif;
  font-size: 3.5rem;
  font-weight: 900;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  letter-spacing: 0.25em;
  filter: drop-shadow(0 2px 4px rgba(212, 168, 75, 0.3));
}

.players-list { text-align: left; margin-bottom: 1.5rem; }
.player-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  margin-bottom: 0.5rem;
  border: 1px solid rgba(255,255,255,0.04);
}
.player-row .player-icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #1a1200;
  display: flex;
  align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  margin-right: 12px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(212, 168, 75, 0.3);
}
.player-row .player-name { flex: 1; font-weight: 600; font-size: 0.95rem; }
.player-row .host-badge {
  font-size: 0.65rem;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #1a1200;
  padding: 3px 10px;
  border-radius: 8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.settings-panel {
  text-align: left;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(212, 168, 75, 0.1);
}
.settings-panel h3 {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  font-size: 1rem;
  margin-bottom: 0.75rem;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.9rem;
  color: var(--text-dim);
}
.setting-control {
  display: flex;
  align-items: center;
  gap: 10px;
}
.setting-control button {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--gold-dark);
  background: rgba(212, 168, 75, 0.1);
  color: var(--gold);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center; justify-content: center;
  transition: all 0.15s;
  box-shadow: 0 2px 0 rgba(0,0,0,0.3);
}
.setting-control button:hover { background: rgba(212, 168, 75, 0.2); }
.setting-control button:active { transform: translateY(1px); box-shadow: none; }
.setting-control span {
  min-width: 55px;
  text-align: center;
  font-weight: 700;
  color: var(--cream);
  font-size: 0.95rem;
}

.waiting-text { color: var(--text-muted); font-style: italic; font-size: 0.9rem; }

/* ============ GAME TABLE ============ */
#screen-game {
  flex-direction: column;
  background: var(--bg-dark);
}

/* Table surface with 3D rail edge */
.table-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 8px 12px;
  min-height: 0;
  /* 3D felt surface */
  background:
    radial-gradient(ellipse 130% 90% at 50% 45%, var(--felt-highlight) 0%, var(--felt-mid) 20%, var(--felt) 45%, var(--felt-dark) 75%, var(--rail) 92%, var(--rail-edge) 100%);
  border-top: 3px solid var(--rail-light);
  box-shadow:
    inset 0 3px 12px rgba(0,0,0,0.4),
    inset 0 -2px 8px rgba(0,0,0,0.3);
}
/* Felt texture noise overlay */
.table-area::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  background-size: 256px;
  pointer-events: none;
  z-index: 0;
}
/* Spotlight on center of table */
.table-area::after {
  content: '';
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  height: 50%;
  background: radial-gradient(ellipse, rgba(255,255,240,0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.game-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  padding-top: max(8px, env(safe-area-inset-top, 8px));
  background: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.4) 100%);
  backdrop-filter: blur(12px);
  z-index: 10;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(212, 168, 75, 0.1);
}
.room-badge {
  font-family: 'Playfair Display', serif;
  font-size: 0.9rem;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 0.12em;
  background: rgba(0, 0, 0, 0.4);
  padding: 5px 14px;
  border-radius: 8px;
  border: 1px solid rgba(212, 168, 75, 0.25);
}
.round-indicator {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
  flex: 1;
  padding: 0 8px;
  font-weight: 500;
}
.btn-menu {
  background: none;
  border: none;
  color: var(--gold);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 6px 8px;
  transition: opacity 0.2s;
}
.btn-menu:hover { opacity: 0.7; }

/* Side Menu */
.game-menu {
  position: fixed;
  top: 0; right: 0;
  width: 300px; max-width: 85vw;
  height: 100%;
  background: var(--bg-panel);
  backdrop-filter: blur(24px);
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  border-left: 1px solid rgba(212, 168, 75, 0.1);
  box-shadow: -8px 0 30px rgba(0,0,0,0.5);
}
.game-menu.hidden { transform: translateX(100%); box-shadow: none; }
.menu-content { padding: 1.5rem; }
.menu-content h3 {
  color: var(--gold); margin-bottom: 1rem;
}
.menu-content h4 {
  color: var(--text-dim); font-size: 0.8rem;
  margin: 1.25rem 0 0.5rem;
  text-transform: uppercase; letter-spacing: 0.12em;
}
.addon-control {
  display: flex; gap: 8px;
  align-items: center; margin-bottom: 0.75rem;
}
.addon-control select, .addon-control input {
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(212, 168, 75, 0.2);
  border-radius: 8px;
  color: var(--cream);
  font-size: 0.85rem;
}
.addon-control select { flex: 1; }
.addon-control input { width: 70px; }

.event-log {
  max-height: 300px;
  overflow-y: auto;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.7;
}
.event-log .log-entry {
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

/* ============ POT DISPLAY ============ */
.pot-display {
  text-align: center;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}
.pot-label {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-weight: 700;
}
.pot-amount {
  font-family: 'Playfair Display', serif;
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold) 50%, var(--gold-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 8px rgba(212, 168, 75, 0.5));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  line-height: 1.1;
}
.pot-amount.pulse {
  animation: potPulse 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes potPulse {
  0% { transform: scale(1); filter: drop-shadow(0 2px 8px rgba(212,168,75,0.5)); }
  40% { transform: scale(1.2); filter: drop-shadow(0 4px 20px rgba(212,168,75,0.8)); }
  100% { transform: scale(1); filter: drop-shadow(0 2px 8px rgba(212,168,75,0.5)); }
}
/* Chip stack icon under pot */
.pot-chips {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-top: 2px;
}
.chip {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  margin: 0 -3px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
.chip-gold { background: linear-gradient(135deg, var(--gold-light), var(--gold-dark)); }
.chip-red { background: linear-gradient(135deg, #e74c3c, #8b1a1a); border-color: #e74c3c; }
.chip-blue { background: linear-gradient(135deg, #3498db, #1a5276); border-color: #3498db; }

/* ============ PLAYER SEATS ============ */
.seats-ring {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
  max-width: 100%;
  position: relative;
  z-index: 1;
}
.seat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 10px 6px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255,255,255,0.06);
  min-width: 68px;
  transition: all 0.4s ease;
  backdrop-filter: blur(4px);
}
.seat.active-turn {
  border-color: var(--gold);
  box-shadow: 0 0 20px var(--glow-gold), 0 0 40px rgba(212, 168, 75, 0.15);
  background: rgba(212, 168, 75, 0.08);
}
.seat.active-turn .seat-icon {
  animation: activePulse 2s ease-in-out infinite;
}
@keyframes activePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212, 168, 75, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(212, 168, 75, 0); }
}
.seat.eliminated {
  opacity: 0.25;
  filter: grayscale(0.8);
}
.seat.disconnected .seat-icon {
  border-color: var(--danger) !important;
  box-shadow: 0 0 8px rgba(220, 53, 69, 0.4);
}

.seat-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--felt-light), var(--felt-dark));
  border: 2.5px solid var(--text-dim);
  display: flex;
  align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--cream);
  margin-bottom: 4px;
  position: relative;
  box-shadow: 0 3px 8px rgba(0,0,0,0.4);
  transition: all 0.3s ease;
}
.seat.is-dealer .seat-icon {
  border-color: var(--gold);
  box-shadow: 0 3px 8px rgba(0,0,0,0.4), 0 0 12px rgba(212, 168, 75, 0.3);
}
.dealer-chip {
  position: absolute;
  top: -5px; right: -5px;
  width: 18px; height: 18px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
  color: #1a1200;
  border-radius: 50%;
  font-size: 0.55rem;
  font-weight: 900;
  display: flex;
  align-items: center; justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
  border: 1.5px solid var(--gold-bright);
}
.seat-name {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--cream);
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seat-stack {
  font-size: 0.7rem;
  color: var(--gold);
  font-weight: 800;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* ============ CARD AREA ============ */
.card-area {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
  margin-bottom: 8px;
  width: 100%;
  position: relative;
  z-index: 1;
}
.hand-section {
  flex: 1;
  text-align: center;
  max-width: 45%;
}
.hand-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 6px;
  font-weight: 700;
}
.hand-cards {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  min-height: 90px;
}
.hand-total {
  display: inline-block;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--cream);
  margin-top: 6px;
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  min-width: 40px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.hand-total.total-flash {
  animation: totalFlash 0.4s ease;
}
@keyframes totalFlash {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(212,168,75,0); }
  50% { transform: scale(1.15); box-shadow: 0 0 12px rgba(212,168,75,0.5); border-color: var(--gold); }
  100% { transform: scale(1); box-shadow: 0 0 0 rgba(212,168,75,0); }
}

.vs-badge {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 900;
  background: linear-gradient(180deg, var(--gold-light), var(--gold-dark));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  opacity: 0.6;
  align-self: center;
  margin-top: 24px;
  flex-shrink: 0;
}

/* ============ PLAYING CARDS (Premium) ============ */
.card {
  width: 62px;
  height: 90px;
  border-radius: 8px;
  position: relative;
  margin: 0 -5px;
  flex-shrink: 0;
  perspective: 800px;
  animation: dealIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
}
@keyframes dealIn {
  0% { opacity: 0; transform: translateY(-60px) rotate(-8deg) scale(0.7); }
  60% { opacity: 1; transform: translateY(4px) rotate(1deg) scale(1.02); }
  100% { opacity: 1; transform: translateY(0) rotate(0) scale(1); }
}
/* Newly dealt card highlight */
.card.card-new {
  animation: cardNew 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}
@keyframes cardNew {
  0% { opacity: 0; transform: translateY(-80px) rotate(-12deg) scale(0.5); filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5)) brightness(1.5); }
  50% { opacity: 1; transform: translateY(6px) rotate(2deg) scale(1.08); filter: drop-shadow(0 8px 16px rgba(212,168,75,0.4)) brightness(1.2); }
  100% { opacity: 1; transform: translateY(0) rotate(0) scale(1); filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5)) brightness(1); }
}

.card-inner {
  width: 100%; height: 100%;
  border-radius: 8px;
  position: relative;
}
.card-face {
  width: 100%; height: 100%;
  border-radius: 8px;
  background: linear-gradient(160deg, #ffffff 0%, var(--card-white) 40%, #f5f0e0 100%);
  box-shadow:
    0 1px 2px rgba(0,0,0,0.2),
    inset 0 0 0 1px rgba(0,0,0,0.06),
    inset 0 1px 0 rgba(255,255,255,0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
/* Inner card border */
.card-face::before {
  content: '';
  position: absolute;
  inset: 3px;
  border: 0.5px solid rgba(0,0,0,0.06);
  border-radius: 5px;
  pointer-events: none;
}
/* Subtle sheen */
.card-face::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    225deg,
    transparent 45%,
    rgba(255,255,255,0.08) 50%,
    transparent 55%
  );
  pointer-events: none;
}

.card-face.face-down {
  background: linear-gradient(145deg, #1e4570, #122c4a, #0d1f35);
  border: 2px solid var(--gold-dark);
  box-shadow:
    0 1px 2px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.08);
}
.card-face.face-down::before {
  inset: 5px;
  border: 1.5px solid rgba(212, 168, 75, 0.25);
  border-radius: 4px;
}
.card-face.face-down::after {
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 3px,
    rgba(212, 168, 75, 0.06) 3px,
    rgba(212, 168, 75, 0.06) 6px
  );
}
/* Center diamond on card back */
.card-face.face-down .card-back-deco {
  position: absolute;
  width: 20px; height: 20px;
  border: 1.5px solid rgba(212, 168, 75, 0.3);
  transform: rotate(45deg);
  z-index: 1;
}

.card-rank-top {
  position: absolute;
  top: 4px; left: 6px;
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  font-weight: 900;
  line-height: 1;
}
.card-suit-top {
  position: absolute;
  top: 20px; left: 6px;
  font-size: 0.70rem;
  line-height: 1;
}
.card-center-suit {
  font-size: 1.8rem;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.1));
}
.card-rank-bottom {
  position: absolute;
  bottom: 4px; right: 6px;
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  font-weight: 900;
  transform: rotate(180deg);
  line-height: 1;
}
.card-suit-bottom {
  position: absolute;
  bottom: 20px; right: 6px;
  font-size: 0.70rem;
  transform: rotate(180deg);
  line-height: 1;
}

.card.red .card-rank-top, .card.red .card-suit-top,
.card.red .card-center-suit, .card.red .card-rank-bottom,
.card.red .card-suit-bottom { color: var(--red-suit); }

.card.black .card-rank-top, .card.black .card-suit-top,
.card.black .card-center-suit, .card.black .card-rank-bottom,
.card.black .card-suit-bottom { color: var(--black-suit); }

/* ============ PEEKED CARD ============ */
.card-face.face-down.peeked {
  border-color: var(--gold);
  box-shadow:
    0 1px 2px rgba(0,0,0,0.3),
    0 0 12px rgba(212, 168, 75, 0.25),
    inset 0 1px 0 rgba(255,255,255,0.08);
}
.peek-corner {
  position: absolute;
  top: -1px; left: -1px;
  width: 24px; height: 30px;
  background: linear-gradient(145deg, #fffef8, #f5f0e0);
  border-bottom-right-radius: 6px;
  border-top-left-radius: 7px;
  box-shadow: 3px 3px 6px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 3;
  gap: 0;
  padding: 2px 0;
}
.peek-rank {
  font-family: 'Playfair Display', serif;
  font-size: 0.65rem;
  font-weight: 900;
  line-height: 1;
}
.peek-suit {
  font-size: 0.55rem;
  line-height: 1;
}
.peek-corner.red .peek-rank, .peek-corner.red .peek-suit { color: var(--red-suit); }
.peek-corner.black .peek-rank, .peek-corner.black .peek-suit { color: var(--black-suit); }

/* ============ ACTION PANEL ============ */
.action-panel {
  padding: 14px 16px;
  padding-bottom: max(14px, env(safe-area-inset-bottom, 14px));
  background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.85) 100%);
  backdrop-filter: blur(16px);
  flex-shrink: 0;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(212, 168, 75, 0.08);
}
.action-panel .btn {
  padding: 14px 28px;
  font-size: 1rem;
  min-height: 52px;
  min-width: 100px;
}
.action-panel .waiting-msg {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.9rem;
  text-align: center;
}

.btn-hit {
  background: linear-gradient(180deg, #2ecc71, #1a9c52, #157a3f);
  color: white;
  box-shadow: 0 4px 0 #0d5c28, 0 6px 15px rgba(46,204,113,0.3);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.btn-hit:active { transform: translateY(2px); box-shadow: 0 1px 0 #0d5c28; }

.btn-stand {
  background: linear-gradient(180deg, #f39c12, #e67e22, #c0600e);
  color: white;
  box-shadow: 0 4px 0 #8a4a08, 0 6px 15px rgba(230,126,34,0.3);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.btn-stand:active { transform: translateY(2px); box-shadow: 0 1px 0 #8a4a08; }

.btn-fold {
  background: rgba(255,255,255,0.06);
  color: var(--text-dim);
  border: 2px solid rgba(255,255,255,0.1);
  box-shadow: 0 4px 0 rgba(0,0,0,0.3);
}
.btn-fold:active { transform: translateY(2px); box-shadow: none; }

/* ============ MODALS ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  animation: modalBgIn 0.3s ease;
}
@keyframes modalBgIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal.hidden { display: none; }
.modal-content {
  background: linear-gradient(180deg, rgba(22, 40, 28, 0.97), rgba(10, 20, 14, 0.98));
  border: 1px solid rgba(212, 168, 75, 0.25);
  border-radius: 20px;
  padding: 2rem;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 40px rgba(212, 168, 75, 0.1);
  animation: modalContentIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modalContentIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-content h3 {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 0.75rem;
  font-size: 1.3rem;
}
.modal-content p {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

.bet-display {
  font-family: 'Playfair Display', serif;
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 1rem;
  filter: drop-shadow(0 2px 4px rgba(212, 168, 75, 0.3));
}
.bet-controls { justify-content: center; margin-bottom: 1.5rem; }
.bet-actions { display: flex; flex-direction: column; gap: 0.75rem; }

/* ============ HAND RESULT BANNER ============ */
.hand-result-banner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 60;
  background: linear-gradient(180deg, rgba(6, 18, 10, 0.95), rgba(0, 0, 0, 0.95));
  border: 2px solid var(--gold);
  border-radius: 20px;
  padding: 24px 40px;
  text-align: center;
  max-width: 90vw;
  pointer-events: none;
  animation: bannerIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow:
    0 0 60px rgba(212, 168, 75, 0.25),
    0 20px 50px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(212, 168, 75, 0.2);
}
.hand-result-banner.fade-out {
  animation: bannerOut 0.6s ease forwards;
}
.hand-result-text {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 900;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  line-height: 1.3;
  filter: drop-shadow(0 2px 4px rgba(212, 168, 75, 0.4));
}
@keyframes bannerIn {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes bannerOut {
  from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  to { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
}

/* ============ DEAL HAND LOG ============ */
.deal-hand-log {
  position: fixed;
  top: 60px;
  bottom: auto;
  right: 10px;
  width: 220px;
  max-height: 240px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(212, 168, 75, 0.15);
  border-radius: 12px;
  padding: 8px 12px;
  z-index: 15;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  transition: max-height 0.3s ease, background 0.3s ease;
}
.deal-hand-log.collapsed {
  max-height: 54px;
  overflow: hidden;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.85);
}
.deal-log-toggle {
  font-size: 0.6rem;
  color: var(--gold);
  text-align: center;
  cursor: pointer;
  padding-bottom: 4px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(212, 168, 75, 0.15);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.deal-hand-log.collapsed .deal-log-toggle {
  border: none;
  padding-bottom: 0;
  margin-bottom: 2px;
}
.deal-hand-log.collapsed .deal-hand-log-title {
  display: none;
}
.deal-hand-log.collapsed .deal-hand-log-entry:not(:last-child) {
  display: none;
}
.deal-hand-log.collapsed .deal-hand-log-entry:last-child {
  border: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0;
}
.deal-hand-log-title {
  font-size: 0.6rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 800;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(212, 168, 75, 0.15);
}
.deal-hand-log-entry {
  font-size: 0.7rem;
  color: var(--text-dim);
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  line-height: 1.3;
}
.deal-hand-log-entry:last-child { border-bottom: none; }
.deal-hand-log:empty, .deal-hand-log.empty { display: none; }

/* ============ GAME OVER ============ */
#screen-gameover {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.gameover-container {
  max-width: 460px;
  width: 100%;
  text-align: center;
  position: relative;
  z-index: 1;
}
.gameover-title {
  font-size: 3rem;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold), var(--gold-dark));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 3px 6px rgba(212, 168, 75, 0.3));
}
.winner-announce {
  font-size: 1.2rem;
  color: var(--cream);
  margin-bottom: 2rem;
  font-weight: 500;
}
.ledger-table { width: 100%; margin-bottom: 2rem; }
.ledger-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.ledger-table th {
  color: var(--gold);
  font-weight: 700;
  padding: 10px 8px;
  border-bottom: 2px solid rgba(212, 168, 75, 0.3);
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.ledger-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.ledger-table .positive { color: var(--success); font-weight: 700; }
.ledger-table .negative { color: var(--danger); font-weight: 700; }

/* ============ TOAST ============ */
#toast-container {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: rgba(6, 18, 10, 0.95);
  border: 1px solid rgba(212, 168, 75, 0.3);
  border-radius: 12px;
  padding: 12px 22px;
  color: var(--cream);
  font-size: 0.85rem;
  font-weight: 600;
  backdrop-filter: blur(16px);
  animation: toastIn 0.3s ease, toastOut 0.4s ease 2.6s;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.toast.error {
  border-color: var(--danger);
  color: #ff8a8a;
  box-shadow: 0 4px 20px rgba(220, 53, 69, 0.2);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-8px); }
}

/* ============ WIN PARTICLES ============ */
.particles-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 55;
  overflow: hidden;
}
.particle {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  animation: particleFly 1.5s ease-out forwards;
}
@keyframes particleFly {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--px), var(--py)) scale(0); }
}

/* ============ SOLO SETUP / CPU ============ */
#screen-solo-setup {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 120% 80% at 50% 35%, var(--felt-highlight) 0%, var(--felt) 35%, var(--felt-dark) 70%, var(--bg-dark) 100%);
}

.difficulty-selector {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.diff-btn {
  flex: 1;
  padding: 10px 0;
  border: 2px solid var(--glass-border);
  border-radius: 10px;
  background: var(--glass);
  color: var(--text-dim);
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
}
.diff-btn.active {
  border-color: var(--gold);
  background: rgba(212, 168, 75, 0.15);
  color: var(--gold);
}
.diff-btn:hover:not(.active) {
  border-color: rgba(212, 168, 75, 0.4);
  color: var(--text-primary);
}

.cpu-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: var(--gold-dark);
  color: #1a1200;
  font-size: 0.45rem;
  font-weight: 800;
  padding: 1px 3px;
  border-radius: 3px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#solo-cpu-slider {
  width: 100%;
  accent-color: var(--gold);
  margin-top: 0.5rem;
  cursor: pointer;
}

.player-row .btn-danger {
  margin-left: auto;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 420px) {
  .game-title { font-size: 3.2rem; }
  .pot-amount { font-size: 2.4rem; }
  .card { width: 52px; height: 76px; }
  .card-rank-top, .card-rank-bottom { font-size: 0.85rem; }
  .card-suit-top, .card-suit-bottom { font-size: 0.65rem; }
  .card-center-suit { font-size: 1.4rem; }
  .card-suit-top { top: 18px; }
  .card-suit-bottom { bottom: 18px; }
  .seat { padding: 6px 8px; min-width: 58px; }
  .seat-icon { width: 34px; height: 34px; font-size: 0.8rem; }
  .seat-name { font-size: 0.65rem; max-width: 60px; }
  .seat-stack { font-size: 0.65rem; }
  .vs-badge { font-size: 0.9rem; }
  .action-panel .btn { padding: 12px 22px; font-size: 0.95rem; }
  .deal-hand-log { width: 180px; top: 55px; bottom: auto; right: 6px; }
  .deal-hand-log-entry { font-size: 0.65rem; }
  .hand-result-text { font-size: 1.15rem; }
  .hand-result-banner { padding: 18px 24px; }
  .peek-corner { width: 20px; height: 26px; }
  .peek-rank { font-size: 0.55rem; }
  .peek-suit { font-size: 0.5rem; }
  .modal-content { padding: 1.5rem; }
}

@media (min-width: 768px) {
  .card { width: 72px; height: 104px; }
  .card-rank-top, .card-rank-bottom { font-size: 1rem; }
  .card-suit-top { top: 18px; font-size: 0.75rem; }
  .card-suit-bottom { bottom: 18px; font-size: 0.75rem; }
  .card-center-suit { font-size: 2.2rem; }
  .pot-amount { font-size: 3.5rem; }
  .hand-result-text { font-size: 1.6rem; }
  .action-panel .btn { padding: 16px 36px; font-size: 1.1rem; }
  .seat { min-width: 80px; padding: 10px 14px; }
  .seat-icon { width: 48px; height: 48px; font-size: 1rem; }
  .peek-corner { width: 28px; height: 34px; }
  .peek-rank { font-size: 0.7rem; }
  .peek-suit { font-size: 0.65rem; }
}
