@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #09090b;
  --bg-surface: #18181b;
  --bg-card: #27272a;
  --bg-card-hover: #3f3f46;
  --border: #3f3f46;
  --border-subtle: #27272a;
  --text: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --green: #4ADE80;
  --green-dim: rgba(74, 222, 128, 0.15);
  --coral: #F06050;
  --coral-dim: rgba(240, 96, 80, 0.15);
  --blue: #60A5FA;
  --blue-dim: rgba(96, 165, 250, 0.15);
  --orange: #F59E0B;
  --orange-dim: rgba(245, 158, 11, 0.15);
  --red: #f87171;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-full: 9999px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

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

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ═══ HEADER ═══ */
.clips-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 16px 20px;
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

.clips-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.clips-logo {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.clips-logo-img {
  height: 30px;
  width: auto;
  object-fit: contain;
}
.clips-logo span { color: var(--green); }

.clips-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 0;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.clips-header-right a {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  transition: all 0.2s;
  white-space: nowrap;
}
.clips-header-right a:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

/* ═══ CREDIT COUNTER ═══ */
.credit-counter {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 5px 12px 5px 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  transition: all 0.3s ease;
  cursor: default;
  white-space: nowrap;
}
.credit-counter .credit-icon {
  font-size: 1rem;
  line-height: 1;
}
.credit-counter .credit-amount {
  min-width: 16px;
  text-align: center;
  transition: all 0.3s ease;
}
.credit-counter.credit-warning {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}
.credit-counter.credit-danger {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  animation: creditPulse 1.5s ease-in-out infinite;
}
@keyframes creditPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
.credit-counter.credit-recharging .credit-amount {
  animation: creditRefill 0.8s ease-out;
}
@keyframes creditRefill {
  0% { transform: scale(0.5); opacity: 0.3; }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); opacity: 1; }
}
.credit-counter .credit-tick {
  animation: creditTick 0.4s ease-out;
}
@keyframes creditTick {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-8px); opacity: 0; }
}

/* ═══ HERO ═══ */
.hero {
  position: relative;
  padding: calc(100px + env(safe-area-inset-top, 0px)) 0 40px;
  text-align: center;
  overflow: hidden;
}

/* Hero Background Reels */
.hero-reels {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  padding: 0 10%;
  transition: opacity 1.2s ease;
}
.hero-reels.loaded { opacity: 0.12; }

.reel-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.reel-col-1 { animation: scrollReelUp 25s linear infinite; }
.reel-col-2 { animation: scrollReelUp 30s linear infinite reverse; }
.reel-col-3 { animation: scrollReelUp 22s linear infinite; }

@keyframes scrollReelUp {
  0% { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}

.reel-column video {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border-radius: 12px;
  flex-shrink: 0;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom,
    rgba(9,9,11,0.7) 0%,
    rgba(9,9,11,0.3) 40%,
    rgba(9,9,11,0.5) 70%,
    rgba(9,9,11,1) 100%
  );
  z-index: 1;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero h1 {
  font-size: clamp(2rem, 8vw, 3.2rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1.5px;
  margin-bottom: 16px;
}

.hero h1 .gradient {
  background: linear-gradient(135deg, var(--coral), var(--green), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-cycle {
  background: linear-gradient(90deg, var(--coral), var(--orange), var(--green), var(--blue), var(--coral));
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 4s linear infinite;
  display: inline-block;
}
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}
.hero-cycle-fade {
  animation: gradientShift 4s linear infinite, cycleFade 0.4s ease;
}
@keyframes cycleFade {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 360px;
  margin: 0 auto 32px;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--green);
  background: var(--green-dim);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  margin-bottom: 20px;
}

/* ═══ CREATOR FORM ═══ */
.creator {
  padding: 0 0 40px;
}

.creator-step {
  margin-bottom: 28px;
}

.step-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green-dim);
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-label h3 {
  font-size: 1rem;
  font-weight: 700;
}

/* Camera Viewfinder */
.camera-viewfinder {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 560px;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  margin: 0 auto;
}

.camera-feed {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  transform: scaleX(-1);
}
.camera-viewfinder.active .camera-feed { display: block; }

#camera-canvas { display: none; }

.camera-captured {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
.camera-viewfinder.captured .camera-captured { display: block; }

.camera-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-surface);
  transition: opacity 0.3s;
}
.camera-viewfinder.active .camera-overlay,
.camera-viewfinder.captured .camera-overlay { opacity: 0; pointer-events: none; }

.camera-icon { font-size: 3rem; }
.camera-text {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 600;
}
.camera-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.camera-flip-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: none;
  z-index: 5;
  transition: transform 0.3s;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
.camera-flip-btn:active { transform: rotate(180deg) scale(0.9); }
.camera-viewfinder.active .camera-flip-btn { display: flex; align-items: center; justify-content: center; }
.camera-viewfinder.captured .camera-flip-btn { display: none; }

.camera-viewfinder.env-mode .camera-feed {
  transform: none;
}

.camera-capture-btn {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  border: 4px solid var(--green);
  cursor: pointer;
  display: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  transition: transform 0.15s;
}
.camera-capture-btn:active { transform: translateX(-50%) scale(0.9); }
.camera-viewfinder.active .camera-capture-btn { display: block; }
.camera-viewfinder.captured .camera-capture-btn { display: none; }

.camera-retake-btn {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 28px;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: none;
}
.camera-viewfinder.captured .camera-retake-btn { display: block; }

