.mode-btn {
  background: #3b82f6;
  color: white;
  transition: background 0.2s;
}
.mode-btn.active, .mode-btn:focus {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
  color: #fff !important;
  box-shadow: 0 0 0 2px #bbf7d0;
  outline: none;
}

/* Center add/remove player/bot buttons in local setup */
.player-bot-btns {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
/* Ultra rare percent box (diamond) */
.chance-rarity.rarity-diamond {
  background: linear-gradient(135deg, #00ffff 0%, #00ccff 20%, #ff00ff 40%, #ffff00 60%, #00ff00 80%, #00ffff 100%);
  background-size: 300% 300%;
  color: white;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 0 0 20px rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.6), 0 0 30px rgba(255, 0, 255, 0.4), 0 4px 15px rgba(0, 0, 0, 0.3);
  animation: rainbowShimmer 3s ease-in-out infinite, pulseGlow 1.5s ease-in-out infinite;
  position: relative;
  font-weight: 900;
  border: 2px solid rgba(255, 255, 255, 0.6);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  letter-spacing: 0.5px;
  display: inline-block;
  z-index: 1;
  margin-left: 8px;
  margin-right: 0;
  overflow: hidden;
}
.chance-rarity.rarity-diamond::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.8) 50%, transparent 70%);
  animation: diamondShine 2s linear infinite;
}

/* Ultra cursed percent box (cursed) */
.chance-rarity.rarity-cursed {
  background: linear-gradient(135deg, #1a0000 0%, #4a0000 20%, #8b0000 40%, #ff4500 60%, #ff0000 80%, #1a0000 100%);
  background-size: 300% 300%;
  color: white;
  text-shadow: 0 0 10px rgba(255, 69, 0, 1), 0 0 20px rgba(139, 0, 0, 0.8), 0 0 30px rgba(0, 0, 0, 0.9);
  box-shadow: 0 0 15px 4px rgba(255, 48, 48, 0.85), 0 0 30px 8px rgba(255, 69, 0, 0.7), 0 4px 15px rgba(0, 0, 0, 0.4);
  animation: hellfire 2s ease-in-out infinite, pulseHell 1s ease-in-out infinite;
  position: relative;
  font-weight: 900;
  border: 2px solid rgba(255, 69, 0, 0.8);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  letter-spacing: 0.5px;
  display: inline-block;
  z-index: 1;
  margin-left: 8px;
  margin-right: 0;
  overflow: hidden;
}
.chance-rarity.rarity-cursed::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 69, 0, 0.6) 0%, transparent 70%);
  animation: fireEmbers 3s linear infinite;
}
.chance-rarity.rarity-cursed::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 0, 0, 0.4) 50%, transparent 70%);
  animation: burningFlame 1.5s linear infinite;
}
/* Hide horizontal scroll bar for local players list in setup */
#localPlayersList {
  overflow-x: hidden !important;
  max-width: 100%;
}
#localPlayersList li {
  overflow-x: hidden !important;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
/* UI Components, Buttons, Controls, and Interactive Elements */

