/* Shared thumbnail viewer; no admin page layout rules. */
.ame-thumb{cursor:zoom-in}
.ame-modal-overlay{
  position:fixed!important;inset:0!important;z-index:2147483640!important;background:rgba(2,6,23,.82);
  width:100%!important;height:100dvh!important;max-width:none!important;max-height:none!important;
  margin:0!important;transform:none!important;box-sizing:border-box!important;overflow:auto!important;
  display:none!important;align-items:center;justify-content:center;padding:18px;
}
.ame-modal-overlay.show{display:flex!important;}
@layer mv-sidebar-layout {
 body:has(> .ame-modal-overlay.show){overflow:hidden!important;}
}
.ame-flip-stage{width:min(1040px,96vw);height:min(760px,92vh);perspective:1400px;}
.ame-flip-card{position:relative;width:100%;height:100%;transform-style:preserve-3d;transition:transform .45s ease;}
.ame-flip-card.is-flipped{transform:rotateY(180deg);}
.ame-face{position:absolute;inset:0;backface-visibility:hidden;background:#05070d;color:#fff;border-radius:22px;overflow:hidden;box-shadow:0 30px 90px rgba(0,0,0,.45);border:1px solid rgba(255,255,255,.12);display:flex;flex-direction:column;}
.ame-back{transform:rotateY(180deg);background:#0b1120;}
.ame-modal-head{padding:12px 14px;display:flex;align-items:center;gap:10px;border-bottom:1px solid rgba(255,255,255,.12);}
.ame-modal-title{font-weight:800;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.ame-modal-actions{margin-left:auto;display:flex;gap:8px;align-items:center;}
.ame-icon-btn{border:1px solid rgba(255,255,255,.18);background:rgba(255,255,255,.08);color:#fff;border-radius:999px;min-width:38px;height:38px;padding:0 11px;display:inline-flex;align-items:center;justify-content:center;gap:6px;}
.ame-icon-btn:hover{background:rgba(255,255,255,.16);}
.ame-media-body{flex:1;display:grid;place-items:center;min-height:0;padding:12px;background:#000;}
.ame-media-body img,.ame-media-body video,.ame-media-body iframe{max-width:100%;max-height:100%;border-radius:16px;background:#000;object-fit:contain;}
.ame-gallery-grid{padding:16px;display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:12px;overflow:auto;}
.ame-gallery-item{border:1px solid rgba(255,255,255,.12);border-radius:14px;overflow:hidden;background:rgba(255,255,255,.05);cursor:pointer;}
.ame-gallery-item img,.ame-gallery-item video{width:100%;height:120px;object-fit:cover;background:#000;display:block;}
.ame-gallery-item span{display:block;padding:8px 10px;font-size:.8rem;color:#dbeafe;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.ame-hint{color:#cbd5e1;font-size:.82rem;padding:0 14px 12px;}
@media(max-width:640px){
  .ame-flip-stage{height:88vh;}
  .ame-modal-title{font-size:.9rem;}
  .ame-gallery-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
}

/* Native top-layer media preview cannot be trapped behind a transformed page. */
dialog#ameMediaOverlay{position:fixed!important;inset:0!important;width:100vw!important;height:100dvh!important;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;margin:0!important;border:0!important;padding:18px!important;transform:none!important;contain:none!important;isolation:isolate;box-sizing:border-box!important}
dialog#ameMediaOverlay:not([open]){display:none!important}
dialog#ameMediaOverlay::backdrop{background:transparent}
dialog#ameMediaOverlay .ame-flip-stage{min-width:0;max-width:100%;max-height:100%;flex:0 1 1040px}
dialog#ameMediaOverlay .ame-media-body img,dialog#ameMediaOverlay .ame-media-body video{width:auto!important;height:auto!important;max-width:100%!important;max-height:100%!important;min-width:0!important;min-height:0!important}
.ame-thumb:focus-visible{outline:3px solid #eaa932;outline-offset:3px}
@media(prefers-reduced-motion:reduce){#ameMediaOverlay .ame-flip-card{transition:none}}
