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

body {
  overflow-x: hidden;
}

body.light-mode {
  background: #f5eddb !important;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: #0d0d1a;
}
::-webkit-scrollbar-thumb {
  background: #3a3a5e;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #e6c200;
}

.light-mode ::-webkit-scrollbar-track {
  background: #f5eddb;
}
.light-mode ::-webkit-scrollbar-thumb {
  background: #c4a35a;
}

/* Gold button glow */
@keyframes goldPulse {
  0%, 100% { box-shadow: 0 0 15px rgba(230, 194, 0, 0.3), 0 0 30px rgba(230, 194, 0, 0.1); }
  50% { box-shadow: 0 0 25px rgba(230, 194, 0, 0.5), 0 0 50px rgba(230, 194, 0, 0.2); }
}

.gold-glow:hover {
  animation: goldPulse 2s ease-in-out infinite;
}

.gold-glow:disabled {
  animation: none;
  opacity: 0.5;
  cursor: not-allowed;
}

/* Typewriter animation */
@keyframes typewriter {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.script-line {
  animation: typewriter 0.15s ease-out forwards;
  opacity: 0;
}

/* Film grain overlay */
@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-5%, -10%); }
  20% { transform: translate(-15%, 5%); }
  30% { transform: translate(7%, -25%); }
  40% { transform: translate(-5%, 25%); }
  50% { transform: translate(-15%, 10%); }
  60% { transform: translate(15%, 0%); }
  70% { transform: translate(0%, 15%); }
  80% { transform: translate(3%, 35%); }
  90% { transform: translate(-10%, 10%); }
}

.film-grain::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  right: -50%;
  bottom: -50%;
  width: 200%;
  height: 200%;
  background: transparent url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E") repeat;
  animation: grain 8s steps(10) infinite;
  pointer-events: none;
  z-index: 9999;
}

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

.reel-spin {
  animation: reelSpin 1.5s linear infinite;
  display: inline-block;
}

/* Slide in sidebar */
@keyframes slideIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

.sidebar-slide {
  animation: slideIn 0.3s ease-out;
}

/* Fade in */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

/* Script page styling */
.script-page {
  font-family: 'Special Elite', 'Courier New', monospace;
  line-height: 1.7;
  letter-spacing: 0.02em;
}

.script-page .scene-heading {
  font-weight: bold;
  text-transform: uppercase;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-size: 1em;
}

.script-page .action {
  margin-bottom: 0.8em;
}

.script-page .character-name {
  text-align: center;
  text-transform: uppercase;
  margin-top: 1em;
  margin-bottom: 0.2em;
  font-weight: bold;
}

.script-page .parenthetical {
  text-align: center;
  font-style: italic;
  margin-bottom: 0.2em;
  color: #666;
}

.script-page .dialogue {
  text-align: center;
  max-width: 70%;
  margin: 0 auto 0.8em;
}

.script-page .transition {
  text-align: right;
  text-transform: uppercase;
  margin-top: 1em;
  margin-bottom: 1em;
  font-weight: bold;
}

/* Textarea focus */
textarea:focus {
  outline: none;
  border-color: #e6c200 !important;
  box-shadow: 0 0 0 2px rgba(230, 194, 0, 0.2);
}

/* Pill buttons */
.pill-active {
  background: linear-gradient(135deg, #e6c200, #c4a35a) !important;
  color: #0d0d1a !important;
  font-weight: 600;
}

/* Background pattern */
.bg-pattern {
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(230, 194, 0, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(196, 163, 90, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(30, 30, 60, 0.5) 0%, transparent 50%);
}

/* Selection */
::selection {
  background: rgba(230, 194, 0, 0.3);
  color: #f0e6d3;
}