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

body {
  font-family: 'Quicksand', sans-serif;
  background: linear-gradient(135deg, #0f0520 0%, #1a0a2e 50%, #0d1b2a 100%);
  min-height: 100vh;
  color: #e8d5f0;
  overflow-x: hidden;
}

.app-container {
  min-height: 100vh;
  position: relative;
}

.stars {
  position: fixed;
  inset: 0;
  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.6), 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 380px 60px, #fff, transparent),
    radial-gradient(2px 2px at 450px 200px, rgba(255,255,255,0.5), transparent);
  background-size: 500px 500px;
  animation: twinkle 8s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

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

.header {
  text-align: center;
  padding: 2rem 1rem 1rem;
  position: relative;
  z-index: 1;
}

.title {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(1.8rem, 6vw, 3.5rem);
  font-weight: 900;
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FFD700 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 40px rgba(255, 215, 0, 0.5);
  animation: glow 3s ease-in-out infinite alternate;
}

@keyframes glow {
  from { filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.5)); }
  to { filter: drop-shadow(0 0 40px rgba(255, 215, 0, 0.8)); }
}

.subtitle {
  font-size: 1.1rem;
  color: #aa96da;
  margin-top: 0.5rem;
  font-weight: 500;
}

.main-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  padding: 1rem;
  position: relative;
  z-index: 1;
}

@media (min-width: 1024px) {
  .main-content {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem;
  }
}

.wheel-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.wheel-container {
  position: relative;
  width: min(90vw, 400px);
  height: min(90vw, 400px);
}

.wheel-canvas {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 30px rgba(138, 43, 226, 0.4));
}

.pointer {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-top: 40px solid #FFD700;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
  z-index: 10;
}

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

.spin-button {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.4rem;
  font-weight: 700;
  padding: 1rem 2.5rem;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, #6C5CE7 0%, #A29BFE 50%, #6C5CE7 100%);
  color: white;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  box-shadow: 
    0 0 30px rgba(108, 92, 231, 0.6),
    inset 0 2px 4px rgba(255,255,255,0.3);
  transition: all 0.3s ease;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 30px rgba(108, 92, 231, 0.6); }
  50% { box-shadow: 0 0 50px rgba(255, 215, 0, 0.8); }
}

.spin-button:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 0 50px rgba(255, 215, 0, 0.8);
}

.spin-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  animation: none;
}

.spin-button.spinning {
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FFD700 100%);
  animation: spinning-glow 0.5s ease-in-out infinite alternate;
}

@keyframes spinning-glow {
  from { box-shadow: 0 0 30px rgba(255, 215, 0, 0.6); }
  to { box-shadow: 0 0 60px rgba(255, 215, 0, 1); }
}

.controls-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 400px;
}

.panel {
  background: rgba(45, 27, 78, 0.8);
  border-radius: 16px;
  padding: 1.25rem;
  border: 1px solid rgba(170, 150, 218, 0.3);
  backdrop-filter: blur(10px);
}

.panel-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.1rem;
  color: #FFD700;
  margin-bottom: 1rem;
  text-align: center;
}

.input-group {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.name-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid rgba(170, 150, 218, 0.5);
  border-radius: 12px;
  background: rgba(15, 5, 32, 0.8);
  color: #e8d5f0;
  font-family: 'Quicksand', sans-serif;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.name-input:focus {
  outline: none;
  border-color: #FFD700;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.name-input::placeholder {
  color: rgba(170, 150, 218, 0.6);
}

.add-button {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #00B894, #00D9A5);
  color: white;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.add-button:hover {
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(0, 184, 148, 0.6);
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.preset-button {
  padding: 0.4rem 0.8rem;
  border: 1px solid rgba(170, 150, 218, 0.5);
  border-radius: 20px;
  background: transparent;
  color: #aa96da;
  font-family: 'Quicksand', sans-serif;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.preset-button:hover {
  background: rgba(170, 150, 218, 0.2);
  border-color: #FFD700;
  color: #FFD700;
}

.names-count {
  font-size: 0.85rem;
  color: #aa96da;
  margin-bottom: 0.75rem;
  text-align: center;
}

.names-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.names-list::-webkit-scrollbar {
  width: 6px;
}

.names-list::-webkit-scrollbar-thumb {
  background: rgba(170, 150, 218, 0.5);
  border-radius: 3px;
}

.name-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  color: #1a0a2e;
  font-weight: 600;
}

.remove-button {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.3);
  color: white;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-button:hover {
  background: rgba(255, 0, 0, 0.6);
  transform: scale(1.1);
}

.clear-button {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid rgba(255, 107, 107, 0.5);
  border-radius: 8px;
  background: transparent;
  color: #FF6B6B;
  font-family: 'Quicksand', sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
}

.clear-button:hover {
  background: rgba(255, 107, 107, 0.2);
}

.setting-label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: #aa96da;
}

.voice-select {
  padding: 0.6rem;
  border: 1px solid rgba(170, 150, 218, 0.5);
  border-radius: 8px;
  background: rgba(15, 5, 32, 0.8);
  color: #e8d5f0;
  font-family: 'Quicksand', sans-serif;
  cursor: pointer;
}

.voice-select:focus {
  outline: none;
  border-color: #FFD700;
}

.speed-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(170, 150, 218, 0.3);
  appearance: none;
  cursor: pointer;
}

.speed-slider::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  font-size: 0.95rem;
}

.toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #FFD700;
  cursor: pointer;
}

.history-list {
  list-style: none;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(170, 150, 218, 0.2);
  font-size: 0.95rem;
}

.history-item:last-child {
  border-bottom: none;
}

.history-icon {
  font-size: 1rem;
}

.winner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 5, 32, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.winner-modal {
  background: linear-gradient(135deg, #2D1B4E 0%, #1a0a2e 100%);
  border: 3px solid #FFD700;
  border-radius: 24px;
  padding: 3rem 2rem;
  text-align: center;
  max-width: 90vw;
  box-shadow: 
    0 0 60px rgba(255, 215, 0, 0.5),
    inset 0 0 60px rgba(255, 215, 0, 0.1);
  animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.winner-crown {
  font-size: 4rem;
  animation: bounce 1s ease infinite;
}

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

.winner-text {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.2rem;
  color: #aa96da;
  margin: 1rem 0 0.5rem;
  letter-spacing: 3px;
}

.winner-name {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(2rem, 8vw, 3.5rem);
  font-weight: 900;
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FFD700 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: glow 1s ease-in-out infinite alternate;
  margin: 0.5rem 0;
}

.winner-subtitle {
  font-size: 1.1rem;
  color: #e8d5f0;
  margin-bottom: 1.5rem;
}

.close-winner {
  padding: 0.75rem 2rem;
  border: 2px solid #FFD700;
  border-radius: 30px;
  background: transparent;
  color: #FFD700;
  font-family: 'Cinzel Decorative', serif;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

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

.confetti-particle {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confetti-fall 3s linear forwards;
  z-index: 150;
  pointer-events: none;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-20px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg) translateX(var(--drift, 0));
    opacity: 0;
  }
}

.footer {
  text-align: center;
  padding: 2rem 1rem;
  color: #aa96da;
  font-size: 0.9rem;
  position: relative;
  z-index: 1;
}

.remix-link {
  color: #FFD700;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
}

.remix-link:hover {
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

@media (max-width: 480px) {
  .wheel-container {
    width: min(85vw, 320px);
    height: min(85vw, 320px);
  }
  
  .spin-button {
    font-size: 1.1rem;
    padding: 0.8rem 1.8rem;
  }
  
  .panel {
    padding: 1rem;
  }
}