.prose-paper img { cursor:zoom-in; }
.image-dialog {
 position:fixed; inset:0; width:fit-content; height:fit-content;
 max-width:calc(100vw - 32px); max-height:90vh; max-height:90dvh; margin:auto; padding:0;
 border:1px solid #cbd5e1; border-radius:5px; background:#f8fafc; color:#475569;
 box-shadow:0 20px 60px #0f172a55; overflow:hidden;
}
.image-dialog::backdrop { background:rgba(15,23,42,.68); backdrop-filter:blur(6px); -webkit-backdrop-filter:blur(6px); }
.image-dialog[open] { display:grid; grid-template-rows:40px minmax(0,1fr) auto; animation:image-viewer-enter .15s ease-out; }
.image-viewer-bar { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:0 12px 0 14px; background:#306fa9; color:#fff; }
.image-viewer-bar strong { font-size:14px; font-weight:600; }
.image-dialog .image-viewer-bar button { position:static; display:grid; place-items:center; width:28px; height:28px; margin:0; padding:0; border:0; border-radius:3px; background:transparent; color:#fff; font-size:22px; line-height:1; }
.image-dialog .image-viewer-bar button:hover { background:#ffffff24; filter:none; }
.image-viewer-stage { position:relative; display:flex; align-items:center; justify-content:center; min-width:160px; min-height:80px; margin:0; padding:0; border:0; border-radius:0; background:transparent; overflow:hidden; touch-action:pan-y pinch-zoom; }
.image-dialog .image-viewer-stage img { display:block; width:auto; height:auto; max-width:min(86vw,1100px); max-height:calc(90vh - 68px); max-height:calc(90dvh - 68px); margin:0; padding:0; border:0; border-radius:0; object-fit:contain; box-shadow:none; user-select:none; }
.image-viewer-stage img.is-loading { opacity:0; }
.image-viewer-stage.is-zoomed { touch-action:none; }
.image-viewer-stage [data-image-status] { position:absolute; max-width:90%; margin:0; text-align:center; font-size:13px; color:#64748b; pointer-events:none; }
.image-viewer-stage [data-image-status]:empty { display:none; }
.image-dialog .image-viewer-arrow { position:absolute; top:50%; z-index:1; display:grid; place-items:center; width:44px; height:44px; margin:0; padding:0; border:0; border-radius:50%; background:rgba(15,23,42,.16); color:rgba(255,255,255,.8); opacity:.65; transform:translateY(-50%); cursor:pointer; transition:opacity .18s,background .18s; }
.image-dialog .image-viewer-prev { left:10px; }
.image-dialog .image-viewer-next { right:10px; }
.image-dialog .image-viewer-arrow:hover { background:rgba(15,23,42,.35); opacity:1; filter:none; }
.image-dialog .image-viewer-arrow:active { transform:translateY(-50%) scale(.94); }
.image-dialog .image-viewer-arrow:focus-visible { outline:2px solid #fff; outline-offset:2px; opacity:1; }
.image-dialog .image-viewer-arrow:disabled { opacity:.18; cursor:default; background:rgba(15,23,42,.1); }
.image-viewer-footer { display:flex; align-items:center; justify-content:space-between; gap:16px; box-sizing:border-box; min-height:26px; margin:0; padding:3px 8px; border:0; border-top:1px solid #d7e0e8; background:#f1f5f9; color:#64748b; font-size:11px; line-height:1.5; }
.image-viewer-footer [data-image-name] { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.image-viewer-footer [data-image-count] { flex-shrink:0; font-variant-numeric:tabular-nums; }
:root[data-mode=dark] .image-dialog { border-color:#526174; background:#252c39; color:#e2e8f0; }
:root[data-mode=dark] .image-viewer-stage { border-color:#526174; background:#1b2230; }
:root[data-mode=dark] .image-viewer-footer { border-color:#526174; background:#303a49; color:#cbd5e1; }
@keyframes image-viewer-enter { from{opacity:0;transform:translateY(5px)} to{opacity:1;transform:translateY(0)} }
@media(max-width:767.98px) {
 .image-dialog { max-width:calc(100vw - 16px); }

 .image-dialog .image-viewer-stage img { max-width:calc(100vw - 18px); max-height:calc(90dvh - 68px); }

}
@media(prefers-reduced-motion:reduce) { .image-dialog[open] { animation:none; } }
