:root {
  /* Colors */
  --bg-color: #0a0e1a;
  --accent-gold: #d4a843;
  --win-emerald: #1db954;
  --loss-crimson: #e74c3c;
  --text-primary: #f0f0f0;
  --text-secondary: rgba(255, 255, 255, 0.6);
  --panel-bg: rgba(255, 255, 255, 0.05);
  --panel-border: rgba(255, 255, 255, 0.08);
  --header-bg: rgba(10, 14, 26, 0.95);
  
  /* Typography */
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-color);
  background-image: radial-gradient(circle at center, rgba(30, 80, 70, 0.15) 0%, var(--bg-color) 70%);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: var(--panel-border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Typography Utilities */
h1, h2, h3, .title-suit, #game-message {
  font-family: var(--font-heading);
}

/* ==================== TOP BAR ==================== */
#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 60px;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(212, 168, 67, 0.2);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
}

#top-bar-left, #top-bar-center, #top-bar-right {
  display: flex;
  align-items: center;
}

#top-bar-left {
  flex: 1;
}

#top-bar-center {
  flex: 1;
  justify-content: center;
}

#top-bar-right {
  flex: 1;
  justify-content: flex-end;
  gap: 10px;
}

#game-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-primary);
}

.title-suit {
  color: var(--accent-gold);
}

#bankroll-display {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

#bankroll-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  letter-spacing: 1px;
}

#bankroll-amount {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  text-shadow: 0 0 10px rgba(212, 168, 67, 0.3);
  font-family: var(--font-heading);
}

.header-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 6px 14px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.header-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.header-btn.active {
  background: rgba(212, 168, 67, 0.15);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

/* ==================== MAIN LAYOUT ==================== */
#main-layout {
  display: flex;
  flex: 1;
  margin-top: 60px; /* Header clearance */
  height: calc(100vh - 60px);
  position: relative;
}

/* ==================== GAME TABLE ==================== */
#game-table {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

#shoe-indicator {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 20px;
}

#shoe-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

#shoe-progress {
  height: 100%;
  width: 100%; /* controlled by JS */
  background: var(--win-emerald);
  box-shadow: 0 0 8px var(--win-emerald);
  transition: width 0.3s ease;
}

#shoe-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.area-label {
  font-size: 0.85rem;
  letter-spacing: 4px;
  color: rgba(255, 255, 255, 0.3);
  font-weight: 600;
  margin-bottom: 15px;
}

#dealer-area, #player-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 180px;
  position: relative;
  width: 100%;
}

#dealer-cards, .player-cards {
  display: flex;
  justify-content: center;
  min-height: 130px;
}

#player-hands-container {
  display: flex;
  gap: 40px;
  justify-content: center;
}

.hand-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  transition: opacity 0.3s ease;
}

.hand-container:not(.active) {
  opacity: 0.5;
}

/* ==================== PLAYING CARDS ==================== */
.card {
  width: 90px;
  height: 130px;
  perspective: 1000px;
  margin-left: -30px;
  position: relative;
  z-index: 1;
  transition: transform 0.3s ease;
}

.card:first-child {
  margin-left: 0;
}

.card:hover {
  transform: translateY(-10px);
  z-index: 10;
}

.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 2px 4px 12px rgba(0, 0, 0, 0.4);
  border-radius: 8px;
}

.card.face-down .card-inner {
  transform: rotateY(180deg);
}

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

.card-front {
  background: #f8f9fa;
  border: 1px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-back {
  background: #1a1a2e;
  border: 4px solid #fff;
  transform: rotateY(180deg);
  background-image: repeating-linear-gradient(45deg, var(--accent-gold) 0, var(--accent-gold) 2px, transparent 2px, transparent 8px),
                    repeating-linear-gradient(-45deg, var(--accent-gold) 0, var(--accent-gold) 2px, transparent 2px, transparent 8px);
  background-size: 20px 20px;
}

.card[data-suit="hearts"], .card[data-suit="diamonds"] {
  color: var(--loss-crimson);
}

.card[data-suit="clubs"], .card[data-suit="spades"] {
  color: #1a1a2e;
}

.card-corner {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.top-left {
  top: 6px;
  left: 6px;
}

.bottom-right {
  bottom: 6px;
  right: 6px;
  transform: rotate(180deg);
}

.card-rank {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-heading);
}

.card-suit-symbol {
  font-size: 1rem;
}

.card-center-pip {
  font-size: 3rem;
}

.card.dealing {
  animation: dealCard 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* ==================== SCORE BADGES ==================== */
.score-badge {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  margin-top: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.hand-container.active .score-badge {
  border-color: var(--accent-gold);
  box-shadow: 0 0 10px rgba(212, 168, 67, 0.3);
}

/* ==================== GAME MESSAGE ==================== */
#game-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  z-index: 50;
  text-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  animation: fadeIn 0.3s ease-out;
}

#game-message.win { color: var(--accent-gold); }
#game-message.loss { color: var(--loss-crimson); }
#game-message.push { color: var(--text-primary); }
#game-message.blackjack { 
  color: var(--accent-gold);
  animation: fadeIn 0.3s ease-out, pulseGlow 2s infinite;
}

/* ==================== BETTING & CHIPS ==================== */
#betting-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-top: 20px;
  width: 100%;
}