.camera-fallback {
  text-align: center;
  margin-top: 12px;
}
.camera-upload-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  transition: color 0.2s;
}
.camera-upload-label:hover { color: var(--text-secondary); }
.camera-upload-label input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

/* Reference Composition Grid */
.ref-hint {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.ref-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.ref-slot {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
}

.ref-slot .ref-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  z-index: 3;
  cursor: pointer;
}

.ref-slot .ref-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  transition: all 0.2s;
}

.ref-slot:hover .ref-empty,
.ref-slot:active .ref-empty {
  border-color: var(--green);
  background: var(--green-dim);
}

.ref-plus {
  font-size: 1.8rem;
  font-weight: 300;
  color: var(--text-tertiary);
  line-height: 1;
  transition: color 0.2s;
}

.ref-slot:hover .ref-plus { color: var(--green); }

.ref-slot .ref-filled {
  width: 100%;
  height: 100%;
  position: relative;
}

.ref-slot .ref-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid var(--green);
}

.ref-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 4;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.ref-slot.from-theme .ref-input { display: none; }

/* ═══ MODE SWITCHER — Scrollable Pills ═══ */
.mode-switcher {
  margin: -4px 0 20px;
}

.mode-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0;
  mask-image: linear-gradient(to right, black 0, black calc(100% - 32px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, black 0, black calc(100% - 32px), transparent 100%);
}

.mode-track::-webkit-scrollbar { display: none; }

.mode-track::after {
  content: '';
  flex: 0 0 1px;
  padding-right: 8px;
}

.mode-option {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--bg-surface);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-full, 100px);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.25s;
  -webkit-user-select: none;
  user-select: none;
  white-space: nowrap;
}

.mode-option.selected {
  color: #fff;
  background: linear-gradient(135deg, var(--coral), var(--orange));
  border-color: transparent;
}

.mode-option:not(.selected):active {
  transform: scale(0.97);
}

.mode-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.mode-label {
  font-size: 0.75rem;
  letter-spacing: -0.2px;
}

.mode-description {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: center;
  transition: opacity 0.2s;
  min-height: 18px;
}

/* ═══ LANGUAGE SELECTOR ═══ */
.language-selector {
  margin: 0 0 20px;
}

.language-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.language-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0;
  mask-image: linear-gradient(to right, black 0, black calc(100% - 40px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, black 0, black calc(100% - 40px), transparent 100%);
}

.language-track::-webkit-scrollbar { display: none; }

.language-track::after {
  content: '';
  flex: 0 0 1px;
  padding-right: 12px;
}

.lang-option {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-surface);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-full, 100px);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.25s;
  -webkit-user-select: none;
  user-select: none;
  white-space: nowrap;
}

.lang-option.selected {
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-color: transparent;
}

.lang-option:not(.selected):active {
  transform: scale(0.97);
}

.lang-flag {
  font-size: 1rem;
  line-height: 1;
}

.lang-name {
  font-size: 0.72rem;
  letter-spacing: -0.2px;
}

/* ═══ EXTENDED VIDEO TOGGLE ═══ */
.extended-toggle-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.extended-toggle-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
  flex: 1;
}

.extended-toggle-text strong {
  color: var(--text);
  display: block;
  font-size: 0.82rem;
  margin-bottom: 1px;
}

/* ═══ ADVANCED VIRAL CONTROL TOGGLE ═══ */
.advanced-toggle-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  transition: all 0.3s ease;
}
.advanced-toggle-bar.active {
  border-color: var(--green);
  background: rgba(52, 211, 153, 0.06);
  border-style: solid;
}
.advanced-toggle-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
  flex: 1;
}
.advanced-toggle-text strong {
  color: var(--text);
  display: block;
  font-size: 0.82rem;
}
.advanced-slider {
  position: relative;
}
.advanced-toggle-bar.active .advanced-slider {
  animation: advancedShake 0.5s ease-in-out;
}
@keyframes advancedShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-2px) rotate(-1deg); }
  40% { transform: translateX(2px) rotate(1deg); }
  60% { transform: translateX(-1px) rotate(-0.5deg); }
  80% { transform: translateX(1px) rotate(0.5deg); }
}

/* Hot Themes Strip */
.themes-strip {
  margin: -4px 0 16px;
  padding: 0;
}

.themes-strip-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding: 0 2px;
}

.themes-strip-fire {
  font-size: 1rem;
  animation: pulse-fire 1.5s ease-in-out infinite;
}

