[data-ymw-preview-trigger], [data-ymw-preview-image] { cursor: zoom-in; }
[data-ymw-preview-trigger]:focus-visible {
  outline: 3px solid #087354;
  outline-offset: 4px;
  border-radius: 4px;
}
html.ymw-image-viewer-open { overflow: hidden; }
html.ymw-image-viewer-open > body { padding-inline-end: var(--ymw-viewer-scrollbar, 0px); }

.ymw-image-viewer {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: min(var(--ymw-viewer-width, 360px), calc(100% - 24px));
  height: max-content;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  max-width: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid #deebe4;
  border-radius: 16px;
  background: #fff;
  color: #17342b;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  box-shadow: 0 18px 58px #14262045;
}
.ymw-image-viewer[open] { display: flex; flex-direction: column; }
.ymw-image-viewer::backdrop { background: #263a366c; }
.ymw-image-viewer *, .ymw-image-viewer *::before, .ymw-image-viewer *::after { box-sizing: border-box; }
.ymw-viewer-header {
  display: grid;
  flex: none;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid #e0ebe5;
  background: #fff;
}
.ymw-viewer-header h2 {
  min-width: 0;
  margin: 0;
  color: #17342b;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ymw-viewer-controls {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 5px;
}
.ymw-image-viewer .ymw-viewer-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 4px 8px;
  border: 1px solid #dbe8e0;
  border-radius: 8px;
  background: #fff;
  color: #245545;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
.ymw-image-viewer .ymw-viewer-control:hover { background: #eaf4ee; }
.ymw-image-viewer .ymw-viewer-control:focus-visible,
.ymw-viewer-stage:focus-visible { outline: 2px solid #087557; outline-offset: -2px; }
.ymw-image-viewer .ymw-viewer-control:disabled { opacity: .48; cursor: default; }
.ymw-image-viewer .ymw-viewer-close {
  grid-column: 3;
  grid-row: 1;
  color: #fff;
  border-color: #087057;
  background: #087057;
  font-size: 24px;
  line-height: 1;
}
.ymw-image-viewer .ymw-viewer-close:hover { background: #065841; }
.ymw-image-viewer .ymw-viewer-close:focus-visible { outline-color: white; outline-offset: -4px; }
.ymw-viewer-stage {
  flex: 0 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  background: #f4f8f5;
  touch-action: pan-x pan-y pinch-zoom;
}
.ymw-viewer-canvas {
  display: grid;
  place-items: center;
  width: max-content;
  min-width: 100%;
  padding: 8px;
}
.ymw-image-viewer .ymw-viewer-image {
  display: block;
  max-width: none;
  max-height: none;
  margin: 0;
  object-fit: contain;
}
.ymw-viewer-status { margin: 0; padding: 14px; color: #476257; font: inherit; }
.ymw-viewer-status:empty, .ymw-viewer-stage[hidden] { display: none; }

.ymw-image-viewer.ymw-viewer-compact .ymw-viewer-header {
  grid-template-columns: minmax(0, 1fr) auto;
}
.ymw-image-viewer.ymw-viewer-compact .ymw-viewer-close { grid-column: 2; }
.ymw-image-viewer.ymw-viewer-compact .ymw-viewer-controls {
  grid-column: 1 / -1;
  grid-row: 2;
  flex-wrap: wrap;
}
.ymw-image-viewer.ymw-viewer-compact .ymw-viewer-original { margin-inline-start: auto; }
