/* ============================================================
   JMHD mobile hover reset
   Put this at the very bottom of styles.css, or load it after
   /static/styles.css and /static/topbar-dropdown-fix.css.
   ============================================================ */

/* Stop browser-native image drag/selection from interfering with touch drag. */
img,
.game-button,
.explore-card,
.fav-item,
.launch-btn,
.mgr-row {
  -webkit-user-drag: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Horizontal rails should scroll horizontally without leaving hover state behind. */
#favourites-list,
#last-played-list,
.explore-banner {
  touch-action: pan-y;
  overscroll-behavior-x: contain;
}

/* Phones/tablets: disable hover-only visual effects entirely. */
@media (hover: none), (pointer: coarse) {
  .game-screenshot-tooltip,
  .launch-save-preview {
    display: none !important;
  }

  .game-button:hover,
  .explore-card:hover,
  #favourites-list .fav-item:hover,
  #last-played-list .fav-item:hover,
  .fav-btn:hover,
  .launch-btn:hover,
  .launch-dialog-fav:hover,
  .launch-core-select-wrap:hover,
  .launch-core-info:hover,
  .mgr-row:hover,
  .mgr-continue-btn:hover,
  .mgr-action:hover,
  .nav-button:hover,
  .dropdown-item:hover,
  .theme-btn:hover,
  .mobile-nav-btn:hover,
  .logout-topbar:hover,
  .system-grid-toggle:hover,
  .show-more-saves:hover,
  .show-all-saves:hover,
  .save-row:hover,
  .game-actions button:hover,
  .save-actions button:hover,
  #sram-sync-button:hover,
  .emulator-footer .game-button:hover,
  #emulator-container > .game-button:hover {
    transform: none !important;
    box-shadow: none !important;
  }

  .game-button:hover,
  .explore-card:hover,
  #favourites-list .fav-item:hover,
  #last-played-list .fav-item:hover {
    border-color: transparent !important;
  }

  .game-button:hover .game-name,
  #favourites-list .fav-item:hover .fav-item-name,
  #last-played-list .fav-item:hover .fav-item-name {
    color: inherit !important;
  }

  #favourites-list .fav-item:hover img,
  #last-played-list .fav-item:hover img {
    border-color: var(--border) !important;
  }

  .game-card-fav {
    opacity: 1;
  }
}

/* Extra safety while a touch gesture is active. */
body.is-touching .game-screenshot-tooltip,
body.is-touching .launch-save-preview,
body.is-touch-scrolling .game-screenshot-tooltip,
body.is-touch-scrolling .launch-save-preview {
  display: none !important;
}

body.is-touching .game-button:hover,
body.is-touching .explore-card:hover,
body.is-touching #favourites-list .fav-item:hover,
body.is-touching #last-played-list .fav-item:hover,
body.is-touch-scrolling .game-button:hover,
body.is-touch-scrolling .explore-card:hover,
body.is-touch-scrolling #favourites-list .fav-item:hover,
body.is-touch-scrolling #last-played-list .fav-item:hover {
  transform: none !important;
  box-shadow: none !important;
  border-color: transparent !important;
}
