:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --electric-blue: #00d4ff;
  --magenta: #ff00ff;
  --purple: #8b5cf6;
  --neon-pink: #f472b6;
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --glass-bg: rgba(18, 18, 26, 0.7);
  --glass-border: rgba(139, 92, 246, 0.3);
}

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

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

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

.background-effects {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.gradient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.4;
  animation: float 20s ease-in-out infinite;
}

.orb-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--purple), transparent 70%);
  top: -200px;
  right: -200px;
  animation-delay: 0s;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--electric-blue), transparent 70%);
  bottom: -150px;
  left: -150px;
  animation-delay: -7s;
}

.orb-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--magenta), transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -14s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -30px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(20px, 30px) scale(1.02); }
}

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

.title {
  font-size: clamp(1.8rem, 5vw, 3.5rem);
  font-weight: 700;
  background: linear-gradient(135deg, var(--electric-blue), var(--purple), var(--magenta));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 60px rgba(139, 92, 246, 0.5);
  animation: glow 3s ease-in-out infinite alternate;
}

@keyframes glow {
  from { filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.3)); }
  to { filter: drop-shadow(0 0 40px rgba(0, 212, 255, 0.4)); }
}

.tagline {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-top: 0.5rem;
  font-weight: 300;
}

.main-content {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.builder-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 2rem;
  box-shadow: 
    0 0 40px rgba(139, 92, 246, 0.1),
    inset 0 0 60px rgba(139, 92, 246, 0.05);
  animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.input-group {
  margin-bottom: 1.5rem;
}

.subject-input {
  width: 100%;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: var(--text-primary);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.subject-input:focus {
  outline: none;
  border-color: var(--electric-blue);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

.subject-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

.dropdowns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.dropdown-container {
  position: relative;
}

.dropdown-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dropdown-trigger {
  width: 100%;
  padding: 0.875rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
}

.dropdown-trigger:hover, .dropdown-trigger.open {
  border-color: var(--purple);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
}

.dropdown-value {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.dropdown-arrow {
  font-size: 0.7rem;
  transition: transform 0.3s ease;
  color: var(--text-secondary);
}

.dropdown-arrow.open {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  max-height: 280px;
  overflow-y: auto;
  z-index: 100;
  animation: dropdownSlide 0.2s ease-out;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

@keyframes dropdownSlide {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.dropdown-item:hover {
  background: rgba(139, 92, 246, 0.2);
}

.dropdown-item.selected {
  background: rgba(139, 92, 246, 0.3);
  color: var(--electric-blue);
}

.dropdown-menu::-webkit-scrollbar {
  width: 6px;
}

.dropdown-menu::-webkit-scrollbar-track {
  background: transparent;
}

.dropdown-menu::-webkit-scrollbar-thumb {
  background: var(--purple);
  border-radius: 3px;
}

.action-buttons {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.randomize-btn {
  flex: 1;
  min-width: 150px;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, var(--purple), var(--magenta));
  border: none;
  border-radius: 12px;
  color: white;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.3);
}

.randomize-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 50px rgba(139, 92, 246, 0.5);
}

.randomize-btn.rolling .dice-icon {
  animation: roll 0.6s ease-out;
}

@keyframes roll {
  0% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(180deg) scale(1.2); }
  50% { transform: rotate(360deg) scale(1); }
  75% { transform: rotate(540deg) scale(1.1); }
  100% { transform: rotate(720deg) scale(1); }
}

.dice-icon {
  font-size: 1.3rem;
  display: inline-block;
}

.reset-btn {
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: var(--text-secondary);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.reset-btn:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.prompt-display {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.prompt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.hint {
  font-size: 0.75rem;
  opacity: 0.6;
}

.prompt-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  word-break: break-word;
}

.prompt-subject { color: #22c55e; }
.prompt-style { color: var(--purple); }
.prompt-lighting { color: #fbbf24; }
.prompt-camera { color: var(--electric-blue); }
.prompt-mood { color: var(--neon-pink); }
.prompt-params { color: var(--text-secondary); opacity: 0.8; }

.copy-btn {
  width: 100%;
  padding: 1.125rem;
  background: linear-gradient(135deg, var(--electric-blue), var(--purple));
  border: none;
  border-radius: 12px;
  color: white;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.3);
}

.copy-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 50px rgba(0, 212, 255, 0.5);
}

.copy-btn.copied {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 0 30px rgba(34, 197, 94, 0.4);
}

.advanced-section {
  margin-top: 1.5rem;
  border-top: 1px solid var(--glass-border);
  padding-top: 1rem;
}

.advanced-toggle, .history-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.5rem 0;
  transition: color 0.3s ease;
}

.advanced-toggle:hover, .history-toggle:hover {
  color: var(--electric-blue);
}

.advanced-panel {
  margin-top: 1rem;
  animation: fadeIn 0.3s ease-out;
}

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

.advanced-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.slider-group {
  margin-bottom: 1rem;
}

.slider-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  -webkit-appearance: none;
  appearance: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--electric-blue), var(--purple));
  cursor: pointer;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
  transition: transform 0.2s ease;
}

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

.history-section {
  margin-top: 1.5rem;
}

.history-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1rem;
  margin-top: 0.75rem;
  animation: fadeIn 0.3s ease-out;
}

.history-empty {
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-align: center;
  padding: 1rem;
}

.clear-history-btn {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  margin-bottom: 1rem;
  transition: all 0.3s ease;
}

.clear-history-btn:hover {
  background: rgba(239, 68, 68, 0.3);
}

.history-item {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid transparent;
  word-break: break-word;
}

.history-item:hover {
  background: rgba(139, 92, 246, 0.1);
  border-color: var(--purple);
}

.history-item:last-child {
  margin-bottom: 0;
}

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  padding: 1rem 2rem;
  border-radius: 12px;
  font-weight: 600;
  box-shadow: 0 10px 40px rgba(34, 197, 94, 0.4);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-secondary);
  position: relative;
  z-index: 1;
}

.footer a {
  color: var(--electric-blue);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer a:hover {
  color: var(--magenta);
}

.footer-message {
  font-size: 0.85rem;
  margin-top: 0.5rem;
  opacity: 0.7;
}

@media (max-width: 640px) {
  .builder-card {
    padding: 1.25rem;
  }
  
  .dropdowns-grid {
    grid-template-columns: 1fr;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .randomize-btn, .reset-btn {
    width: 100%;
  }
  
  .prompt-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
  
  .advanced-grid {
    grid-template-columns: 1fr;
  }
}