html.gallery-open { overflow: hidden; }
.gallery-viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #101113;
  color: #fff;
  overflow: hidden;
}
.gallery-viewer::backdrop { background: #101113; }
.gallery-viewer[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.gallery-viewer__stage {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
}
.gallery-viewer__image { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.gallery-viewer__image[hidden] { display: none; }
.gallery-viewer__close { position: absolute; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); z-index: 1; }
.gallery-viewer button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #ffffff30;
  border-radius: 50%;
  background: #24262be8;
  color: #fff;
  font: 30px/1 Arial, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}
.gallery-viewer button:hover { background: #44474d; }
.gallery-viewer button:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.gallery-viewer__bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 8px 12px max(8px, env(safe-area-inset-bottom));
}
.gallery-viewer__count { min-width: 72px; color: #fff; text-align: center; font: 15px/1.4 Arial, sans-serif; font-variant-numeric: tabular-nums; }
.gallery-viewer__status { position: absolute; color: #ddd; text-align: center; padding: 24px; font: 16px/1.5 Arial, sans-serif; }
/* Bootstrap's reset displays dialog elements even without the open attribute. */
.gallery-viewer:not([open]) { display: none; }
