html.qrd-image-open { overflow: hidden; scrollbar-gutter: stable; }
[data-image-preview] { display: block; cursor: zoom-in; }
.qrd-image-viewer {
  width: min(1500px, calc(100vw - 48px));
  max-width: none;
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 0;
  border: 1px solid #ffffff28;
  border-radius: 12px;
  color: var(--ink);
  background: var(--paper);
  overflow: hidden;
  box-shadow: 0 24px 80px #0007;
}
.qrd-image-viewer[open] { display: flex; flex-direction: column; }
.qrd-image-viewer::backdrop { background: #111c; backdrop-filter: blur(5px); }
.qrd-image-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 18px 12px 24px;
  border-bottom: 1px solid var(--line);
}
.qrd-image-toolbar h2 { min-width: 0; margin: 0; font-size: 16px; line-height: 1.5; font-weight: 600; overflow-wrap: anywhere; }
.qrd-image-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #ffffffb3;
  font-size: 14px;
  line-height: 1.4;
}
.qrd-image-close:hover { background: white; border-color: var(--muted); }
.qrd-image-close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.qrd-image-stage { min-height: 0; padding: 16px; display: grid; place-items: center; overflow: auto; background: #191b1e; }
.qrd-image-stage img { display: block; width: auto; height: auto; max-width: 100%; max-height: calc(100dvh - 210px); object-fit: contain; }
.qrd-image-caption { flex: 0 0 auto; margin: 0; padding: 14px 24px; color: var(--muted); font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
@media(max-width:760px) {
  .qrd-image-viewer { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); border-radius: 8px; }
  .qrd-image-toolbar { gap: 12px; padding: 10px 12px 10px 16px; }
  .qrd-image-toolbar h2 { font-size: 14px; }
  .qrd-image-close { padding: 8px; }
  .qrd-image-close-label { display: none; }
  .qrd-image-stage { padding: 8px; }
  .qrd-image-stage img { max-height: calc(100dvh - 195px); }
  .qrd-image-caption { padding: 12px 16px; }
}
@media(max-height:500px) {
  .qrd-image-toolbar { padding-block: 6px; }
  .qrd-image-caption { padding-block: 8px; }
  .qrd-image-stage { padding: 8px; }
  .qrd-image-stage img { max-height: calc(100dvh - 180px); }
}
