* { box-sizing: border-box; }

body {
  background: #0a0e14;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: 
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(255,255,255,0.008) 2px,
      rgba(255,255,255,0.008) 4px
    );
  pointer-events: none;
  z-index: 9999;
}

@keyframes filmGrain {
  0%, 100% { opacity: 0.03; }
  50% { opacity: 0.06; }
}

.film-grain-overlay {
  position: fixed;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.4'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9998;
  animation: filmGrain 0.15s steps(3) infinite;
  opacity: 0.04;
}

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

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

@keyframes typewriter {
  from { max-height: 0; }
  to { max-height: 5000px; }
}

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

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(245, 166, 35, 0.2); }
  50% { box-shadow: 0 0 24px rgba(245, 166, 35, 0.5); }
}

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

@keyframes clapSnap {
  0% { transform: rotate(0deg); }
  15% { transform: rotate(-25deg); }
  30% { transform: rotate(0deg); }
  100% { transform: rotate(0deg); }
}

.animate-fade-up {
  animation: fadeSlideUp 0.5s ease-out forwards;
}

.animate-fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}

.reel-spin {
  animation: reelSpin 2s linear infinite;
}

.pulse-glow {
  animation: pulseGlow 2s ease-in-out infinite;
}

.clap-snap {
  animation: clapSnap 1.5s ease-in-out infinite;
}

/* Sprocket hole styling for scene cards */
.sprocket-card {
  position: relative;
}

.sprocket-card::before,
.sprocket-card::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14px;
  background: repeating-linear-gradient(
    180deg,
    transparent 0px,
    transparent 8px,
    rgba(245, 166, 35, 0.15) 8px,
    rgba(245, 166, 35, 0.15) 16px,
    transparent 16px,
    transparent 24px
  );
  border-radius: 1px;
}

.sprocket-card::before { left: -2px; }
.sprocket-card::after { right: -2px; }

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #131920;
}

::-webkit-scrollbar-thumb {
  background: #2a3340;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #f5a623;
}

/* Title shimmer */
.title-shimmer {
  background: linear-gradient(90deg, #f5a623 0%, #ffd580 25%, #f5a623 50%, #ffd580 75%, #f5a623 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 4s linear infinite;
}

/* Story text typewriter */
.story-reveal {
  overflow: hidden;
  animation: typewriter 3s ease-out forwards;
}

/* Scene card hover */
.scene-card-hover {
  transition: all 0.3s ease;
}

.scene-card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(245, 166, 35, 0.15);
}

/* Genre chip */
.genre-chip {
  transition: all 0.2s ease;
}

.genre-chip:hover {
  transform: scale(1.05);
}

.genre-chip.active {
  background: #f5a623;
  color: #0a0e14;
  font-weight: 600;
}

/* Loading messages */
.loading-msg {
  animation: fadeIn 0.6s ease-out;
}

/* Custom range slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #1a2028, #f5a623);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #f5a623;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(245, 166, 35, 0.4);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #f5a623;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(245, 166, 35, 0.4);
}

/* Scene timeline connector */
.timeline-connector {
  position: relative;
}

.timeline-connector::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -20px;
  width: 20px;
  height: 2px;
  background: linear-gradient(90deg, #f5a623, rgba(245, 166, 35, 0.2));
}

.timeline-connector:last-child::after {
  display: none;
}

/* Mobile responsive scene scroll */
@media (max-width: 768px) {
  .scene-scroll {
    flex-direction: column !important;
    overflow-x: visible !important;
  }
  
  .sprocket-card::before,
  .sprocket-card::after {
    display: none;
  }
}