import yaml

lines = []
with open("/tmp/nezha-config-raw.yaml") as f:
    for line in f:
        if not line.startswith("custom_code"):
            lines.append(line)

config = yaml.safe_load("".join(lines))

config["custom_code"] = (
    "<style>"
    "body{background:url(/static/bg.jpg) no-repeat center center fixed!important;background-size:cover!important}"
    "#root,.loaded,.bg-background,.flex.min-h-screen{background:transparent!important}"
    "main{background:transparent!important}"
    "[class*=bg-card],button[class*=rounded-full]{background-color:rgba(255,255,255,0.01)!important;"
    "backdrop-filter:blur(2px) saturate(100%)!important;"
    "-webkit-backdrop-filter:blur(2px) saturate(100%)!important;"
    "border-radius:16px!important;"
    "border:1px solid rgba(255,255,255,0.2)!important;"
    "transition:all 0.3s ease!important;"
    "position:relative!important;overflow:hidden!important}"
    "header,nav,footer{background:transparent!important}"
    ".text-stone-400,.text-stone-500,.opacity-50,.text-muted-foreground,p.text-xs,span.text-xs{color:rgba(40,40,40,0.8)!important;opacity:1!important;font-weight:500!important}"
    "[class*=bg-card] p,[class*=bg-card] span,.font-medium,.font-semibold{color:#2a2a2a!important}"
    ".text-sm.font-medium{color:#2a2a2a!important;opacity:1!important}"
    "div[role=tablist]{background:rgba(0,0,0,0.05)!important;border:1px solid rgba(0,0,0,0.08)!important;backdrop-filter:blur(2px)!important}"
    "</style>"
)

with open("/tmp/nezha-config-fixed.yaml", "w") as f:
    yaml.dump(config, f, allow_unicode=True, default_flow_style=False)

print("done")
