.editor-preview {
  --bg: #edf2f5;
  --surface: #fff;
  --surface-soft: #f5f8fa;
  --text: #182c3d;
  --muted: #647887;
  --primary: #176c9b;
  --primary-strong: #145577;
  --primary-soft: #e7f2f8;
  --line: #dbe3e9;
  --focus: #176c9b;
  --error: #a62f27;
  --header-h: 54px;
  scroll-behavior: auto;
}

.editor-preview body {
  background: var(--bg);
  line-height: 1.45;
}

.editor-preview body::before {
  display: none;
}

.editor-preview .preview-header {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--header-h);
  padding: 6px clamp(12px, 3vw, 40px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.editor-preview .preview-brand {
  color: var(--text);
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.45px;
  text-decoration: none;
}

.editor-preview .preview-header .top-actions,
.editor-preview .preview-languages {
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-preview .preview-languages {
  gap: 2px;
}

.editor-preview .preview-languages a {
  padding: 7px 8px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}

.editor-preview .preview-languages a[aria-current] {
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 700;
}

.editor-preview #main-content {
  max-width: none;
  margin: auto;
  padding: 18px clamp(12px, 2.5vw, 32px) 24px;
}

.editor-preview #timestamp-tool {
  margin: 0;
  padding: 0;
}

.editor-preview .editor-title {
  margin: 0 0 12px;
  font-family: var(--font-sans);
  font-size: clamp(17px, 1.6vw, 22px);
  font-weight: 700;
  letter-spacing: -0.35px;
}

.editor-preview .layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(340px, 25vw, 360px);
  align-items: start;
  gap: 14px;
  max-width: none;
  margin: 0;
  padding: 0;
}

.editor-preview .card {
  min-width: 0;
  padding: 0;
  border-color: var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 1px 2px #182c3d0a;
}

.editor-preview .layout .upload-card,
.editor-preview .layout .settings-card {
  grid-column: auto;
  grid-row: auto;
}

.editor-preview .layout .preview-card {
  position: static;
}

.editor-preview .preview-workspace {
  min-width: 0;
  min-height: 0;
}

.editor-preview .preview-head {
  position: relative;
  flex-flow: row wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.editor-preview .upload-card .upload-dropzone {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid #c2dce9;
  border-radius: 6px;
  background: var(--primary-soft);
}

.editor-preview .upload-card .upload-dropzone:hover {
  border-color: var(--primary);
}

.editor-preview .upload-card .upload-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 700;
}

.editor-preview .upload-action::before {
  content: "+";
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
}

.editor-preview .upload-limit,
.editor-preview .preview-switcher,
.editor-preview #uploadMeta {
  color: var(--muted);
  font-size: 12px;
}

.editor-preview .preview-switcher {
  margin-left: auto;
}

.editor-preview .preview-switcher button {
  min-height: 34px;
  padding: 5px 8px;
  font-size: 12px;
}

.editor-preview .upload-card:not(.has-photos) .preview-switcher,
.editor-preview
  .preview-workspace:not(:has(.has-photos, .has-import-failures))
  .next-selection,
.editor-preview
  .preview-workspace:not(:has(.has-photos))
  .next-selection
  > :not(.next-select-buttons),
.editor-preview
  .preview-workspace:not(:has(.has-photos))
  .next-select-buttons
  button:not(#clearBtn),
.editor-preview .preview-workspace:not(:has(.has-photos)) .thumb-grid,
.editor-preview .preview-workspace:has(.has-photos) .download-empty,
.editor-preview .upload-card.has-photos .upload-dropzone {
  display: none;
}

.editor-preview .photo-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: clamp(8px, 1.5vw, 20px);
  background: #e5ecf1;
}

.editor-preview .photo-stage.is-dragover {
  outline: 3px dashed var(--primary);
  outline-offset: -5px;
  background: var(--primary-soft);
}

.editor-preview .preview-add-photos {
  flex: none;
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid #c2dce9;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 700;
}

