from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]
JS = (ROOT / "ui_builder" / "static" / "app.js").read_text(encoding="utf-8")
CSS = (ROOT / "ui_builder" / "static" / "styles.css").read_text(encoding="utf-8")
APP = (ROOT / "app.py").read_text(encoding="utf-8")


def test_build70_prefers_css_zoom_for_runtime_canvas():
    assert 'CSS.supports("zoom", "1")' in JS
    assert 'el.runtimeStage.style.zoom = String(scale);' in JS
    assert 'el.runtimeStage.style.transform = "none";' in JS


def test_build70_fallback_does_not_force_translate3d_layer():
    start = JS.index('const canUseCssZoom')
    snippet = JS[start:start + 1500]
    assert 'style.transform = `translate3d' not in snippet
    assert 'el.runtimeStage.style.transform = `scale(${scale})`;' in snippet


def test_build70_runtime_topbar_has_no_backdrop_blur():
    start = CSS.index('.runtime-topbar {')
    runtime_topbar = CSS[start:CSS.index('}', start) + 1]
    assert 'backdrop-filter' not in runtime_topbar
    assert 'background: #080d15' in runtime_topbar


def test_build70_version():
    assert 'BUILD_VERSION = "2026.08.19.28"' in APP
