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

:root {
  --bg-dark: #0a0a0f;
  --bg-card: rgba(20, 20, 30, 0.6);
  --purple: #8b5cf6;
  --pink: #ec4899;
  --cyan: #06b6d4;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
}

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  background-image: 
    radial-gradient(ellipse at 20% 0%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(236, 72, 153, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(6, 182, 212, 0.05) 0%, transparent 70%);
}

.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.chaos-mode {
  animation: chaosHue 2s infinite linear;
}

@keyframes chaosHue {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

.app-header {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.2));
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(139, 92, 246, 0.5); }
  50% { box-shadow: 0 0 40px rgba(236, 72, 153, 0.7); }
}

.sidebar-toggle {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 1.2rem;
  cursor: pointer;
}

.main-layout {
  flex: 1;
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  padding: 1rem;
  gap: 1rem;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 1.25rem;
}

.section-title {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
  background: linear-gradient(90deg, var(--purple), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.genre-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.5rem;
}

.genre-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--text);
}

.genre-card:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: var(--purple);
  transform: translateY(-2px);
}

.genre-card.selected {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.4), rgba(236, 72, 153, 0.4));
  border-color: var(--pink);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.fusion-badge {
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(90deg, var(--purple), var(--pink));
  border-radius: 20px;
  text-align: center;
  font-weight: 600;
  font-size: 0.875rem;
  animation: shimmer 2s infinite;
}

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

.mood-sliders {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mood-slider-container {
  padding: 0.5rem 0;
}

.mood-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--slider-color-1), var(--slider-color-2));
  outline: none;
  cursor: pointer;
}

.mood-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s;
}

.mood-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.prompt-container {
  position: relative;
}

.prompt-input {
  width: 100%;
  min-height: 100px;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.875rem;
  resize: vertical;
  transition: border-color 0.3s;
}

.prompt-input:focus {
  outline: none;
  border-color: var(--purple);
}

.prompt-input::placeholder {
  color: var(--text-dim);
  opacity: 0.6;
}

.inspire-btn {
  padding: 0.5rem 1rem;
  background: linear-gradient(90deg, var(--cyan), var(--purple));
  border: none;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  font-size: 0.75rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.inspire-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.4);
}

.visualizer-section {
  position: relative;
  min-height: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.visualizer-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.generate-btn {
  position: relative;
  z-index: 10;
  padding: 1rem 2rem;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  border: none;
  border-radius: 50px;
  color: white;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.5);
}

.generate-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 0 50px rgba(236, 72, 153, 0.7);
}

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

.generate-btn.generating {
  animation: glowPulse 1s infinite;
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 30px rgba(139, 92, 246, 0.5); }
  50% { box-shadow: 0 0 60px rgba(236, 72, 153, 0.8); }
}

.result-panel {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(236, 72, 153, 0.15));
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.result-title {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(90deg, var(--cyan), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.result-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--text-dim);
}

.result-meta span {
  padding: 0.25rem 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
}

.result-vibe {
  font-style: italic;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.lyrics-container {
  margin-bottom: 1rem;
}

.lyrics-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  line-height: 1.8;
  white-space: pre-wrap;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.instruments-container {
  margin-bottom: 1rem;
}

.instruments-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.instrument-tag {
  padding: 0.25rem 0.75rem;
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.3), rgba(6, 182, 212, 0.3));
  border-radius: 20px;
  font-size: 0.75rem;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.action-btn {
  flex: 1;
  min-width: 100px;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn.save {
  background: linear-gradient(90deg, var(--purple), var(--pink));
  color: white;
}

.action-btn.copy {
  background: rgba(6, 182, 212, 0.2);
  color: var(--cyan);
  border: 1px solid var(--cyan);
}

.action-btn.share {
  background: rgba(236, 72, 153, 0.2);
  color: var(--pink);
  border: 1px solid var(--pink);
}

.action-btn:hover {
  transform: translateY(-2px);
}

.tips-panel {
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.3);
}

.sidebar {
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar-section {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 1rem;
}

.sidebar-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
  color: var(--text-dim);
}

.presets-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.preset-btn {
  width: 100%;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
}

.preset-btn:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: var(--purple);
}

.saved-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 400px;
  overflow-y: auto;
}

.saved-creation {
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.saved-creation:hover {
  background: rgba(236, 72, 153, 0.15);
  border-color: var(--pink);
}

.genre-tag {
  padding: 0.125rem 0.5rem;
  background: rgba(139, 92, 246, 0.3);
  border-radius: 10px;
  font-size: 0.625rem;
  text-transform: uppercase;
}

.app-footer {
  text-align: center;
  padding: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.75rem;
  color: var(--text-dim);
}

.footer-link {
  color: var(--pink);
  text-decoration: none;
  font-weight: 600;
}

.footer-link:hover {
  text-decoration: underline;
}

.disclaimer {
  margin-top: 0.5rem;
  opacity: 0.6;
  font-size: 0.65rem;
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100vh;
    background: var(--bg-dark);
    z-index: 200;
    padding: 1rem;
    padding-top: 5rem;
    transition: right 0.3s ease;
    overflow-y: auto;
  }

  .sidebar.show {
    right: 0;
  }

  .genre-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .result-actions {
    flex-direction: column;
  }

  .action-btn {
    flex: none;
    width: 100%;
  }
}

@media (min-width: 1024px) {
  .sidebar-toggle {
    display: none;
  }
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--purple), var(--pink));
  border-radius: 4px;
}