#bet-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 80px;
}

#bet-chips-visual {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  position: relative;
  height: 40px;
}

.bet-chip-visual {
  position: absolute;
  /* Visual stacked chips style applied via JS */
}

#bet-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 10px;
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 16px;
  border-radius: 20px;
  border: 1px solid var(--accent-gold);
}

#bet-label { font-size: 0.75rem; color: var(--text-secondary); }
#bet-amount { font-size: 1.2rem; font-weight: 700; color: var(--accent-gold); }

#chip-tray {
  display: flex;
  gap: 12px;
  justify-content: center;
  padding: 15px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 40px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.chip {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5), inset 0 2px 4px rgba(255,255,255,0.3);
}

.chip-inner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px dashed rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chip-value {
  font-weight: 800;
  font-size: 1.1rem;
}

.chip-1 { background: #e8e8e8; color: #1a1a2e; }
.chip-5 { background: #c0392b; color: white; }
.chip-25 { background: #27ae60; color: white; }
.chip-100 { background: #1a1a2e; color: var(--accent-gold); border: 2px solid var(--accent-gold); }
.chip-500 { background: #8e44ad; color: white; }

.chip:hover { transform: scale(1.1); }
.chip:active { transform: scale(0.95); }

.chip-1:hover { box-shadow: 0 0 15px rgba(232, 232, 232, 0.6); }
.chip-5:hover { box-shadow: 0 0 15px rgba(192, 57, 43, 0.6); }
.chip-25:hover { box-shadow: 0 0 15px rgba(39, 174, 96, 0.6); }
.chip-100:hover { box-shadow: 0 0 15px rgba(212, 168, 67, 0.6); }
.chip-500:hover { box-shadow: 0 0 15px rgba(142, 68, 173, 0.6); }

#bet-actions {
  display: flex;
  gap: 10px;
}

.bet-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 8px 20px;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bet-btn:hover { background: rgba(255, 255, 255, 0.2); }

.bet-btn.primary {
  background: var(--accent-gold);
  color: #1a1a2e;
  border-color: var(--accent-gold);
  font-size: 1.1rem;
  padding: 8px 30px;
  box-shadow: 0 0 15px rgba(212, 168, 67, 0.4);
}

.bet-btn.primary:hover {
  background: #f1c40f;
  box-shadow: 0 0 25px rgba(212, 168, 67, 0.6);
}

.bet-btn:disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* ==================== ACTION BUTTONS ==================== */
#action-buttons {
  display: flex;
  gap: 15px;
  margin-top: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.action-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1rem;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.action-btn.hit { background: linear-gradient(135deg, #2ecc71, #27ae60); }
.action-btn.stand { background: linear-gradient(135deg, #3498db, #2980b9); }
.action-btn.double { background: linear-gradient(135deg, #f1c40f, #f39c12); color: #1a1a2e; }
.action-btn.split { background: linear-gradient(135deg, #9b59b6, #8e44ad); }
.action-btn.insurance { background: linear-gradient(135deg, #1abc9c, #16a085); }

.action-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

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

.action-btn:disabled {
  opacity: 0.3;
  pointer-events: none;
  filter: grayscale(100%);
}

/* ==================== STRATEGY ADVISOR ==================== */
#strategy-advisor {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 24px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  margin-top: 8px;
  margin-bottom: 4px;
  animation: fadeIn 0.3s ease;
  min-width: 180px;
}

#strategy-advisor-label {
  font-size: 0.65rem;
  letter-spacing: 2px;
  color: var(--text-secondary);
  font-weight: 600;
}

#strategy-advisor-action {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

#strategy-advisor-detail {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-align: center;
  max-width: 200px;
  line-height: 1.3;
}

#strategy-advisor.recommend-hit #strategy-advisor-action { color: #2ecc71; }
#strategy-advisor.recommend-stand #strategy-advisor-action { color: #3498db; }
#strategy-advisor.recommend-double #strategy-advisor-action { color: #f1c40f; }
#strategy-advisor.recommend-split #strategy-advisor-action { color: #9b59b6; }
#strategy-advisor.recommend-insurance #strategy-advisor-action { color: #1abc9c; }

/* ==================== COUNTING PANEL ==================== */
#counting-panel {
  width: 280px;
  min-width: 280px;
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  border-left: 1px solid var(--panel-border);
  height: 100%;
  transition: transform 0.3s ease, opacity 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -5px 0 25px rgba(0, 0, 0, 0.3);
  z-index: 90;
  overflow-y: auto;
}

.panel-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.system-badge {
  background: rgba(29, 185, 84, 0.2);
  color: var(--win-emerald);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  border: 1px solid rgba(29, 185, 84, 0.5);
}

.panel-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.count-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.count-stat {
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.2);
  padding: 10px;
  border-radius: 8px;
  flex: 1;
  text-align: center;
}

.count-stat.primary {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  font-family: var(--font-heading);
}

.primary .stat-value {
  font-size: 2rem;
  color: var(--text-primary);
}

.suggested .stat-value {
  color: var(--accent-gold);
  font-size: 1.5rem;
}

/* Card Distribution */
#card-distribution h3 {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

#card-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.card-count-cell {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  padding: 5px;
  text-align: center;
  display: flex;
  flex-direction: column;
}

.card-count-cell[data-hi-lo="plus"] { background: rgba(29, 185, 84, 0.15); border: 1px solid rgba(29, 185, 84, 0.3); }
.card-count-cell[data-hi-lo="minus"] { background: rgba(231, 76, 60, 0.15); border: 1px solid rgba(231, 76, 60, 0.3); }
.card-count-cell[data-hi-lo="zero"] { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); }

.cell-rank { font-weight: 700; font-size: 0.9rem; }
.cell-count { font-size: 0.65rem; color: var(--text-secondary); }

#count-legend {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-top: -10px;
}

.legend-item { padding: 4px 8px; border-radius: 4px; }
.legend-plus { color: var(--win-emerald); background: rgba(29, 185, 84, 0.1); }
.legend-zero { color: var(--text-secondary); background: rgba(255, 255, 255, 0.05); }
.legend-minus { color: var(--loss-crimson); background: rgba(231, 76, 60, 0.1); }


/* ==================== ANALYTICS PANEL ==================== */
#analytics-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--header-bg);
  backdrop-filter: blur(15px);
  border-top: 1px solid var(--panel-border);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), height 0.4s;
  z-index: 110;
  max-height: 400px;
}

#analytics-panel.hidden {
  transform: translateY(100%);
}

#analytics-panel .panel-body {
  display: flex;
  flex-direction: row;
  gap: 30px;
  padding: 20px 30px;
}

#stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  flex: 1;
}

.stat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.stat-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-heading);
  margin-bottom: 5px;
}

