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

:root {
  --bg: #0a0e17;
  --surface: #12182a;
  --primary: #00ff88;
  --secondary: #ff3366;
  --tertiary: #00d4ff;
  --gold: #ffd700;
  --text: #ffffff;
  --text-dim: #6b7280;
}

body {
  font-family: 'Exo 2', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

#game-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 10px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  background: var(--surface);
  border-radius: 12px;
  margin-bottom: 15px;
  border: 1px solid rgba(0, 255, 136, 0.2);
}

.logo {
  position: relative;
}

.logo-text {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--primary);
  text-shadow: 0 0 20px rgba(0, 255, 136, 0.5),
               0 0 40px rgba(0, 255, 136, 0.3);
  letter-spacing: 3px;
}

.balance-display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(0, 255, 136, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(0, 255, 136, 0.3);
}

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

.balance-amount {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
}

.balance-amount.flash-green {
  animation: flashGreen 0.3s ease;
}

.balance-amount.flash-red {
  animation: flashRed 0.3s ease;
}

@keyframes flashGreen {
  0%, 100% { color: var(--primary); }
  50% { color: #fff; text-shadow: 0 0 20px var(--primary); }
}

@keyframes flashRed {
  0%, 100% { color: var(--primary); }
  50% { color: var(--secondary); text-shadow: 0 0 20px var(--secondary); }
}

.sound-btn {
  width: 40px;
  height: 40px;
  background: var(--surface);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 8px;
  color: var(--tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.sound-btn:hover {
  background: rgba(0, 212, 255, 0.2);
  border-color: var(--tertiary);
}

.sound-btn svg {
  width: 20px;
  height: 20px;
}

/* Main */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

#board-container {
  flex: 1;
  min-height: 400px;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid rgba(0, 255, 136, 0.2);
  overflow: hidden;
  position: relative;
}

#canvas {
  display: block;
}

#multipliers {
  display: flex;
  justify-content: center;
  padding: 5px 10px 10px;
  gap: 2px;
  flex-wrap: wrap;
}

.multiplier-slot {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 6px 2px;
  min-width: 35px;
  text-align: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.multiplier-slot.profit {
  background: linear-gradient(180deg, rgba(0, 255, 136, 0.3), rgba(0, 255, 136, 0.1));
  color: var(--primary);
  border: 1px solid rgba(0, 255, 136, 0.4);
}

.multiplier-slot.loss {
  background: linear-gradient(180deg, rgba(255, 51, 102, 0.3), rgba(255, 51, 102, 0.1));
  color: var(--secondary);
  border: 1px solid rgba(255, 51, 102, 0.4);
}

.multiplier-slot.jackpot {
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.4), rgba(255, 215, 0, 0.1));
  color: var(--gold);
  border: 1px solid rgba(255, 215, 0, 0.5);
  animation: jackpotPulse 2s infinite;
}

.multiplier-slot.hit {
  transform: scale(1.2);
  box-shadow: 0 0 20px currentColor;
}

@keyframes jackpotPulse {
  0%, 100% { box-shadow: 0 0 5px rgba(255, 215, 0, 0.3); }
  50% { box-shadow: 0 0 15px rgba(255, 215, 0, 0.6); }
}

/* Controls */
#controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

@media (max-width: 600px) {
  #controls {
    grid-template-columns: 1fr;
  }
}

.control-panel, .history-panel {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid rgba(0, 255, 136, 0.2);
  padding: 15px;
}

.control-section {
  margin-bottom: 15px;
}

.control-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.bet-input-group {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.bet-btn {
  padding: 8px 12px;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 6px;
  color: var(--tertiary);
  font-family: 'Exo 2', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.bet-btn:hover {
  background: rgba(0, 212, 255, 0.2);
  border-color: var(--tertiary);
}

#bet-amount {
  flex: 1;
  min-width: 80px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid rgba(0, 255, 136, 0.3);
  border-radius: 6px;
  color: var(--text);
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  text-align: center;
}

#bet-amount:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.risk-toggle {
  display: flex;
  gap: 5px;
}

.risk-btn {
  flex: 1;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--text-dim);
  font-family: 'Exo 2', sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.risk-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.risk-btn.active {
  background: rgba(0, 255, 136, 0.2);
  border-color: var(--primary);
  color: var(--primary);
}

#rows-select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid rgba(0, 255, 136, 0.3);
  border-radius: 6px;
  color: var(--text);
  font-family: 'Exo 2', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
}

#rows-select:focus {
  outline: none;
  border-color: var(--primary);
}

.drop-button {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--primary), #00aa55);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.drop-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 255, 136, 0.4);
}

.drop-button:active {
  transform: translateY(0);
}

.drop-text {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--bg);
  letter-spacing: 2px;
  position: relative;
  z-index: 1;
}

.drop-glow {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: dropGlow 2s infinite;
}

@keyframes dropGlow {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* History */
.history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 150px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 20px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
}

.history-item.profit {
  background: rgba(0, 255, 136, 0.15);
  color: var(--primary);
}

.history-item.loss {
  background: rgba(255, 51, 102, 0.15);
  color: var(--secondary);
}

.history-item.jackpot {
  background: rgba(255, 215, 0, 0.2);
  color: var(--gold);
}

.history-item .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Win Popup */
.win-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: var(--surface);
  border-radius: 16px;
  padding: 30px 50px;
  text-align: center;
  z-index: 1000;
  animation: popIn 0.3s forwards;
  border: 2px solid currentColor;
}

.win-popup.hidden {
  animation: popOut 0.3s forwards;
}

.win-popup.profit {
  color: var(--primary);
  box-shadow: 0 0 50px rgba(0, 255, 136, 0.5);
}

.win-popup.loss {
  color: var(--secondary);
  box-shadow: 0 0 50px rgba(255, 51, 102, 0.5);
}

.win-popup.jackpot {
  color: var(--gold);
  box-shadow: 0 0 80px rgba(255, 215, 0, 0.6);
  animation: popIn 0.3s forwards, jackpotShake 0.1s 0.3s 3;
}

@keyframes popIn {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes popOut {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
}

@keyframes jackpotShake {
  0%, 100% { transform: translate(-50%, -50%) scale(1) rotate(0); }
  25% { transform: translate(-50%, -50%) scale(1.05) rotate(-2deg); }
  75% { transform: translate(-50%, -50%) scale(1.05) rotate(2deg); }
}

.win-multiplier {
  font-family: 'Orbitron', sans-serif;
  font-size: 3rem;
  font-weight: 900;
}

.win-amount {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 10px;
}

/* Shake animation */
.shake {
  animation: shake 0.5s ease;
}

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

/* Particles container */
#particles-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

/* Footer */
footer {
  text-align: center;
  padding: 15px;
  margin-top: 10px;
}

footer a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.8rem;
  transition: all 0.2s;
}

footer a:hover {
  color: var(--primary);
  text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 3px;
}

/* Mobile adjustments */
@media (max-width: 500px) {
  .logo-text {
    font-size: 1.3rem;
  }
  
  .balance-amount {
    font-size: 1rem;
  }
  
  .multiplier-slot {
    font-size: 0.55rem;
    min-width: 28px;
    padding: 4px 1px;
  }
  
  .bet-btn {
    padding: 6px 8px;
    font-size: 0.8rem;
  }
  
  #bet-amount {
    min-width: 60px;
  }
}