/* General button styles */
button {
  margin: 0;
  padding: 12px 16px;
  cursor: pointer;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

button:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
  transform: translateY(-2px);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed !important;
  background: linear-gradient(135deg, #bdc3c7 0%, #95a5a6 100%) !important;
  box-shadow: none !important;
  transform: none !important;
  color: #7f8c8d !important;
}

button:disabled:hover {
  background: linear-gradient(135deg, #bdc3c7 0%, #95a5a6 100%) !important;
  transform: none !important;
}

/* Start button */
.start-btn {
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  background: #3b82f6;
  color: white;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.2s ease;
}

.start-btn:hover {
  background: #2563eb;
}

.start-btn:active {
  background: #1d4ed8;
}

.start-btn:disabled { 
  opacity: 0.6; 
  cursor: not-allowed; 
  background: linear-gradient(135deg, #bdc3c7 0%, #95a5a6 100%);
  color: #ecf0f1;
  box-shadow: 0 2px 8px rgba(149, 165, 166, 0.2);
  transform: none;
}

/* Roll controls */
.roll-controls { display:flex; flex-direction:column; gap:10px; align-items:center; margin-top:6px; }
.dice-group { display:flex; gap:8px; }
.die { width:44px; height:44px; border-radius:8px; display:flex; align-items:center; justify-content:center; background:#fff; box-shadow:0 8px 18px rgba(0,0,0,0.12); font-weight:700; font-size:1.1rem; }
.die.roll-anim { transform: translateY(-6px) scale(1.05); transition: transform 160ms ease; }

/* Money change indicator */
.money-change {
  position: absolute;
  right: 12px;
  top: -8px;
  background: rgba(255,255,255,0.95);
  border-radius: 12px;
  padding: 6px 8px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(0,0,0,0.12);
  transform: translateY(0);
  opacity: 0;
  z-index: 2200;
}
.money-change.show {
  animation: moneyPop 900ms cubic-bezier(.2,.9,.2,1) forwards;
}
.money-change.positive { color: #0b6d3a; }
.money-change.negative { color: #9b1c1c; }

.coin-icon { width:16px; height:16px; vertical-align:middle; margin-right:6px; }

/* Range controls */
.range-wrapper { display:flex; flex-direction:column; align-items:center; gap:6px; }
.range-wrapper input[type="range"] { width: 220px; }
.range-wrapper label { font-weight:700; color:var(--board-edge); }

.range-wrapper {
  background: #f8fafc;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e2e8f0;
}

.range-wrapper label {
  color: #334155;
  font-weight: 600;
  font-size: 15px;
}

.range-wrapper input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: #3b82f6;
  cursor: pointer;
  width: 250px;
  height: 8px;
  border-radius: 10px;
  box-shadow: none;
}

.range-wrapper input[type="range"]::-webkit-slider-track {
  background: #3b82f6;
  height: 8px;
  border-radius: 10px;
  box-shadow: none;
}

.range-wrapper input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  background: #ffffff;
  height: 20px;
  width: 20px;
  border-radius: 50%;
  border: 2px solid #3b82f6;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
  margin-top: -0px; /* For 8px track and 20px thumb: (track/2 - thumb/2) = (8/2 - 20/2) = -6px */
  cursor: pointer;
}

.range-wrapper input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

.range-wrapper input[type="range"]::-moz-range-track {
  background: #3b82f6;
  height: 8px;
  border-radius: 10px;
  box-shadow: none;
}

.range-wrapper input[type="range"]::-moz-range-thumb {
  /* For Firefox, align thumb vertically on 8px track */
  margin-top: 0px;
  /* Remove default outline for focus, but keep accessibility */
  outline: none;
  background: #ffffff;
  height: 20px;
  width: 20px;
  border-radius: 50%;
  border: 2px solid #3b82f6;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
  cursor: pointer;
}

.range-wrapper input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

#startingMoneyDisplay {
  color: #1e293b;
  font-weight: 700;
  font-size: 18px;
}

/* Mode selection button styling */
#mode-local, #mode-online {
  background: #3b82f6;
  box-shadow: none;
  font-size: 15px;
  font-weight: 600;
  padding: 14px 24px;
  transition: background 0.2s ease;
}

#mode-local:hover, #mode-online:hover {
  background: #2563eb;
}

#hostBotControls {
  background: #f8fafc;
  border-radius: 10px;
  padding: 16px;
  border: 1px solid #e2e8f0;
}

