:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(25, 25, 40, 0.7);
  --accent-cyan: #00d4ff;
  --accent-magenta: #ff00aa;
  --accent-gold: #ffd700;
  --text-primary: #f0f0f5;
  --text-secondary: #8888aa;
  --border-glow: rgba(0, 212, 255, 0.3);
}

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

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

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

/* Header */
.header {
  position: relative;
  padding: 2rem;
  background: linear-gradient(180deg, rgba(20, 10, 40, 0.9) 0%, transparent 100%);
  overflow: hidden;
}

.header-content {
  position: relative;
  z-index: 2;
  text-align: center;
}

.title {
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-magenta) 50%, var(--accent-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.title-icon {
  display: inline-block;
  animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}

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

/* Particles */
.particles-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  background: var(--accent-cyan);
  border-radius: 50%;
  opacity: 0;
  animation: float linear infinite;
}

@keyframes float {
  0% { opacity: 0; transform: translateY(0) scale(0); }
  10% { opacity: 0.8; }
  90% { opacity: 0.8; }
  100% { opacity: 0; transform: translateY(-100px) scale(1); }
}

/* Mobile Warning */
.mobile-warning {
  background: linear-gradient(90deg, var(--accent-magenta), var(--accent-cyan));
  padding: 0.5rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
}

/* Main Content */
.main-content {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

@media (min-width: 1024px) {
  .main-content {
    grid-template-columns: 1fr 380px;
  }
}

/* Preview Section */
.preview-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.artwork-container {
  aspect-ratio: 1024 / 1448;
  max-height: 70vh;
  background: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
}

.artwork-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.empty-state, .error-state {
  flex-direction: column;
  text-align: center;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.error-text {
  color: var(--accent-magenta);
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.error-message {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.retry-btn {
  background: transparent;
  border: 1px solid var(--accent-magenta);
  color: var(--accent-magenta);
  padding: 0.5rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.retry-btn:hover {
  background: var(--accent-magenta);
  color: white;
}

/* Loading State */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.loading-rings {
  position: relative;
  width: 100px;
  height: 100px;
}

.ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid transparent;
  animation: spin linear infinite;
}

.ring-1 {
  inset: 0;
  border-top-color: var(--accent-cyan);
  animation-duration: 1.5s;
}

.ring-2 {
  inset: 10px;
  border-right-color: var(--accent-magenta);
  animation-duration: 2s;
  animation-direction: reverse;
}

.ring-3 {
  inset: 20px;
  border-bottom-color: var(--accent-gold);
  animation-duration: 2.5s;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 1.1rem;
  color: var(--text-primary);
}

.loading-hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Download Button */
.download-btn {
  background: linear-gradient(135deg, #1a3a2a 0%, #0d2a1a 100%);
  border: 1px solid rgba(0, 255, 100, 0.3);
  color: #00ff64;
  padding: 1rem 2rem;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.download-btn:hover {
  border-color: #00ff64;
  box-shadow: 0 0 20px rgba(0, 255, 100, 0.3);
  transform: translateY(-2px);
}

/* Controls Section */
.controls-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.control-group label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Mood Chips */
.mood-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.mood-chip {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  backdrop-filter: blur(10px);
}

.mood-chip:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.mood-chip.selected {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta));
  border-color: transparent;
  color: white;
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.4);
}

/* Prompt Input */
.prompt-input-container {
  position: relative;
}

.prompt-input {
  width: 100%;
  min-height: 100px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1rem;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  resize: vertical;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

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

.prompt-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

.char-counter {
  position: absolute;
  bottom: 0.5rem;
  right: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}

/* Reference Upload */
.reference-upload {
  background: var(--bg-card);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.reference-upload:hover, .reference-upload.dragging {
  border-color: var(--accent-cyan);
  background: rgba(0, 212, 255, 0.05);
}

.upload-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.upload-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.reference-preview {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 1rem;
  backdrop-filter: blur(10px);
}

.reference-thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
}

.clear-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  background: var(--accent-magenta);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reference-note {
  font-size: 0.8rem;
  color: var(--text-secondary);
  flex: 1;
}

/* Generate Button */
.generate-btn {
  background: linear-gradient(135deg, var(--accent-magenta) 0%, #8800aa 100%);
  border: none;
  color: white;
  padding: 1.25rem 2rem;
  border-radius: 12px;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.generate-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: translateX(-100%);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  100% { transform: translateX(100%); }
}

.generate-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(255, 0, 170, 0.4);
}

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

/* History Panel */
.history-panel {
  margin-top: 1rem;
}

.history-panel h3 {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}

.history-item {
  aspect-ratio: 1024 / 1448;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  opacity: 0.7;
  transition: all 0.3s ease;
  border: 1px solid transparent;
}

.history-item:hover {
  opacity: 1;
  border-color: var(--accent-cyan);
  transform: scale(1.05);
}

.history-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Footer */
.footer {
  padding: 1.5rem 2rem;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: var(--bg-secondary);
}

.footer p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.footer .style-note {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  opacity: 0.7;
}

.footer a {
  color: var(--accent-cyan);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

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

/* Responsive */
@media (max-width: 768px) {
  .main-content {
    padding: 1rem;
    gap: 1.5rem;
  }
  
  .artwork-container {
    max-height: 50vh;
  }
  
  .prompt-input {
    min-height: 80px;
  }
  
  .history-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}