{pkgs, ...}: {
  programs.mpv = {
    enable = true;
    scripts = with pkgs.mpvScripts; [
      uosc
      thumbfast
      autocrop
    ];
    scriptOpts = {
      autocrop = {
        auto = "yes"; # Automatically run on video load
        notice = "yes"; # Optional: Show an OSD message when it crops
        delay = "5"; # Optional: Wait 1 second before detecting (helps skip studio logos)
      };
    };
    config = {
      # uosc provides its own UI
      osc = "no";
      osd-bar = "no";
      border = "no";
      hwdec = "auto-copy";

      # Subtitle preferences - prefer full subtitles over forced
      # slang = "eng,en,enm"; # English subtitle preference order
      # subs-fallback = "default"; # Use default if preferred not found
      # sub-forced-events-only = "no"; # Don't limit to forced subtitle events
    };

    bindings = {
      # Bind it to 'C' (Shift+c) to toggle cropping manually
      "C" = "script-message-to autocrop toggle_crop";
    };
  };

  xdg.mimeApps = {
    enable = true;
    defaultApplications = {
      "video/mp4" = "mpv.desktop";
      "video/mkv" = "mpv.desktop";
      "video/webm" = "mpv.desktop";
      "video/avi" = "mpv.desktop";
      "video/x-matroska" = "mpv.desktop";
      "video/quicktime" = "mpv.desktop";
    };
  };

  wayland.windowManager.hyprland.settings.windowrule = [
    # --- VIDEO PLAYER (mpv) ---
    "match:class ^(mpv)$, float on"
    "match:class ^(mpv)$, center on"
    "match:class ^(mpv)$, size 60% 70%"
  ];
}