@keyframes pulse-fire {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.themes-strip-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: linear-gradient(90deg, var(--coral), var(--orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.themes-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0;
  mask-image: linear-gradient(to right, black 0, black calc(100% - 40px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, black 0, black calc(100% - 40px), transparent 100%);
}

.themes-scroll::-webkit-scrollbar { display: none; }

.themes-scroll::after {
  content: '';
  flex: 0 0 1px;
  padding-right: 12px;
}

.theme-chip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 2px solid var(--border-subtle);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
  max-width: 180px;
}

.theme-chip.has-thumbs {
  flex-wrap: wrap;
  padding: 8px 10px 6px;
}

.theme-chip:active { transform: scale(0.95); }

.theme-chip.selected {
  border-color: var(--coral);
  background: rgba(255, 107, 107, 0.1);
  box-shadow: 0 0 16px rgba(255, 107, 107, 0.15);
}

.theme-chip-emoji {
  font-size: 1rem;
  line-height: 1;
}

.theme-chip-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.theme-chip-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}

.theme-chip-sub {
  font-size: 0.58rem;
  color: var(--text-tertiary);
  line-height: 1.2;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-chip-thumbs {
  display: flex;
  gap: 4px;
  width: 100%;
  margin-top: 2px;
}

.theme-chip-thumb {
  width: 30px;
  height: 40px;
  border-radius: 5px;
  object-fit: cover;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.theme-chip:hover .theme-chip-thumb,
.theme-chip.selected .theme-chip-thumb {
  opacity: 1;
}

.item-upload-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.item-upload-btn:hover { border-color: var(--green); color: var(--text); }
.item-upload-btn input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

/* Idea Input */
.idea-area {
  position: relative;
}

.idea-textarea {
  width: 100%;
  min-height: 80px;
  max-height: 200px;
  padding: 14px 50px 14px 16px;
  background: var(--bg-surface);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: none;
  overflow-y: auto;
  outline: none;
  transition: border-color 0.2s, height 0.15s ease;
}
.idea-textarea::placeholder { color: var(--text-muted); }
.idea-textarea:focus { border-color: var(--green); }

.voice-btn {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--green-dim);
  border: none;
  color: var(--green);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  z-index: 2;
}
.voice-btn:hover { background: var(--green); color: white; }
.voice-btn.recording {
  background: var(--red);
  color: white;
  animation: pulse-recording 1s ease infinite;
}

@keyframes pulse-recording {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.5); }
  50% { box-shadow: 0 0 0 10px rgba(248, 113, 113, 0); }
}

.idea-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Create Button */
.create-btn {
  width: 100%;
  padding: 18px 24px;
  background: linear-gradient(135deg, var(--coral), var(--orange));
  border: none;
  border-radius: var(--radius);
  color: white;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 8px;
  position: relative;
  overflow: hidden;
}
.create-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(240, 96, 80, 0.3); }
.create-btn:active { transform: translateY(0); }
.create-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.create-btn-sub {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0.8;
  margin-top: 4px;
}

/* Button Spinner */
.btn-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

/* Auto-Charge Toggle */
.auto-charge-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-top: 12px;
}
.auto-charge-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
  flex: 1;
}
.auto-charge-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.auto-charge-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-card);
  border-radius: 24px;
  transition: 0.3s;
  border: 1px solid var(--border);
}
.toggle-slider:before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--text-muted);
  border-radius: 50%;
  transition: 0.3s;
}
.auto-charge-toggle input:checked + .toggle-slider {
  background: var(--green-dim);
  border-color: var(--green);
}
.auto-charge-toggle input:checked + .toggle-slider:before {
  transform: translate(20px, -50%);
  background: var(--green);
}

/* ═══ PROGRESS ═══ */
.progress-section {
  display: none;
  padding: 60px 0;
  text-align: center;
}
.progress-section.active { display: block; }

.progress-spinner {
  width: 64px;
  height: 64px;
  border: 4px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 24px;
}

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

.progress-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.progress-step {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: var(--bg-card);
  border-radius: var(--radius-full);
  margin: 24px 0 12px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--green), var(--coral), var(--blue));
  border-radius: var(--radius-full);
  transition: width 0.8s ease;
}

.progress-bar-text {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--green), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.progress-substep {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ═══ FRAME PREVIEW STRIP ═══ */
.frame-preview-strip {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 20px 0;
  min-height: 0;
  overflow: hidden;
  transition: min-height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.6s;
}

.frame-preview-strip.visible {
  min-height: 120px;
}

.frame-preview-slot {
  width: 68px;
  height: 120px;
  border: 2px dashed var(--border);
  border-radius: 10px;
  background: var(--bg-surface);
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.9);
  transition: opacity 0.5s, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.frame-preview-slot.entered {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.frame-preview-slot .frame-number {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-tertiary);
  z-index: 1;
  transition: opacity 0.6s;
}

.frame-preview-slot .frame-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.frame-preview-slot.has-image .frame-number {
  opacity: 0;
}

.frame-preview-slot .frame-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  opacity: 0;
  filter: blur(18px) saturate(0.3);
  transition: opacity 8s ease-out, filter 8s ease-out;
}

.frame-preview-slot.has-image {
  border-color: var(--green);
  border-style: solid;
}

.frame-preview-slot.has-image .frame-img {
  opacity: 1;
  filter: blur(0px) saturate(1);
}

/* ═══ RESULT ═══ */
.result-section {
  display: none;
  padding: 40px 0 60px;
}
.result-section.active { display: block; }

.result-title {
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 20px;
}
.result-title .gradient {
  background: linear-gradient(135deg, var(--green), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.video-player {
  position: relative;
  width: 100%;
  max-width: 360px;
  margin: 0 auto 20px;
  border-radius: 20px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.06);
  cursor: pointer;
  aspect-ratio: 9/16;
}
.result-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.video-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.25);
  transition: opacity 0.3s;
  z-index: 2;
}
.video-play-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.video-play-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2px solid rgba(255,255,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  padding-left: 4px;
  transition: transform 0.2s, background 0.2s;
}
.video-play-btn:active {
  transform: scale(0.9);
}
.video-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255,255,255,0.15);
  z-index: 3;
}
.video-progress-fill {
  height: 100%;
  background: var(--green);
  width: 0%;
  transition: width 0.2s linear;
  border-radius: 0 2px 2px 0;
}

