// скрипт...

// Listen for a click on the button
const prefersDarkScheme = window.matchMedia("(prefers-color-scheme: dark)");

document.getElementById("theme-switcher").addEventListener("click", function () {
  if (prefersDarkScheme.matches) {
    document.body.classList.toggle("light-theme");
  } else {
    document.body.classList.toggle("dark-theme");
  }
});
