html.gallery-open,
body.gallery-open {
  overflow: hidden;
  overscroll-behavior: none;
}

.gallery-card,
.gallery-nav,
.gallery-modal .modal-close {
  touch-action: manipulation;
}

.gallery-modal {
  overflow: hidden;
  overscroll-behavior: none;
}

.gallery-modal .modal-box {
  overflow: hidden;
}

.gallery-viewer {
  overflow: hidden;
}

.gallery-stage {
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

.gallery-stage img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 64px);
  margin: 0 auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.gallery-nav,
.gallery-modal .modal-close {
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 768px) {
  .gallery-modal .modal-box {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    padding: 0;
    border-radius: 0;
  }

  .gallery-viewer {
    gap: 0;
    min-height: 100dvh;
  }

  .gallery-stage {
    width: 100vw;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .gallery-stage img {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
  }

  .gallery-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    width: 42px;
    height: 42px;
  }

  #gallery-prev {
    left: 10px;
  }

  #gallery-next {
    right: 10px;
  }

  .gallery-modal .modal-close {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 21;
  }

  .gallery-counter {
    position: fixed;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 21;
  }
}
