/* Shared Contour ↔ GZI media viewer (edit once → both apps via hardlink) */
.media-backdrop,
.dialog-backdrop.media-backdrop,
.lightbox.media-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  cursor: zoom-out;
}
.dialog-backdrop.media-backdrop { z-index: 40; }

.media-stage {
  position: relative;
  z-index: 1;
  max-width: 100%;
  max-height: 100%;
  touch-action: none;
}
.media-zoom {
  display: block;
  max-width: min(960px, 92vw);
  max-height: 86vh;
  width: auto;
  height: auto;
  object-fit: contain;
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
  border-radius: 12px;
  background: #000;
}
.media-stage.can-pan .media-zoom { cursor: grab; }
.media-stage.panning .media-zoom { cursor: grabbing; }

.media-tools {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  z-index: 3;
  display: flex;
  gap: 8px;
}
.media-tools .icon-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  box-shadow: none;
}
.media-tools .icon-btn svg {
  width: 22px;
  height: 22px;
  display: block;
}
.media-tools .icon-btn:active { opacity: 0.7; }

.media-nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}
.media-nav svg { width: 28px; height: 28px; display: block; }
.media-nav.prev { left: 12px; }
.media-nav.next { right: 12px; }

.media-count {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 3;
  text-align: center;
  color: #fff;
  font-size: 14px;
  pointer-events: none;
}

.media-frame { position: relative; cursor: default; }
.media-player {
  display: block;
  max-width: min(960px, 92vw);
  max-height: 86vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  background: #000;
}
.media-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
}