.result-info {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 24px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  text-decoration: none;
}

.btn-share {
  background: linear-gradient(135deg, var(--green), var(--blue));
  color: white;
}
.btn-share:hover { opacity: 0.9; }

.btn-download {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-download:hover { border-color: var(--text-muted); }

.btn-finalcut {
  background: var(--bg-surface);
  border: 1px solid var(--orange);
  color: var(--orange);
}
.btn-finalcut:hover { background: rgba(255,140,50,0.1); }

.btn-another {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-another:hover { color: var(--text); border-color: var(--text-muted); }

/* Post-Video Prompts */
.post-video-prompts {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.prompt-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  animation: fadeIn 0.4s ease both;
}

.prompt-icon { font-size: 1.4rem; flex-shrink: 0; }
.prompt-text { flex: 1; }
.prompt-text strong { display: block; font-size: 0.85rem; margin-bottom: 2px; }
.prompt-text span { font-size: 0.72rem; color: var(--text-secondary); }

.prompt-btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.prompt-btn:active { opacity: 0.8; }
.prompt-btn-green { background: var(--green); color: #000; }
.prompt-btn-blue { background: var(--blue); color: #000; }
.prompt-btn-saved { background: var(--bg-surface); color: var(--text-muted); opacity: 0.7; cursor: default; }

/* ═══ EMAIL CAPTURE ═══ */

.email-capture-inline {
  display: flex;
  gap: 6px;
  align-items: center;
  width: 100%;
  margin-top: 8px;
}

.email-capture-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 0.8rem;
  outline: none;
}
.email-capture-input:focus { border-color: var(--green); }
.email-capture-input::placeholder { color: rgba(255,255,255,0.3); }

#prompt-email { flex-wrap: wrap; }
#prompt-email .prompt-text { width: 100%; }

/* ═══ SHARE CLIPZZ BUTTON ═══ */

.share-clipzz-btn {
  width: 100%; margin-top: 16px; padding: 14px 20px;
  background: transparent; border: 1px dashed rgba(255,255,255,0.15);
  border-radius: var(--radius-sm); color: var(--text-muted);
  font-family: inherit; font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: all 0.25s;
}
.share-clipzz-btn:hover { border-color: rgba(255,255,255,0.3); color: #fff; }
.share-clipzz-btn:active { transform: scale(0.98); opacity: 0.8; }

/* ═══ VIDEO GALLERY ═══ */

.gallery-section { padding: 20px 0 40px; }
.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.gallery-header h3 { font-size: 1.1rem; font-weight: 700; color: #fff; margin: 0; }
.gallery-count { font-size: 0.75rem; color: var(--text-secondary); }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.gallery-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 9/16;
  background: var(--surface);
  cursor: pointer;
}

.gallery-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-card-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 8px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gallery-card-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-card-meta { font-size: 0.6rem; color: rgba(255,255,255,0.6); }
.gallery-card-time { font-size: 0.6rem; color: rgba(255,255,255,0.6); }

.gallery-video-wrap {
  position: relative; width: 100%; height: 100%;
}

.gallery-spinner {
  position: absolute; top: calc(50% - 12px); left: calc(50% - 12px);
  width: 24px; height: 24px; border: 3px solid rgba(255,255,255,0.15);
  border-top-color: rgba(255,255,255,0.6); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.gallery-unavailable {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
}
.gallery-unavailable-icon { font-size: 1.6rem; opacity: 0.7; }
.gallery-unavailable-text {
  font-size: 0.6rem; color: #a1a1aa; margin-top: 4px; text-align: center;
  padding: 0 8px; line-height: 1.3;
}

.gallery-modal-unavailable {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border-radius: 12px;
}

.gallery-overlay {
  position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.3s;
  overscroll-behavior: contain;
}
.gallery-overlay.visible { opacity: 1; }

.gallery-modal {
  width: 92%; max-width: 400px; max-height: 90dvh;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 0 4px 20px 4px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.gallery-modal-close {
  position: absolute; top: 12px; right: 16px; background: none; border: none;
  color: #fff; font-size: 2rem; cursor: pointer; z-index: 2;
  padding-top: env(safe-area-inset-top, 0px);
}

.gallery-modal-player {
  position: relative;
  width: 100%; aspect-ratio: 9/16; border-radius: 12px; overflow: hidden;
  background: #000;
}

.gallery-modal-video { width: 100%; height: 100%; object-fit: cover; }

.gallery-modal-title {
  font-size: 1rem; font-weight: 700; color: #fff; margin-top: 12px;
  text-align: center;
}

.gallery-modal-link {
  display: flex; align-items: center; gap: 8px; margin-top: 10px;
  padding: 10px 14px; background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm); cursor: pointer;
}
.gallery-modal-link-url {
  flex: 1; font-size: 0.72rem; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gallery-modal-link-copy { font-size: 0.7rem; font-weight: 700; color: var(--blue); white-space: nowrap; }

.gallery-modal-actions {
  display: flex; gap: 8px; margin-top: 10px;
}

.gallery-modal-btn {
  flex: 1; padding: 10px 8px; background: var(--bg-surface);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  color: #fff; font-family: inherit; font-size: 0.75rem; font-weight: 600;
  cursor: pointer; text-align: center;
}
.gallery-modal-btn:active { opacity: 0.7; }

.gallery-modal-stats {
  display: flex; gap: 16px; justify-content: center; margin-top: 8px;
  font-size: 0.78rem; color: var(--text-muted);
}

.gallery-modal-comments { margin-top: 14px; }
.gm-comments-title { font-size: 0.8rem; font-weight: 700; color: #fff; margin-bottom: 8px; }
.gm-comments-empty { font-size: 0.75rem; color: var(--text-muted); text-align: center; padding: 8px 0; }
.gm-comment { padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.gm-comment-author { font-size: 0.72rem; font-weight: 700; color: #fff; }
.gm-comment-time { font-size: 0.62rem; color: var(--text-muted); margin-left: 6px; }
.gm-comment-text { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; line-height: 1.3; }

.result-link-bar {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  padding: 10px 14px; background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s;
}
.result-link-bar:active { background: #222; }
.result-link-url {
  flex: 1; font-size: 0.72rem; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.result-link-copy {
  font-size: 0.7rem; font-weight: 700; color: var(--blue); white-space: nowrap;
}

/* ═══ NOTIFICATION CREDIT BANNER ═══ */

.notify-credit-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 16px;
  animation: notifyPulse 3s ease-in-out infinite;
}

@keyframes notifyPulse {
  0%, 100% { border-color: rgba(99, 102, 241, 0.3); }
  50% { border-color: rgba(168, 85, 247, 0.5); }
}

.notify-credit-icon { font-size: 1.5rem; flex-shrink: 0; }
.notify-credit-text { flex: 1; }
.notify-credit-text strong { display: block; font-size: 0.88rem; color: #fff; margin-bottom: 2px; }
.notify-credit-text span { font-size: 0.73rem; color: var(--text-secondary); }

.notify-credit-btn {
  padding: 8px 18px;
  border: none;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff;
  white-space: nowrap;
  transition: opacity 0.15s, transform 0.15s;
}
.notify-credit-btn:active { opacity: 0.8; transform: scale(0.96); }

/* ═══ FOOTER ═══ */
.clips-footer {
  text-align: center;
  padding: 40px 20px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
}
.clips-footer a {
  color: var(--text-muted);
  text-decoration: none;
}
.clips-footer a:hover { color: var(--text-secondary); }
.footer-legal {
  margin-top: 8px;
}
.footer-legal a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.7rem;
}
.footer-legal a:hover { color: var(--text-secondary); }

.clips-version {
  margin-top: 8px;
  font-size: 0.6rem;
  color: var(--border);
  letter-spacing: 0.5px;
}

/* ═══ SHARE SHEET ═══ */
.share-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 200;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.share-overlay.active { display: block; }

.share-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 201;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.share-sheet.active { transform: translateY(0); }

.share-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  font-size: 1rem;
  font-weight: 700;
}

.share-sheet-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-card);
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.share-platforms {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.share-platform {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s;
}
.share-platform:active { transform: scale(0.92); }

.share-platform-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.share-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.share-action-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.share-action-btn:hover { background: var(--bg-card-hover); }
.share-action-btn:active { background: var(--bg-card-hover); }

.share-action-icon {
  font-size: 1.1rem;
}

.toast-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  z-index: 10000;
  pointer-events: none;
  transition: background 0.3s ease;
}
.toast-backdrop.visible {
  background: rgba(0, 0, 0, 0.25);
  pointer-events: auto;
}

.share-toast {
  position: fixed;
  bottom: 50%;
  left: 50%;
  transform: translate(-50%, 50%) scale(0.95);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 20px 28px 14px;
  border-radius: 16px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.5;
  z-index: 10001;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  text-align: center;
  width: calc(100% - 48px);
  max-width: 340px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}
.share-toast .toast-hint {
  display: block;
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 10px;
  letter-spacing: 0.03em;
}
.share-toast.visible {
  opacity: 1;
  transform: translate(-50%, 50%) scale(1);
  pointer-events: auto;
  cursor: pointer;
}

/* ═══ RECOVERY MODAL ═══ */
.recover-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 300;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.recover-overlay.active { display: block; }

.recover-modal {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 301;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  padding: 28px 24px calc(28px + env(safe-area-inset-bottom, 0px));
  max-width: 480px;
  margin: 0 auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.recover-modal.active {
  display: block;
  transform: translateY(0);
}

.recover-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-card);
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.recover-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.recover-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

.recover-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}
.recover-input:focus { border-color: var(--green); }
.recover-input::placeholder { color: var(--text-muted); }

.recover-btn {
  width: 100%;
  padding: 14px;
  background: var(--green);
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.recover-btn:active { opacity: 0.8; }
.recover-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.recover-sent-to {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.recover-sent-to strong { color: var(--green); }

.recover-link {
  display: block;
  width: 100%;
  margin-top: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  text-align: center;
  padding: 8px;
}
.recover-link:hover { color: var(--text-secondary); }

.recover-success-icon { font-size: 2.5rem; text-align: center; margin-bottom: 12px; }
.recover-success-msg {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--green);
}

.recover-error {
  color: var(--red);
  font-size: 0.8rem;
  margin-top: 12px;
  min-height: 20px;
}

/* ═══ ANIMATIONS ═══ */
.fade-in {
  animation: fadeIn 0.4s ease both;
}

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

/* ═══ SCROLL BAR ═══ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ═══ ERROR OVERLAY ═══ */
#error-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
}
#error-overlay.active { display: flex; }
.error-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.error-overlay-card {
  position: relative;
  background: var(--surface, #1a1a2e);
  border: 1px solid var(--border, #333);
  border-radius: 20px;
  padding: 36px 28px 28px;
  width: calc(100% - 40px);
  max-width: 400px;
  text-align: center;
  animation: errorSlideUp 0.3s ease;
}
@keyframes errorSlideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
.error-overlay-emoji { font-size: 48px; margin-bottom: 12px; }
.error-overlay-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
}
.error-overlay-msg {
  font-size: 0.95rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.5;
  margin-bottom: 16px;
}
.error-overlay-note {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.4);
  margin-bottom: 20px;
}
.error-overlay-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--accent, #6366f1);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.error-overlay-btn:active { opacity: 0.8; }

/* ═══ INSTALL APP BUTTON ═══ */
.install-app-btn {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--coral), var(--orange));
  border: none;
  border-radius: var(--radius-full);
  padding: 6px 14px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  animation: installGlow 2.5s ease-in-out infinite;
}

.install-app-btn.hidden { display: none; }

@keyframes installGlow {
  0%, 100% { box-shadow: 0 0 6px rgba(240, 96, 80, 0.3); }
  50% { box-shadow: 0 0 18px rgba(240, 96, 80, 0.6), 0 0 40px rgba(245, 158, 11, 0.2); }
}

/* ═══ INSTALL MODAL ═══ */
.install-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.install-modal-overlay.active { display: flex; }

.install-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 400px;
  width: 100%;
  padding: 28px 24px;
  position: relative;
}

.install-modal h2 {
  font-size: 1.3rem;
  margin-bottom: 6px;
}

.install-modal-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.install-modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
}

.install-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.install-step-icon {
  font-size: 1.4rem;
  flex: 0 0 auto;
  line-height: 1.3;
}

.install-step-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.install-step-text strong {
  color: var(--text);
}

/* ═══ TERMS CHECKBOX ═══ */
.terms-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 0 4px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.terms-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  flex: 0 0 auto;
  accent-color: var(--green);
  cursor: pointer;
}

.terms-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.terms-text a {
  color: var(--text-secondary);
  text-decoration: underline;
}

/* ═══ VERSION UPDATE BANNER ═══ */
.version-update-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9998;
  background: linear-gradient(135deg, var(--coral), var(--orange));
  color: #fff;
  text-align: center;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transform: translateY(-100%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.version-update-bar.visible {
  transform: translateY(0);
}

/* ═══ RESPONSIVE ═══ */
@media (min-width: 640px) {
  .container { max-width: 520px; }
  .ref-grid { gap: 12px; }
}

@media (min-width: 1024px) {
  .container { max-width: 480px; }
}

/* ═══════════════════════════════════════════════════════════════
   ADVANCED MODE EDITOR
   ═══════════════════════════════════════════════════════════════ */

.advanced-section {
  padding: 20px 0 40px;
}

.adv-stage {
  animation: advFadeIn 0.4s ease-out;
}

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

.adv-stage-header {
  margin-bottom: 20px;
}

.adv-stage-number {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--green);
  margin-bottom: 4px;
}

.adv-stage-header h3 {
  font-size: 1.3rem;
  font-weight: 800;
  margin: 0 0 4px;
}

.adv-stage-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

.adv-back-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8rem;
  padding: 4px 0;
  cursor: pointer;
  margin-bottom: 8px;
  display: block;
}
.adv-back-btn:hover { color: var(--text); }

/* ── Buttons ── */

.adv-btn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius);
  padding: 12px 20px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
}

