define e = Character("2B", color="#87ceeb")
define m = Character("Max", color="#87ceeb")
define c = Character("Chloe", color="#ff4444")

# Create a variable that points to the current tutor
default tutor = None
$ tutor_name = ""
default tutor_mode = " clothed1"
default power = 1
default show_affection_popup = False
default patreon = False

# Add this style definition at the top of your script (before label start)
style menu_window:
    yalign 0.5
    xalign 0.5

# Transform definitions
transform breathing_center:
    ease 1.5 zoom 1.01
    ease 1.5 zoom 1.0
    repeat

transform breathing_right:
    ease 1.5 zoom 1.01 xoffset 10
    ease 1.5 zoom 1.0 xoffset 0
    repeat

transform breathing_left:
    ease 1.5 zoom 1.01 xoffset -10
    ease 1.5 zoom 1.0 xoffset 0
    repeat


screen patreon_button():
    zorder 100
    
    textbutton "Support on Patreon ❤️":
        xpos 20
        ypos 20
        padding (30, 40)
        text_size 44
        action OpenURL("https://patreon.com/c10ud")
        background "#ff6b4a"
        hover_background "#ff8c6a"
        text_color "#ffffff"


# Updated label start to use the new screen
label start:
    scene bg plane
    show screen patreon_button
    show 2b clothed1 at center, breathing_center
    "Welcome to Gooners academy: {b}48 Laws of Power{/b} Visual Novel!"
    
    call screen tutor_selection
    $ tutor_name = _return
    
    if tutor_name == "2b":
        $ tutor = e
        hide max
        hide chloe
        with dissolve
        show 2b clothed1 at center, breathing_center with move
        tutor "Greetings, Operator. I am YoRHa No.2 Type B, designated as tutor."
        tutor "My current mission parameters include instruction in human strategic theory—specifically, the 48 Laws of Power."
        tutor "We will proceed one law per session. Comprehension will be verified. Efficiency is expected."

    play music "dango.opus"
    jump chapter_label
    return


screen bio_text(message):
    frame:
        xalign 0.5
        yalign 0.95
        background "#000000cc"
        padding (30, 20)
        xmaximum 900
        
        text message size 24 color "#ffffff" text_align 0.5


# Add these transform definitions with your other transforms
transform fade_in_slide:
    alpha 0.0 yoffset 30
    ease 0.4 alpha 1.0 yoffset 0

transform button_hover:
    on idle:
        ease 0.2 zoom 1.0
    on hover:
        ease 0.2 zoom 1.05


label chapter_label:
    show bg classroom normal with dissolve
    $ tutor_image = tutor_name + tutor_mode
    show expression tutor_image at left, breathing_left with move
    show screen affection_display
    show screen tutor_mode_selector with dissolve
    if tutor_name == "2b":
        tutor "YoRHa No.2 Type B at your service."
    call screen laws_of_power_menu
    return


screen tutor_mode_selector:
    zorder 10
    
    # Left sidebar button - MASSIVE SIZE
    button:
        xpos 100
        ypos 900
        xysize (350, 200)
        background "#ff6b4a"
        hover_background "#ff8c6a"
        action Show("tutor_mode_menu")
        at mode_button_alpha
        
        text "CHANGE\nSTYLE" size 80 color "#ffffff" xalign 0.5 yalign 0.5


