"""
Changelog:
v0.2.1:
UI Update
 * Added icons to menu actions for better readability.
 * Improved menu navigation with directional arrows.
 * Refined the cheat menu visual style.
New Cheats
 * Added Reset Love.
 * Added Reset Obedience.
 * Added Reset Inhibition.
 * Added Reset Temptation.
 * Added Reset Lust.
 * Added Reset Partner Suspicion.
Partner System
 * Partner Friendship and Partner Suspicion are now handled by separate cheats.
v0.2.0:
- Added a version and credits footer to the bottom-right corner of the cheat menu.
- Added a cheat to change a girl's sexuality using her ID from GIRL_BY_ID.
- Added a cheat to make a girl best friends with all other girls.
v0.1.9:
New Feature: Integrated Pregnancy Management & Cheat Logic.
- Smart Impregnation Engine (force_impregnate_girl):
  * Added instant impregnation logic fully aligned with internal engine registers.
  * Safely initializes pregnancy state (_pregnant = True, _pregnancy_day = 0, _pregnancy_stage = 0, _pregnancy_known = True) and triggers cycle conception resets via safely wrapped exceptions.

- Dynamic Instant Birth Trigger (instant_pregnancy):
  * Automated instant pregnancy completion that respects game settings.
  * Dynamically queries the game's internal _pregnancy_birth_day() function (or falls back to evaluating store._pregnancy_duration) to determine whether the limit is 65 ("short") or 130 ("long") days.
  * Instantly sets the character's pregnancy day to the exact threshold required to fire the dev's birth event seamlessly on the next cycle/interaction without breaking story flags.
v0.1.8:
Cheat to reset the intoxication of the girls partners.
Improvements to menu texts to make them easier to understand.
v0.1.7:
Cheat to change the character name in player menu.
Android & Cross-Platform Compatibility: Added explicit Confirm and Cancel buttons to the name-change interface. This ensures full usability on mobile devices (Android) where physical keyboards or enter keys can sometimes break standard input popups.
Streamlined Player Name System: Refactored the name-changing logic to safely update the protagonist's name (Player.Name) without throwing interaction context errors.
v0.1.6:
I fix the cheat time now. It may work until the dev change the things
v0.1.5:
New cheat added for the new character shion!
v0.1.4:
A command was added to reset the suspicion level, which measures the probability of being caught.
Menu function names were changed to make them more intuitive.
The player's focus was changed to "Lust" since that's what increases.
v0.1.3:
Improvements & New Features
Smart Time Freeze System:
Implemented real-time synchronization between the cheat menu UI and the game engine's internal state (store._time_locked).
Auto-Reset: The freeze time toggle now automatically disables itself whenever the game naturally forces a time skip (e.g., going to sleep or advancing story events), preventing progression bugs or frozen logic.
Allows free map navigation without wasting any of your 100 time units just searching for NPCs.
Stat Engine Refactoring (set_player_stat):
Dynamic Architecture: Replaced redundant elif blocks with a dictionary mapping system (stat_map), making the codebase significantly cleaner, faster, and easier to extend.
Crash Prevention: Wrapped execution in safe exception handling (try/except) with method callable checks. If future game updates alter attribute references, the menu will gracefully skip the action instead of crashing your game.
Bug Fixes
Focus Attribute Fix: Resolved the TypeError: 'int' object is not callable crash by changing the method call p.Focus(value) to direct assignment p.Focus = value.
V0.1.2:
Fixed overlap of achievements with the cheats button
V0.1.1:
New UI menu and also added the new character from the update for the cheat menu
Screen Navigation (Dynamic Flow per Character) - Intuitive Navigation
New cheats: max gifts +999 , freeze time.
Granular Actions for Characters:
set_girl_single_stat(girl_id, stat, value): Allows modifying individual attributes (Love, Obed, Inbt) without altering all stats at once.
reset_girl_drunk(girl_id): Clears only the alcohol level of the selected character.
max_girl_partner(girl_id): Maximizes friendship and reduces suspicion to zero for the associated partner/secondary character.
Atomic Player Control:
set_player_stat(stat, value): Unifies player attribute modifications (Energy, Cash, Attractiveness, Study level, Alcohol level) into a single parameterized function."""
init 999 python:
    def set_player_stat(stat, value=None):
        try:
            if stat == "sober":
                if hasattr(store, "_hangout_player_alcohol"):
                    store._hangout_player_alcohol = 0.0
                return
            if not hasattr(store, "Player"):
                return    
            p = store.Player
            stat_map = {
                "energy": "energy_max",
                "attractiveness": "attractiveness",
                "study": "study_level",
                "workout": "total_workouts",
                "Focus": "Focus"
            }
            if stat in stat_map:
                attr_name = stat_map[stat]
                if hasattr(p, attr_name):
                    setattr(p, attr_name, value)
            elif stat == "cash" and hasattr(p, "add_cash"):
                if callable(getattr(p, "add_cash")):
                    p.add_cash(value)
        except Exception as e:
            pass
    def give_max_gifts():
        if hasattr(store, "Player") and hasattr(store, "SHOP_CATALOG"):
            p = store.Player
            gifts = store.SHOP_CATALOG.get("gifts", {}).get("items", [])
            for item in gifts:
                item_id = item.get("id")
                if item_id and hasattr(p, "get_item_count") and hasattr(p, "add_item"):
                    try:
                        current = p.get_item_count(item_id)
                        needed = 999 - current
                        if needed > 0:
                            p.add_item(item_id, needed)
                    except Exception:
                        pass

    def caught_system():
        try:
            if hasattr(store, "_public_attention"):
                store._public_attention = 0
        except Exception:
            pass

    def _enforce_time_freeze_callback():
        if getattr(persistent, "switch", False):
            if hasattr(store, "time_lock") and callable(store.time_lock):
                store.time_lock()
            else:
                store._time_locked = True

    if _enforce_time_freeze_callback not in config.interact_callbacks:
        config.interact_callbacks.append(_enforce_time_freeze_callback)


    def is_time_frozen():
        return getattr(persistent, "switch", False)

    def toggle_freeze_time():
        try:
            new_state = not getattr(persistent, "switch", False)
            persistent.switch = new_state
            
            if new_state:
                if hasattr(store, "time_lock") and callable(store.time_lock):
                    store.time_lock()
                else:
                    store._time_locked = True
            else:
                if hasattr(store, "time_unlock") and callable(store.time_unlock):
                    store.time_unlock()
                else:
                    store._time_locked = False
        except Exception:
            pass



    def set_girl_single_stat(girl_id, stat, value):
        if hasattr(store, "GIRL_BY_ID"):
            girl_obj = store.GIRL_BY_ID.get(girl_id)
            if girl_obj and 'Change_Status' in globals():
                try:
                    Change_Status(girl_obj, stat, value)
                except Exception:
                    pass

    def reset_girl_drunk(girl_id):
        if hasattr(store, "GIRL_BY_ID"):
            girl_obj = store.GIRL_BY_ID.get(girl_id)
            if girl_obj:
                try:
                    fn_set_drunk = globals().get("set_drunk")
                    if callable(fn_set_drunk):
                        fn_set_drunk(girl_obj, 0.0)
                    elif hasattr(girl_obj, "_hangout_alcohol"):
                        setattr(girl_obj, "_hangout_alcohol", 0.0)
                except Exception:
                    pass
    def max_partner_friendship(girl_id):
        if hasattr(store, "GIRL_BY_ID"):
            girl_obj = store.GIRL_BY_ID.get(girl_id)
            if girl_obj:
                npc_partners = getattr(store, "NPC_PARTNERS", {})
                girl_gid = getattr(girl_obj, "gid", girl_id)
                npc = npc_partners.get("npc_bf_%s" % girl_gid) or npc_partners.get("npc_gf_%s" % girl_gid)
                if npc and hasattr(npc, "friendship_with_player"):
                    npc.friendship_with_player = 10000

    def reset_partner_suspicion(girl_id):
        if hasattr(store, "GIRL_BY_ID"):
            girl_obj = store.GIRL_BY_ID.get(girl_id)
            if girl_obj:
                npc_partners = getattr(store, "NPC_PARTNERS", {})
                girl_gid = getattr(girl_obj, "gid", girl_id)
                npc = npc_partners.get("npc_bf_%s" % girl_gid) or npc_partners.get("npc_gf_%s" % girl_gid)
                if npc and hasattr(npc, "suspicion"):
                    npc.suspicion = 0

    #def max_girl_partner(girl_id):
        #if hasattr(store, "GIRL_BY_ID"):
            #girl_obj = store.GIRL_BY_ID.get(girl_id)
            #if girl_obj:
                #npc_partners = getattr(store, "NPC_PARTNERS", {})
                #girl_gid = getattr(girl_obj, "gid", girl_id)
                #npc = npc_partners.get("npc_bf_%s" % girl_gid) or npc_partners.get("npc_gf_%s" % girl_gid)
                #if npc:
                    #if hasattr(npc, "friendship_with_player"):
                        #npc.friendship_with_player = 10000
                    #if hasattr(npc, "suspicion"):
                       # npc.suspicion = 0

    def reset_partner_drunk(girl_id):
        if hasattr(store, "GIRL_BY_ID"):
            girl_obj = store.GIRL_BY_ID.get(girl_id)
            if girl_obj:
                npc_partners = getattr(store, "NPC_PARTNERS", {})
                girl_gid = getattr(girl_obj, "gid", girl_id)
                npc = npc_partners.get("npc_bf_%s" % girl_gid) or npc_partners.get("npc_gf_%s" % girl_gid)
                try:
                    fn_set_drunk = globals().get("set_drunk")
                    if npc:
                        if callable(fn_set_drunk):
                            fn_set_drunk(npc, 0.0)
                        elif hasattr(npc, "_hangout_alcohol"):
                            setattr(npc, "_hangout_alcohol", 0.0)
                except Exception:
                    pass

    def refill_girl_by_id(girl_id):
        set_girl_single_stat(girl_id, "Love", 10000)
        set_girl_single_stat(girl_id, "Obed", 10000)
        set_girl_single_stat(girl_id, "Inbt", 10000)
        set_girl_single_stat(girl_id, "Temptation", 10000)
        set_girl_single_stat(girl_id, "Lust", 10000)
        reset_girl_drunk(girl_id)
        max_partner_friendship(girl_id)
        reset_partner_suspicion(girl_id)
        #max_girl_partner(girl_id)

    def refill_all_direct():
        for gid in ["gwen", "rogue", "ntw", "tenny","shion"]:
            refill_girl_by_id(gid)

    def set_character_name(target_type, target_id, new_name):
        if target_type != "player":
            return
        new_name = str(new_name).strip()
        if not new_name:
            return

        try:
            p = store.Player
            p.Name = new_name
            renpy.log("Player name changed to: {}".format(p.Name))
        except Exception as e:
            renpy.log("Error changing player name: {}".format(e))

    def prompt_change_player_name():
        current_name = getattr(
            getattr(store, "Player", None),
            "Name",
            "Player"
        )
        store._cheat_temp_input_var = str(current_name)
        renpy.show_screen("cheat_input_screen",prompt_text="ENTER NEW PLAYER NAME:",default_text=str(current_name))
    def confirm_player_name():
        new_name = str(getattr(store, "_cheat_temp_input_var", "")).strip()
        if new_name:
            set_character_name("player", None, new_name)
        renpy.hide_screen("cheat_input_screen")

    def instant_pregnancy(girl_id):
        if hasattr(store, "GIRL_BY_ID"):
            girl_obj = store.GIRL_BY_ID.get(girl_id)
            if girl_obj:
                try:
                    max_days = None
                    if "_pregnancy_birth_day" in globals() and callable(_pregnancy_birth_day):
                        max_days = _pregnancy_birth_day()
                    elif hasattr(store, "_pregnancy_birth_day") and callable(store._pregnancy_birth_day):
                        max_days = store._pregnancy_birth_day()
                    
                    if max_days is None:
                        duration = getattr(store, "_pregnancy_duration", "short")
                        max_days = 65 if duration == "short" else 130

                    girl_obj._pregnant = True
                    girl_obj._pregnancy_known = True
                    girl_obj._pregnancy_day = max_days
                except Exception:
                    pass

    def force_impregnate_girl(girl_id):
        if hasattr(store, "GIRL_BY_ID"):
            girl_obj = store.GIRL_BY_ID.get(girl_id)
            if girl_obj:
                try:
                    girl_obj._pregnant = True
                    girl_obj._pregnancy_day = 0
                    girl_obj._pregnancy_stage = 0
                    girl_obj._pregnancy_known = True
                    if "_pregnancy_reset_flags" in globals() and callable(_pregnancy_reset_flags):
                        _pregnancy_reset_flags(girl_obj, "cycle", "conception")
                    elif hasattr(store, "_pregnancy_reset_flags") and callable(store._pregnancy_reset_flags):
                        store._pregnancy_reset_flags(girl_obj, "cycle", "conception")
                        
                except Exception:
                    pass

    def cheat_set_sexuality(girl_id, sexuality):
        try:
            if getattr(store, "sexuality_locked", False):
                return

            girl_obj = getattr(store, "GIRL_BY_ID", {}).get(girl_id)
            if girl_obj is None:
                return

            spectrum_values = {
                "heterosexual": 0,
                "bisexual": 50,
                "lesbian": 100,
                "homosexual": 100,
            }

            if sexuality not in spectrum_values:
                return

            girl_obj.sexuality_spectrum = spectrum_values[sexuality]
            girl_obj._spectrum_temp_shift = 0

            traits = getattr(girl_obj, "traits", None)

            if traits is not None:
                if sexuality == "bisexual":
                    traits.add("bisexual")
                    traits.discard("lesbian")
                elif sexuality in ("lesbian", "homosexual"):
                    traits.discard("bisexual")
                    traits.add("lesbian")
                else:
                    traits.discard("bisexual")
                    traits.discard("lesbian")

            fn_debug = globals().get("debug_log")
            if callable(fn_debug):
                fn_debug(
                    "[SPECTRUM CHEAT] %s -> %s (%s)"
                    % (girl_obj.gid, sexuality, girl_obj.sexuality_spectrum)
                )

        except Exception as e:
            renpy.log("[SPECTRUM CHEAT] Error: {}".format(e))
    def cheat_max_all_npc_friendship(girl_id):
        try:
            girls = getattr(store, "GIRL_BY_ID", {})
            girl_a = girls.get(girl_id)

            if girl_a is None:
                return

            for other_id, girl_b in girls.items():

                if girl_b is None or girl_b is girl_a:
                    continue

                Change_Girl_Like(
                    girl_a,
                    girl_b,
                    MAX_STAT,
                    mutual=True,
                    show_popup=False,
                    raw=True
                )

        except Exception as e:
            renpy.log("[NPC FRIENDSHIP CHEAT] Error: {}".format(e))


