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

body {
  font-family: "Arial", sans-serif;
  background: linear-gradient(
      135deg,
      rgba(26, 0, 51, 0.55),
      rgba(51, 0, 102, 0.55),
      rgba(77, 0, 128, 0.55)
    ),
    url("images/bg.webp");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: #fff;
  min-height: 100vh;
  overflow-x: hidden;
}

.game-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
}

.game-header {
  text-align: center;
  margin-bottom: 30px;
  position: relative;
}

.game-title {
  font-size: 2.5rem;
  background: linear-gradient(45deg, #ffd700, #ff6b35, #8a2be2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
  animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
  0% {
    filter: brightness(1);
  }
  100% {
    filter: brightness(1.2);
  }
}

.magical-orb {
  position: absolute;
  top: -10px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: radial-gradient(circle, #ffd700, #ff6b35);
  border-radius: 50%;
  animation: orbFloat 4s ease-in-out infinite;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
}

@keyframes orbFloat {
  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-10px) rotate(180deg);
  }
}

.game-board {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 20px;
  padding: 30px;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 215, 0, 0.3);
}

.slot-machine {
  position: relative;
  margin-bottom: 30px;
}

.reels-container {
  position: relative;
  background: linear-gradient(135deg, #2d1b69, #1a0033);
  border-radius: 15px;
  padding: 20px;
  border: 3px solid #ffd700;
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.4), inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.reel-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 8px;
  width: 300px;
  height: 300px;
  margin: 0 auto;
}

.reel-cell {
  background: linear-gradient(135deg, #4a0e4e, #2d1b69);
  border: 2px solid rgba(255, 215, 0, 0.5);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  position: relative;
  transition: all 0.3s ease;
  cursor: pointer;
}

.reel-cell:hover {
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
}

.reel-cell.spinning {
  animation: cellSpin 0.1s linear infinite;
}

@keyframes cellSpin {
  0% {
    transform: rotateY(0deg);
  }
  100% {
    transform: rotateY(360deg);
  }
}

.reel-cell.morphing {
  animation: morphTransform 1.5s ease-in-out;
}

@keyframes morphTransform {
  0% {
    transform: scale(1) rotateZ(0deg);
  }
  25% {
    transform: scale(0.8) rotateZ(90deg);
    filter: blur(2px);
  }
  50% {
    transform: scale(1.2) rotateZ(180deg);
    filter: blur(4px);
  }
  75% {
    transform: scale(0.9) rotateZ(270deg);
    filter: blur(2px);
  }
  100% {
    transform: scale(1) rotateZ(360deg);
    filter: blur(0px);
  }
}

.reel-cell.winning {
  animation: winPulse 1s ease-in-out infinite;
  border-color: #ffd700;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
}

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

.morph-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  border-radius: 15px;
}

.morph-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #ffd700;
  border-radius: 50%;
  animation: morphParticle 2s ease-out forwards;
}

@keyframes morphParticle {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0) translateY(-50px);
  }
}