/* Chance rarity colors */
.chance-rarity {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rarity-common {
  background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(127, 140, 141, 0.3);
}

.rarity-uncommon {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.rarity-rare {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.rarity-epic {
  background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(155, 89, 182, 0.3);
}

.rarity-cursed {
  background: linear-gradient(135deg, #1a0000 0%, #4a0000 20%, #8b0000 40%, #ff4500 60%, #ff0000 80%, #1a0000 100%);
  background-size: 300% 300%;
  color: white;
  text-shadow: 0 0 10px rgba(255, 69, 0, 1), 0 0 20px rgba(139, 0, 0, 0.8), 0 0 30px rgba(0, 0, 0, 0.9);
    box-shadow: 0 0 12px 2px rgba(255, 48, 48, 0.7), 0 0 20px 4px rgba(255, 69, 0, 0.5), 0 4px 15px rgba(0, 0, 0, 0.25);
  position: relative;
  font-weight: 900;
  border: 2px solid rgba(255, 69, 0, 0.8);
}

/* Only add the shiny overlay outside the percent box */

/* Only animate inside the percent box for ultra cursed */
.chance-rarity.rarity-cursed {
  position: relative;
  overflow: hidden;
    background: linear-gradient(135deg, #7a1a00 0%, #b93d1a 20%, #a83200 40%, #ff4500 60%, #8b0000 80%, #7a1a00 100%);
  background-size: 300% 300%;
  color: white;
  text-shadow: 0 0 10px rgba(255, 235, 205, 0.8), 0 0 20px rgba(255, 140, 0, 0.6);
    box-shadow: 0 0 12px 2px rgba(255, 48, 48, 0.7), 0 0 20px 4px rgba(255, 69, 0, 0.5), 0 4px 15px rgba(0, 0, 0, 0.25);
  animation: hellfire 2s ease-in-out infinite, pulseHell 1s ease-in-out infinite;
  position: relative;
  font-weight: 900;
  border: 2px solid rgba(255, 69, 0, 0.8);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  letter-spacing: 0.5px;
  display: inline-block;
  z-index: 1;
  margin-left: 8px;
  margin-right: 0;
  overflow: hidden;
}

@keyframes cursedShimmer {
  0% {
    background-position: -120% 0;
  }
  100% {
    background-position: 120% 0;
  }
}
.chance-rarity.rarity-cursed span, .chance-rarity.rarity-cursed strong, .chance-rarity.rarity-cursed em {
  position: relative;
  z-index: 1;
}



.rarity-diamond {
  background: linear-gradient(135deg, #00ffff 0%, #00ccff 20%, #ff00ff 40%, #ffff00 60%, #00ff00 80%, #00ffff 100%);
  background-size: 300% 300%;
  color: white;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 0 0 20px rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.6), 0 0 30px rgba(255, 0, 255, 0.4), 0 4px 15px rgba(0, 0, 0, 0.3);
  animation: rainbowShimmer 3s ease-in-out infinite, pulseGlow 1.5s ease-in-out infinite;
  position: relative;
  /* overflow: hidden; */
  font-weight: 900;
  border: 2px solid rgba(255, 255, 255, 0.6);
}


.rarity-legendary {
  background: linear-gradient(135deg, #f1c40f 0%, #f39c12 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(241, 196, 15, 0.4);
  animation: shimmerGold 2s infinite;
}

.chance-item {
  margin: 10px 0;
  padding: 14px;
  border-radius: 10px;
  background: rgba(0,0,0,0.03);
  border-left: 4px solid #ddd;
  transition: all 0.2s ease;
}

.chance-item:hover {
  transform: translateX(4px);
  background: rgba(0,0,0,0.05);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chance-item-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.chance-item.rarity-cursed-item { 
  border-left-color: #ff4500;
  background: linear-gradient(90deg, rgba(139,0,0,0.15) 0%, rgba(255,69,0,0.15) 50%, rgba(139,0,0,0.15) 100%);
  /* Remove card glow and animation, only animate percent box */
  box-shadow: none;
  animation: none;
}

.chance-item.rarity-diamond-item { 
  border-left-color: #00ffff; 
  background: linear-gradient(90deg, rgba(0,255,255,0.1) 0%, rgba(255,0,255,0.1) 50%, rgba(255,255,0,0.1) 100%);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.chance-item.rarity-common-item { border-left-color: #7f8c8d; }
.chance-item.rarity-uncommon-item { border-left-color: #2980b9; }
.chance-item.rarity-rare-item { border-left-color: #2980b9; }
.chance-item.rarity-epic-item { border-left-color: #8e44ad; }
.chance-item.rarity-legendary-item { border-left-color: #f39c12; }