.editor-preview .preview-add-photos::before {
  margin-right: 6px;
  content: "+";
}

.editor-preview .preview-card:not(.has-photos) .preview-add-photos {
  display: none;
}

.editor-preview .preview-card .preview-canvas {
  width: 100%;
  max-width: none;
  min-width: 0;
  max-height: min(68svh, 680px);
  margin: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
}

.editor-preview .preview-card:not(.has-photos) .preview-canvas {
  min-height: clamp(180px, 27vw, 370px);
  aspect-ratio: auto;
}

.editor-preview .preview-viewport-meter {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 100svh;
  visibility: hidden;
  pointer-events: none;
}

.editor-preview .preview-card.has-photos .photo-stage {
  padding: 10px;
}

.editor-preview .preview-card.has-photos .preview-canvas {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: none;
  min-height: 0;
}

.editor-preview #previewImage {
  grid-area: 1 / 1;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
}

.editor-preview .empty-photo {
  grid-area: 1 / 1;
  display: grid;
  align-content: center;
  justify-items: center;
  width: 100%;
  min-height: inherit;
  gap: 3px;
  padding: 12px;
  border: 2px dashed transparent;
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
  color: #4c6170;
  font-size: 12px;
  text-align: center;
}

.editor-preview .empty-photo:hover:not(:disabled),
.editor-preview .empty-photo:focus-visible {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.editor-preview .empty-photo strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

.editor-preview .empty-photo-icon {
  position: relative;
  display: block;
  width: 35px;
  height: 27px;
  margin: 0 0 7px;
  overflow: hidden;
  border: 1px solid #889fad;
  border-radius: 5px;
  background: #f5f8f9;
}

.editor-preview .empty-photo-icon::before {
  position: absolute;
  top: 5px;
  right: 6px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #839dab;
  content: "";
}

.editor-preview .empty-photo-icon::after {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 17px;
  background: #b6cbd7;
  clip-path: polygon(
    0 67%,
    35% 8%,
    63% 66%,
    81% 40%,
    100% 72%,
    100% 100%,
    0 100%
  );
  content: "";
}

.editor-preview .preview-name {
  min-width: 0;
  margin-right: auto;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-preview #photoMetadata {
  flex: 1 1 160px;
  padding: 0 12px;
  border-top: 0;
}

.editor-preview #photoMetadata > summary {
  white-space: nowrap;
}

.editor-preview #photoMetadata > summary::after {
  flex: none;
  margin-left: 4px;
}

.editor-preview .exif-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 112px), 1fr));
  padding-bottom: 5px;
}

.editor-preview .exif-item {
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--surface-soft);
}

.editor-preview .exif-value {
  font-size: 13px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.editor-preview #exifPanel {
  padding-bottom: 8px;
}

.editor-preview .preview-notices {
  width: 100%;
}

.editor-preview .preview-notices > :not(:empty),
.editor-preview .preview-notices #nextProgress {
  border-radius: 6px;
  background: var(--surface);
}

.editor-preview #exifLibraryStatus {
  display: none;
}

.editor-preview .upload-card #exifLibraryStatus[data-state="unavailable"] {
  display: block;
  padding: 6px 12px;
  font-size: 12px;
}

.editor-preview .inspector-group {
  min-width: 0;
  padding: 14px 16px;
}

.editor-preview .inspector-group + .inspector-group {
  border-top: 1px solid var(--line);
}

.editor-preview .inspector-group h2,
.editor-preview .inspector-group h4,
.editor-preview #moreEditing > summary {
  margin: 0 0 10px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
}

.editor-preview .inspector-disclosure {
  min-width: 0;
}

.editor-preview .inspector-disclosure > summary {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}

.editor-preview .inspector-disclosure > summary::-webkit-details-marker {
  display: none;
}

.editor-preview .inspector-disclosure > summary::after {
  width: 6px;
  height: 6px;
  margin: 0 3px 2px auto;
  border-right: 1.5px solid var(--primary);
  border-bottom: 1.5px solid var(--primary);
  content: "";
  transform: rotate(45deg);
}

