date % 60000),
        );
        const secondsRemaining = Math.ceil(timeUntilNextUpdate / 1000);

        document.getElementById(
          "countdown",
        ).textContent = `${secondsRemaining}s`;

        // Enable refresh button if at least 5 seconds have passed since last update
        refreshButton.disabled = isRefreshing || timeSinceLastUpdate < 5000;
      }

      function startCountdown() {
        if (countdownInterval) {
          clearInterval(countdownInterval);
        }
        updateCo