// 防止闪烁：在页面渲染前立即应用主题
try {
  const saved = localStorage.getItem('nav_settings');
  if (saved) {
    const settings = JSON.parse(saved);
    if (settings.theme === 'dark') {
      document.documentElement.classList.add('dark-theme');
      if (document.body) {
        document.body.classList.add('dark-theme');
      } else {
        // 如果 body 还没加载，监听 DOMContentLoaded
        document.addEventListener('DOMContentLoaded', function() {
          document.body.classList.add('dark-theme');
        });
      }
    }
  }
} catch (e) {
  // 静默失败，不影响页面加载
}

