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

body {
  background: #0a0e1a;
  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(245, 197, 24, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 90%, rgba(255, 45, 120, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(0, 229, 255, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

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

/* Film grain overlay */
.film-grain {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.03;
  background-image: 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)'/%3E%3C/svg%3E");
}

/* Screenplay formatting */
.screenplay {
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: #e0e0e0;
}

.screenplay-container {
  background: linear-gradient(135deg, #111827 0%, #0f1729 100%);
  border: 1px solid rgba(245, 197, 24, 0.15);
  border-radius: 12px;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

.screenplay-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #f5c518, #ff2d78, #00e5ff);
}

/* Genre pill styles */
.genre-pill {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  user-select: none;
}

.genre-pill:hover {
  border-color: rgba(245, 197, 24, 0.4);
  background: rgba(245, 197, 24, 0.08);
  transform: translateY(-2px);
}

.genre-pill.active {
  border-color: #f5c518;
  background: rgba(245, 197, 24, 0.15);
  color: #f5c518;
  box-shadow: 0 0 20px rgba(245, 197, 24, 0.15);
}

/* Generate button */
.generate-btn {
  background: linear-gradient(135deg, #f5c518 0%, #e0a800 100%);
  color: #0a0e1a;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.generate-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.2) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform 0.6s;
}

.generate-btn:hover::after {
  transform: translateX(100%);
}

.generate-btn:hover {
  transform: scale(1.03);
  box-shadow: 0 0 40px rgba(245, 197, 24, 0.3);
}

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

.generate-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.generate-btn:disabled:hover::after {
  transform: translateX(-100%);
}

/* Toast notification */
.toast-enter {
  animation: toastIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast-exit {
  animation: toastOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

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

/* Clapperboard animation */
@keyframes clapSnap {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-20deg); }
  50% { transform: rotate(0deg); }
  75% { transform: rotate(-10deg); }
}

.clap-animate {
  animation: clapSnap 1.5s ease-in-out infinite;
  transform-origin: left bottom;
}

/* Typewriter cursor blink */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.cursor-blink::after {
  content: '▌';
  animation: blink 1s step-end infinite;
  color: #f5c518;
}

/* Loading dots */
@keyframes loadingDots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60% { content: '...'; }
  80%, 100% { content: ''; }
}

/* Spotlight sweep */
@keyframes spotlightSweep {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.spotlight-text {
  background: linear-gradient(
    90deg,
    #f5c518 0%,
    #fff 15%,
    #f5c518 30%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: spotlightSweep 4s linear infinite;
}

/* Meditation badge shake */
@keyframes badgeShake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-2deg); }
  75% { transform: rotate(2deg); }
}

.badge-hover:hover {
  animation: badgeShake 0.3s ease-in-out;
}

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

::-webkit-scrollbar-track {
  background: #0a0e1a;
}

::-webkit-scrollbar-thumb {
  background: rgba(245, 197, 24, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(245, 197, 24, 0.5);
}

/* Textarea custom styling */
textarea::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

textarea:focus {
  outline: none;
}

/* History card */
.history-card {
  transition: all 0.2s ease;
  cursor: pointer;
}

.history-card:hover {
  background: rgba(245, 197, 24, 0.06);
  border-color: rgba(245, 197, 24, 0.3);
}

/* Stagger fade-in */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in-up {
  animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  opacity: 0;
}

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

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(245, 197, 24, 0.5);
  border: 2px solid #f5c518;
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(245, 197, 24, 0.5);
  border: 2px solid #f5c518;
}

/* Anti-meditation badge */
.anti-med-badge {
  background: linear-gradient(135deg, rgba(255, 45, 120, 0.15) 0%, rgba(255, 45, 120, 0.05) 100%);
  border: 1px solid rgba(255, 45, 120, 0.3);
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .screenplay {
    font-size: 11px;
    padding: 1rem;
  }
  
  .screenplay-container {
    padding: 1rem;
  }
}