.adv-btn-primary {
  background: var(--green);
  color: var(--bg);
}
.adv-btn-primary:hover { filter: brightness(1.1); }
.adv-btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.adv-btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}
.adv-btn-secondary:hover { background: var(--bg-card-hover); }

.adv-btn-ghost {
  background: none;
  color: var(--text-muted);
  border: 1px dashed var(--border);
}
.adv-btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }

.adv-btn-generate {
  background: linear-gradient(135deg, var(--coral), var(--orange));
  color: white;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 14px 28px;
}
.adv-btn-generate:hover { filter: brightness(1.1); }

.adv-cost {
  font-size: 0.7rem;
  font-weight: 400;
  opacity: 0.7;
}

/* ── Base Image (Stage 2) ── */

.adv-base-image-container {
  aspect-ratio: 9 / 16;
  max-height: 55vh;
  border-radius: 20px;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  margin: 0 auto 16px;
  max-width: 280px;
  position: relative;
}

.adv-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255,255,255,0.1);
  z-index: 2;
}
.adv-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--blue));
  border-radius: 2px;
  transition: width 0.5s ease-out;
  width: 0%;
}

.adv-guidance-field {
  margin-bottom: 12px;
}
.adv-guidance-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  padding: 10px 12px;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.adv-guidance-input:focus {
  outline: none;
  border-color: var(--green);
  border-style: solid;
}
.adv-guidance-input::placeholder {
  color: var(--text-muted);
}

