:root {
  --bg-canvas: #07090E;
  --bg-elevated: #0D111A;
  --bg-card: #121826;
  --bg-card-hover: #171F31;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;

  --opac-indigo: #4F46E5;
  --opac-cyan: #06B6D4;
  --opac-violet: #8B5CF6;
  --viral-emerald: #10B981;
  --hot-rose: #F43F5E;
  --amber-gold: #F59E0B;

  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  background-color: var(--bg-canvas);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(79, 70, 229, 0.18), transparent 70%),
    radial-gradient(circle at 85% 20%, rgba(6, 182, 212, 0.09), transparent 45%);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
}

/* Subtle cinema studio grid backdrop */
.cinema-grid {
  background-size: 48px 48px;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
}

/* Focus visibility for WCAG 2.1 AA */
:focus-visible {
  outline: 2px solid var(--opac-cyan);
  outline-offset: 2px;
}

/* Typography helpers */
.font-mono {
  font-family: var(--font-mono);
}

.gradient-text {
  background: linear-gradient(120deg, #F8FAFC 10%, #22D3EE 55%, #A78BFA 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Surface cards */
.studio-panel {
  background: rgba(13, 17, 26, 0.88);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(16px);
}

.clip-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: border-color 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
}

.clip-card:hover {
  border-color: rgba(6, 182, 212, 0.4);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

/* Longform Timeline Scanner Animation */
.scanner-beam {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, transparent, #22D3EE, #A855F7, transparent);
  box-shadow: 0 0 18px 3px rgba(34, 211, 238, 0.65);
  left: 0%;
  opacity: 0;
  pointer-events: none;
}

.scanner-beam.scanning {
  opacity: 1;
  animation: scanSweep 1.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes scanSweep {
  0% {
    left: 2%;
  }
  100% {
    left: 97%;
  }
}

/* Waveform bars */
.wave-bar {
  border-radius: 999px;
  transition: height 0.25s ease, background-color 0.25s ease;
}

.is-playing .wave-bar {
  animation: waveBounce 0.9s ease-in-out infinite alternate;
}

@keyframes waveBounce {
  0% {
    transform: scaleY(0.55);
  }
  100% {
    transform: scaleY(1.15);
  }
}

/* 9:16 Vertical Frame */
.vertical-stage {
  aspect-ratio: 9 / 16;
  position: relative;
  overflow: hidden;
  border-radius: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: radial-gradient(circle at 50% 25%, #1E293B 0%, #090D16 75%);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
}

/* Neural Face Tracking Reticle */
.speaker-reticle {
  position: absolute;
  border: 2px solid rgba(34, 211, 238, 0.85);
  border-radius: 0.75rem;
  box-shadow: 0 0 0 9999px rgba(7, 9, 14, 0.22), 0 0 16px rgba(6, 182, 212, 0.35);
  transition: all 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.speaker-reticle::before {
  content: attr(data-label);
  position: absolute;
  top: -22px;
  left: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(6, 182, 212, 0.9);
  color: #07090E;
  white-space: nowrap;
}

/* Live Caption Styles */
.caption-word {
  display: inline-block;
  margin: 0 2px;
  transition: transform 0.12s ease, color 0.12s ease, background-color 0.12s ease;
}

.caption-style-hormozi .caption-word {
  font-weight: 900;
  text-transform: uppercase;
  text-shadow: 0 3px 0 #000000, 0 0 10px rgba(0, 0, 0, 0.9);
  color: #FFFFFF;
}

.caption-style-hormozi .caption-word.active {
  color: #FACC15;
  transform: scale(1.12);
}

.caption-style-opac .caption-word {
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  color: #E2E8F0;
}

.caption-style-opac .caption-word.active {
  background: rgba(79, 70, 229, 0.88);
  color: #FFFFFF;
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.55);
  transform: translateY(-2px);
}

.caption-style-split .caption-word {
  font-weight: 800;
  color: #FFFFFF;
  background: rgba(15, 23, 42, 0.8);
  padding: 1px 5px;
  border-radius: 4px;
}

.caption-style-split .caption-word.active {
  background: #10B981;
  color: #07090E;
}

.caption-style-minimal .caption-word {
  font-weight: 600;
  letter-spacing: 0.01em;
  color: rgba(248, 250, 252, 0.65);
}

.caption-style-minimal .caption-word.active {
  color: #FFFFFF;
  text-decoration: underline;
  text-decoration-color: #22D3EE;
  text-underline-offset: 4px;
}

/* Smooth fade-in for extracted clips */
@keyframes clipAppear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.clip-enter {
  animation: clipAppear 0.35s ease forwards;
}

/* Modal backdrop */
dialog::backdrop {
  background: rgba(3, 5, 10, 0.78);
  backdrop-filter: blur(8px);
}

/* Custom subtle scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #07090E;
}

::-webkit-scrollbar-thumb {
  background: #1E293B;
  border-radius: 999px;
}

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