/* v36: mobile tap, zoom focal point, modal close/avatar hardening */
@media (hover: none), (pointer: coarse) {
  .integrated-pin-card.is-touch-open .integrated-pin-hoverbar {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    translate: 0 0 !important;
  }
}
.gallery-post-close,
.gallery-image-zoom-close {
  box-sizing: border-box !important;
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  min-height: 42px !important;
  max-width: 42px !important;
  max-height: 42px !important;
  padding: 0 !important;
  display: inline-grid !important;
  place-items: center !important;
  text-align: center !important;
  line-height: 1 !important;
  overflow: hidden !important;
  flex: 0 0 auto !important;
}
.gallery-post-info-head .gallery-post-author-avatar,
.gallery-post-info-head .pin-author-button {
  width: 52px !important;
  height: 52px !important;
  min-width: 52px !important;
  min-height: 52px !important;
  max-width: 52px !important;
  max-height: 52px !important;
  overflow: hidden !important;
  border-radius: 999px !important;
  flex: 0 0 52px !important;
}
.gallery-post-info-head .gallery-post-author-avatar img,
.gallery-post-info-head .pin-author-button img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center center !important;
  border-radius: inherit !important;
  display: block !important;
}
.gallery-image-zoom.is-actual-size .gallery-image-zoom-stage img,
.gallery-image-zoom.is-pannable .gallery-image-zoom-stage img {
  max-width: calc(100vw - 56px) !important;
  max-height: calc(100dvh - 126px) !important;
}
.gallery-image-zoom.is-actual-size .gallery-image-zoom-stage img {
  cursor: zoom-out !important;
}
.gallery-image-zoom.is-dragging .gallery-image-zoom-stage img {
  cursor: grabbing !important;
}
.pin-like-button.like-error,
.integrated-pin-card .pin-like-button.like-error {
  animation: likeRejectShake .34s ease both !important;
}
@keyframes likeRejectShake {
  0%, 100% { translate: 0 0; }
  22% { translate: -4px 0; }
  45% { translate: 4px 0; }
  68% { translate: -2px 0; }
}
@media (max-width: 760px) {
  .gallery-post-close {
    position: fixed !important;
    top: max(10px, env(safe-area-inset-top)) !important;
    right: max(10px, env(safe-area-inset-right)) !important;
    z-index: 10010 !important;
  }
  .gallery-post-info-head .gallery-post-author-avatar,
  .gallery-post-info-head .pin-author-button {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
    flex-basis: 48px !important;
  }
  .gallery-image-zoom.is-actual-size .gallery-image-zoom-stage img,
  .gallery-image-zoom.is-pannable .gallery-image-zoom-stage img {
    max-width: calc(100vw - 24px) !important;
    max-height: calc(100dvh - 116px) !important;
  }
}

/* v37: mobile card two-tap, mobile zoom gesture-only, detail close/avatar hardening */
@media (hover: none), (pointer: coarse) {
  .integrated-pin-card.is-touch-open .integrated-pin-hoverbar {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    translate: 0 0 !important;
  }
}

.gallery-post-close,
.gallery-image-zoom-close {
  box-sizing: border-box !important;
  display: grid !important;
  place-items: center !important;
  align-items: center !important;
  justify-items: center !important;
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  min-height: 42px !important;
  max-width: 42px !important;
  max-height: 42px !important;
  padding: 0 !important;
  overflow: hidden !important;
  line-height: 1 !important;
  font-size: 0 !important;
  text-indent: 0 !important;
  flex: 0 0 auto !important;
}
.gallery-post-close::before,
.gallery-image-zoom-close::before {
  content: "×" !important;
  display: block !important;
  width: 1em !important;
  height: 1em !important;
  line-height: .92 !important;
  text-align: center !important;
  font-size: 24px !important;
  font-weight: 900 !important;
  transform: translateY(-1px) !important;
}
.gallery-post-close {
  position: absolute !important;
  top: 14px !important;
  right: 14px !important;
  left: auto !important;
  bottom: auto !important;
  z-index: 10010 !important;
}

.gallery-post-info-head .gallery-post-author-avatar,
.gallery-post-info-head .pin-author-button.gallery-post-author-avatar {
  width: 56px !important;
  height: 56px !important;
  min-width: 56px !important;
  min-height: 56px !important;
  max-width: 56px !important;
  max-height: 56px !important;
  flex: 0 0 56px !important;
  padding: 0 !important;
  overflow: hidden !important;
  border-radius: 999px !important;
}
.gallery-post-info-head .gallery-post-author-avatar img,
.gallery-post-info-head .pin-author-button.gallery-post-author-avatar img {
  display: block !important;
  width: 112% !important;
  height: 112% !important;
  min-width: 112% !important;
  min-height: 112% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover !important;
  object-position: center center !important;
  border-radius: inherit !important;
  transform: scale(1.06) !important;
}