screen tutor_mode_menu:
    modal True
    zorder 20
    
    # Semi-transparent overlay
    add "#00000099" xysize (config.screen_width, config.screen_height)
    
    # Calculate unlock status based on power variable
    $ style_1_unlocked = True  # Always available
    $ style_2_unlocked = power >= 8
    $ style_3_unlocked = power >= 16
    $ style_4_unlocked = power >= 24
    $ style_5_unlocked = power >= 32
    $ style_6_unlocked = power >= 40
    $ style_7_unlocked = power >= 48
    
    frame:
        xalign 0.5
        yalign 0.5
        xysize (1800, 2400)
        background Frame("gui/frame.png", 20, 20)
        at menu_pop_in
        padding (100, 100, 100, 100)
        
        vbox:
            xalign 0.5
            spacing 50
            
            text "SELECT STYLE" size 140 color "#ff6b4a" xalign 0.5
            
            # Style 1 - clothed1 - Always unlocked
            button:
                xysize (1400, 180)
                background "#2d2d2d"
                hover_background "#ff6b4a"
                action Function(change_tutor_mode, " clothed1"), Hide("tutor_mode_menu")
                xalign 0.5
                
                text "Clothed 1" size 90 color "#ffffff" xalign 0.5 yalign 0.5
            
            # Style 2 - clothed2 - Unlock at power 8
            if style_2_unlocked:
                button:
                    xysize (1400, 180)
                    background "#2d2d2d"
                    hover_background "#ff6b4a"
                    action Function(change_tutor_mode, " clothed2"), Hide("tutor_mode_menu")
                    xalign 0.5
                    
                    text "Clothed 2" size 90 color "#ffffff" xalign 0.5 yalign 0.5
            else:
                button:
                    xysize (1400, 180)
                    background "#1a1a1a"
                    sensitive False
                    xalign 0.5
                    
                    text "Clothed 2 - Unlock at Power 8" size 80 color "#666666" xalign 0.5 yalign 0.5
            
            # Style 3 - undies1 - Unlock at power 16
            if style_3_unlocked:
                button:
                    xysize (1400, 180)
                    background "#2d2d2d"
                    hover_background "#ff6b4a"
                    action Function(change_tutor_mode, " undies1"), Hide("tutor_mode_menu")
                    xalign 0.5
                    
                    text "Undies 1" size 90 color "#ffffff" xalign 0.5 yalign 0.5
            else:
                button:
                    xysize (1400, 180)
                    background "#1a1a1a"
                    sensitive False
                    xalign 0.5
                    
                    text "Undies 1 - Unlock at Power 16" size 80 color "#666666" xalign 0.5 yalign 0.5
            
            # Style 4 - undies2 - Unlock at power 24
            if style_4_unlocked:
                button:
                    xysize (1400, 180)
                    background "#2d2d2d"
                    hover_background "#ff6b4a"
                    action Function(change_tutor_mode, " undies2"), Hide("tutor_mode_menu")
                    xalign 0.5
                    
                    text "Undies 2" size 90 color "#ffffff" xalign 0.5 yalign 0.5
            else:
                button:
                    xysize (1400, 180)
                    background "#1a1a1a"
                    sensitive False
                    xalign 0.5
                    
                    text "Undies 2 - Unlock at Power 24" size 80 color "#666666" xalign 0.5 yalign 0.5
            
            # Style 5 - shorts1 - Unlock at power 32
            if style_5_unlocked:
                button:
                    xysize (1400, 180)
                    background "#2d2d2d"
                    hover_background "#ff6b4a"
                    action Function(change_tutor_mode, " shorts1"), Hide("tutor_mode_menu")
                    xalign 0.5
                    
                    text "Shorts 1" size 90 color "#ffffff" xalign 0.5 yalign 0.5
            else:
                button:
                    xysize (1400, 180)
                    background "#1a1a1a"
                    sensitive False
                    xalign 0.5
                    
                    text "Shorts 1 - Unlock at Power 32" size 80 color "#666666" xalign 0.5 yalign 0.5
            
            # Style 6 - naked1 - Unlock at power 40
            if style_6_unlocked:
                button:
                    xysize (1400, 180)
                    background "#2d2d2d"
                    hover_background "#ff6b4a"
                    action Function(change_tutor_mode, " naked1"), Hide("tutor_mode_menu")
                    xalign 0.5
                    
                    text "Naked 1" size 90 color "#ffffff" xalign 0.5 yalign 0.5
            else:
                button:
                    xysize (1400, 180)
                    background "#1a1a1a"
                    sensitive False
                    xalign 0.5
                    
                    text "Naked 1 - Unlock at Power 40" size 80 color "#666666" xalign 0.5 yalign 0.5
            
            # Style 7 - naked2 - Unlock at power 48
            if style_7_unlocked:
                button:
                    xysize (1400, 180)
                    background "#2d2d2d"
                    hover_background "#ff6b4a"
                    action Function(change_tutor_mode, " naked2"), Hide("tutor_mode_menu")
                    xalign 0.5
                    
                    text "Naked 2" size 90 color "#ffffff" xalign 0.5 yalign 0.5
            else:
                button:
                    xysize (1400, 180)
                    background "#1a1a1a"
                    sensitive False
                    xalign 0.5
                    
                    text "Naked 2 - Unlock at Power 48" size 80 color "#666666" xalign 0.5 yalign 0.5


transform mode_button_alpha:
    on show:
        alpha 0.0 xoffset -200
        linear 0.6 alpha 1.0 xoffset 0
    on hide:
        linear 0.4 alpha 0.0 xoffset -200

transform menu_pop_in:
    on show:
        zoom 0.7
        alpha 0.0
        parallel:
            linear 0.5 zoom 1.0
        parallel:
            linear 0.5 alpha 1.0
    on hide:
        linear 0.3 zoom 0.85 alpha 0.0


init python:
    def change_tutor_mode(new_mode):
        global tutor_mode, tutor_image
        tutor_mode = new_mode
        tutor_image = tutor_name + tutor_mode
        
        # Update the tutor expression with a transition
        renpy.show(tutor_image)