make that if the text is above a certain amount of numbers it get into the seconds line:
# video_generation.py

import os
from moviepy.editor import (
    TextClip,
    ColorClip,
    CompositeVideoClip,
    ImageClip,
    AudioFileClip,
    CompositeAudioClip
)
from moviepy.config import change_settings
import numpy as np
from PIL import Image, ImageDraw

# Configure ImageMagick
change_settings(
    {"IMAGEMAGICK_BINARY": r"C:\Program Files\ImageMagick-7.1.1-Q16-HDRI\magick.exe"}
)

class WouldYouRatherGenerator:
    def __init__(self):
        # Initialize video parameters
        self.width = 1080
        self.height = 1920
        self.middle_y = self.height // 2

    def process_image(self, image_path, size=(600, 600), start_time=0, duration=0):
        """
        Process the image by converting mode and resizing proportionally without warping.
        """
        debug_print = lambda msg: print(f"[DEBUG] {msg}")
        debug_print(f"Processing image: {image_path}")

        if not os.path.exists(image_path):
            debug_print(f"Image file does not exist: {image_path}")
            return None

        img = Image.open(image_path)

        if img.mode != "RGBA":
            img = img.convert("RGBA")

        # Resize image proportionally
        if size:
            img.thumbnail(size, Image.LANCZOS)

        img_array = np.array(img)
        clip_duration = duration if duration > 0 else self.total_duration
        clip = ImageClip(img_array).set_duration(clip_duration)

        if start_time > 0:
            clip = clip.set_start(start_time)

        debug_print(f"Image processed: {image_path}")
        return clip

    def create_styled_text(
        self, text, y_position, duration, start_time=0, fontsize=60, color="white",
        stroke_color="black", stroke_width=3
    ):
        """
        Create a styled TextClip with automatic text wrapping.
        """
        debug_print = lambda msg: print(f"[DEBUG] {msg}")
        debug_print(f"Creating styled text: {text} at position {y_position}")

        text_clip = TextClip(
            text.upper(),
            font="Arial-Bold",
            color=color,
            fontsize=fontsize,
            method="label",
            stroke_color=stroke_color,
            stroke_width=stroke_width
        ).set_duration(duration)

        if start_time > 0:
            text_clip = text_clip.set_start(start_time)

        debug_print(f"Styled text created: {text}")
        return text_clip.set_position(("center", y_position))

    def create_timer_clips(self, start_time, countdown_seconds):
        """
        Create countdown timer clips from countdown_seconds to 1.
        """
        timer_clips = []
        for i in range(countdown_seconds, 0, -1):
            current_time = countdown_seconds - i
            timer_text = str(i)
            timer_duration = 1
            timer_clip = self.create_styled_text(
                timer_text,
                self.middle_y - 100,  # Positioned slightly above center
                timer_duration,
                start_time + current_time,
                fontsize=150,
                color="white",
                stroke_color="black",
                stroke_width=3
            )
            timer_clips.append(timer_clip)
        return timer_clips

    def generate_video(
        self,
        option1_text,
        option2_text,
        image1_path,
        image2_path,
        audio1_path,
        audio2_path,
        percent1="1.02%",
        percent2="999.72%",
        initial_pause=2,
        timer_delay=1,
        countdown_wait=1,
        countdown_seconds=3,
        output_filename="would_you_rather.mp4"
    ):
        """
        Generate the 'Would You Rather' video with optimized positioning and timing.
        """
        debug_print = lambda msg: print(f"[DEBUG] {msg}")
        debug_print(f"Starting video generation: {output_filename}")

        # Load audio clips
        try:
            audio1_clip = AudioFileClip(audio1_path)
            audio2_clip = AudioFileClip(audio2_path)
            debug_print(f"Loaded audio1: {audio1_path} (Duration: {audio1_clip.duration:.2f}s)")
            debug_print(f"Loaded audio2: {audio2_path} (Duration: {audio2_clip.duration:.2f}s)")
        except Exception as e:
            debug_print(f"Error loading audio files: {str(e)}")
            return

        # Calculate timings
        audio1_start = initial_pause
        audio2_start = audio1_start + audio1_clip.duration + timer_delay
        countdown_start_time = audio2_start + audio2_clip.duration + countdown_wait
        percentage_duration = 3
        buffer_time = percentage_duration
        self.total_duration = countdown_start_time + countdown_seconds + buffer_time

        # Create background clips
        clips = [
            ColorClip((self.width, self.middle_y), color=(255, 0, 0))
                .set_duration(self.total_duration)
                .set_position((0, 0)),
            ColorClip((self.width, self.middle_y), color=(0, 0, 255))
                .set_duration(self.total_duration)
                .set_position((0, self.middle_y))
        ]

        # Fixed positions
        top_image_y = 15
        top_text_y = 650
        top_percentage_y = 750
        bottom_image_y = self.middle_y + 350
        bottom_text_y = 1200
        bottom_percentage_y = 1100

        # Add dividing line
        line_thickness = 8
        black_line = ColorClip((self.width, line_thickness), color=(0, 0, 0)).set_duration(self.total_duration)
        black_line = black_line.set_position((0, self.middle_y - line_thickness // 2))
        clips.append(black_line)

        # Add center black circle
        circle_diameter = 50
        circle_size = (circle_diameter, circle_diameter)
        circle_img = Image.new("RGBA", circle_size, (0, 0, 0, 0))
        draw = ImageDraw.Draw(circle_img)
        draw.ellipse((0, 0, circle_diameter, circle_diameter), fill=(0, 0, 0, 255))
        
        circle_clip = ImageClip(np.array(circle_img)).set_duration(self.total_duration)
        circle_position = (self.width // 2 - circle_diameter // 2, self.middle_y - circle_diameter // 2)
        clips.append(circle_clip.set_position(circle_position))

        # Add top image (Option 1)
        img1_clip = self.process_image(
            image1_path,
            start_time=audio1_start,
            duration=self.total_duration - audio1_start
        )
        if img1_clip:
            clips.append(img1_clip.set_position(("center", top_image_y)))

        # Add top text
        clips.append(self.create_styled_text(
            option1_text,
            top_text_y,
            self.total_duration - audio1_start,
            audio1_start
        ))

        # Add bottom image (Option 2)
        img2_clip = self.process_image(
            image2_path,
            start_time=audio2_start,
            duration=self.total_duration - audio2_start
        )
        if img2_clip:
            clips.append(img2_clip.set_position(("center", bottom_image_y)))

        # Add bottom text
        clips.append(self.create_styled_text(
            option2_text,
            bottom_text_y,
            self.total_duration - audio2_start,
            audio2_start
        ))

        # Add countdown timer
        clips.extend(self.create_timer_clips(countdown_start_time, countdown_seconds))

        # Add percentage indicators
        clips.append(self.create_styled_text(
            percent1,
            top_percentage_y,
            percentage_duration,
            countdown_start_time + countdown_seconds,
            fontsize=100,
            color="yellow"
        ))

        clips.append(self.create_styled_text(
            percent2,
            bottom_percentage_y,
            percentage_duration,
            countdown_start_time + countdown_seconds,
            fontsize=100,
            color="yellow"
        ))

        # Create final composite
        debug_print("Creating final composite...")
        final_clip = CompositeVideoClip(clips, size=(self.width, self.height))

        # Add audio
        debug_print("Adding audio tracks...")
        try:
            composite_audio = CompositeAudioClip([
                audio1_clip.set_start(audio1_start),
                audio2_clip.set_start(audio2_start)
            ])
            final_clip = final_clip.set_audio(composite_audio)
        except Exception as e:
            debug_print(f"Error combining audio tracks: {str(e)}")

        # Render video
        debug_print(f"Rendering final video to {output_filename}...")
        final_clip.write_videofile(
            output_filename,
            fps=30,
            codec="libx264",
            audio_codec="aac",
            threads=4,
            preset="medium"
        )
        debug_print("Video generation complete.")