.gallery-dialog {
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: #171312;
  color: #fff;
}
.gallery-dialog::backdrop { background: rgb(16 11 12 / .88); }
.gallery-dialog-viewer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: clamp(14px, 3vw, 32px);
  overflow: hidden;
  touch-action: pan-y;
}
.gallery-dialog-viewer[aria-busy="true"]:empty::before { content: ''; width: min(80vw, 900px); aspect-ratio: 3 / 2; max-height: 75%; background: linear-gradient(100deg, #282221 20%, #39312f 48%, #282221 75%); background-size: 200% 100%; animation: gallery-loading 1.4s linear infinite; pointer-events: none; }
.gallery-dialog-viewer[aria-busy="true"]:has(img)::after,
.media-frame[aria-busy="true"]:has(img[data-media-state="ready"])::after {
  content: ''; pointer-events: none; position: absolute; z-index: 4;
  left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, #bb9f85, #fff3e9, #bb9f85) 0 0 / 200% 100%;
  animation: gallery-loading 1.4s linear infinite;
}
.gallery-photo-error {
  position: absolute; z-index: 5; bottom: max(18px, env(safe-area-inset-bottom));
  max-width: calc(100% - 32px); padding: 8px 14px;
  background: #282221; color: #fff; text-align: center; font-size: 14px;
}
@keyframes gallery-loading { to { background-position: -200% 0; } }
.gallery-slide-outgoing, .gallery-slide-incoming { transition: none !important; }
.gallery-slide-incoming { position: absolute !important; inset: 0; z-index: 2; width: 100% !important; height: 100% !important; object-fit: cover; pointer-events: none; }
.lobby-gallery-image .gallery-slide-incoming { inset: 8px 8px 22px; width: calc(100% - 16px) !important; height: calc(100% - 30px) !important; }
.gallery-dialog-viewer .gallery-slide-incoming { inset: clamp(14px, 3vw, 32px); width: calc(100% - clamp(14px, 3vw, 32px) - clamp(14px, 3vw, 32px)) !important; height: calc(100% - clamp(14px, 3vw, 32px) - clamp(14px, 3vw, 32px)) !important; object-fit: contain; }
.gallery-dialog-viewer img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
.gallery-dialog-close {
  position: absolute;
  z-index: 10;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / .55);
  border-radius: 50%;
  background: rgb(22 18 18 / .72);
  color: #fff;
  font: 28px/1 Arial, sans-serif;
}
.gallery-dialog-close:hover { background: #4b2033; }
.gallery-dialog-nav {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: clamp(8px, 2.5vw, 34px);
  pointer-events: none;
}
.gallery-dialog-nav[hidden] { display: none; }
.gallery-dialog-nav button {
  display: grid;
  place-items: center;
  width: clamp(44px, 5vw, 58px);
  height: clamp(44px, 5vw, 58px);
  padding: 0 0 5px;
  border: 1px solid rgb(255 255 255 / .65);
  border-radius: 50%;
  background: rgb(22 18 18 / .67);
  color: #fff;
  font: 40px/1 Georgia, serif;
  cursor: pointer;
  pointer-events: auto;
  transition: background-color .2s ease, opacity .2s ease;
}
.gallery-dialog-nav button:hover:not(:disabled), .gallery-dialog-nav button:focus-visible { background: #4b2033; }
.gallery-dialog-nav button:disabled { opacity: .24; cursor: default; }
@media (prefers-reduced-motion: reduce) {
  .gallery-dialog-nav button { transition: none; }
  .gallery-dialog-viewer[aria-busy="true"]::before,
  .gallery-dialog-viewer[aria-busy="true"]::after,
  .media-frame[aria-busy="true"]::after { animation: none !important; }
}
@media (max-width: 640px) { .gallery-dialog-nav { display: none; } }
