// assets/js/app.js
document.addEventListener('DOMContentLoaded', function(){
  const btn = document.getElementById('darkToggle');
  const setMode = (isDark) => {
    if (isDark) document.body.classList.add('dark'); else document.body.classList.remove('dark');
    localStorage.setItem('dark',''+(isDark?1:0));
  };
  const cur = localStorage.getItem('dark') === '1';
  setMode(cur);
  if (btn) btn.addEventListener('click', ()=> setMode(!document.body.classList.contains('dark')));
});
