body.image-viewer-open { overflow: hidden; }
.image-viewer {
  position: fixed;
  inset: 0;
  width: min(920px, calc(100vw - 36px));
  max-width: none;
  max-height: calc(100vh - 36px);
  max-height: calc(100svh - 36px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--ui-border);
  border-radius: 18px;
  background: var(--ui-surface);
  color: var(--ui-ink);
  box-shadow: 0 20px 70px #0006;
  overscroll-behavior: contain;
}
.image-viewer::backdrop { background: rgb(6 20 35 / .76); }
.image-viewer__panel { padding: 20px; }
.image-viewer__header { display: flex; align-items: center; gap: 20px; margin-bottom: 12px; }
.image-viewer__header h2 { flex: 1; margin: 0; color: var(--ui-ink); font-size: 1.25rem; line-height: 1.4; }
.image-viewer__close { flex: none; width: 44px; height: 44px; border: 1px solid var(--ui-border); border-radius: 50%; background: var(--ui-soft); color: var(--ui-ink); font: 30px/1 Arial,sans-serif; cursor: pointer; }
.image-viewer__image-button { display: block; width: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-out; }
.image-viewer__image { display: block; width: auto; max-width: 100%; height: auto; max-height: min(68vh, 740px); max-height: min(calc(100svh - 215px), 740px); margin: 0 auto; object-fit: contain; border-radius: 8px; }
.image-viewer__caption { margin: 14px 0 0; color: var(--ui-ink); font-size: .95rem; line-height: 1.6; }
.image-viewer__help { margin: 8px 0 0; color: var(--ui-muted); font-size: .8rem; line-height: 1.5; }
[data-image-viewer] { cursor: zoom-in; }
@media (max-width: 575px) {
  .image-viewer { width: calc(100vw - 20px); max-height: calc(100svh - 20px); border-radius: 12px; }
  .image-viewer__panel { padding: 12px; }
  .image-viewer__header { gap: 10px; }
  .image-viewer__header h2 { font-size: 1.1rem; }
}
@media print { .image-viewer { display: none !important; } }