default persistent.cheat_menu_visible = False
default persistent.switch = False
default persistent.cheat_submenu = "main"
default persistent.selected_girl = ""

init -2:

    style cheat_button is default:
        background "#1c1c3a"
        hover_background "#2c2c55"

        xpadding 12
        ypadding 8

    style cheat_button_text is default:
        color "#eeeeff"
        hover_color "#ff90b8"

        size 16
        bold True

        outlines [
        (1, "#000000", 0, 0)
    ]


screen hud_refill_button_overlay():
    zorder 9999  

    frame:
        align (0.92, 0.25)   
        padding (14, 10)
        background "#12122a"   

        textbutton "CHEATS":
            action ToggleVariable("persistent.cheat_menu_visible")
            text_size 18
            text_bold True
            text_color "#ffffff"
            text_hover_color "#ff90b8"
    if persistent.cheat_menu_visible:
        button:
            xysize (config.screen_width, config.screen_height)
            background "#000000aa"
            action SetVariable("persistent.cheat_menu_visible", False)

            frame:
                background "#12122af0"
                padding (28, 24)
                xalign 0.5
                yalign 0.5
                xmaximum 440

                vbox:
                    spacing 10
                    xfill True

                    # -------------------------------------------------------------
                    # 1. MAIN MENU
                    # -------------------------------------------------------------
                    if persistent.cheat_submenu == "main":
                        text "CHEATS MENU" size 22 color "#eeeeff" hover_color "#ff90b8"  outlines [

 (1, "#000000", 0, 0),

 (1, "#b85c85", 0, 0)

] bold True xalign 0.5
                        text "Select a category:" size 12 color "#eeeeff" hover_color "#ff90b8"  outlines [

 (1, "#000000", 0, 0),

 (1, "#b85c85", 0, 0)

] bold True xalign 0.5
                        null height 6

                        textbutton "Girls >":
                            xfill True
                            action SetVariable("persistent.cheat_submenu", "girls_list")
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        textbutton "Others / Player Stats >":
                            xfill True
                            action SetVariable("persistent.cheat_submenu", "others_menu")
                            style "cheat_button"
                            #text_size 16 text_color "#ff90b8" text_hover_color "#ffffff"

                        null height 8

                        textbutton "Close":
                            xfill True
                            action SetVariable("persistent.cheat_menu_visible", False)
                            style "cheat_button"
                            text_xalign 0.5
                            #text_size 15 text_color "#8a9ab8" text_hover_color "#c8d8f0" text_xalign 0.5

                    # -------------------------------------------------------------
                    # 2. GIRLS MENU
                    # -------------------------------------------------------------
                    elif persistent.cheat_submenu == "girls_list":
                        text "SELECT A GIRL" size 22 color "#eeeeff" hover_color "#ff90b8"  outlines [

 (1, "#000000", 0, 0),

 (1, "#b85c85", 0, 0)

] bold True xalign 0.5
                        null height 6

                        textbutton "Rogue >":
                            xfill True
                            action [SetVariable("persistent.selected_girl", "rogue"), SetVariable("persistent.cheat_submenu", "girl_menu")]
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        textbutton "Negasonic >":
                            xfill True
                            action [SetVariable("persistent.selected_girl", "ntw"), SetVariable("persistent.cheat_submenu", "girl_menu")]
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        textbutton "Gwen >":
                            xfill True
                            action [SetVariable("persistent.selected_girl", "gwen"), SetVariable("persistent.cheat_submenu", "girl_menu")]
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        textbutton "Tenny >":
                            xfill True
                            action [SetVariable("persistent.selected_girl", "tenny"), SetVariable("persistent.cheat_submenu", "girl_menu")]
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        textbutton "Shion >":
                            xfill True
                            action [SetVariable("persistent.selected_girl", "shion"), SetVariable("persistent.cheat_submenu", "girl_menu")]
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        null height 8

                        textbutton "< back to main menu":
                            xfill True
                            action SetVariable("persistent.cheat_submenu", "main")
                            style "cheat_button"
                            text_xalign 0.5
                            #text_size 15 text_color "#8a9ab8" text_hover_color "#c8d8f0" text_xalign 0.5

                    # -------------------------------------------------------------
                    # 3. SUBMENU GIRL'S OPTIONS
                    # -------------------------------------------------------------
                    elif persistent.cheat_submenu == "girl_menu":
                        text ("[ 'Girl: ' + persistent.selected_girl.upper() ]") size 22 color "#eeeeff" hover_color "#ff90b8"  outlines [

 (1, "#000000", 0, 0),

 (1, "#b85c85", 0, 0)

] bold True xalign 0.5
                        null height 6

                        textbutton "Stats (Love, Obed, Inbt) >":
                            xfill True
                            action SetVariable("persistent.cheat_submenu", "girl_stats")
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        textbutton "🤝 Increase your friendship with her partner":
                            xfill True
                            action Function(max_partner_friendship, persistent.selected_girl)
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        textbutton "⚠ Reset Partner Suspicion":
                            xfill True
                            action Function(reset_partner_suspicion, persistent.selected_girl)
                            style "cheat_button"

                        textbutton "🍺 Reset their state of intoxication":
                            xfill True
                            action Function(reset_girl_drunk, persistent.selected_girl)
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"


                        textbutton "🍺 Reset the intoxication of their partner":
                            xfill True
                            action Function(reset_partner_drunk, persistent.selected_girl)
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        textbutton "👶 Instant Pregnancy":
                            xfill True
                            action Function(force_impregnate_girl, persistent.selected_girl)
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        textbutton "🍼 Instant Birth":
                            xfill True
                            action Function(instant_pregnancy, persistent.selected_girl)
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8" 

                        textbutton "♀ Make her heterosexual":
                            xfill True
                            action Function(cheat_set_sexuality, persistent.selected_girl, "heterosexual")
                            #text_size 16
                            #text_color "#eeeef8"
                            style "cheat_button"
                            #text_hover_color "#ff90b8"

                        textbutton "💜 Make her bisexual":
                            xfill True
                            action Function(cheat_set_sexuality, persistent.selected_girl, "bisexual")
                            #text_size 16
                            #text_color "#eeeef8"
                            style "cheat_button"
                            #text_hover_color "#ff90b8"

                        textbutton "🌈 Make her Lesbian":
                            xfill True
                            action Function(cheat_set_sexuality, persistent.selected_girl, "homosexual")
                            #text_size 16
                            #text_color "#eeeef8"
                            style "cheat_button"
                            #text_hover_color "#ff90b8"

                        textbutton "👭 Make her best friends with all girls":
                            xfill True
                            action Function(cheat_max_all_npc_friendship, persistent.selected_girl)     
                            #text_size 16
                            #text_color "#eeeef8"
                            style "cheat_button"
                            #text_hover_color "#ff90b8"                  

                        textbutton "🚀 MAX All":
                            xfill True
                            action Function(refill_girl_by_id, persistent.selected_girl)
                            style "cheat_button"
                            #text_size 16 text_color "#ff90b8" text_hover_color "#ffffff"

                        null height 8

                        textbutton "< Back to girls":
                            xfill True
                            action SetVariable("persistent.cheat_submenu", "girls_list")
                            style "cheat_button"
                            text_xalign 0.5
                            #text_size 15 text_color "#8a9ab8" text_hover_color "#c8d8f0" text_xalign 0.5

                    # -------------------------------------------------------------
                    # 4. GIRL SPECIFIC STATS
                    # -------------------------------------------------------------
                    elif persistent.cheat_submenu == "girl_stats":
                        text ("Stats of " + persistent.selected_girl.upper()) size 22 color "#eeeeff" hover_color "#ff90b8"  outlines [

 (1, "#000000", 0, 0),

 (1, "#b85c85", 0, 0)

] bold True xalign 0.5
                        null height 6

                        textbutton "💖 +Love":
                            xfill True
                            action Function(set_girl_single_stat, persistent.selected_girl, "Love", 1000)
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        textbutton "💔 Reset Love":
                            xfill True
                            style "cheat_button"
                            action Function(
                            set_girl_single_stat,
                            persistent.selected_girl,
                            "Love",-1000)

                        textbutton "🔒 +Obedience":
                            xfill True
                            action Function(set_girl_single_stat, persistent.selected_girl, "Obed", 1000)
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        textbutton "🔓 Reset Obedience":
                            xfill True
                            action Function(set_girl_single_stat, persistent.selected_girl, "Obed", -1000)
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        textbutton "😍 +Inhibition":
                            xfill True
                            action Function(set_girl_single_stat, persistent.selected_girl, "Inbt", 1000)
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        textbutton "😐 Reset Inhibition":
                            xfill True
                            action Function(set_girl_single_stat, persistent.selected_girl, "Inbt", -1000)
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        textbutton "💋 +Temptation":
                            xfill True
                            action Function(set_girl_single_stat, persistent.selected_girl, "Temptation", 1000)
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        textbutton "❄️ Reset Temptation":
                            xfill True
                            action Function(set_girl_single_stat, persistent.selected_girl, "Temptation", -1000)
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        textbutton "🔥 +Lust":
                            xfill True
                            action Function(set_girl_single_stat, persistent.selected_girl, "Lust", 1000)
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        textbutton "🧊 Reset Lust":
                            xfill True
                            action Function(set_girl_single_stat, persistent.selected_girl, "Lust", -1000)
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        null height 8

                        

                        textbutton "< Back to " + persistent.selected_girl.capitalize():
                            xfill True
                            action SetVariable("persistent.cheat_submenu", "girl_menu")
                            style "cheat_button"
                            text_xalign 0.5
                            #text_size 15 text_color "#8a9ab8" text_hover_color "#c8d8f0" text_xalign 0.5

                    # -------------------------------------------------------------
                    # 5. OTHERS SUBMENU
                    # -------------------------------------------------------------
                    elif persistent.cheat_submenu == "others_menu":
                        text "OTHERS / PLAYER STATS" size 22 color "#eeeeff" hover_color "#ff90b8"  outlines [

 (1, "#000000", 0, 0),

 (1, "#b85c85", 0, 0)

] bold True xalign 0.5
                        null height 6

                        textbutton "Player Stats >":
                            xfill True
                            action SetVariable("persistent.cheat_submenu", "player_stats")
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        textbutton "🎁 Max Gifts (999)":
                            xfill True
                            action Function(give_max_gifts)
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        textbutton "⏱ Freeze Time ([ 'ON' if is_time_frozen() else 'OFF' ])":
                            xfill True
                            action Function(toggle_freeze_time)
                            style "cheat_button"
                            #text_size 16
                            #text_color ("#ff90b8" if is_time_frozen() else "#eeeef8")
                            #text_hover_color "#ff90b8"

                        textbutton "⚠ Reset the rate to get caught":
                            xfill True
                            action Function(caught_system)
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        null height 8

                        textbutton "< Back to main menu":
                            xfill True
                            action SetVariable("persistent.cheat_submenu", "main")
                            style "cheat_button"
                            text_xalign 0.5
                            #text_size 15 text_color "#8a9ab8" text_hover_color "#c8d8f0" text_xalign 0.5

                    # -------------------------------------------------------------
                    # 6. PLAYER ATTRIBUTES (PLAYER STATS)
                    # -------------------------------------------------------------
                    elif persistent.cheat_submenu == "player_stats":
                        text "PLAYER STATS" size 20 color "#eeeeff" hover_color "#ff90b8"  outlines [

 (1, "#000000", 0, 0),

 (1, "#b85c85", 0, 0)

] bold True xalign 0.5
                        null height 6

                        textbutton "Change your Name >":
                            xfill True
                            action Function(prompt_change_player_name)
                            style "cheat_button"
                            #text_size 16
                            #text_color "#eeeef8"
                           # text_hover_color "#ff90b8"

                        textbutton "⚡ Max Stamina":
                            xfill True
                            action Function(set_player_stat, "energy", 25)
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        textbutton "🎓 Max study":
                            xfill True
                            action Function(set_player_stat, "study", 100)
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        textbutton "✨ Max attractiveness":
                            xfill True
                            action Function(set_player_stat, "attractiveness", 100)
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        textbutton "💪 Max workout":
                            xfill True
                            action Function(set_player_stat, "workout", 100)
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        textbutton "🍺 Reset intoxication":
                            xfill True
                            action Function(set_player_stat, "sober", 0.0)
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        textbutton "💰 +$10,000 ":
                            xfill True
                            action Function(set_player_stat, "cash", 10000)
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        textbutton "🔥 Max lust":
                            xfill True
                            action Function(set_player_stat, "Focus", 100)
                            style "cheat_button"
                            #text_size 16 text_color "#eeeef8" text_hover_color "#ff90b8"

                        null height 8

                        textbutton "< Back to others":
                            xfill True
                            action SetVariable("persistent.cheat_submenu", "others_menu")
                            style "cheat_button"
                            text_xalign 0.5
                            #text_size 15 text_color "#8a9ab8" text_hover_color "#c8d8f0" text_xalign 0.5
                    # -------------------------------------------------------------
                    # MENU FOOTER - VERSION & CREDITS (shown on every submenu)
                    # -------------------------------------------------------------
                    null height 12

                    text "Version 0.2.1  |  Credits: Vuistaz":
                        xfill True
                        size 10
                        color "#8a9ab8"
                        text_align 1.0


screen cheat_input_screen(prompt_text, default_text=""):
    zorder 99999
    modal True

    add "#000000aa"

    frame:
        xalign 0.5
        yalign 0.5
        xmaximum 500
        padding (30, 25)
        background "#12122af0"

        vbox:
            spacing 15
            xfill True

            text prompt_text:
                size 18
                color "#eeeef8"
                bold True
                xalign 0.5

            frame:
                background "#1c1c3a"
                padding (10, 8)
                xfill True

                input:
                    value VariableInputValue(
                        "_cheat_temp_input_var"
                    )
                    length 15
                    color "#ff90b8"
                    size 18
                    xalign 0.5
                    default default_text

            text "Press ENTER to confirm":
                size 12
                color "#8a9ab8"
                xalign 0.5

            hbox:
                spacing 12
                xalign 0.5

                textbutton "Confirm":
                    action Function(confirm_player_name)

                textbutton "Cancel":
                    action Hide("cheat_input_screen")
init python:
    if "hud_refill_button_overlay" not in config.overlay_screens:
        config.overlay_screens.append("hud_refill_button_overlay")