.editor-preview .inspector-disclosure[open] > summary::after {
  margin-bottom: -3px;
  transform: rotate(225deg);
}

.editor-preview #moreEditing {
  padding-block: 4px;
}

.editor-preview #moreEditing > summary {
  margin: 0;
  min-height: 40px;
}

.editor-preview #moreEditing > .inspector-group {
  padding: 8px 0;
}

.editor-preview .next-style-group > .inspector-disclosure {
  margin-top: 4px;
}

.editor-preview #moreEditing > details > summary {
  min-height: 30px;
}

.editor-preview .inspector-fields,
.editor-preview .inspector-pair {
  display: grid;
  align-items: start;
  gap: 8px;
  min-width: 0;
}

.editor-preview .inspector-pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.editor-preview .inspector-subfields {
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.editor-preview .settings-card label,
.editor-preview #compressPanel label {
  color: var(--muted);
  font-size: 13px;
}

.editor-preview
  .settings-card
  :is(
    select,
    input:not(
        [type="checkbox"],
        [type="radio"],
        [type="color"],
        [type="range"]
      ),
    textarea
  ),
.editor-preview #exportResolution,
.editor-preview #photoFilter {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  max-width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.editor-preview .settings-card textarea {
  resize: vertical;
}

.editor-preview #formatSelect {
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.editor-preview .inspector-date-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.editor-preview #changeStampDate {
  flex: none;
  min-height: 36px;
  padding: 3px 7px;
  border-color: transparent;
  background: transparent;
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 650;
}

.editor-preview #changeStampDate:hover {
  background: var(--primary-soft);
}

.editor-preview #stampDateSource {
  scroll-margin-block: calc(var(--header-h) + 16px) 108px;
}

.editor-preview #stampDateFeedback:empty {
  display: none;
}

.editor-preview .next-check {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  cursor: pointer;
}

.editor-preview .next-check input,
.editor-preview .next-thumb > input {
  width: 17px;
  height: 17px;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
  flex: none;
}

.editor-preview #stampExtensionField {
  padding-left: 24px;
}

.editor-preview .next-pro {
  display: inline-flex;
  align-items: center;
  padding: 1px 4px;
  border: 1px solid #e6d4b6;
  border-radius: 4px;
  background: #faf2e4;
  color: #724610;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.editor-preview .next-apply {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 6px;
}

.editor-preview .inspector-fields button.ghost,
.editor-preview .inspector-fields button.secondary {
  justify-self: start;
  min-height: 36px;
  padding: 5px 8px;
  font-size: 12px;
}

.editor-preview .next-order-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.editor-preview .next-order-row span {
  flex: 1;
}

.editor-preview .next-order-row button {
  min-width: 32px;
  min-height: 32px;
  padding: 2px 6px;
}

.editor-preview .next-error {
  margin: 6px 0 0;
  color: var(--error);
  font-size: 12px;
}

.editor-preview .next-error:empty {
  margin: 0;
}

.editor-preview #stampPreviewError:not(:empty) {
  padding: 0 12px 6px;
}

.editor-preview .position-visual {
  justify-content: flex-start;
  margin: 0 0 4px;
}

