body.image-viewer-open { overflow: hidden; }
.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: rgba(8, 13, 24, 0.94);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 160ms ease, visibility 160ms ease;
}

.image-viewer--open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.image-viewer-topbar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  padding: max(14px, env(safe-area-inset-top)) 14px 8px;
}

.image-viewer-close {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.image-viewer-stage {
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 8px 14px 12px;
  touch-action: none;
  overscroll-behavior: contain;
  cursor: default;
}

.image-viewer-stage--dragging {
  cursor: grabbing;
}

.image-viewer-img {
  display: block;
  max-width: calc(100vw - 28px);
  max-height: calc(100vh - 156px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center center;
  transition: transform 140ms ease;
  will-change: transform;
}

.image-viewer-img--active {
  cursor: grab;
}

.image-viewer-img--immediate {
  transition: none;
}

.image-viewer-controls {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 8px 14px max(18px, env(safe-area-inset-bottom));
}

.image-viewer-controls button {
  min-width: 56px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
