.cm-image-preview{
  cursor:zoom-in;
  touch-action:auto;
  -webkit-tap-highlight-color:transparent;
}

.cm-image-preview:focus-visible{
  outline:3px solid #f6d76f;
  outline-offset:3px;
}

.cm-image-viewer[hidden]{
  display:none!important;
}

.cm-image-viewer{
  position:fixed;
  inset:0;
  z-index:10000;
  display:grid;
  grid-template-rows:auto minmax(0,1fr) auto;
  gap:10px;
  padding:max(12px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));
  background:rgba(18,16,14,.96);
  color:#fff;
  overscroll-behavior:contain;
  touch-action:pan-x pan-y pinch-zoom;
}

.cm-image-viewer__toolbar{
  position:relative;
  z-index:2;
  display:flex;
  justify-content:flex-end;
  gap:8px;
}

.cm-image-viewer__button{
  min-width:48px;
  min-height:48px;
  padding:8px 15px;
  border:1px solid rgba(255,255,255,.55);
  border-radius:999px;
  background:rgba(255,255,255,.12);
  color:#fff;
  font:800 14px/1.2 "Microsoft YaHei","PingFang SC",system-ui,sans-serif;
  cursor:pointer;
  touch-action:manipulation;
}

.cm-image-viewer__button:focus-visible{
  outline:3px solid #f6d76f;
  outline-offset:2px;
}

.cm-image-viewer__close{
  width:48px;
  padding:0;
  font-size:27px;
  line-height:1;
}

.cm-image-viewer__viewport{
  min-width:0;
  min-height:0;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:auto;
  text-align:center;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;
  touch-action:pan-x pan-y pinch-zoom;
}

.cm-image-viewer__image{
  display:block;
  width:auto;
  height:auto;
  max-width:100%;
  max-height:calc(100dvh - 150px);
  margin:auto;
  object-fit:contain;
  cursor:zoom-out;
  user-select:none;
  -webkit-user-select:none;
  -webkit-touch-callout:none;
  touch-action:pan-x pan-y pinch-zoom;
}

.cm-image-viewer__caption{
  min-height:24px;
  margin:0;
  color:rgba(255,255,255,.86);
  font:700 13px/1.5 "Microsoft YaHei","PingFang SC",system-ui,sans-serif;
  text-align:center;
}

@media(max-width:640px){
  .cm-image-viewer__toolbar{
    justify-content:space-between;
  }

  .cm-image-viewer__button{
    min-height:52px;
  }
}

@media(prefers-reduced-motion:reduce){
  .cm-image-viewer{
    scroll-behavior:auto;
  }
}