.editor-preview .position-photo {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 1px;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.editor-preview .position-stamp {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: linear-gradient(165deg, #f4f7fb 0%, #e8edf4 100%);
  box-shadow: none;
  cursor: pointer;
}

.editor-preview .position-stamp-bar {
  display: block;
  width: 44%;
  height: 20%;
  border-radius: 999px;
  background: rgba(23, 35, 59, 0.16);
  transition:
    background 0.15s ease,
    transform 0.15s ease;
  pointer-events: none;
}

.editor-preview .position-stamp:hover .position-stamp-bar,
.editor-preview .position-stamp:focus-visible .position-stamp-bar {
  background: rgba(23, 35, 59, 0.42);
}

.editor-preview .position-stamp[aria-pressed="true"] {
  background: linear-gradient(165deg, #eef3fa 0%, #dfe7f2 100%);
}

.editor-preview .position-stamp[aria-pressed="true"] .position-stamp-bar {
  background: var(--primary);
  box-shadow: 0 1px 5px rgba(23, 35, 59, 0.3);
}

.editor-preview .margin-control {
  margin: 0;
}

.editor-preview .margin-inputs {
  gap: 6px;
  margin-top: 3px;
}

.editor-preview .margin-inputs #marginUnit {
  width: 68px;
}

.editor-preview .margin-inputs .control-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.editor-preview .style-trigger,
.editor-preview .style-option {
  display: grid;
  grid-template-columns: 102px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 4px 7px;
  border-radius: 6px;
}

.editor-preview .style-options {
  display: grid;
  gap: 2px;
  margin-top: 5px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.editor-preview .style-option {
  cursor: pointer;
}

.editor-preview .style-option.is-active {
  background: var(--primary-soft);
}

.editor-preview .style-name {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  text-align: left;
  overflow-wrap: anywhere;
}

.editor-preview .style-check {
  visibility: hidden;
  color: var(--primary);
  font-size: 13px;
}

.editor-preview .style-option[aria-selected="true"] .style-check {
  visibility: visible;
}

.editor-preview .style-swatch {
  display: grid;
  place-items: center;
  min-height: 30px;
  overflow: hidden;
  border-radius: 4px;
  background: #445e70;
}

.editor-preview .style-swatch::before,
.editor-preview .style-sample {
  grid-area: 1 / 1;
}

.editor-preview .style-swatch::before {
  width: 94px;
  height: 21px;
  border-radius: 2px;
  background: var(--sample-backing, transparent);
  content: "";
}

.editor-preview .style-sample {
  z-index: 0;
  line-height: 1;
  white-space: nowrap;
}

.editor-preview .timestamp-font-picker,
.editor-preview .baby-panel-inner .setting-group {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
}

.editor-preview .timestamp-font-picker h4 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.editor-preview .font-picker-field {
  margin-top: 4px;
}

.editor-preview .font-picker-swatch {
  min-height: 30px;
  max-width: clamp(100px, 43vw, 170px);
}

.editor-preview .font-picker-sample {
  flex: none;
  width: auto;
  height: auto;
  max-width: calc(100% * var(--font-sample-fit));
  max-height: var(--font-sample-height);
}

.editor-preview .inspector-color {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.editor-preview .inspector-color input {
  width: 44px;
  height: 34px;
  padding: 3px;
  cursor: pointer;
}

.editor-preview .inspector-range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px;
}

.editor-preview .inspector-range output {
  font-variant-numeric: tabular-nums;
}

.editor-preview .inspector-range input {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 22px;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
}

.editor-preview .baby-panel-inner {
  display: grid;
  gap: 9px;
}

.editor-preview .baby-panel-inner .grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.editor-preview .baby-panel-inner .logo-option {
  min-width: 0;
}

.editor-preview .next-selection {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 8px;
  padding: 6px 12px 0;
  border-top: 1px solid var(--line);
}

.editor-preview .next-select-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.editor-preview .next-selection button {
  min-height: 32px;
  padding: 3px 6px;
  font-size: 11px;
}

.editor-preview .next-selection > label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
}

.editor-preview #photoFilter {
  width: auto;
  min-height: 32px;
  padding: 4px;
  font-size: 12px;
}

.editor-preview #selectionSummary {
  margin: 0 0 0 auto;
}

