
    (() => {
      const btn = document.getElementById('theme-toggle');
      const label = document.getElementById('theme-label');
      if (!btn || !label) return;
      const sync = () => {
        const t = document.documentElement.dataset.theme || 'dark';
        label.textContent = t === 'dark' ? 'Dark' : 'Light';
      };
      sync();
      btn.addEventListener('click', () => {
        const cur = document.documentElement.dataset.theme || 'dark';
        const next = cur === 'dark' ? 'light' : 'dark';
        document.documentElement.dataset.theme = next;
        try { localStorage.setItem('lvonce-theme', next); } catch {}
        sync();
      });
    })();
  