.paylines-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.payline {
  position: absolute;
  height: 3px;
  background: linear-gradient(90deg, transparent, #ffd700, transparent);
  animation: paylineGlow 2s ease-in-out;
  border-radius: 2px;
}

.symbol-img {
  width: 72%;
  height: 72%;
  object-fit: contain;
  pointer-events: none;
}

@keyframes paylineGlow {
  0%,
  100% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
}

.win-display {
  text-align: center;
  margin: 20px 0;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.win-display.show {
  opacity: 1;
}

.win-amount {
  font-size: 3rem;
  font-weight: bold;
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
  animation: winCountUp 2s ease-out;
}

@keyframes winCountUp {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

.win-text {
  font-size: 1.2rem;
  color: #ccc;
  margin-top: 5px;
}

.game-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.balance-section,
.bet-section {
  text-align: center;
}

.balance-label,
.bet-label {
  font-size: 0.9rem;
  color: #ccc;
  margin-bottom: 5px;
}

.balance-amount,
.bet-amount {
  font-size: 1.5rem;
  font-weight: bold;
  color: #ffd700;
}

.bet-section {
  display: flex;
  align-items: center;
  gap: 15px;
}

.bet-btn {
  width: 40px;
  height: 40px;
  border: 2px solid #ffd700;
  background: linear-gradient(135deg, #4a0e4e, #2d1b69);
  color: #ffd700;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.bet-btn:hover {
  background: linear-gradient(135deg, #6a1e6e, #4d2b89);
  transform: scale(1.1);
}

.bet-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.spin-btn {
  position: relative;
  width: 120px;
  height: 60px;
  border: 3px solid #ffd700;
  background: linear-gradient(135deg, #ff6b35, #ffd700);
  color: #000;
  border-radius: 30px;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
}

.spin-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

.spin-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.spin-btn.spinning {
  animation: spinButtonPulse 0.5s ease-in-out infinite alternate;
}

@keyframes spinButtonPulse {
  0% {
    transform: scale(1);
  }
  100% {
    transform: scale(1.05);
  }
}

.spin-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: spinGlow 2s linear infinite;
  opacity: 0;
}

.spin-btn:hover .spin-glow {
  opacity: 1;
}

@keyframes spinGlow {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.bonus-indicator {
  text-align: center;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.bonus-indicator.active {
  opacity: 1;
  animation: bonusReady 1s ease-in-out infinite alternate;
}

@keyframes bonusReady {
  0% {
    transform: scale(1);
  }
  100% {
    transform: scale(1.05);
  }
}

.bonus-text {
  font-size: 0.9rem;
  color: #8a2be2;
  margin-bottom: 5px;
}

.bonus-counter {
  font-size: 1.2rem;
  font-weight: bold;
  color: #ffd700;
}

.paytable-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.7);
  color: #ffd700;
  padding: 10px 20px;
  border-radius: 20px;
  cursor: pointer;
  border: 2px solid #ffd700;
  transition: all 0.3s ease;
}

.paytable-toggle:hover {
  background: rgba(255, 215, 0, 0.2);
  transform: scale(1.05);
}

.paytable-modal,
.bonus-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.paytable-modal.show,
.bonus-modal.show {
  display: flex;
}

.paytable-content,
.bonus-content {
  background: linear-gradient(135deg, #2d1b69, #1a0033);
  border: 3px solid #ffd700;
  border-radius: 20px;
  padding: 30px;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  background: none;
  border: none;
  color: #ffd700;
  font-size: 2rem;
  cursor: pointer;
  transition: color 0.3s ease;
}

.close-btn:hover {
  color: #ff6b35;
}

.paytable-grid {
  margin: 20px 0;
}

.symbol-row {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
}

.symbol {
  font-size: 2rem;
  width: 60px;
  text-align: center;
}

.payout {
  font-weight: bold;
  color: #ffd700;
  width: 80px;
  text-align: center;
}

.description {
  flex: 1;
  color: #ccc;
}

.mechanics-info {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid rgba(255, 215, 0, 0.3);
}

.mechanics-info h3 {
  color: #ffd700;
  margin-bottom: 10px;
}

.mechanics-info p {
  margin-bottom: 8px;
  color: #ccc;
  line-height: 1.4;
}

.bonus-content {
  text-align: center;
}

.bonus-content h2 {
  color: #ffd700;
  margin-bottom: 20px;
  font-size: 2rem;
  animation: bonusTitle 1s ease-in-out infinite alternate;
}

@keyframes bonusTitle {
  0% {
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
  }
  100% {
    text-shadow: 0 0 20px rgba(255, 215, 0, 1);
  }
}

.bonus-spins-left {
  font-size: 1.5rem;
  color: #8a2be2;
  margin-bottom: 15px;
}

.bonus-total-win {
  font-size: 2rem;
  color: #ffd700;
  font-weight: bold;
}

/* Responsive Design */
@media (max-width: 768px) {
  .game-container {
    padding: 10px;
  }

  .game-title {
    font-size: 2rem;
  }

  .reel-grid {
    width: 250px;
    height: 250px;
  }

  .reel-cell {
    font-size: 2rem;
  }

  .game-controls {
    flex-direction: column;
    gap: 15px;
  }

  .bet-section {
    order: -1;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
