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

body {
  font-family: 'Rubik', sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Star particles background */
.stars-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.star-particle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: #ffc107;
  border-radius: 50%;
  animation: twinkle 3s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.5); }
}

.star-particle:nth-child(1) { top: 5%; left: 10%; animation-delay: 0s; }
.star-particle:nth-child(2) { top: 15%; left: 80%; animation-delay: 0.5s; }
.star-particle:nth-child(3) { top: 25%; left: 30%; animation-delay: 1s; }
.star-particle:nth-child(4) { top: 35%; left: 60%; animation-delay: 1.5s; }
.star-particle:nth-child(5) { top: 45%; left: 15%; animation-delay: 2s; }
.star-particle:nth-child(6) { top: 55%; left: 90%; animation-delay: 0.3s; }
.star-particle:nth-child(7) { top: 65%; left: 45%; animation-delay: 0.8s; }
.star-particle:nth-child(8) { top: 75%; left: 70%; animation-delay: 1.3s; }
.star-particle:nth-child(9) { top: 85%; left: 25%; animation-delay: 1.8s; }
.star-particle:nth-child(10) { top: 95%; left: 55%; animation-delay: 2.3s; }
.star-particle:nth-child(11) { top: 10%; left: 50%; animation-delay: 0.7s; width: 2px; height: 2px; }
.star-particle:nth-child(12) { top: 30%; left: 85%; animation-delay: 1.2s; width: 4px; height: 4px; }
.star-particle:nth-child(13) { top: 50%; left: 5%; animation-delay: 1.7s; }
.star-particle:nth-child(14) { top: 70%; left: 35%; animation-delay: 2.2s; width: 2px; height: 2px; }
.star-particle:nth-child(15) { top: 90%; left: 75%; animation-delay: 0.2s; width: 4px; height: 4px; }

/* Desktop scaling */
@media (min-width: 768px) {
  .desktop-container {
    max-width: 960px;
  }
}

@media (min-width: 1200px) {
  .desktop-container {
    max-width: 1100px;
  }
}

@media (min-width: 1600px) {
  .desktop-container {
    max-width: 1300px;
  }
}

/* Kirby title gradient */
.kirby-title {
  font-size: 4.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #ff9a9e 0%, #ffc3a0 20%, #ff6b9d 40%, #ff9a9e 60%, #ffc3a0 80%, #ff6b9d 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 4px 20px rgba(255, 107, 157, 0.4));
  letter-spacing: -2px;
  line-height: 1;
}

/* Custom range slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: linear-gradient(to right, #ff6b6b 0%, #ff6b6b var(--val, 50%), #3a3a5e var(--val, 50%), #3a3a5e 100%);
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffc107;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
  transition: transform 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffc107;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #3a3a5e;
  border-radius: 26px;
  transition: 0.3s;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: #b2bec3;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background: linear-gradient(135deg, #6c5ce7, #a855f7);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(22px);
  background-color: #fff;
}

/* Character card */
.character-card {
  transition: all 0.2s ease;
  cursor: pointer;
  border-left: 4px solid transparent;
}

.character-card:hover {
  background: #33335a !important;
  transform: translateX(4px);
}

.character-card.selected {
  border-left-color: #ffc107;
  background: #2d2d52 !important;
  box-shadow: 0 0 15px rgba(255, 193, 7, 0.15);
}

/* Desktop character grid */
@media (min-width: 768px) {
  .character-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
}

@media (min-width: 1200px) {
  .character-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Generate button */
.generate-btn {
  transition: all 0.2s ease;
}

.generate-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 25px rgba(255, 193, 7, 0.4);
}

.generate-btn:active {
  transform: scale(0.98);
}

/* Loading spinner */
@keyframes spin-star {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.spin-star {
  animation: spin-star 1s linear infinite;
  display: inline-block;
}

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

.confetti-piece {
  position: fixed;
  top: -10px;
  width: 10px;
  height: 10px;
  z-index: 100;
  pointer-events: none;
  animation: confetti-fall 3s ease-out forwards;
}

/* Tooltip */
.tooltip-container {
  position: relative;
  display: inline-block;
}

.tooltip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: #16213e;
  color: #e0e0e0;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  white-space: nowrap;
  border: 1px solid #3a3a5e;
  transition: opacity 0.2s;
  z-index: 50;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.tooltip-container:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Textarea */
textarea {
  font-family: 'Rubik', sans-serif;
}

textarea:focus, input:focus {
  outline: none;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #1a1a2e;
}

::-webkit-scrollbar-thumb {
  background: #3a3a5e;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #4a4a6e;
}

/* Modal overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

/* Episode script formatting */
.episode-script p {
  margin-bottom: 0.75rem;
}

@media (min-width: 768px) {
  .episode-script {
    font-size: 0.95rem;
    line-height: 1.8;
  }
}

/* Desktop layout enhancements */
@media (min-width: 768px) {
  .kirby-title {
    font-size: 5.5rem;
  }

  .section-card {
    padding: 2rem;
  }

  .options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .action-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
  }
}

@media (min-width: 1200px) {
  .kirby-title {
    font-size: 6rem;
  }
}

/* Section accent border */
.section-card {
  border-left: 3px solid #6c5ce7;
}

/* Pulse animation for loading */
@keyframes pulse-pink {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.4); }
  50% { box-shadow: 0 0 20px 10px rgba(255, 107, 107, 0); }
}

.pulse-loading {
  animation: pulse-pink 1.5s ease-in-out infinite;
}

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

.float-anim {
  animation: float 3s ease-in-out infinite;
}