.stat-card-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-card.win .stat-card-value { color: var(--win-emerald); }
.stat-card.loss .stat-card-value { color: var(--loss-crimson); }
.stat-card.special .stat-card-value { color: var(--accent-gold); }

#chart-container {
  flex: 1;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 15px;
  display: flex;
  flex-direction: column;
}

#chart-container h3 {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

/* ==================== ANIMATIONS ==================== */
@keyframes dealCard {
  0% { transform: translateY(-100px) rotate(-15deg); opacity: 0; }
  100% { transform: translateY(0) rotate(0deg); opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulseGlow {
  0% { text-shadow: 0 0 10px rgba(212, 168, 67, 0.5); }
  50% { text-shadow: 0 0 25px rgba(212, 168, 67, 0.9), 0 0 10px rgba(212, 168, 67, 0.5); }
  100% { text-shadow: 0 0 10px rgba(212, 168, 67, 0.5); }
}

/* UTILITY CLASSES */
.hidden {
  display: none !important;
}

/* Panels use transform-based hiding instead of display:none so animations work */
#counting-panel.hidden {
  display: flex !important;
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
}

#analytics-panel.hidden {
  display: block !important;
  transform: translateY(100%);
  pointer-events: none;
}

/* Score badge positive/negative colors */
.stat-value.positive { color: var(--win-emerald); }
.stat-value.negative { color: var(--loss-crimson); }

