:root {
  --bg-deep: #07060d;
  --bg-card: #0e0d18;
  --bg-glass: rgba(18, 16, 32, 0.7);
  --purple: #a855f7;
  --cyan: #06d6d6;
  --pink: #ec4899;
  --magenta: #d946ef;
}

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

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

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: 
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(168,85,247,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 90%, rgba(6,214,214,0.04) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(236,72,153,0.03) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

#root { position: relative; z-index: 1; }

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

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(168,85,247,0.3), 0 0 40px rgba(236,72,153,0.1); }
  50% { box-shadow: 0 0 30px rgba(168,85,247,0.5), 0 0 60px rgba(236,72,153,0.2); }
}

@keyframes float-in {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

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

@keyframes frame-reveal {
  from { opacity: 0; transform: scale(0.8) rotateY(20deg); }
  to { opacity: 1; transform: scale(1) rotateY(0deg); }
}

@keyframes sparkle-float {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 1; }
  50% { transform: translateY(-8px) rotate(180deg); opacity: 0.6; }
}

.title-gradient {
  background: linear-gradient(135deg, #a855f7, #06d6d6, #ec4899, #a855f7);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 4s ease infinite;
}

.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(168,85,247,0.12);
  border-radius: 16px;
}

.glow-border {
  border: 1px solid rgba(168,85,247,0.25);
  box-shadow: 0 0 15px rgba(168,85,247,0.08), inset 0 0 15px rgba(168,85,247,0.03);
}

.glow-border:focus-within {
  border-color: rgba(168,85,247,0.5);
  box-shadow: 0 0 25px rgba(168,85,247,0.15), inset 0 0 25px rgba(168,85,247,0.05);
}

.gen-button {
  background: linear-gradient(135deg, #a855f7, #ec4899);
  animation: pulse-glow 2.5s ease-in-out infinite;
  transition: all 0.3s ease;
}

.gen-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 40px rgba(168,85,247,0.4), 0 0 80px rgba(236,72,153,0.2);
}

.gen-button:disabled {
  animation: none;
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.gen-button .spinner {
  animation: spin 1s linear infinite;
}

.style-chip {
  background: rgba(168,85,247,0.08);
  border: 1px solid rgba(168,85,247,0.2);
  transition: all 0.25s ease;
  cursor: pointer;
}

.style-chip:hover {
  background: rgba(168,85,247,0.15);
  border-color: rgba(168,85,247,0.4);
  transform: translateY(-1px);
}

.style-chip.active {
  background: rgba(168,85,247,0.25);
  border-color: var(--purple);
  box-shadow: 0 0 12px rgba(168,85,247,0.2);
}

.viewport {
  aspect-ratio: 16/9;
  background: #09081280;
  border: 1px solid rgba(168,85,247,0.15);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.frame-thumb {
  transition: all 0.2s ease;
  cursor: pointer;
  border: 2px solid transparent;
}

.frame-thumb:hover {
  border-color: rgba(168,85,247,0.5);
  transform: scale(1.05);
}

.frame-thumb.active {
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(6,214,214,0.3);
}

.frame-reveal {
  animation: frame-reveal 0.5s ease forwards;
}

.control-btn {
  background: rgba(168,85,247,0.1);
  border: 1px solid rgba(168,85,247,0.2);
  color: #e2e0f0;
  transition: all 0.2s ease;
  cursor: pointer;
}

.control-btn:hover {
  background: rgba(168,85,247,0.2);
  border-color: rgba(168,85,247,0.4);
}

.control-btn.active {
  background: rgba(6,214,214,0.15);
  border-color: var(--cyan);
  color: var(--cyan);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  height: 6px;
}

input[type="range"]::-webkit-slider-track {
  background: rgba(168,85,247,0.15);
  border-radius: 3px;
  height: 6px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  border-radius: 50%;
  border: 2px solid var(--bg-deep);
  box-shadow: 0 0 8px rgba(168,85,247,0.4);
  margin-top: -6px;
}

input[type="range"]::-moz-range-track {
  background: rgba(168,85,247,0.15);
  border-radius: 3px;
  height: 6px;
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  border-radius: 50%;
  border: 2px solid var(--bg-deep);
  box-shadow: 0 0 8px rgba(168,85,247,0.4);
}

textarea {
  font-family: 'Bricolage Grotesque', sans-serif;
}

.gallery-card {
  transition: all 0.3s ease;
}

.gallery-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(168,85,247,0.15);
}

.header-border {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--purple), var(--cyan), var(--pink), transparent);
  background-size: 200% 100%;
  animation: gradientShift 3s ease infinite;
}

.filmstrip-bg {
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 8px,
    rgba(168,85,247,0.05) 8px,
    rgba(168,85,247,0.05) 10px
  );
}

.crossfade-enter {
  animation: float-in 0.4s ease forwards;
}

@media (max-width: 768px) {
  .viewport { aspect-ratio: 4/3; }
}