.wiki-media-open { overflow: hidden; }
dialog.wiki-media-viewer {
  /* Cancel the shared canvas zoom so modal controls retain physical size. */
  zoom: var(--ad-page-scale, 1);
  box-sizing: border-box;
  width: max-content;
  min-width: min(260px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  padding: 44px 20px 18px;
  border: 1px solid #bbb;
  border-radius: 0;
  color: #222;
  background: #fff;
  overflow: auto;
}
.wiki-media-viewer::backdrop { background: rgb(0 0 0 / 65%); }
.wiki-media-viewer figure { margin: 0; text-align: center; }
.wiki-media-viewer img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100dvh - 150px);
  object-fit: contain;
  margin: 0 auto;
}
.wiki-media-viewer figcaption { margin-top: 14px; overflow-wrap: anywhere; font: 13px/1.4 Arial, sans-serif; }
.wiki-media-surface { position: relative; }
.wiki-media-surface[style] img { width: 100%; max-height: none; }
.wiki-media-close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #333;
  cursor: pointer;
  font: 26px/36px Arial, sans-serif;
}
.wiki-media-close:hover, .wiki-media-close:focus-visible { background: #eee; }