.adv-base-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.85rem;
  position: relative;
  overflow: hidden;
}

.adv-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,0.03) 50%, transparent 70%);
  animation: advShimmer 2s ease-in-out infinite;
}

@keyframes advShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.adv-base-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.adv-base-actions {
  display: flex;
  gap: 10px;
}
.adv-base-actions .adv-btn { flex: 1; justify-content: center; }

/* ── Frame Editor (Stage 3) ── */

.adv-frames-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.adv-frame-card {
  aspect-ratio: 9 / 16;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.adv-frame-card:hover {
  border-color: var(--green);
  transform: translateY(-2px);
}

.adv-frame-card.prepared {
  border-style: solid;
  border-color: var(--green);
}

.adv-frame-card.approved {
  border-color: var(--green);
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.2);
}

.adv-frame-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

.adv-frame-number {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  z-index: 1;
}

.adv-frame-teaser {
  padding: 6px 8px;
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
  position: relative;
  z-index: 1;
}

.adv-frame-status {
  position: absolute;
  bottom: 6px;
  right: 6px;
  font-size: 0.9rem;
  z-index: 1;
}

.adv-frame-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.5);
  border: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.2s;
}
.adv-frame-card:hover .adv-frame-remove { opacity: 1; }
.adv-frame-remove:hover { color: var(--coral); }

