eString()} bytes | Original: ${originalSize.toLocaleString()} bytes | Saved: ${savings}%`;
      };
      img.src = originalSrc;
    }

    function updateDisplayedImage() {
      if (!originalSrc || !optimizedSrc) return;
      
      const showOriginal = viewToggle.classList.contains('active');
      output.src = showOriginal ? originalSrc : optimizedSrc;
    }

    function updatePreviewHint() {
      const showOriginal = viewToggle.classList.contains('active');
      previewText.textContent = showOrigin