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}"
    ".rounded-lg.border.bg-card{background:rgba(255,255,255,0.5)!important;"
    "backdrop-filter:blur(8px)!important;"
    "-webkit-backdrop-filter:blur(8px)!important;"
    "border:1px solid rgba(255,255,255,0.3)!important}"
    "header,nav,footer{background:transparent!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")
