mlElement.classList.add("dark");
          moonIcon.style.display = "none";
          sunIcon.style.display = "block";
        } else {
          htmlElement.classList.remove("dark");
          moonIcon.style.display = "block";
          sunIcon.style.display = "none";
        }
        localStorage.theme = isDark ? "dark" : "light";
      };

      // Check for saved theme preference or respect OS preference
      const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
      const sa