import re

with open("/tmp/nezha-config-raw.yaml") as f:
    content = f.read()

content = re.sub(r"custom_code:.*\n?", "", content)

css = (
    '<style>'
    'body{background:url(/static/bg.jpg) no-repeat center center fixed!important;background-size:cover!important}'
    '#root,.loaded,.bg-background{background:transparent!important}'
    'main{background:transparent!important}'
    '.flex.min-h-screen{background:transparent!important}'
    'main>div>div,section,.card,.rounded-lg,.rounded-xl,.border{background:rgba(255,255,255,0.05)!important;border:1px solid rgba(255,255,255,0.15)!important;box-shadow:none!important}'
    'header,nav,footer{background:transparent!important}'
    '.bg-card,.bg-muted,.bg-accent,.bg-popover{background:rgba(255,255,255,0.05)!important}'
    '.text-muted-foreground{color:rgba(255,255,255,0.7)!important}'
    '.text-card-foreground,.text-foreground,p,span,h1,h2,h3{color:rgba(255,255,255,0.9)!important}'
    '</style>'
)

content = content.rstrip() + '\ncustom_code: "' + css + '"\n'

with open("/tmp/nezha-config-fixed.yaml", "w") as f:
    f.write(content)

print("done")