@media (max-width: 760px) {
  .gallery-post-close {
    position: fixed !important;
    top: max(10px, env(safe-area-inset-top)) !important;
    right: max(10px, env(safe-area-inset-right)) !important;
    left: auto !important;
    bottom: auto !important;
    z-index: 10020 !important;
  }
  .gallery-post-info-head .gallery-post-author-avatar,
  .gallery-post-info-head .pin-author-button.gallery-post-author-avatar {
    width: 54px !important;
    height: 54px !important;
    min-width: 54px !important;
    min-height: 54px !important;
    max-width: 54px !important;
    max-height: 54px !important;
    flex-basis: 54px !important;
  }
  .gallery-image-zoom-mode {
    display: none !important;
  }
  .gallery-image-zoom-help {
    width: min(280px, calc(100vw - 32px)) !important;
  }
}


/* v38: detail close/avatar final polish */
/* v39: rank 6 badge white tone */
.gallery-post-close,
.gallery-image-zoom-close {
  position: relative !important;
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  min-height: 42px !important;
  max-width: 42px !important;
  max-height: 42px !important;
  padding: 0 !important;
  overflow: hidden !important;
  display: grid !important;
  place-items: center !important;
  line-height: 1 !important;
  font-size: 0 !important;
  text-indent: 0 !important;
}
.gallery-post-close::before,
.gallery-image-zoom-close::before {
  content: "×" !important;
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  display: grid !important;
  place-items: center !important;
  line-height: 1 !important;
  font-size: 24px !important;
  font-weight: 900 !important;
  transform: none !important;
  translate: 0 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}
.gallery-post-close { position: absolute !important; }

.gallery-post-info-head .gallery-post-author-avatar,
.gallery-post-info-head .pin-author-button.gallery-post-author-avatar {
  width: 52px !important;
  height: 52px !important;
  min-width: 52px !important;
  min-height: 52px !important;
  max-width: 52px !important;
  max-height: 52px !important;
  flex: 0 0 52px !important;
  padding: 0 !important;
  overflow: hidden !important;
  border-radius: 999px !important;
}
.gallery-post-info-head .gallery-post-author-avatar img,
.gallery-post-info-head .pin-author-button.gallery-post-author-avatar img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: cover !important;
  object-position: center center !important;
  border-radius: inherit !important;
  transform: none !important;
}

.rank-6 {
  color: #6f6470 !important;
  background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(255,250,254,.88)) !important;
  border-color: rgba(229, 211, 223, .88) !important;
  box-shadow: 0 8px 20px rgba(72, 54, 66, .12) !important;
}
html[data-theme="dark"] .rank-6,
[data-theme="dark"] .rank-6 {
  color: #6f6470 !important;
  background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(255,250,254,.88)) !important;
  border-color: rgba(229, 211, 223, .88) !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .18) !important;
}
html[data-theme="dark"] .integrated-pin-card .rank-badge,
[data-theme="dark"] .integrated-pin-card .rank-badge {
  color: #4f3f4a !important;
}
html[data-theme="dark"] .integrated-pin-card .rank-1,
[data-theme="dark"] .integrated-pin-card .rank-1 { color: #7a5608 !important; }
html[data-theme="dark"] .integrated-pin-card .rank-2,
[data-theme="dark"] .integrated-pin-card .rank-2 { color: #565665 !important; }
html[data-theme="dark"] .integrated-pin-card .rank-3,
[data-theme="dark"] .integrated-pin-card .rank-3 { color: #765046 !important; }
html[data-theme="dark"] .integrated-pin-card .rank-4,
[data-theme="dark"] .integrated-pin-card .rank-4 { color: #8a4b76 !important; }
html[data-theme="dark"] .integrated-pin-card .rank-5,
[data-theme="dark"] .integrated-pin-card .rank-5 { color: #496a7a !important; }
html[data-theme="dark"] .integrated-pin-card .rank-6,
[data-theme="dark"] .integrated-pin-card .rank-6 { color: #6f6470 !important; }

@media (max-width: 760px) {
  .gallery-post-close {
    position: fixed !important;
    top: max(10px, env(safe-area-inset-top)) !important;
    right: max(10px, env(safe-area-inset-right)) !important;
    left: auto !important;
    bottom: auto !important;
    z-index: 10020 !important;
  }
  .gallery-post-info-head .gallery-post-author-avatar,
  .gallery-post-info-head .pin-author-button.gallery-post-author-avatar {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
    flex-basis: 48px !important;
  }
}

/* v82: prevent mobile double-tap zoom on gallery cards */
.integrated-pin-card,
.integrated-pin-card * {
  touch-action: manipulation;
}
