body.media-viewer-open {
  overflow: hidden;
}
dialog.media-viewer:not([open]) {
  display: none;
}
dialog.media-viewer[open] {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #10141c;
  color: #f5f7fa;
  overflow: hidden;
}
.media-viewer::backdrop {
  background: #10141c;
}
.media-viewer-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  min-height: 72px;
  flex-shrink: 0;
  border-bottom: 1px solid #ffffff14;
}
.media-viewer-identity {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}
.media-viewer-identity strong {
  font-size: 14px;
  font-weight: 600;
}
.media-viewer-filename {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #a2abba;
  font-size: 12px;
}
.media-viewer-count {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: #bac3d0;
}
body .media-viewer-action,
body button.media-viewer-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-height: 40px;
  min-width: 40px;
  padding: 0;
  background: #ffffff0d;
  border: 1px solid #ffffff18;
  border-radius: 8px;
  color: #f5f7fa;
  text-decoration: none;
  box-shadow: none;
}
body .media-viewer-action:hover,
body button.media-viewer-nav:hover {
  background: #ffffff1c;
}
.media-viewer svg {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
}
.media-viewer :focus-visible {
  outline: 2px solid #67a8ff;
  outline-offset: 3px;
}
.media-viewer-stage {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-y pinch-zoom;
}
.media-viewer-content {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(100% - 144px);
  height: 100%;
  min-height: 0;
}
.media-viewer img.media-viewer-media,
.media-viewer video.media-viewer-media {
  display: block;
  width: auto;
  height: auto;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
}
.media-viewer video.media-viewer-media {
  width: 100%;
  height: 100%;
  background: transparent;
}
.media-viewer-status {
  position: absolute;
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%);
  padding: 12px 18px;
  max-width: 80%;
  border-radius: 8px;
  background: #10141cdb;
  color: #e0e6ee;
  font-size: 13px;
  text-align: center;
  pointer-events: none;
}
body button.media-viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 50%;
  width: 44px;
  height: 44px;
}
body button.media-viewer-prev {
  left: 18px;
}
body button.media-viewer-next {
  right: 18px;
}
body button.media-viewer-nav:disabled {
  opacity: 0.25;
  cursor: default;
}
.media-viewer-footer {
  padding: 12px 20px;
  border-top: 1px solid #ffffff14;
  flex-shrink: 0;
}
.media-viewer-thumbnails {
  display: flex;
  justify-content: safe center;
  gap: 8px;
  overflow-x: auto;
  padding: 3px;
  scrollbar-width: thin;
}
body button.media-viewer-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 54px;
  height: 54px;
  min-height: 54px;
  padding: 0;
  flex-shrink: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  background: #252b36;
  color: #fff;
  overflow: hidden;
  opacity: 0.6;
}
body button.media-viewer-thumb[aria-current="true"] {
  border-color: #4295ff;
  opacity: 1;
}
.media-viewer-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-viewer-thumb-video {
  position: absolute;
  bottom: 1px;
  left: 0;
  right: 0;
  background: #0008;
  font-size: 8px;
  line-height: 13px;
  color: #fff;
  text-align: center;
}
#messages [data-media-viewer] {
  cursor: pointer;
}
@media (max-width: 600px) {
  .media-viewer-header {
    min-height: 64px;
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
    gap: 10px;
  }
  .media-viewer-identity strong {
    font-size: 13px;
  }
  .media-viewer-filename {
    max-width: 145px;
    font-size: 11px;
  }
  .media-viewer-count {
    font-size: 11px;
  }
  body .media-viewer-action {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
  }
  .media-viewer-content {
    width: 100%;
  }
  body button.media-viewer-nav {
    width: 34px;
    height: 40px;
    min-width: 34px;
    min-height: 40px;
    border-radius: 6px;
    z-index: 2;
    background: #10141c99;
  }
  body button.media-viewer-prev {
    left: 6px;
  }
  body button.media-viewer-next {
    right: 6px;
  }
  .media-viewer-footer {
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  }
  body button.media-viewer-thumb {
    width: 44px;
    height: 44px;
    min-height: 44px;
  }
}
.media-viewer .media-viewer-header {
  background: #10141c;
  color: #f5f7fa;
}
.media-viewer .media-viewer-footer {
  background: #10141c;
}
.media-viewer img.media-viewer-media {
  cursor: grab;
  user-select: none;
}
.media-viewer-stage:active img.media-viewer-media {
  cursor: grabbing;
}
