.editor-page .gallery-browse-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.editor-page .gallery-browse-actions > button {
  width: 100%;
  min-height: 34px;
  padding-inline: 6px;
}
.editor-page #gallery-preview {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 14px 20px 10px;
  border: 0;
  color: #dedede;
  background: rgba(0,0,0,.9);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  pointer-events: auto;
  overflow: hidden;
  overscroll-behavior: contain;
}
.editor-page #gallery-preview[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  gap: 10px;
}
#gallery-preview::backdrop { background: transparent; }
#gallery-preview .gallery-preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#gallery-preview .gallery-preview-heading-actions { display: flex; align-items: center; gap: 8px; }
#gallery-preview-fullscreen { display: grid; place-items: center; width: 36px; height: 36px; padding: 7px; user-select: none; -webkit-user-select: none; }
#gallery-preview-fullscreen svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#gallery-preview-title { margin: 0; color: #999; font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
#gallery-preview-stage { position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; overflow: hidden; }
#gallery-preview-image { display: block; }
#gallery-preview-image[hidden], #gallery-preview-message[hidden] { display: none; }
#gallery-preview-info, #gallery-preview-help, #gallery-preview-message { margin: 0; color: #999; text-align: center; font-size: 12px; line-height: 1.4; }
#gallery-preview-info { min-height: 1.4em; user-select: none; -webkit-user-select: none; cursor: default; outline: none; }
#gallery-preview-info::selection { background: transparent; color: #999; }
#gallery-preview-help { color: #777; font-size: 11px; user-select: none; -webkit-user-select: none; cursor: default; outline: none; }
#gallery-preview-help::selection { background: transparent; color: #777; }
#gallery-preview-filmstrip {
  display: flex;
  justify-self: center;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
  padding: 5px;
  overflow-x: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #555 #111;
}
#gallery-preview button { background: #101010; color: #ddd; border: 1px solid #383838; border-radius: 4px; cursor: pointer; }
#gallery-preview button:hover { background: #202020; border-color: #888; }
#gallery-preview button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.editor-page #gallery-preview #gallery-preview-close { background: #111; color: #ddd; border-color: #444; box-shadow: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.editor-page #gallery-preview #gallery-preview-close::selection { background: transparent; color: #ddd; }
.editor-page #gallery-preview #gallery-preview-close:not(:focus-visible) { outline: none; }
.editor-page #gallery-preview #gallery-preview-close:hover { background: #222; color: #fff; border-color: #777; }
.editor-page #gallery-preview #gallery-preview-close:active { background: #303030; }
.editor-page #gallery-preview #gallery-preview-close:focus-visible { outline: 2px solid #ddd; outline-offset: -3px; }
#gallery-preview .gallery-preview-arrow { position: absolute; z-index: 1; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 44px; height: 64px; padding: 6px; border: 0; background: #0005; }
#gallery-preview-previous { left: 8px; }
#gallery-preview-next { right: 8px; }
#gallery-preview .gallery-preview-arrow svg { width: 20px; height: 34px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#gallery-preview .gallery-preview-thumb { display: grid; place-items: center; flex: 0 0 88px; width: 88px; height: 68px; min-height: 0; padding: 4px; }
#gallery-preview .gallery-preview-thumb[aria-pressed="true"] { border-color: #e8e8e8; box-shadow: 0 0 0 1px #e8e8e8; background: #222; }
#gallery-preview .gallery-preview-thumb canvas { max-width: 100%; max-height: 100%; min-width: 0; min-height: 0; object-fit: contain; }
@media (max-width: 600px), (max-height: 500px) {
  .editor-page #gallery-preview { padding: 8px; }
  .editor-page #gallery-preview[open] { gap: 6px; }
  #gallery-preview .gallery-preview-thumb { flex-basis: 72px; width: 72px; height: 54px; }
}

/* An isolated, image-only presentation of the existing Gallery preview. */
.editor-page #gallery-preview.gallery-preview-fullscreen {
  padding: 0;
  gap: 0;
  grid-template-rows: minmax(0, 1fr);
  background: #000;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  user-select: none;
  -webkit-user-select: none;
}
#gallery-preview.gallery-preview-fullscreen > :not(#gallery-preview-stage),
#gallery-preview.gallery-preview-fullscreen .gallery-preview-arrow { display: none; }
#gallery-preview.gallery-preview-fullscreen #gallery-preview-stage { width: 100%; height: 100%; background: #000; }
#gallery-preview-stage:fullscreen { width: 100vw; height: 100dvh; background: #000; }
#gallery-preview-stage::backdrop { background: #000; }
#gallery-preview-fullscreen-controls {
  position: absolute;
  z-index: 2;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 24px);
  box-sizing: border-box;
  padding: 4px 6px;
  border-radius: 6px;
  background: #080808b8;
  color: #eee;
  font: 12px/1.2 Arial, sans-serif;
  text-transform: none;
  letter-spacing: normal;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}
#gallery-preview-fullscreen-controls[hidden] { display: none; }
#gallery-preview-fullscreen-controls * { user-select: none; -webkit-user-select: none; }
#gallery-preview-fullscreen-help { font-size: 11px; color: #ccc; }
#gallery-preview-zoom { min-width: 4em; text-align: center; font-variant-numeric: tabular-nums; }
#gallery-preview #gallery-preview-fullscreen-controls button {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  min-height: 0;
  padding: 0;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: #eee;
  font: 400 24px/1 Arial, sans-serif;
}
#gallery-preview #gallery-preview-fullscreen-controls button:disabled { opacity: .35; cursor: default; }
#gallery-preview #gallery-preview-fullscreen-controls :is(#gallery-preview-zoom-out, #gallery-preview-zoom-in, #gallery-preview-fullscreen-close) {
  outline: none;
  box-shadow: none;
  background: transparent;
  border-color: transparent;
  color: #eee;
  -webkit-tap-highlight-color: transparent;
}