.editor-preview .thumb-grid {
  grid-auto-flow: column;
  grid-auto-columns: 90px;
  grid-template-columns: none;
  justify-content: start;
  gap: 6px;
  max-height: none;
  margin: 0;
  padding: 7px 12px 9px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.editor-preview .thumb-grid > p {
  grid-column: 1 / span 3;
  margin: 4px 0;
  color: var(--muted);
  font-size: 12px;
}

.editor-preview .next-thumb {
  position: relative;
  min-width: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.editor-preview .next-thumb.active {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.editor-preview .next-thumb > input {
  position: absolute;
  z-index: 1;
  top: 7px;
  left: 7px;
}

.editor-preview .next-thumb > button {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.editor-preview .next-thumb img {
  display: block;
  width: 100%;
  height: 52px;
  border-radius: 3px;
  object-fit: cover;
}

.editor-preview .thumb-name {
  display: block;
  overflow: hidden;
  padding: 2px 1px 0;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-preview .thumb-state {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.editor-preview .next-thumb[data-state="failed"] .thumb-state {
  color: var(--error);
}

.editor-preview .next-thumb[data-state="generated"] .thumb-state {
  color: #26765b;
}

.editor-preview .bottom-bar {
  position: relative;
  inset: auto;
  z-index: 15;
  gap: 3px;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 7px 10px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0 0 10px 10px;
  background: var(--surface);
  box-shadow: none;
  transform: none;
}

.editor-preview .download-empty {
  margin: 0;
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
}

.editor-preview .export-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.editor-preview .export-row {
  justify-content: start;
  gap: 6px;
}

.editor-preview .export-row button {
  flex: 0 1 auto;
  max-width: none;
  min-width: 0;
  min-height: 38px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 650;
}

.editor-preview button:disabled {
  opacity: 0.55;
  cursor: default;
}

.editor-preview #exportQuality {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 11px;
}

.editor-preview #compressPanel {
  min-width: 0;
  padding: 0;
}

.editor-preview #exportResolution {
  width: 100%;
  min-height: 32px;
  padding: 4px 6px;
  font-size: 12px;
}

.editor-preview #exportQuality > label {
  flex: none;
  margin: 0;
}

.editor-preview .export-policy-note {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  text-align: left;
}

.editor-preview .next-results {
  position: relative;
  margin: 12px 0;
  padding: 10px 12px;
  font-size: 13px;
  scroll-margin-block: 70px 100px;
}

.editor-preview .next-results-dismiss {
  position: absolute;
  top: 6px;
  right: 8px;
}

.editor-preview :is(#nextResult, #importFailures) > strong {
  display: block;
  padding-right: 60px;
}

.editor-preview
  .next-results:not(
    :has(#nextResult:not([hidden]), #importFailures:not([hidden]))
  ) {
  display: none;
}

.editor-preview .next-progress-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.editor-preview #nextProgress {
  scroll-margin-top: calc(var(--header-h) + 8px);
}

.editor-preview #importProgressSlot #nextProgress {
  padding: 4px 12px 8px;
  font-size: 13px;
}

.editor-preview #nextProgress progress {
  display: block;
  width: 100%;
  height: 9px;
  accent-color: var(--primary);
}

.editor-preview .next-results ul {
  max-height: 130px;
  margin: 6px 0;
  padding-left: 18px;
  overflow: auto;
  overflow-wrap: anywhere;
}

.editor-preview .next-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.editor-preview .next-results button,
.editor-preview .next-progress-heading button {
  padding: 4px 8px;
  font-size: 12px;
}

.editor-preview .hint-bubble {
  right: 12px;
  bottom: 12px;
  left: auto;
  max-width: min(320px, calc(100vw - 24px));
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  pointer-events: none;
}

.editor-preview #timestamp-tool [hidden],
.editor-preview #previewPip {
  display: none !important;
}

.editor-preview :is(summary, textarea):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

