import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { installDebugLog } from "./lib/debuglog";
import { SimApp } from "./modes/sim/SimApp";
import "./styles/base.css";
import "./styles/ui.css";

installDebugLog(); // overlay console → daemon log (the WKWebView inspector is unusable)

const root = document.getElementById("root");
if (!root) throw new Error("no #root element");

// ?mode=overlay → transparent shell over the real desktop; running inside the
// Tauri shell implies overlay. Default (browser/Space) → sim.
const overlay =
  new URLSearchParams(location.search).get("mode") === "overlay" || "__TAURI_INTERNALS__" in window;

createRoot(root).render(
  <StrictMode>
    <SimApp overlay={overlay} />
  </StrictMode>,
);
