:root {
  --bg-deep: #06060f;
  --bg-card: rgba(15, 15, 35, 0.7);
  --neon-blue: #00d4ff;
  --neon-purple: #a855f7;
  --neon-pink: #ec4899;
  --neon-green: #22d3ee;
  --text-primary: #e8e8f0;
  --text-muted: #8888aa;
}

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

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

/* Animated background */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: 
    radial-gradient(ellipse 80% 50% at 20% 20%, rgba(168, 85, 247, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(0, 212, 255, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 50% 50%, rgba(236, 72, 153, 0.04) 0%, transparent 60%);
  z-index: -1;
  animation: bgPulse 12s ease-in-out infinite alternate;
}

@keyframes bgPulse {
  0% { opacity: 0.8; transform: scale(1); }
  100% { opacity: 1; transform: scale(1.05); }
}

/* Sparkle particles */
.sparkle-container {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 200px;
  overflow: hidden;
  pointer-events: none;
}

.sparkle {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  animation: sparkleFloat 4s ease-in-out infinite;
}

@keyframes sparkleFloat {
  0% { opacity: 0; transform: translateY(0) scale(0); }
  20% { opacity: 1; transform: translateY(-20px) scale(1); }
  80% { opacity: 0.6; }
  100% { opacity: 0; transform: translateY(-120px) scale(0.3); }
}

/* Glow textarea */
.glow-textarea {
  background: rgba(10, 10, 30, 0.8);
  border: 1.5px solid rgba(0, 212, 255, 0.25);
  border-radius: 16px;
  transition: all 0.4s ease;
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.05);
}

.glow-textarea:focus {
  border-color: var(--neon-blue);
  box-shadow: 
    0 0 20px rgba(0, 212, 255, 0.15),
    0 0 60px rgba(0, 212, 255, 0.05),
    inset 0 0 20px rgba(0, 212, 255, 0.03);
  outline: none;
}

/* Glass card */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
}

/* Generate button */
.generate-btn {
  background: linear-gradient(135deg, var(--neon-purple), var(--neon-pink), var(--neon-blue));
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
  border: none;
  border-radius: 14px;
  color: white;
  font-weight: 800;
  font-size: 1.1rem;
  padding: 16px 40px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
}

.generate-btn::before {
  content: '';
  position: absolute;
  top: 0; left: -100%; right: 0; bottom: 0;
  width: 300%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  animation: shimmer 2.5s ease infinite;
}

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

.generate-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 40px rgba(168, 85, 247, 0.4);
}

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

.generate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Style chips */
.style-chip {
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: 100px;
  padding: 6px 16px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.25s ease;
  color: var(--text-muted);
  white-space: nowrap;
}

.style-chip:hover {
  background: rgba(168, 85, 247, 0.2);
  border-color: var(--neon-purple);
  color: var(--neon-purple);
  transform: translateY(-1px);
}

.style-chip.active {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(236, 72, 153, 0.3));
  border-color: var(--neon-purple);
  color: white;
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.2);
}

/* Progress bar */
.progress-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 100px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--neon-purple), var(--neon-blue), var(--neon-pink));
  background-size: 300% 100%;
  animation: progressGlow 2s linear infinite;
  transition: width 0.5s ease;
}

@keyframes progressGlow {
  0% { background-position: 0% 0%; }
  100% { background-position: 300% 0%; }
}

/* Filmstrip */
.filmstrip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(168, 85, 247, 0.3) transparent;
}

.filmstrip::-webkit-scrollbar { height: 4px; }
.filmstrip::-webkit-scrollbar-track { background: transparent; }
.filmstrip::-webkit-scrollbar-thumb { background: rgba(168, 85, 247, 0.3); border-radius: 100px; }

.film-frame {
  flex: 0 0 100px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.3s ease;
  position: relative;
}

.film-frame.active {
  border-color: var(--neon-blue);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.3);
}

.film-frame.loading {
  animation: framePulse 1.5s ease-in-out infinite;
}

@keyframes framePulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

/* Player */
.player-container {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 16/9;
}

.player-frame {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  object-fit: cover;
  transition: opacity 1s ease;
}

.player-container video {
  background: #000;
}

.player-container video::-webkit-media-controls-panel {
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
}

/* Thumbnail */
.thumbnail-card {
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all 0.3s ease;
}

.thumbnail-card:hover {
  border-color: rgba(168, 85, 247, 0.3);
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

/* Scrollbar global */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(168, 85, 247, 0.2); border-radius: 100px; }

/* Film reel spinner */
.film-reel {
  display: inline-block;
  animation: spin 1.5s linear infinite;
}

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

/* Fullscreen mode */
.fullscreen-player {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 9999 !important;
  border-radius: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
}

/* Subtitle bar */
.subtitle-bar {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  border-radius: 8px;
  padding: 8px 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: #fff;
  text-align: center;
  max-width: 80%;
  margin: 0 auto;
}

/* Mono text */
.mono { font-family: 'JetBrains Mono', monospace; }

/* Speed selector */
.speed-btn {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid rgba(255,255,255,0.1);
  background: transparent;
  color: var(--text-muted);
}

.speed-btn.active {
  background: var(--neon-blue);
  color: #000;
  border-color: var(--neon-blue);
  font-weight: 700;
}

/* Pulse dot */
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-green);
  animation: pulseDot 1.2s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

@media (max-width: 768px) {
  .generate-btn {
    font-size: 0.95rem;
    padding: 14px 28px;
  }
  
  .player-container {
    aspect-ratio: 4/3;
  }
}