(function() { const saved = localStorage.getItem('theme') || 'light'; const osPref = matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'; document.documentElement.setAttribute('data-theme', saved ?? osPref); })();