const { useState, useEffect, useRef } = React; // ── Language / Theme selector controls ─────────────────────────────────────── const LangDropdown = ({ lang, setLang }) => { const [open, setOpen] = useState(false); const ref = useRef(null); useEffect(() => { const handler = (e) => { if (ref.current && !ref.current.contains(e.target)) setOpen(false); }; document.addEventListener('mousedown', handler); return () => document.removeEventListener('mousedown', handler); }, []); const langs = Object.values(window.LANGS || {}); return (