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

body {
  font-family: 'Jua', sans-serif;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a0533 0%, #2d1b4e 25%, #1a0533 50%, #0d0d2b 100%);
  overflow-x: hidden;
  position: relative;
}

/* Animated background stars */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(2px 2px at 20px 30px, #fff, transparent),
    radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.8), transparent),
    radial-gradient(1px 1px at 90px 40px, #fff, transparent),
    radial-gradient(2px 2px at 160px 120px, rgba(255,255,255,0.9), transparent),
    radial-gradient(1px 1px at 230px 80px, #fff, transparent),
    radial-gradient(2px 2px at 300px 150px, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 350px 200px, #fff, transparent),
    radial-gradient(2px 2px at 420px 50px, rgba(255,255,255,0.8), transparent);
  background-size: 500px 300px;
  animation: twinkle 4s infinite;
  pointer-events: none;
  z-index: 0;
}

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

.container {
  position: relative;
  z-index: 2;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* Title styling */
.title {
  font-family: 'Black Han Sans', sans-serif;
  font-size: 4rem;
  text-align: center;
  color: #fff;
  text-shadow:
    0 0 10px #ff00de,
    0 0 20px #ff00de,
    0 0 40px #ff00de,
    0 0 80px #ff00de,
    4px 4px 0 #ff6b00;
  margin-bottom: 30px;
  animation: titleGlow 2s ease-in-out infinite;
}

.title .star {
  display: inline-block;
  color: #ffd700;
  animation: starSpin 3s linear infinite;
  text-shadow: 0 0 20px #ffd700;
}

@keyframes titleGlow {
  0%, 100% {
    text-shadow:
      0 0 10px #ff00de,
      0 0 20px #ff00de,
      0 0 40px #ff00de,
      4px 4px 0 #ff6b00;
  }
  50% {
    text-shadow:
      0 0 20px #00ffff,
      0 0 40px #00ffff,
      0 0 60px #00ffff,
      4px 4px 0 #ff6b00;
  }
}

@keyframes starSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Main content layout */
.main-content {
  display: flex;
  gap: 40px;
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap;
}

/* Wheel section */
.wheel-section {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wheel-frame {
  position: relative;
  padding: 30px;
  background: linear-gradient(145deg, #ffd700, #ff8c00, #ffd700);
  border-radius: 50%;
  box-shadow:
    0 0 30px rgba(255, 215, 0, 0.5),
    inset 0 0 30px rgba(255, 140, 0, 0.3),
    0 10px 40px rgba(0, 0, 0, 0.4);
  animation: frameGlow 2s ease-in-out infinite;
}

.wheel-frame::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border-radius: 50%;
  border: 8px dashed rgba(255, 255, 255, 0.3);
  animation: rotateBorder 20s linear infinite;
}

@keyframes frameGlow {
  0%, 100% { box-shadow: 0 0 30px rgba(255, 215, 0, 0.5), 0 10px 40px rgba(0, 0, 0, 0.4); }
  50% { box-shadow: 0 0 60px rgba(255, 215, 0, 0.8), 0 10px 40px rgba(0, 0, 0, 0.4); }
}

@keyframes rotateBorder {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Pointer */
.pointer {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 25px solid transparent;
  border-right: 25px solid transparent;
  border-top: 50px solid #ff0040;
  z-index: 10;
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.5));
}

.pointer::after {
  content: '';
  position: absolute;
  top: -45px;
  left: -15px;
  width: 0;
  height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 30px solid #ff6b8a;
}

#wheel {
  display: block;
  border-radius: 50%;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.3);
}

/* Spin button */
.spin-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(145deg, #ff0040, #cc0033);
  color: white;
  font-family: 'Black Han Sans', sans-serif;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow:
    0 5px 20px rgba(255, 0, 64, 0.5),
    inset 0 -5px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  z-index: 5;
}

.spin-btn:hover {
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow:
    0 10px 30px rgba(255, 0, 64, 0.7),
    inset 0 -5px 10px rgba(0, 0, 0, 0.2);
}

.spin-btn:active {
  transform: translate(-50%, -50%) scale(0.95);
}

.spin-btn:disabled {
  background: linear-gradient(145deg, #666, #444);
  cursor: not-allowed;
  box-shadow: none;
}

/* Result display */
.result {
  margin-top: 30px;
  padding: 20px 40px;
  background: linear-gradient(145deg, rgba(255, 215, 0, 0.2), rgba(255, 140, 0, 0.2));
  border: 3px solid #ffd700;
  border-radius: 20px;
  font-size: 2rem;
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.5s ease;
}

.result.show {
  opacity: 1;
  transform: scale(1);
  animation: resultPop 0.5s ease;
}

@keyframes resultPop {
  0% { transform: scale(0.5); }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* Control panel */
.control-panel {
  background: linear-gradient(145deg, rgba(45, 27, 78, 0.9), rgba(26, 5, 51, 0.9));
  border: 3px solid;
  border-image: linear-gradient(145deg, #ff00de, #00ffff) 1;
  border-radius: 20px;
  padding: 25px;
  min-width: 320px;
  box-shadow:
    0 0 20px rgba(255, 0, 222, 0.3),
    inset 0 0 30px rgba(0, 0, 0, 0.3);
}

.panel-header {
  font-family: 'Black Han Sans', sans-serif;
  font-size: 1.8rem;
  color: #fff;
  text-align: center;
  margin-bottom: 20px;
  text-shadow: 0 0 10px #00ffff;
}

.panel-header .bulb {
  animation: bulbBlink 0.5s infinite alternate;
}

@keyframes bulbBlink {
  from { opacity: 1; filter: brightness(1); }
  to { opacity: 0.7; filter: brightness(1.5); }
}

.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  color: #ffeb3b;
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.input-group input {
  width: calc(100% - 80px);
  padding: 12px 15px;
  border: 2px solid #ff00de;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.1rem;
  font-family: 'Jua', sans-serif;
}

.input-group input:focus {
  outline: none;
  border-color: #00ffff;
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

.apply-btn {
  width: 70px;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(145deg, #ff00de, #cc00b1);
  color: white;
  font-family: 'Jua', sans-serif;
  font-size: 1rem;
  cursor: pointer;
  margin-left: 10px;
  transition: all 0.3s ease;
}

.apply-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(255, 0, 222, 0.5);
}

.segments-input {
  margin-bottom: 20px;
}

.segments-input label {
  display: block;
  color: #ffeb3b;
  margin-bottom: 10px;
  font-size: 1.1rem;
}

#segment-inputs {
  max-height: 300px;
  overflow-y: auto;
  padding-right: 5px;
}

#segment-inputs::-webkit-scrollbar {
  width: 8px;
}

#segment-inputs::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

#segment-inputs::-webkit-scrollbar-thumb {
  background: linear-gradient(#ff00de, #00ffff);
  border-radius: 4px;
}

.segment-input-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
}

.segment-input-row span {
  color: #00ffff;
  font-size: 1rem;
  min-width: 30px;
}

.segment-input-row input {
  flex: 1;
  padding: 10px 12px;
  border: 2px solid #00ffff;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1rem;
  font-family: 'Jua', sans-serif;
}

.segment-input-row input:focus {
  outline: none;
  border-color: #ff00de;
  box-shadow: 0 0 10px rgba(255, 0, 222, 0.5);
}

.update-btn {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 15px;
  background: linear-gradient(145deg, #00ff88, #00cc6a);
  color: #1a0533;
  font-family: 'Black Han Sans', sans-serif;
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 20px;
}

.update-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

.preset-section {
  border-top: 2px solid rgba(255, 255, 255, 0.2);
  padding-top: 15px;
}

.preset-section label {
  display: block;
  color: #ffeb3b;
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.preset-btn {
  width: 100%;
  padding: 12px;
  margin-bottom: 8px;
  border: 2px solid #ff8c00;
  border-radius: 10px;
  background: rgba(255, 140, 0, 0.2);
  color: #fff;
  font-family: 'Jua', sans-serif;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.preset-btn:hover {
  background: rgba(255, 140, 0, 0.4);
  transform: translateX(5px);
  box-shadow: 0 0 15px rgba(255, 140, 0, 0.5);
}

/* Footer decoration */
.footer-decoration {
  text-align: center;
  margin-top: 40px;
  font-size: 3rem;
  animation: bounce 2s ease-in-out infinite;
}

.footer-decoration span {
  display: inline-block;
  margin: 0 15px;
  animation: footerFloat 3s ease-in-out infinite;
}

.footer-decoration span:nth-child(2) { animation-delay: 0.2s; }
.footer-decoration span:nth-child(3) { animation-delay: 0.4s; }
.footer-decoration span:nth-child(4) { animation-delay: 0.6s; }
.footer-decoration span:nth-child(5) { animation-delay: 0.8s; }

@keyframes footerFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

/* Confetti animation for winning */
@keyframes confetti {
  0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  top: -10px;
  z-index: 100;
  animation: confetti 3s linear forwards;
}

/* Responsive design */
@media (max-width: 900px) {
  .main-content {
    flex-direction: column;
    align-items: center;
  }

  .title {
    font-size: 2.5rem;
  }

  .wheel-frame {
    padding: 20px;
  }

  #wheel {
    width: 350px;
    height: 350px;
  }

  .spin-btn {
    width: 80px;
    height: 80px;
    font-size: 1rem;
  }

  .control-panel {
    min-width: 280px;
  }
}

@media (max-width: 500px) {
  .title {
    font-size: 2rem;
  }

  #wheel {
    width: 280px;
    height: 280px;
  }

  .spin-btn {
    width: 70px;
    height: 70px;
    font-size: 0.9rem;
  }

  .result {
    font-size: 1.5rem;
    padding: 15px 25px;
  }
}
