img.slk-image-preview {
  cursor: zoom-in;
}

img.slk-image-preview:focus-visible {
  outline: 3px solid #795c37;
  outline-offset: 3px;
}

html.slk-image-viewer-open,
html.slk-image-viewer-open body {
  overflow: hidden;
}

dialog.slk-image-viewer {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgb(15 13 10 / 94%);
  color: #fff7e3;
  font: 16px/1.5 system-ui, sans-serif;
  overscroll-behavior: contain;
}

dialog.slk-image-viewer[open] {
  display: flex;
  flex-direction: column;
}

.slk-image-viewer::backdrop {
  background: rgb(0 0 0 / 80%);
}

.slk-image-viewer__toolbar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
  border-bottom: 1px solid rgb(255 247 227 / 20%);
}

.slk-image-viewer__caption {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slk-image-viewer__controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slk-image-viewer__level {
  min-width: 62px;
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.slk-image-viewer__toolbar button {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid rgb(255 247 227 / 45%);
  border-radius: 6px;
  background: #30271c;
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.slk-image-viewer__toolbar button:hover {
  background: #59412d;
}

.slk-image-viewer__toolbar button:focus-visible {
  outline: 2px solid #fff7e3;
  outline-offset: 3px;
}

.slk-image-viewer__toolbar button:disabled {
  opacity: 0.5;
  cursor: default;
}

.slk-image-viewer__toolbar .slk-image-viewer__close {
  padding: 0;
  font-size: 30px;
  line-height: 1;
}

.slk-image-viewer__stage {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  overflow-anchor: none;
}

.slk-image-viewer__stage.is-pannable {
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.slk-image-viewer__stage.is-panning {
  cursor: grabbing;
}

.slk-image-viewer__canvas {
  display: grid;
  box-sizing: border-box;
  place-items: center;
  width: max-content;
  min-width: 100%;
  min-height: 100%;
  padding: 16px;
}

.slk-image-viewer__image {
  display: block;
  max-width: none;
  max-height: none;
  margin: 0;
  object-fit: contain;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
}

.slk-image-viewer__image.is-max-zoom {
  cursor: grab;
}

.slk-image-viewer__stage.is-panning .slk-image-viewer__image {
  cursor: grabbing;
}

.slk-image-viewer [hidden] {
  display: none;
}

.slk-image-viewer__status {
  margin: 0;
  padding: 16px;
  text-align: center;
}

@media (max-width: 480px) {
  .slk-image-viewer__toolbar {
    gap: 8px;
    flex-wrap: wrap;
  }

  .slk-image-viewer__caption {
    flex-basis: 100%;
  }

  .slk-image-viewer__controls {
    width: 100%;
    justify-content: space-between;
    gap: 4px;
  }

  .slk-image-viewer__level {
    min-width: 50px;
  }

  .slk-image-viewer__toolbar button {
    padding: 8px;
    font-size: 14px;
  }
}