.adv-frame-card.selected {
  border-color: var(--blue);
  border-style: solid;
  box-shadow: 0 0 8px rgba(96, 165, 250, 0.25);
}

.adv-frame-unprepared {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 28px;
  gap: 2px;
  opacity: 0.5;
}
.adv-frame-unprepared-icon { font-size: 1.3rem; }
.adv-frame-unprepared-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.adv-frame-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255,255,255,0.08);
  z-index: 5;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}
.adv-frame-progress .adv-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--green), var(--blue));
  transition: width 0.3s ease;
}

.adv-btn-accent {
  background: linear-gradient(135deg, var(--green), var(--blue));
  color: #fff;
  border: none;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  transition: opacity 0.2s, transform 0.15s;
}
.adv-btn-accent:hover { opacity: 0.9; transform: translateY(-1px); }
.adv-btn-accent:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.adv-btn-accent.loading { opacity: 0.6; pointer-events: none; }

.adv-tap-hint {
  position: absolute;
  bottom: 28px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.6rem;
  color: var(--blue);
  font-weight: 600;
  background: rgba(0,0,0,0.5);
  padding: 3px 0;
  z-index: 2;
  animation: advFadeIn 0.3s ease-out;
}

.adv-frames-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.adv-frames-actions .adv-btn-accent { flex: 1 1 100%; justify-content: center; }
.adv-frames-actions .adv-btn-primary { flex: 1; justify-content: center; }

/* ── Per-Frame Editing (Stage 4) ── */

.adv-edit-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.adv-edit-preview {
  aspect-ratio: 9 / 16;
  max-height: 40vh;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  position: relative;
}

.adv-edit-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.8rem;
  position: relative;
  overflow: hidden;
}

.adv-edit-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.adv-edit-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.adv-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.adv-textarea {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 10px 12px;
  resize: vertical;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.adv-textarea:focus {
  outline: none;
  border-color: var(--green);
}

.adv-dialogue {
  border-color: var(--orange);
  background: rgba(245, 158, 11, 0.04);
}
.adv-dialogue:focus { border-color: var(--orange); }

.adv-field-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 2px;
  display: block;
}

.adv-cut-slider-container {
  padding: 0 4px;
}

.adv-cut-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--bg-card);
  border-radius: 2px;
  outline: none;
}
.adv-cut-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--green);
  cursor: pointer;
}

.adv-cut-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.adv-edit-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.adv-edit-btns .adv-btn { flex: 1; justify-content: center; min-width: 120px; }

/* ── Video Preview (Stage 5) — Clip Strip ── */

.adv-clip-strip {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 16px;
  scrollbar-width: thin;
  scroll-snap-type: x mandatory;
}

.adv-clip-card {
  flex: 0 0 160px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  position: relative;
  scroll-snap-align: start;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.adv-clip-card.clip-ready {
  border-color: var(--green);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.25);
}
.adv-clip-card.clip-rendering {
  border-color: var(--orange);
}

.adv-clip-card .adv-frame-number {
  top: 4px;
  left: 4px;
  font-size: 0.6rem;
  z-index: 3;
}

.adv-clip-media {
  width: 100%;
  aspect-ratio: 9 / 16;
  position: relative;
  background: var(--bg);
  overflow: hidden;
}
.adv-clip-media img,
.adv-clip-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.adv-clip-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.35);
  color: white;
  font-size: 2rem;
  cursor: pointer;
  z-index: 2;
  transition: opacity 0.2s;
}
.adv-clip-play-overlay:hover {
  background: rgba(0,0,0,0.5);
}

.adv-clip-progress {
  display: none;
  height: 3px;
  background: var(--bg);
  overflow: hidden;
}
.adv-clip-progress-fill {
  height: 100%;
  background: var(--orange);
  width: 0%;
  transition: width 0.4s ease;
}

.adv-clip-controls {
  padding: 8px;
}

