<script>
  let wakeLock = null;

  async function requestWakeLock() {
    try {
      if ('wakeLock' in navigator) {
        wakeLock = await navigator.wakeLock.request('screen');
        console.log('Wake lock active');

        wakeLock.addEventListener('release', () => {
          console.log('Wake lock was released');
        });
      }
    } catch (err) {
      console.error(`${err.name}, ${err.message}`);
    }
  }

  // Re-request on visibility change (some browsers release it when tab is hidden)
  