html:has(.ms-photo-viewer[open]) { overflow: hidden; }
.ms-photo-viewer {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  padding: max(12px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background: #211e1b;
  color: #faf6ef;
  font-family: var(--font-body, sans-serif);
  overscroll-behavior: contain;
}
.ms-photo-viewer::backdrop { background: #211e1b; }
.ms-photo-viewer[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(8px, 2vh, 18px);
}
.ms-viewer-top, .ms-viewer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(100%, 1024px);
  margin-inline: auto;
}
.ms-viewer-count { font-size: 15px; font-variant-numeric: tabular-nums; }
.ms-viewer-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
  min-height: 0;
  touch-action: pan-y pinch-zoom;
}
.ms-viewer-stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
.ms-photo-viewer button {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border: 1px solid #a79e94;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.ms-photo-viewer button svg {
  display: block; width: 22px; height: 22px; fill: none;
  stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.ms-photo-viewer button:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.ms-photo-viewer button:active { background: #51493f; }
@media (hover: hover) { .ms-photo-viewer button:hover { background: #403a34; } }
.ms-viewer-bottom { max-width: 660px; }
.ms-viewer-caption { text-align: center; font-size: clamp(14px, 1.7vw, 17px); line-height: 1.4; }
@media (max-height: 480px) and (min-width: 560px) {
  .ms-photo-viewer[open] { gap: 4px; padding-block: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-bottom)); }
}