@media (min-width: 851px) {
  .editor-preview {
    --preview-download-height: clamp(140px, 18svh, 160px);
    height: 100%;
    overflow: hidden;
  }

  .editor-preview body {
    display: flex;
    flex-direction: column;
    height: 100svh;
    min-height: 0;
    overflow: hidden;
  }

  .editor-preview .preview-header {
    flex: none;
  }

  .editor-preview #main-content {
    flex: 1;
    min-height: 0;
    margin: 0;
  }

  .editor-preview .editor-title {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .editor-preview #timestamp-tool,
  .editor-preview .layout {
    height: 100%;
    min-height: 0;
  }

  .editor-preview .layout {
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
  }

  .editor-preview .preview-workspace {
    display: grid;
    grid-template-rows: minmax(0, 1fr);
  }

  .editor-preview .layout .preview-card {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) var(--preview-download-height);
    align-self: stretch;
    min-height: 0;
  }

  .editor-preview .preview-head {
    z-index: 5;
    flex-wrap: nowrap;
    min-width: 0;
    padding: 6px 8px;
  }

  .editor-preview .preview-switcher {
    flex: none;
    gap: 4px;
    margin-left: 0;
  }

  .editor-preview #photoMetadata {
    padding: 0;
  }

  .editor-preview #photoMetadata > summary {
    min-width: 0;
    padding: 0;
  }

  .editor-preview #photoMetadata > summary > span:last-of-type {
    flex: none;
    font-size: 11px;
  }

  .editor-preview #exifPanel {
    position: absolute;
    z-index: 10;
    top: calc(100% + 4px);
    right: 8px;
    width: min(520px, calc(100% - 16px));
    max-height: min(50svh, 420px);
    padding: 12px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 6px 20px #182c3d26;
  }

  .editor-preview .preview-notices {
    position: absolute;
    z-index: 3;
    top: 8px;
    left: 8px;
    width: calc(100% - 16px);
    pointer-events: none;
  }

  .editor-preview .preview-notices #nextProgress {
    pointer-events: auto;
  }

  .editor-preview .preview-card:not(.has-photos) .preview-canvas {
    height: 100%;
    min-height: 0;
    max-height: 100%;
  }

  .editor-preview .empty-photo {
    height: 100%;
    min-height: 0;
  }

  .editor-preview .settings-card {
    height: 100%;
    min-height: 0;
    align-self: stretch;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
  }

  .editor-preview .bottom-bar {
    display: grid;
    grid-template-rows: minmax(0, 1fr) 32px auto;
    align-content: stretch;
    height: var(--preview-download-height);
    min-height: 0;
    gap: 4px;
    margin: 0;
    padding: 6px 10px;
  }

  .editor-preview .download-photos {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 2px;
    min-width: 0;
    min-height: 0;
  }

  .editor-preview .download-empty {
    grid-row: 2;
    align-self: center;
    padding: 0;
  }

  .editor-preview .next-selection {
    gap: 2px 6px;
    padding: 0;
    border: 0;
  }

  .editor-preview .next-selection button,
  .editor-preview #photoFilter {
    min-height: 24px;
    padding: 2px 4px;
    font-size: 11px;
    line-height: 18px;
  }

  .editor-preview .next-selection > label,
  .editor-preview #selectionSummary {
    font-size: 11px;
    line-height: 18px;
  }

  .editor-preview .thumb-grid {
    grid-auto-columns: 136px;
    grid-template-rows: minmax(0, 1fr);
    min-height: 0;
    padding: 0;
    scrollbar-width: thin;
  }

  .editor-preview .next-thumb {
    align-self: center;
    padding: 2px;
  }

  .editor-preview .next-thumb > input {
    top: 4px;
    left: 4px;
    width: 14px;
    height: 14px;
  }

  .editor-preview .next-thumb > button {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    grid-template-rows: 14px 12px;
    gap: 0 5px;
    min-height: 0;
    text-align: left;
  }

  .editor-preview .next-thumb img {
    grid-row: 1 / -1;
    height: 26px;
  }

  .editor-preview .thumb-name {
    padding: 0;
    line-height: 14px;
  }

  .editor-preview .thumb-state {
    line-height: 12px;
  }

  .editor-preview .export-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 6px;
  }

  .editor-preview .export-row {
    min-width: 0;
  }

  .editor-preview .export-row button {
    min-height: 32px;
    padding: 3px 8px;
    font-size: 12px;
    line-height: 13px;
  }

  .editor-preview #exportQuality {
    max-width: 245px;
  }

  .editor-preview .next-results,
  .editor-preview .bottom-bar > #nextProgress {
    position: absolute;
    z-index: 20;
    right: 0;
    bottom: calc(100% + 8px);
    left: 0;
    max-height: min(40svh, 280px);
    margin: 0;
    padding: 10px 12px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 6px 20px #182c3d26;
  }
}

