/* Preloader Styles */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease-out;
}

.preloader-spinner {
  width: 80px;
  height: 80px;
  border: 8px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 20px;
}

.preloader-text {
  color: white;
  font-family: 'Arial', sans-serif;
  font-size: 24px;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  animation: colorChange 3s infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes colorChange {
  0% {
    color: #ff5e62;
  }

  25% {
    color: #ff9966;
  }

  50% {
    color: #ffcc33;
  }

  75% {
    color: #38ef7d;
  }

  100% {
    color: #11998e;
  }
}

/* Main Game Styles */
body {
  background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: 'Montserrat', Arial, sans-serif;
  overflow: hidden;
}

#mainContainer {
  position: relative;
  width: 100%;
  max-width: 600px;
  text-align: center;
  perspective: 1000px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transform-style: preserve-3d;
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0% {
    transform: translateY(0px) rotateX(0deg);
  }

  50% {
    transform: translateY(-20px) rotateX(5deg);
  }

  100% {
    transform: translateY(0px) rotateX(0deg);
  }
}

.text {
  text-align: center;
  font-family: 'Montserrat', Helvetica, Arial, Sans-Serif;
  color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  margin: 10px 0;
}

.scores {
  font-size: 1.8em;
  font-weight: bold;
  background: rgba(0, 0, 0, 0.3);
  padding: 10px 20px;
  border-radius: 50px;
  display: inline-block;
  margin: 10px auto;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

#explanation {
  margin: 20px 0;
  font-size: 1.5em;
  animation: pulse 2s infinite, colorFlow 5s infinite;
  background: linear-gradient(90deg, #ff5e62, #ff9966, #ffcc33, #38ef7d, #11998e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 300% 100%;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes colorFlow {
  0% {
    background-position: 0% 50%;
  }

  100% {
    background-position: 100% 50%;
  }
}

#title {
  margin: 10px 0;
  font-size: 2em;
  font-weight: 900;
  background: linear-gradient(to right, #ff8a00, #e52e71, #b36bff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  animation: shine 3s infinite, titleFloat 4s ease-in-out infinite;
}

@keyframes shine {
  0% {
    background-position: 0% 50%;
  }

  100% {
    background-position: 100% 50%;
  }
}

@keyframes titleFloat {
  0% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }

  100% {
    transform: translateY(0);
  }
}

#spinnerCanvas {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3),
    inset 0 0 30px rgba(255, 255, 255, 0.2);
  transition: transform 0.3s ease;
  cursor: pointer;
  margin: 20px 0;
  border: 5px solid rgba(255, 255, 255, 0.2);
}

#spinnerCanvas:hover {
  transform: scale(1.05) rotate(5deg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4),
    inset 0 0 40px rgba(255, 255, 255, 0.3);
}

.particle {
  position: absolute;
  background: gold;
  border-radius: 50%;
  pointer-events: none;
  z-index: 10;
  filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.7));
}

.confetti {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #f00;
  opacity: 0;
  z-index: 100;
  filter: drop-shadow(0 0 3px currentColor);
}

/* Floating bubbles background */
.bubbles {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}

.bubble {
  position: absolute;
  bottom: -100px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  animation: rise 15s infinite ease-in;
}

.bubble:nth-child(1) {
  width: 40px;
  height: 40px;
  left: 10%;
  animation-duration: 8s;
}

.bubble:nth-child(2) {
  width: 20px;
  height: 20px;
  left: 20%;
  animation-duration: 5s;
  animation-delay: 1s;
}

.bubble:nth-child(3) {
  width: 50px;
  height: 50px;
  left: 35%;
  animation-duration: 7s;
  animation-delay: 2s;
}

.bubble:nth-child(4) {
  width: 80px;
  height: 80px;
  left: 50%;
  animation-duration: 11s;
  animation-delay: 0s;
}

.bubble:nth-child(5) {
  width: 35px;
  height: 35px;
  left: 55%;
  animation-duration: 6s;
  animation-delay: 1s;
}

.bubble:nth-child(6) {
  width: 45px;
  height: 45px;
  left: 65%;
  animation-duration: 8s;
  animation-delay: 3s;
}

.bubble:nth-child(7) {
  width: 25px;
  height: 25px;
  left: 75%;
  animation-duration: 7s;
  animation-delay: 2s;
}

.bubble:nth-child(8) {
  width: 80px;
  height: 80px;
  left: 80%;
  animation-duration: 6s;
  animation-delay: 1s;
}

@keyframes rise {
  0% {
    bottom: -100px;
    transform: translateX(0);
  }

  50% {
    transform: translateX(100px);
  }

  100% {
    bottom: 1080px;
    transform: translateX(-200px);
  }
}

/* Glow effect for score increase */
@keyframes scoreGlow {
  0% {
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
  }

  50% {
    text-shadow: 0 0 20px gold, 0 0 30px gold;
  }

  100% {
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
  }
}

.score-glow {
  animation: scoreGlow 1s ease-out;
}

/* Responsive design */
@media (max-width: 600px) {

  #mainContainer {
    max-width: 400px !important;
    width: auto;
  }

  body {

    display: inherit;
    width: 400px;
    margin: auto;
    margin-top: 30px;
  }

  #title {
    font-size: 2.5em;
  }

  #explanation {
    font-size: 1.2em;
  }

  #spinnerCanvas {
    width: 300px;
    height: 300px;
  }

  .scores {
    font-size: 1.4em;
  }
}