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

body {
  background: #0c0c1d;
  color: #fff;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  font-family: 'Arial', sans-serif;
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: 
    radial-gradient(circle at 10% 20%, rgba(255, 215, 0, 0.05) 0%, transparent 20%),
    radial-gradient(circle at 90% 80%, rgba(255, 0, 0, 0.05) 0%, transparent 20%),
    radial-gradient(circle at 50% 50%, rgba(0, 100, 255, 0.05) 0%, transparent 30%);
  z-index: -1;
}

.hidden { display: none !important; }

.game-container {
  width: 100%; max-width: 1200px;
  background: #1a0a2e;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 0 50px rgba(255, 215, 0, 0.2);
  border: 4px solid #382218;
  position: relative;
  padding: 20px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  padding: 15px 20px;
  background: #8b0000;
  border-radius: 10px;
  margin-bottom: 25px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
  border: 2px solid #d4af37;
  position: relative;
  overflow: hidden;
}

.player-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-shadow: 0 0 5px rgba(255, 215, 0, 0.7);
}

.player-info div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-info span {
  font-weight: bold;
  color: #ffd700;
}

.btn-group {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.casino-btn {
  padding: 12px 25px;
  font-size: 16px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  z-index: 1;
  background: #8b0000;
  color: white;
  border: 2px solid #ffd700;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
}

#logout-btn { background: #00008b; }

.casino-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 20px rgba(255, 215, 0, 0.4);
}

.casino-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.game-content {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.payout-legend {
  flex: 1;
  min-width: 250px;
  background: #8b0000;
  border-radius: 10px;
  padding: 20px;
  border: 2px solid #d4af37;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  height: fit-content;
}

.payout-legend h2 {
  text-align: center;
  margin-bottom: 15px;
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
  font-size: 24px;
}

.cascade-info {
  margin-top: 20px;
  padding: 15px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  border: 1px solid #d4af37;
}

.cascade-info h3 {
  color: #ffd700;
  margin-bottom: 10px;
  font-size: 18px;
  text-align: center;
}

.cascade-info p, .cascade-info li {
  font-size: 14px;
  margin-bottom: 8px;
  line-height: 1.4;
}

.cascade-info ul {
  padding-left: 20px;
  margin-top: 5px;
}

.slot-machine {
  flex: 2;
  min-width: 300px;
  background: #2a0a46;
  padding: 25px;
  border-radius: 15px;
  border: 3px solid #d4af37;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  position: relative;
  overflow: hidden;
}

.slot-machine::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect width="100" height="100" fill="none" stroke="%23d4af37" stroke-width="0.5" stroke-opacity="0.1"/></svg>');
  opacity: 0.3;
  z-index: 0;
}

.reels-container {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 30px;
  position: relative;
  z-index: 1;
  background: linear-gradient(145deg, #1c0f2e, #0d051c);
  border-radius: 10px;
  padding: 10px;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.8);
  border: 2px solid #d4af37;
}

.reel-container {
  position: relative;
  width: 100px;
  height: 300px;
}

.reel-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0.4) 0%,
    rgba(0,0,0,0) 33%,
    rgba(0,0,0,0) 67%,
    rgba(0,0,0,0.4) 100%
  );
  box-shadow: 
    inset 0 0 20px rgba(0,0,0,0.7),
    inset 0 0 5px rgba(212, 175, 55, 0.5);
  border-radius: 10px;
}

.reel-overlay::before {
  content: "";
  position: absolute;
  top: 100px;
  left: 0;
  width: 100%;
  height: 100px;
  background: rgba(255, 215, 0, 0.1);
  border-top: 2px dashed rgba(255, 215, 0, 0.5);
  border-bottom: 2px dashed rgba(255, 215, 0, 0.5);
  z-index: 11;
}

