/* Sosh Insider — Bali :: root app (floating windows + bottom tab bar) */
const { CHAPTERS, TOTAL, PHOTO_ROLLS, VIDEOS, TRAILER, DRIVE_URL, DRIVE_COUNT } = window.BALI;

function TrailerWindow({ geom, onClose, onTitleDown, onFocus, z, narrow }) {
  const ref = React.useRef(null);
  const [playing, setPlaying] = React.useState(false);
  const [muted, setMuted] = React.useState(true);
  if (!TRAILER || !TRAILER.src) return null;
  const toggle = () => {
    const v = ref.current; if (!v) return;
    if (v.paused) { v.play(); setPlaying(true); } else { v.pause(); setPlaying(false); }
  };
  const toggleMute = (e) => {
    e.stopPropagation();
    const v = ref.current; if (!v) return;
    v.muted = !v.muted; setMuted(v.muted);
  };
  return (
    <div onMouseDown={onFocus} style={{ position: "absolute", left: geom.x, top: geom.y, width: geom.w, zIndex: z }}>
      <MacWindow
        title="SOSH TV — Bali, the reel"
        onClose={onClose}
        onTitleDown={onTitleDown}
        zoomable={false}
        style={{ position: "relative", width: "100%" }}
      >
        <div style={{ position: "relative", aspectRatio: "16 / 9", background: "#0b0b0b", borderBottom: "2px solid var(--line)", cursor: "pointer" }} onClick={toggle}>
          <video
            ref={ref}
            src={TRAILER.src}
            poster={TRAILER.poster}
            muted
            loop
            playsInline
            autoPlay
            onPlay={() => setPlaying(true)}
            onPause={() => setPlaying(false)}
            style={{ width: "100%", height: "100%", objectFit: "cover", display: "block", filter: "contrast(1.05) saturate(0.95)" }}
          />
          <div style={{ position: "absolute", inset: 0, pointerEvents: "none", background: "repeating-linear-gradient(to bottom, rgba(0,0,0,0.14) 0 1px, transparent 1px 3px)", mixBlendMode: "multiply" }} />
          <div style={{ position: "absolute", top: 9, left: 10 }}><SoshTVMark /></div>
          <div className="mono" style={{ position: "absolute", top: 11, right: 12, color: "#fff", background: playing ? "#d23b2e" : "rgba(0,0,0,0.55)", padding: "2px 7px", fontSize: 12, letterSpacing: 1 }}>
            {playing ? "● ON AIR" : "○ PAUSED"}
          </div>
          {!playing && (
            <div style={{ position: "absolute", inset: 0, margin: "auto", width: 60, height: 60, background: "rgba(20,16,13,0.45)", border: "2px solid rgba(255,255,255,0.85)", color: "#fff", fontSize: 22, display: "flex", alignItems: "center", justifyContent: "center" }}>▶</div>
          )}
        </div>
        <div style={{ display: "flex", alignItems: "center", gap: 6, padding: "3px 8px", borderBottom: "2px solid var(--line)", background: "var(--paper2)" }}>
          <span className="mono" style={{ fontSize: 13, flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>BALI_REEL.mp4</span>
          <span className="mono" style={{ fontSize: 12, color: "var(--ink-soft)" }}>1920×1080</span>
        </div>
        <div style={{ padding: "10px 12px 6px", background: "var(--paper)" }}>
          <div style={{ display: "flex", alignItems: "center", gap: 8 }}>
            <span className="pixel" style={{ fontSize: 10 }}>SOSH INSIDER: ON AIR</span>
            <span style={{ width: 8, height: 8, borderRadius: "50%", background: playing ? "#d23b2e" : "var(--ink-soft)", boxShadow: playing ? "0 0 0 2px rgba(210,59,46,0.25)" : "none" }} />
          </div>
          <div className="serif" style={{ fontSize: 18, marginTop: 4 }}>
            {TRAILER.title} <span style={{ color: "var(--ink-soft)" }}>— {TRAILER.subtitle}</span>
          </div>
        </div>
        <div style={{ display: "flex", alignItems: "center", gap: 7, padding: "4px 12px 12px", background: "var(--paper)", flexWrap: "wrap" }}>
          <PixelButton accent onClick={toggle} style={{ minWidth: 60, justifyContent: "center" }}>
            {playing ? "❚❚ Pause" : "▶ Play"}
          </PixelButton>
          <PixelButton onClick={toggleMute}>{muted ? "♪ Off" : "♪ On"}</PixelButton>
          <div style={{ flex: 1 }} />
          <span className="mono" style={{ fontSize: 13, color: "var(--ink-soft)", whiteSpace: "nowrap" }}>REEL 01/01</span>
        </div>
      </MacWindow>
    </div>
  );
}

function ThanksWindow({ geom, onClose, onTitleDown, onFocus, z }) {
  const body = `Sosh Insider — Bali
=====================

To the nine strangers who became something
in four days:

  Thank you for putting your phone in the box.
  Thank you for the bad jokes at 5am.
  Thank you for the last morning at Uluwatu.
  Thank you for not posting any of it.

This page is the only place it lives. If
you're reading this, it's because you were
there — or because someone who was there
trusted you with the link.

Don't share it.

Don't screenshot it.

Just remember it.

— R.

p.s. the manta point clip was Day 03,
     somewhere around 17m down. nobody
     said a word for the whole 8 minutes.
     that one stays with me.
`;
  return (
    <div onMouseDown={onFocus} style={{ position: "absolute", left: geom.x, top: geom.y, width: geom.w, height: geom.h, zIndex: z }}>
      <MacWindow title="thanks.txt — Sosh Insider" onClose={onClose} onTitleDown={onTitleDown} zoomable={false} style={{ position: "relative", width: "100%", height: "100%" }}>
        <div className="scroller" style={{ background: "var(--paper)", padding: "18px 22px 22px" }}>
          <pre className="mono" style={{ margin: 0, fontSize: 15, lineHeight: 1.55, color: "var(--ink)", whiteSpace: "pre-wrap", wordBreak: "break-word" }}>
{body}
          </pre>
        </div>
      </MacWindow>
    </div>
  );
}

function TrailerHero({ narrow }) {
  const ref = React.useRef(null);
  const [playing, setPlaying] = React.useState(false);
  const [muted, setMuted] = React.useState(true);
  if (!TRAILER || !TRAILER.src) return null;
  const toggle = () => {
    const v = ref.current;
    if (!v) return;
    if (v.paused) { v.play(); setPlaying(true); } else { v.pause(); setPlaying(false); }
  };
  const toggleMute = (e) => {
    e.stopPropagation();
    const v = ref.current;
    if (!v) return;
    v.muted = !v.muted; setMuted(v.muted);
  };
  return (
    <div style={{ margin: narrow ? "16px 16px 0" : "20px 26px 0", border: "2px solid var(--line)", boxShadow: "3px 3px 0 rgba(43,38,34,0.28)", background: "#0b0b0b", position: "relative" }}>
      <div className="titlebar" style={{ background: "var(--paper)", borderBottom: "2px solid var(--line)" }}>
        <div className="tb-box close" />
        <div className="tb-spacer" />
        <span className="title-text">SOSH TV — Bali, the reel</span>
        <div className="tb-spacer" />
        <div className="tb-box zoom" />
      </div>
      <div style={{ position: "relative", aspectRatio: "16 / 9", overflow: "hidden", cursor: "pointer" }} onClick={toggle}>
        <video
          ref={ref}
          src={TRAILER.src}
          poster={TRAILER.poster}
          muted
          loop
          playsInline
          autoPlay
          onPlay={() => setPlaying(true)}
          onPause={() => setPlaying(false)}
          style={{ width: "100%", height: "100%", objectFit: "cover", display: "block", filter: "contrast(1.05) saturate(0.95)" }}
        />
        <div style={{ position: "absolute", inset: 0, pointerEvents: "none", background: "repeating-linear-gradient(to bottom, rgba(0,0,0,0.14) 0 1px, transparent 1px 3px)", mixBlendMode: "multiply" }} />
        <div style={{ position: "absolute", top: 10, left: 12 }}>
          <SoshTVMark />
        </div>
        <div className="mono" style={{ position: "absolute", top: 12, right: 14, color: "#fff", background: playing ? "#d23b2e" : "rgba(0,0,0,0.55)", padding: "2px 7px", fontSize: 12, letterSpacing: 1 }}>
          {playing ? "● ON AIR" : "○ PAUSED"}
        </div>
        <button
          data-clickable
          onClick={toggleMute}
          aria-label={muted ? "Unmute" : "Mute"}
          style={{ position: "absolute", bottom: 12, right: 12, padding: "5px 9px", background: "rgba(20,16,13,0.55)", color: "#fff", border: "2px solid rgba(255,255,255,0.7)", fontFamily: "var(--pixel)", fontSize: 9, letterSpacing: 0.3, textTransform: "uppercase" }}
        >
          {muted ? "♪ Off" : "♪ On"}
        </button>
        {!playing && (
          <div style={{ position: "absolute", inset: 0, margin: "auto", width: 64, height: 64, background: "rgba(20,16,13,0.45)", border: "2px solid rgba(255,255,255,0.85)", color: "#fff", fontSize: 24, display: "flex", alignItems: "center", justifyContent: "center" }}>▶</div>
        )}
      </div>
      <div style={{ display: "flex", alignItems: "baseline", gap: 10, padding: "8px 12px", background: "var(--paper)", borderTop: "2px solid var(--line)" }}>
        <span className="pixel" style={{ fontSize: 9 }}>NOW SHOWING</span>
        <span className="serif" style={{ fontSize: 16 }}>{TRAILER.title}</span>
        <span style={{ flex: 1 }} />
        <span className="mono" style={{ fontSize: 13, color: "var(--ink-soft)" }}>{TRAILER.subtitle}</span>
      </div>
    </div>
  );
}

const TWEAK_DEFAULTS = {
  cardStyle: "plain",
  accent: "#c97b5a",
  crt: 0.55,
  grain: 0.5,
  desktop: "pink",
};

const DESKTOP_COLORS = { pink: "#f8c8d4", cream: "#e9dcc6" };

function Dialog({ title, lines, onClose, okLabel = "OK" }) {
  return (
    <div style={{ position: "fixed", inset: 0, zIndex: 5000, background: "rgba(20,16,13,0.35)", display: "flex", alignItems: "center", justifyContent: "center", padding: 20 }} onMouseDown={(e) => e.target === e.currentTarget && onClose()}>
      <MacWindow title={title} onClose={onClose} zoomable={false} style={{ position: "relative", width: "min(92vw, 400px)" }}>
        <div style={{ padding: "20px 20px 16px", display: "flex", gap: 14, background: "var(--paper)" }}>
          <div style={{ flex: "0 0 auto", marginTop: 2 }}><IconCamera /></div>
          <div style={{ display: "flex", flexDirection: "column", gap: 7 }}>
            {lines.map((l, i) => (
              <div key={i} className={i === 0 ? "pixel" : "serif"} style={{ fontSize: i === 0 ? 10 : 15, lineHeight: i === 0 ? 1.4 : 1.45, color: i === 0 ? "var(--ink)" : "var(--ink-soft)", textTransform: i === 0 ? "uppercase" : "none" }}>{l}</div>
            ))}
          </div>
        </div>
        <div style={{ display: "flex", justifyContent: "flex-end", padding: "0 16px 16px", background: "var(--paper)" }}>
          <PixelButton accent onClick={onClose}>{okLabel}</PixelButton>
        </div>
      </MacWindow>
    </div>
  );
}

function useViewport() {
  const [vp, setVp] = useState({ w: window.innerWidth, h: window.innerHeight });
  useEffect(() => {
    const f = () => setVp({ w: window.innerWidth, h: window.innerHeight });
    window.addEventListener("resize", f);
    return () => window.removeEventListener("resize", f);
  }, []);
  return vp;
}

function useOffset() {
  const [off, setOff] = useState({ x: 0, y: 0 });
  const start = useRef(null);
  const onDown = (e) => {
    if (e.target.closest("[data-clickable]")) return;
    const pt = e.touches ? e.touches[0] : e;
    start.current = { mx: pt.clientX, my: pt.clientY, ox: off.x, oy: off.y };
    const move = (ev) => {
      const p = ev.touches ? ev.touches[0] : ev;
      setOff({ x: start.current.ox + (p.clientX - start.current.mx), y: start.current.oy + (p.clientY - start.current.my) });
    };
    const up = () => {
      window.removeEventListener("mousemove", move);
      window.removeEventListener("mouseup", up);
      window.removeEventListener("touchmove", move);
      window.removeEventListener("touchend", up);
    };
    window.addEventListener("mousemove", move);
    window.addEventListener("mouseup", up);
    window.addEventListener("touchmove", move, { passive: true });
    window.addEventListener("touchend", up);
  };
  return [off, onDown, setOff];
}

function App() {
  const [t, setTweak] = useTweaks(TWEAK_DEFAULTS);
  const [booted, setBooted] = useState(false);
  const [activeTab, setActiveTab] = useState("home");
  const [chapter, setChapter] = useState(null);
  const [light, setLight] = useState(null);
  const [tv, setTv] = useState({ index: 0, playing: false });
  const [musicOn, setMusicOn] = useState(false);
  const [dialog, setDialog] = useState(null);
  const vp = useViewport();
  const narrow = vp.w < 760;

  const tvDrag = useOffset();
  const storyDrag = useOffset();
  const albumsDrag = useOffset();
  const chapDrag = useOffset();

  useEffect(() => {
    const r = document.documentElement;
    r.style.setProperty("--crt", String(t.crt));
    r.style.setProperty("--grain", String(t.grain));
    r.style.setProperty("--terracotta", t.accent);
    r.style.setProperty("--desktop", DESKTOP_COLORS[t.desktop] || DESKTOP_COLORS.pink);
  }, [t.crt, t.grain, t.accent, t.desktop]);

  const top = narrow ? 30 : 40;
  const dockSpace = narrow ? 120 : 134; // bigger for tab bar + dock
  const availH = vp.h - top - dockSpace;

  const CHROME = 188;
  const tvW = narrow ? vp.w - 12 : Math.round(Math.max(300, Math.min(760, (availH - CHROME) * (16 / 9), vp.w * 0.5)));
  const tvH = Math.round(tvW * (9 / 16) + CHROME);
  const stW = narrow ? vp.w - 12 : Math.min(460, Math.max(330, Math.round(vp.w * 0.3)));

  let tvBaseX, stBaseX;
  const pairW = tvW + 28 + stW;
  if (pairW <= vp.w - 48) {
    tvBaseX = (vp.w - pairW) / 2;
    stBaseX = tvBaseX + tvW + 28;
  } else {
    tvBaseX = Math.max(20, (vp.w - tvW) / 2);
    stBaseX = Math.max(20, vp.w - stW - 20);
  }
  const clusterY = top + Math.max(0, (availH - tvH) / 2);

  const albumsW = Math.min(900, vp.w - 120);
  const chapW = Math.min(960, vp.w - 80);

  const tvGeom = narrow ? { x: 6, y: top, w: vp.w - 12 } : { x: Math.round(tvBaseX + tvDrag[0].x), y: Math.round(clusterY + tvDrag[0].y), w: tvW };
  const storyGeom = narrow ? { x: 6, y: top, w: vp.w - 12, h: availH } : { x: Math.round(stBaseX + storyDrag[0].x), y: Math.round(clusterY + storyDrag[0].y), w: stW, h: tvH };
  const albumsGeom = narrow ? { x: 6, y: top, w: vp.w - 12, h: availH } : { x: Math.round((vp.w - albumsW) / 2 + albumsDrag[0].x), y: top + albumsDrag[0].y, w: albumsW, h: availH };
  const chapGeom = narrow ? { x: 6, y: top, w: vp.w - 12, h: availH } : { x: Math.round((vp.w - chapW) / 2 + chapDrag[0].x), y: top + chapDrag[0].y, w: chapW, h: availH };

  const toggleMusic = () => {
    if (window.SFX) setMusicOn(SFX.toggleMusic());
  };

  const openFrame = (idx) => setLight({ chapterId: chapter.id, index: idx });
  const navFrame = (dir) => {
    setLight((l) => {
      if (!l) return l;
      const ch = CHAPTERS.find((c) => c.id === l.chapterId);
      return { ...l, index: (l.index + dir + ch.count) % ch.count };
    });
  };
  const lightChapter = light ? CHAPTERS.find((c) => c.id === light.chapterId) : null;

  const playClipInTV = (i) => {
    setTv({ index: i, playing: true });
  };

  const resetWindows = () => {
    tvDrag[2]({ x: 0, y: 0 });
    storyDrag[2]({ x: 0, y: 0 });
    albumsDrag[2]({ x: 0, y: 0 });
    chapDrag[2]({ x: 0, y: 0 });
  };

  const downloadDialog = (n) => setDialog({ title: "Download", lines: ["Placeholder archive", "This roll is running on placeholder frames. Drop the real photographs in and Sosh Insider will zip and hand you all " + n + " of them."] });
  const startDownloadAll = (ch) => {
    if (!window.DL) return;
    setDialog({ title: "Download all", lines: ["Zipping " + ch.count + " photos", "Your browser is downloading one " + ch.folder + ".zip — the server is streaming it straight from the bucket, so it starts immediately and finishes when the last frame is in."] });
    DL.downloadAll(ch.folder);
  };
  const aboutDialog = () => setDialog({ title: "About Sosh Insider", lines: ["Sosh Insider — Bali · v7.0.1", "A private archive of " + TOTAL + " frames and one dive reel, found on a Macintosh in a villa above Uluwatu. No phones were used in the making of this."] });

  return (
    <div style={{ position: "absolute", inset: 0, overflow: "hidden" }}>
      {!booted && <BootSequence onDone={() => setBooted(true)} />}

      <MenuBar musicOn={musicOn} onToggleMusic={toggleMusic} onAbout={aboutDialog} onResetIcons={resetWindows} />

      {booted && (
        <>
          {/* Home: trailer + story side by side */}
          {activeTab === "home" && (
            <>
              <TrailerWindow geom={tvGeom} onClose={() => setActiveTab("albums")} onTitleDown={narrow ? undefined : tvDrag[1]} onFocus={() => {}} z={16} narrow={narrow} />
              <StoryWindow geom={storyGeom} onClose={() => setActiveTab("albums")} onTitleDown={narrow ? undefined : storyDrag[1]} onFocus={() => {}} z={15} />
            </>
          )}

          {/* Thanks view */}
          {activeTab === "thanks" && (
            <ThanksWindow geom={albumsGeom} onClose={() => setActiveTab("home")} onTitleDown={narrow ? undefined : albumsDrag[1]} onFocus={() => {}} z={18} />
          )}

          {/* Main content window (switches based on activeTab) */}
          {activeTab === "albums" && !chapter && (
            <MacWindow
              title={"Bali  —  " + PHOTO_ROLLS + " Rolls · " + TOTAL + " Frames"}
              onClose={() => setDialog({ title: "Sosh Insider", lines: ["Can't close the archive", "This is the whole show — there's nowhere else to go. Pick a roll instead."] })}
              onTitleDown={narrow ? undefined : albumsDrag[1]}
              style={{ left: albumsGeom.x, top: albumsGeom.y, width: albumsGeom.w, height: albumsGeom.h, zIndex: 20 }}
            >
              <div style={{ display: "flex", alignItems: "center", gap: 10, padding: "7px 10px", borderBottom: "2px solid var(--line)", background: "var(--paper2)", flexWrap: "wrap" }}>
                <span className="mono" style={{ fontSize: 14, whiteSpace: "nowrap" }}>
                  {PHOTO_ROLLS} rolls · {TOTAL} frames
                </span>
                <div style={{ flex: 1 }} />
                <span className="pixel" style={{ fontSize: 8, color: "var(--ink-soft)" }}>CLICK AN ALBUM TO OPEN</span>
              </div>

              <div className="scroller" style={{ background: "var(--desktop)" }}>
                <div style={{ padding: narrow ? "18px 16px 4px" : "24px 26px 6px" }}>
                  <div className="pixel" style={{ fontSize: 8.5, color: "var(--ink-soft)", letterSpacing: 1, textTransform: "uppercase" }}>Sosh Insider presents</div>
                  <div className="serif" style={{ fontSize: narrow ? 40 : "clamp(40px, 6vw, 76px)", lineHeight: 0.92, letterSpacing: "-0.02em", marginTop: 6 }}>Bali, on film.</div>
                  <div className="serif" style={{ fontSize: 17, fontStyle: "italic", color: "var(--ink-soft)", marginTop: 12, maxWidth: 540, lineHeight: 1.5 }}>
                    Four days, four rolls, one island. The frames that survived the edit — one day at a time.
                  </div>
                </div>

                <div style={{ display: "grid", gridTemplateColumns: narrow ? "1fr" : "repeat(auto-fill, minmax(240px, 1fr))", gap: t.cardStyle === "filmstrip" ? 16 : 18, padding: narrow ? "16px 16px 28px" : "20px 26px 34px" }}>
                  {CHAPTERS.map((c, i) => (
                    <ChapterCard
                      key={c.id}
                      chapter={c}
                      index={i}
                      variant={t.cardStyle}
                      onOpen={(ch) => {
                        if (ch.locked) {
                          setDialog({ title: "Album locked", lines: ["Not unlocked yet", "\u201c" + ch.title + "\u201d opens " + ch.unlockLabel + ". Come back then."] });
                          return;
                        }
                        window.SFX && SFX.open();
                        setChapter(ch);
                      }}
                    />
                  ))}
                </div>
              </div>
            </MacWindow>
          )}

          {/* Chapter window (photo) */}
          {chapter && chapter.kind !== "video" && (
            <ChapterWindow
              chapter={chapter}
              geom={chapGeom}
              onTitleDown={narrow ? undefined : chapDrag[1]}
              onClose={() => setChapter(null)}
              onBack={() => setChapter(null)}
              onOpenFrame={openFrame}
              onDownloadAll={() => startDownloadAll(chapter)}
            />
          )}

          {/* Video chapter window */}
          {chapter && chapter.kind === "video" && (
            <VideoChapterWindow
              chapter={chapter}
              geom={chapGeom}
              onTitleDown={narrow ? undefined : chapDrag[1]}
              onClose={() => setChapter(null)}
              onBack={() => setChapter(null)}
              onPlayClip={playClipInTV}
              onDrive={() => window.open(DRIVE_URL || "about:blank")}
            />
          )}

          {dialog && <Dialog title={dialog.title} lines={dialog.lines} onClose={() => setDialog(null)} />}
        </>
      )}

      {light && lightChapter && <Lightbox chapter={lightChapter} index={light.index} onClose={() => setLight(null)} onNav={navFrame} onDownload={(f) => window.DL && DL.downloadOne(f)} />}

      {/* Bottom tab bar */}
      {booted && (
        <div style={{ position: "fixed", bottom: 0, left: 0, right: 0, height: narrow ? 86 : 96, background: "var(--desktop)", borderTop: "2px solid var(--line)", display: "flex", alignItems: "flex-start", justifyContent: "center", gap: 10, padding: "8px 16px", boxShadow: "0 -3px 0 rgba(43,38,34,0.18)" }}>
          {[
            { id: "home", label: "▶ Home" },
            { id: "albums", label: "◳ Albums" },
            { id: "thanks", label: "✎ Thank U TXT" },
          ].map((tab) => (
            <button
              key={tab.id}
              data-clickable
              onClick={() => {
                window.SFX && SFX.click();
                setActiveTab(tab.id);
                setChapter(null);
              }}
              style={{
                padding: "6px 14px 5px",
                background: activeTab === tab.id ? "var(--ink)" : "var(--paper)",
                color: activeTab === tab.id ? "#fff" : "var(--ink)",
                border: "2px solid var(--line)",
                fontFamily: "var(--pixel)",
                fontSize: 8.5,
                textTransform: "uppercase",
                letterSpacing: 0.3,
                cursor: "pointer",
                boxShadow: "2px 2px 0 rgba(43,38,34,0.22)",
              }}
            >
              {tab.label}
            </button>
          ))}
        </div>
      )}

      {/* Tweaks */}
      <TweaksPanel>
        <TweakSection label="Desktop" />
        <TweakRadio label="Wallpaper" value={t.desktop} options={["pink", "cream"]} onChange={(v) => setTweak("desktop", v)} />
        <TweakSection label="Chapter cards" />
        <TweakRadio label="Card style" value={t.cardStyle} options={["plain", "polaroid", "filmstrip"]} onChange={(v) => setTweak("cardStyle", v)} />
        <TweakSection label="Screen / CRT" />
        <TweakSlider label="Scanlines" value={t.crt} min={0} max={1} step={0.05} onChange={(v) => setTweak("crt", v)} />
        <TweakSlider label="Film grain" value={t.grain} min={0} max={1} step={0.05} onChange={(v) => setTweak("grain", v)} />
        <TweakSection label="Accent" />
        <TweakColor label="UI accent" value={t.accent} options={["#c97b5a", "#8a8b5c", "#c9a44c", "#5f8a86"]} onChange={(v) => setTweak("accent", v)} />
      </TweaksPanel>
    </div>
  );
}

ReactDOM.createRoot(document.getElementById("root")).render(<App />);