.adv-clip-info {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 0.65rem;
}
.adv-clip-cut {
  color: var(--green);
  font-weight: 700;
  white-space: nowrap;
}
.adv-clip-dialogue {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adv-clip-btn-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.adv-clip-btn {
  flex: 1;
  min-width: 0;
  padding: 5px 4px;
  font-size: 0.6rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}
.adv-clip-btn:active { transform: scale(0.96); }

.adv-clip-btn-render {
  background: var(--green);
  color: var(--bg);
}
.adv-clip-btn-render:hover { filter: brightness(1.1); }

.adv-clip-btn-rerender {
  background: var(--orange);
  color: var(--bg);
}
.adv-clip-btn-rerender:hover { filter: brightness(1.1); }

.adv-clip-btn-edit {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}
.adv-clip-btn-edit:hover { border-color: var(--text-muted); }

.adv-clip-btn .adv-cost {
  font-size: 0.55rem;
  opacity: 0.7;
}

.adv-clip-status {
  font-size: 0.65rem;
  padding: 4px 8px;
}
.adv-clip-status.rendering {
  color: var(--orange);
  animation: clipPulse 1.2s infinite;
}

@keyframes clipPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.adv-overview-script {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  max-height: 200px;
  overflow-y: auto;
}

.adv-overview-line {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8rem;
}
.adv-overview-line:last-child { border-bottom: none; }

.adv-overview-line-num {
  color: var(--green);
  font-weight: 700;
  font-size: 0.7rem;
  min-width: 20px;
}

.adv-overview-line-text {
  color: var(--text);
  flex: 1;
}
.adv-overview-line-text .adv-dialogue-highlight {
  color: var(--orange);
  font-weight: 600;
}
.adv-no-dialogue { color: var(--text-muted); font-size: 0.8rem; }

.adv-overview-line-cut {
  color: var(--text-muted);
  font-size: 0.7rem;
  white-space: nowrap;
}

.adv-overview-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Loading State ── */

.adv-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}
.adv-btn.loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 6px;
}

/* ═══════════════════════════════════════════ */
/* ── Final Cut / Video Trimmer ──           */
/* ═══════════════════════════════════════════ */

.trimmer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  flex-direction: column;
  overflow: hidden;
}
.trimmer-overlay.active {
  display: flex;
}

.trimmer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  padding-left: calc(16px + env(safe-area-inset-left, 0px));
  padding-right: calc(16px + env(safe-area-inset-right, 0px));
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.trimmer-close {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
}
.trimmer-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}
.trimmer-apply {
  background: linear-gradient(135deg, var(--green), var(--blue));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 18px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.2s;
}
.trimmer-apply:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.trimmer-video-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}
.trimmer-video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.trimmer-video-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: rgba(0,0,0,0.15);
  transition: opacity 0.2s;
}
.trimmer-video-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.trimmer-play-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: white;
}
.trimmer-time-display {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.trimmer-controls {
  flex-shrink: 0;
  position: relative;
  height: 80px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  overflow: hidden;
}
.trimmer-timeline-wrap {
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.trimmer-timeline-wrap::-webkit-scrollbar {
  display: none;
}
.trimmer-timeline {
  position: relative;
  height: 100%;
  min-width: 400%;
  padding-left: 50vw;
  padding-right: 50vw;
  box-sizing: content-box;
}
.trimmer-waveform {
  width: 100%;
  height: 100%;
  display: block;
}
.trimmer-cuts-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.trimmer-cut-region {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(255, 60, 60, 0.3);
  border-left: 2px solid #ff4444;
  border-right: 2px solid #ff4444;
}
.trimmer-cut-region.active {
  background: rgba(255, 140, 50, 0.35);
  border-color: var(--orange);
  animation: trimmerPulse 1.2s ease-in-out infinite;
}
@keyframes trimmerPulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}
.trimmer-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--green);
  pointer-events: none;
  left: 0;
  z-index: 5;
}

.trimmer-needle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: white;
  z-index: 10;
  pointer-events: none;
  box-shadow: 0 0 6px rgba(255,255,255,0.4);
}
.trimmer-needle::before {
  content: '▼';
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 10px;
}

.trimmer-actions {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  padding-left: calc(16px + env(safe-area-inset-left, 0px));
  padding-right: calc(16px + env(safe-area-inset-right, 0px));
  border-top: 1px solid var(--border);
  background: var(--bg);
  justify-content: center;
  flex-wrap: wrap;
}
.trimmer-btn {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  transition: all 0.2s;
  white-space: nowrap;
}
.trimmer-btn:disabled {
  opacity: 0.35;
  pointer-events: none;
}
.trimmer-btn-cut {
  border-color: var(--orange);
  color: var(--orange);
}
.trimmer-btn-cut.cutting {
  background: var(--orange);
  color: white;
  animation: trimmerPulse 1.2s ease-in-out infinite;
}
.trimmer-btn-end {
  border-color: #ff4444;
  color: #ff4444;
}
.trimmer-btn-undo {
  color: var(--text-muted);
}
.trimmer-btn-preview {
  border-color: var(--green);
  color: var(--green);
}
.trimmer-btn-save {
  background: linear-gradient(135deg, var(--green), var(--blue));
  color: white;
  border-color: transparent;
}
.trimmer-btn-editmore {
  border-color: var(--orange);
  color: var(--orange);
}
.trimmer-btn-discard-cut {
  color: var(--text-muted);
}

.trimmer-status {
  flex-shrink: 0;
  text-align: center;
  padding: 6px 16px 14px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  font-size: 0.78rem;
  color: var(--text-muted);
  min-height: 24px;
}
.trimmer-status:empty {
  padding: 0 0 env(safe-area-inset-bottom, 0px) 0;
  min-height: 0;
}

/* Version chips on result screen */
.version-chips {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
  flex-wrap: wrap;
}
.version-chip {
  padding: 6px 14px;
  border-radius: 20px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-muted);
  transition: all 0.2s;
}
.version-chip.active {
  background: linear-gradient(135deg, var(--green), var(--blue));
  color: white;
  border-color: transparent;
}