@media (min-width: 851px) and (max-width: 1200px) {
  .editor-preview {
    --preview-download-height: 160px;
  }

  .editor-preview .next-select-buttons {
    flex: 1 0 100%;
  }

  .editor-preview .next-selection button,
  .editor-preview #photoFilter {
    min-height: 22px;
    padding-block: 1px;
  }

  .editor-preview .export-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
  }

  .editor-preview .export-row button {
    padding-inline: 3px;
    font-size: 11px;
  }

  .editor-preview #exportQuality {
    width: 130px;
  }

  .editor-preview #exportQuality > label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
}

@media (max-width: 850px) {
  .editor-preview .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .editor-preview #photoMetadata {
    flex-basis: 100%;
  }
}

/* The host reserves 800px. Keep the four primary sections and download row
   inside that budget; retain native overflow as a safety for smaller screens
   and expanded advanced controls. Standalone editor spacing stays unchanged. */
@media (min-width: 851px) {
  .editor-preview .embedded-fit {
    --preview-download-height: 148px;
    height: 100%;
  }

  .editor-preview .embedded-fit #main-content {
    padding: 12px 16px;
  }

  .editor-preview .embedded-fit .inspector-group {
    padding: 8px 14px;
  }

  .editor-preview .embedded-fit .inspector-group h2 {
    margin-bottom: 6px;
  }

  .editor-preview .embedded-fit .inspector-disclosure > summary {
    min-height: 30px;
  }

  .editor-preview .embedded-fit #moreEditing {
    padding-block: 4px;
  }

  .editor-preview .embedded-fit .position-photo {
    max-width: 232px;
  }

  .editor-preview .embedded-fit .inspector-fields {
    gap: 6px;
  }

  .editor-preview .embedded-fit #restoreStampDate,
  .editor-preview .embedded-fit #changeStampDate {
    min-height: 30px;
  }

  .editor-preview .embedded-fit #stampDateFeedback {
    margin: 0;
    font-size: 12px;
  }

  .editor-preview .embedded-fit #stampStylePicker {
    position: relative;
  }

  .editor-preview .embedded-fit .style-options {
    position: absolute;
    z-index: 20;
    top: 100%;
    right: 0;
    left: 0;
    box-shadow: 0 6px 20px #182c3d26;
  }
}

@media (max-width: 480px) {
  .editor-preview .preview-header,
  .editor-preview .preview-header .top-actions {
    gap: 5px;
  }

  .editor-preview .preview-brand {
    font-size: 15px;
  }

  .editor-preview .preview-languages a {
    padding: 6px 5px;
    font-size: 11px;
  }

  .editor-preview .account-widget a[href*="/auth/login"] {
    display: inline-flex;
    padding: 5px 7px;
    font-size: 11px;
    white-space: nowrap;
  }

  .editor-preview .account-name {
    display: none;
  }

  .editor-preview #main-content {
    padding-top: 10px;
  }

  .editor-preview .preview-head {
    gap: 5px 7px;
    padding: 6px 8px;
  }

  .editor-preview .preview-switcher {
    gap: 4px;
  }

  .editor-preview .preview-switcher button {
    padding: 4px 6px;
    font-size: 11px;
  }

  .editor-preview .inspector-group {
    padding-inline: 12px;
  }

  .editor-preview .inspector-disclosure > summary,
  .editor-preview .next-check,
  .editor-preview .upload-card .upload-dropzone,
  .editor-preview .export-row button {
    min-height: 40px;
  }

  .editor-preview .export-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 1px;
  }

  .editor-preview .export-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .editor-preview .export-row button {
    padding: 4px;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .editor-preview * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
