  <script>
    const countEl = document.querySelector(".count");
    const messageEl = document.getElementById("signup-message");

    // 今日の日付（例：2025-05-24）
    const todayKey = new Date().toISOString().slice(0, 10);

    // シード生成（毎日固定）
    function seededRandom(seed) {
      let x = Math.sin(seed.split("").reduce((acc, c) => acc + c.charCodeAt(0), 0)) * 10000;
      return x - Math.floor(x);
    }

    // 今日の最終件数（100〜300の中で固定）
    function getTodayGoalCount() {
      const base = seededRandom(todayKey);
      return Math.floor(100 + base * 200); // 100〜300件
    }

    const totalDuration = 24 * 60 * 60 * 1000; // 24時間（ミリ秒）
    const updateInterval = 15000; // 15秒ごと

    const totalUpdates = Math.floor(totalDuration / updateInterval); // 1日あたりの更新回数
    const finalCount = getTodayGoalCount(); // 今日の目標件数
    const perUpdateIncrement = finalCount / totalUpdates;

    // 0時から今までに何回更新が経過したか
    function getElapsedUpdates() {
      const now = new Date();
      const msSinceMidnight =
        now.getHours() * 3600000 +
        now.getMinutes() * 60000 +
        now.getSeconds() * 1000 +
        now.getMilliseconds();
      return Math.floor(msSinceMidnight / updateInterval);
    }

    // 現在の申込み件数
    function getCurrentCount() {
      return Math.floor(getElapsedUpdates() * perUpdateIncrement);
    }

    // 表示処理
    function updateDisplay() {
      const count = getCurrentCount();
      countEl.textContent = count;

      // 件数に応じてメッセージ切り替え
      if (count >= 100) {
        messageEl.textContent = "申込みが急増しています！";
      } else if (count >= 30) {
        messageEl.textContent = "たくさんの方がご利用中！";
      } else if (count > 0) {
        messageEl.textContent = "本日も受付中です";
      } else {
        messageEl.textContent = "";
      }
    }

    // 初期表示
    updateDisplay();

    // 15秒ごとに更新
    setInterval(updateDisplay, updateInterval);
  </script>