/* Game message type variants via app.js */
#game-message.message-win { color: var(--accent-gold); }
#game-message.message-loss { color: var(--loss-crimson); }
#game-message.message-push { color: var(--text-primary); }
#game-message.message-info { color: var(--text-secondary); }
#game-message.message-blackjack {
  color: var(--accent-gold);
  animation: fadeIn 0.3s ease-out, pulseGlow 2s infinite;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 900px) {
  #counting-panel {
    position: absolute;
    right: 0;
    top: 0;
  }
  
  #analytics-panel .panel-body {
    flex-direction: column;
  }
  
  #stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 600px) {
  #top-bar {
    padding: 0 8px;
    height: 50px;
  }
  
  #main-layout {
    margin-top: 50px;
    height: calc(100vh - 50px);
  }
  
  #game-title {
    font-size: 0.95rem;
    letter-spacing: 1px;
  }
  
  #bankroll-amount {
    font-size: 1.1rem;
  }
  
  .btn-text { display: none; }
  
  .header-btn {
    padding: 5px 8px;
    font-size: 0.8rem;
  }
  
  #chip-tray {
    flex-wrap: wrap;
    max-width: 300px;
    padding: 10px;
    gap: 8px;
  }
  
  .chip {
    width: 48px;
    height: 48px;
  }
  
  .chip-value { font-size: 0.9rem; }
  
  #stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .card {
    width: 65px;
    height: 95px;
    margin-left: -22px;
  }
  
  .card-rank { font-size: 0.85rem; }
  .card-suit-symbol { font-size: 0.75rem; }
  .card-center-pip { font-size: 1.8rem; }
  
  .action-btn {
    padding: 10px 16px;
    font-size: 0.85rem;
  }
  
  #action-buttons { gap: 8px; }
  
  #game-message { font-size: 1.8rem; }
  
  #strategy-advisor { padding: 8px 16px; }
  #strategy-advisor-action { font-size: 1.3rem; }
  
  .area-label {
    font-size: 0.7rem;
    letter-spacing: 3px;
    margin-bottom: 8px;
  }
  
  #dealer-area, #player-area { min-height: 140px; }
}

/* ==================== SETTINGS MODAL ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.2s ease;
  padding: 20px;
}

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

.modal {
  background: linear-gradient(145deg, rgba(20, 25, 40, 0.98), rgba(10, 14, 26, 0.98));
  border: 1px solid rgba(212, 168, 67, 0.2);
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(212, 168, 67, 0.1);
  animation: modalSlideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--panel-border);
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.6rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s;
}

.modal-close:hover { color: var(--text-primary); }

.modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 60vh;
  overflow-y: auto;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-group > label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.setting-input-row {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0 12px;
  transition: border-color 0.2s;
}

.setting-input-row:focus-within {
  border-color: var(--accent-gold);
  box-shadow: 0 0 8px rgba(212, 168, 67, 0.2);
}

.input-prefix {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 1rem;
  margin-right: 4px;
}

.setting-input-row input {
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  padding: 10px 4px;
  width: 100%;
  outline: none;
  -moz-appearance: textfield;
}

.setting-input-row input::-webkit-outer-spin-button,
.setting-input-row input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.setting-hint {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

.setting-divider {
  height: 1px;
  background: var(--panel-border);
  margin: 4px 0;
}

#bet-spread-preview {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spread-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.85rem;
}

.spread-row:nth-child(odd) {
  background: rgba(255, 255, 255, 0.03);
}

.spread-tc {
  color: var(--text-secondary);
  font-weight: 500;
  width: 60px;
}

.spread-bet {
  color: var(--accent-gold);
  font-weight: 700;
  font-family: var(--font-heading);
  font-size: 1rem;
}

.spread-units {
  color: var(--text-secondary);
  font-size: 0.75rem;
  width: 60px;
  text-align: right;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--panel-border);
  display: flex;
  justify-content: flex-end;
}