canvas {
  position: relative;
  z-index: 5;
  width: 100%;
  height: 100%;
  background: linear-gradient(145deg, #0f0a1f, #1a0a2e);
  border-radius: 10px;
  box-shadow: 
    0 5px 15px rgba(0, 0, 0, 0.6), 
    0 0 0 2px #d4af37, 
    0 0 0 5px #8b0000,
    inset 0 0 15px rgba(0, 0, 0, 0.8);
}

.bet-selector {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  position: relative;
  z-index: 1000;
  flex-wrap: wrap;
}

.bet-btn {
  padding: 10px 20px;
  font-size: 16px;
  font-weight: bold;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  background: #4b0000;
  color: white;
  border: 1px solid #ffd700;
  transition: all 0.2s;
  pointer-events: auto !important;
}

.bet-btn:hover {
  background: #8b0000;
  transform: scale(1.05);
}

.bet-btn.active-bet {
  background: #ffd700;
  color: #1a0a2e;
  box-shadow: 0 0 10px #ffd700;
  transform: scale(1.1);
}

.spin-btn {
  padding: 15px 40px;
  font-size: 20px;
  display: block;
  margin: 0 auto;
  background: #ff0000;
  color: white;
  border: 2px solid #ffd700;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
  position: relative;
}

#result-message {
  min-height: 60px;
  font-size: 28px;
  margin-top: 20px;
  color: #ffd700;
  text-shadow: 0 0 15px rgba(255, 204, 0, 0.7);
  text-align: center;
  font-weight: bold;
  letter-spacing: 1px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  border: 1px solid #d4af37;
}

.win-animation {
  animation: winFlash 0.5s ease-in-out 2;
}

.cascade-animation {
  animation: cascadePulse 0.5s ease-in-out;
}

@keyframes winFlash {
  0% { box-shadow: 0 0 80px yellow; }
  50% { box-shadow: 0 0 80px orange; }
  100% { box-shadow: inset 0 0 20px rgba(0,0,0,0.8), 0 5px 15px rgba(0,0,0,0.5); }
}

@keyframes cascadePulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.leaderboard {
  flex: 1;
  min-width: 250px;
  background: #8b0000;
  border-radius: 10px;
  padding: 20px;
  border: 2px solid #d4af37;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  height: fit-content;
}

.leaderboard h2 {
  text-align: center;
  margin-bottom: 15px;
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
  font-size: 24px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

th {
  background: #d4af37;
  color: #1a0a2e;
  padding: 12px;
  text-align: left;
  font-size: 16px;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
  font-size: 14px;
}

tr:nth-child(even) { background: rgba(0, 0, 0, 0.2); }
tr:hover { background: rgba(212, 175, 55, 0.1); }

#login-section {
  text-align: center; padding: 40px 20px;
}

#login-section h1 {
  font-size: 48px; margin-bottom: 30px;
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
  letter-spacing: 2px;
  position: relative;
}

#login-form {
  display: flex; flex-direction: column; gap: 20px;
  max-width: 400px; margin: 0 auto;
  background: rgba(0,0,0,0.5); padding: 30px; border-radius: 15px;
  border: 2px solid #d4af37; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

#login-form input {
  padding: 15px; font-size: 18px; border: none; border-radius: 50px;
  background: rgba(0,0,0,0.3); color: white; border: 1px solid #d4af37;
  text-align: center;
}

#login-form input:focus {
  outline: none; box-shadow: 0 0 15px rgba(212,175,55,0.5);
}

#login-form button {
  padding: 15px; font-size: 20px;
  background: #ff0000; color: white; border: 2px solid #ffd700;
  text-shadow: 0 0 5px rgba(255,255,255,0.8);
}

@media (max-width: 768px) {
  .game-content {
    flex-direction: column;
  }
  
  .payout-legend, .slot-machine, .leaderboard {
    width: 100%;
    min-width: unset;
  }
  
  .reel-container {
    width: 16vw;
    height: 48vw;
  }
  
  .btn-group { justify-content: center; }
  .header { flex-direction: column; text-align: center; }
  .player-info { align-items: center; }
  #result-message { font-size: 22px; }
  .bet-selector { gap: 5px; }
  .bet-btn { padding: 8px 15px; font-size: 14px; }
}

@media (max-width: 480px) {
  .reel-container {
    width: 15vw;
    height: 45vw;
  }
  
  .casino-btn { padding: 10px 15px; font-size: 14px; }
  .spin-btn { padding: 12px 30px; font-size: 18px; }
  #result-message { font-size: 18px; }
  .bet-btn { padding: 6px 10px; font-size: 12px; }
  
  .reels-container {
    gap: 8px;
    padding: 5px;
  }
  
  .payout-legend, .leaderboard {
    padding: 15px;
  }
  
  .reel-overlay::before {
    top: 33.33%;
    height: 33.33%;
  }
  
  .cascade-info {
    padding: 10px;
    font-size: 12px;
  }
}
