"""
Layer 4b: Script Generation Prompt (v2)

Engine: Opus
Input: #1 concept from 4a + Research report + Channel metadata
Output: Production-ready 225-300 word script

Changes from v1:
- Natural technical term integration (no vocabulary lessons mid-escalation)
- Tension/relief alternation (one moment of levity in the middle)
- Varied on-screen text (mix of single words and phrases)
"""

METADATA = {
    "version": "v2",
    "layer": "4b",
    "model": "opus",
    "created": "2026-02-12",
    "description": "Generate production-ready script with natural tone variation and varied callouts"
}

PROMPT = '''You are writing a script for a 90-120 second vertical video. This is the single most important output in the entire pipeline. Every word must earn its place.

## VOICE GUIDELINES

Write like a smart friend explaining something fascinating at a bar, not like a professor delivering a lecture.

- Confident, conversational, slightly irreverent
- Use "you" constantly - speak directly to the viewer
- Short sentences. Punchy. Rhythm matters.
- No filler, no throat-clearing, no setup paragraphs
- If it sounds like a news anchor or documentary narrator wrote it, rewrite it

## CRITICAL: EMOTIONAL FRAMING

The viewer must feel EMPOWERED, not diagnosed. Short-form viewers scroll away from content that makes them feel worse about themselves. They share content that makes them feel like they just unlocked an insight others don't have.

This means:
- "Your brain is doing X to you" → "Here's the trick being played — now you see it"
- "Why you're broken" → "Why you were right all along"
- "You're a victim of your psychology" → "You just gained power over a hidden mechanism"

Throughout the script, the viewer should feel like they're gaining a cheat code, not receiving a diagnosis. Even when revealing uncomfortable truths, frame them as insight that empowers rather than knowledge that traps.

## CHANNEL CONTEXT
Channel: {channel_name}
Voice: {channel_description}
Competitive Gap: {competitive_gap}

Lean into what makes this channel different from competitors covering similar topics.

## THE CONCEPT TO SCRIPT
Title: {concept_title}
Hook: {concept_hook}
Core Revelation: {concept_core_revelation}
Emotional Arc: {concept_emotional_arc}
Data Points to Include: {concept_data_points}
Share Trigger: {concept_share_trigger}

## RESEARCH FOR CONTEXT
{research_report_content}

## SCRIPT REQUIREMENTS

### LENGTH
225-300 words. At ~150 words per minute natural speaking pace, this yields 90-120 seconds. Count your words. This is non-negotiable.

### STRUCTURE

**Opening (0-3 seconds):**
Start with the hook. No intro. No "Hey guys." No "So." Jump straight into the most compelling statement. Create an open loop the viewer NEEDS to see closed.

**Build (3-30 seconds):**
Set up the revelation. Give context that makes the payoff land harder. Weave in data points naturally - spoken as revelations, not listed as facts.

**Pattern Interrupt (30-40 seconds):**
Change the pace. A surprising stat. A rhetorical question. A shift in direction. Something that re-grabs attention. Phrases that work: "But here's the part nobody talks about", "And that's where the data gets weird", "Here's where it gets interesting."

**Payoff (40-80 seconds):**
Deliver the core revelation. This is the moment the whole video builds to. Make it land.

**Close (80-120 seconds):**
End with the share trigger. NOT "like and subscribe." NOT "let me know in the comments." Something content-driven: "Send this to someone who needs to see it", a cliffhanger teasing Part 2, or a final provocative thought that lingers.

### TONE VARIATION (NEW IN V2)

The best short-form content alternates between tension and relief. Include ONE moment of levity or self-aware humor in the middle section - a beat that lets the viewer breathe before the next escalation. Examples:
- "You've been confidently wrong about a cartoon man's eyewear your entire life."
- "Congratulations, your brain just made that up."
- "So that's fun."

This prevents the script from being uniformly intense, which causes viewer fatigue.

### TECHNICAL TERMS (NEW IN V2)

If you need to introduce a technical term (like "confabulation" or "schema theory"), do NOT turn it into a vocabulary lesson mid-emotional-arc. Either:
- Skip the term entirely if the concept is clear without it
- Embed it naturally: "Scientists have a word for this - confabulation. Your brain inventing memories and calling them real."
- Use it as a punchline, not a definition

Never break emotional momentum to explain a word.

### ON-SCREEN TEXT (UPDATED IN V2)

Include 4-7 on-screen text callouts inline in the script using this format:
[ON SCREEN: "exact text to display"]

**Vary the callout types:**
- Some should be single provocative words: [ON SCREEN: "Zero."] or [ON SCREEN: "Nowhere."]
- Some should be key statistics: [ON SCREEN: "58%"]
- Some should be short phrases for the core revelation moment
- Mix lengths to create visual rhythm

Use these for:
- Key statistics (the number should be visible, not just spoken)
- The core revelation moment
- Single-word emphasis at dramatic beats
- Any claim that benefits from visual reinforcement

### FORBIDDEN PHRASES

Do NOT use:
- "Have you ever wondered..."
- "In this video, we'll explore..."
- "What do you think? Let me know in the comments"
- "Like and subscribe"
- "Before we begin..." or "First, let's..."
- Any form of "Let's dive in" or "Let's get into it"
- Framing that makes the viewer feel broken, trapped, guilty, or helpless
- "Your brain is doing this to you" language without the empowering counter ("now you see it")
- Ending on anxiety — always land on empowerment or validation

These signal generic content. The hook should be a specific, surprising claim. The close should make the viewer feel smarter for watching.

## OUTPUT FORMAT

Return valid JSON only. No markdown code blocks.

{{
  "video_script": {{
    "full_script": "Your 225-300 word script with [ON SCREEN: \\"text\\"] callouts inline. Each paragraph is a natural breath/pause point.",
    "word_count": 275,
    "estimated_duration_seconds": 110,
    "on_screen_text_count": 5,
    "data_sources_referenced": ["Source 1 from research", "Source 2 from research"],
    "hook_text": "The exact first 1-2 sentences (the 0-3 second hook)",
    "pattern_interrupt_at": "Description of what the pattern interrupt is and roughly when it hits",
    "levity_moment": "The one moment of humor/relief and where it appears",
    "share_trigger_at_close": "The specific share trigger used in the closing"
  }}
}}
'''
