"""
shot.py — grab a screenshot of the live Flyff window (via host.py) to live.png.
Run:  python shot.py [outfile]
"""
import sys
from playwright.sync_api import sync_playwright
from session import get_page, viewport
from shots import shot_path


def main():
    out = sys.argv[1] if len(sys.argv) > 1 else shot_path("live.png")
    with sync_playwright() as p:
        browser, page = get_page(p)
        w, h = viewport(page)
        page.screenshot(path=out)
        print(f"Saved {out} from live window ({w}x{h} CSS px).")


if __name__ == "__main__":
    main()
