/* The upscale workflow uses its own output size. Keep the three trailing actions together. */
html body.workspace-readable.upscale-only #dashboardCreationPane #dashboardPromptSurface #imageResolutionSelector#imageResolutionSelector {
  display: none !important;
}
@media (min-width: 761px) {
  html body.workspace-readable.upscale-only #dashboardCreationPane #dashboardPromptSurface .dashboard-composer-toolbar > #generateBtn#generateBtn {
    margin-inline-start: 0 !important;
  }
}

/* Each in-flight card has one image stage above a stable, readable status row. */
html body.workspace-readable :is(#resultsView.result-gallery #resultGrid#resultGrid#resultGrid .result-pending-card:not(.result-pending-failed) .result-pending-artwork, #progressView .design-loader, :is(#designConcurrentTasks,#designConversationTurns) .design-conversation-progress:not(.is-failed)) {
  position: relative !important;
  isolation: isolate;
  overflow: hidden !important;
  box-sizing: border-box;
  min-height: 112px !important;
  background: #fff !important;
  border: 1px solid #dce1e8 !important;
  border-radius: 12px !important;
  box-shadow: none !important;
}
html body.workspace-readable :is(#resultsView.result-gallery #resultGrid#resultGrid#resultGrid .result-pending-card:not(.result-pending-failed) .result-pending-artwork, #progressView .design-loader, :is(#designConcurrentTasks,#designConversationTurns) .design-conversation-progress:not(.is-failed))::before,
html body.workspace-readable :is(#resultsView.result-gallery #resultGrid#resultGrid#resultGrid .result-pending-card:not(.result-pending-failed) .result-pending-artwork, #progressView .design-loader, :is(#designConcurrentTasks,#designConversationTurns) .design-conversation-progress:not(.is-failed))::after {
  content: none !important;
  animation: none !important;
}
/* Keep the generation stage white while the current animation loads. */
.cr-render-stage {
  position: relative !important;
  inset: auto !important;
  width: 100%;
  aspect-ratio: 1114 / 626;
  overflow: hidden;
  background: #fff !important;
}
.cr-render-stage img { display: none !important; }
.cr-render-stage::before,
.cr-render-stage::after,
.mobile-creator-progress:not(.error)::before,
.mobile-creator-progress:not(.error)::after {
  content: none !important;
  display: none !important;
  animation: none !important;
}
html body.workspace-readable :is(#resultsView.result-gallery #resultGrid#resultGrid#resultGrid .result-pending-card:not(.result-pending-failed) .result-pending-artwork, #progressView .design-loader, :is(#designConcurrentTasks,#designConversationTurns) .design-conversation-progress:not(.is-failed)) > :is(.result-generation-percent,.progress-meter-head,.conversation-generation-percent,.generation-loading-status) {
  position: absolute !important;
  z-index: 1 !important;
  display: block !important;
  inset: auto 10px 10px auto !important;
  width: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 18px !important;
  font-size: 13px !important;
  font-weight: 550 !important;
  color: #171b22 !important;
  -webkit-text-fill-color: currentColor !important;
  background: none !important;
  animation: none !important;
  transform: none !important;
}
html body.workspace-readable :is(#resultsView.result-gallery #resultGrid#resultGrid#resultGrid .result-pending-card:not(.result-pending-failed) .result-pending-artwork, #progressView .design-loader, :is(#designConcurrentTasks,#designConversationTurns) .design-conversation-progress:not(.is-failed)) > .generation-loading-status {
  inset: auto auto 10px 10px !important;
  font-weight: 400 !important;
}
html body.workspace-readable :is(#resultsView.result-gallery #resultGrid#resultGrid#resultGrid .result-pending-card:not(.result-pending-failed) .result-pending-artwork, #progressView .design-loader, :is(#designConcurrentTasks,#designConversationTurns) .design-conversation-progress:not(.is-failed)) > .generation-loading-status::after { content: none !important; }
html body.workspace-readable #progressView#progressView .progress-meter-head #progressPercent { font: inherit !important; }
/* The edit preview stays in the scrollable timeline after the current turn. */
html body.workspace-readable #outputPanel > #progressView#progressView:not(.hidden) {
  flex: 0 0 auto !important;
  overflow: visible !important;
}
html body.workspace-readable #outputPanel > #progressView#progressView .design-loader {
  flex: none !important;
  width: min(320px, 100%) !important;
  height: auto !important;
  aspect-ratio: 4 / 3;
  min-height: 150px !important;
}
html body.workspace-readable #outputPanel > #progressView[data-local-edit] { order: 3 !important; }

#toast.toast, #mobileToast.mobile-h5-toast {
  box-sizing: border-box;
  max-width: min(580px, calc(100vw - 32px));
  padding: 10px 16px;
  border: 1px solid #dce3ed !important;
  border-radius: 12px !important;
  background: #fff !important;
  color: #273344 !important;
  box-shadow: 0 3px 16px #20365214;
  line-height: 1.55;
}
#toast.toast.error { color: #9d3041 !important; border-color: #efcdd2 !important; }

/* Keep the reference frame's complete aspect ratio above the existing footer. */
html body.workspace-readable :is(#resultsView.result-gallery #resultGrid#resultGrid#resultGrid .result-pending-card:not(.result-pending-failed) .result-pending-artwork, #progressView .design-loader, :is(#designConcurrentTasks,#designConversationTurns) .design-conversation-progress:not(.is-failed)) {
  display: block !important;
  height: auto !important;
  min-height: 0 !important;
  aspect-ratio: auto !important;
  padding: 0 0 39px !important;
}
/* Preserve the card size and suppress legacy vector layers in cached shells. */
html body .cr-vector-scanning > :is(.cr-render-stage,.cr-vector-trace) {
  position: relative !important;
  aspect-ratio: 1114 / 626;
  height: auto !important;
  overflow: hidden;
  border-radius: 8px;
  background: #fff !important;
}
html body .cr-vector-scanning > .cr-vector-trace img { display: none !important; }
html body .cr-vector-scanning > .cr-vector-trace::before,
html body .cr-vector-scanning > .cr-vector-trace::after {
  content: none !important;
  display: none !important;
  animation: none !important;
}
html body.workspace-readable.home-layout-enabled #resultsView.result-gallery #resultGrid#resultGrid#resultGrid > .result-pending-card:not(.result-pending-failed) {
  width: min(336px, 100%) !important;
  min-width: 0 !important;
  max-width: 100% !important;
}
html body.workspace-readable #resultsView.result-gallery #resultGrid#resultGrid#resultGrid .result-pending-card:not(.result-pending-failed) .result-pending-indicator {
  display: none !important;
  animation: none !important;
}

/* The same artwork fits inline waits without adding a full-height card. */
html body #resultGrid .inline-breakdown-panel.working > .inline-breakdown-spinner,
.cr-chat-orbs-stage,
html body .psd-export-progress:not(.hidden,.completed,.failed) .psd-export-progress-track {
  position: relative;
  display: block;
  width: 42px !important;
  height: 42px !important;
  flex-shrink: 0;
  overflow: hidden;
  box-sizing: border-box;
  border: 0 !important;
  border-radius: 50%;
  background: #fff !important;
  animation: none !important;
}
html body .psd-export-progress:not(.hidden,.completed,.failed) .psd-export-progress-track {
  margin-inline: auto;
}
html body .psd-export-progress:not(.hidden,.completed,.failed) .psd-export-progress-track > i {
  display: none;
}
html body .crealink-chat-thinking-copy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  -webkit-text-fill-color: currentColor;
  background: none;
  animation: none !important;
}
html[data-preview-theme="dark"] body :is(
  .cr-vector-scanning, .result-image-handoff, .result-image-handoff-label
) {
  background: #30302f !important;
  border-color: #494948 !important;
  color: #ebebeb !important;
}
html[data-preview-theme="dark"] body :is(
  .cr-vector-trace, .inline-breakdown-panel.working > .inline-breakdown-spinner,
  .cr-chat-orbs-stage, .psd-export-progress:not(.hidden,.completed,.failed) .psd-export-progress-track
) {
  background: #000 !important;
}
@layer workspace-tone {
  html body.workspace-readable :is(#designRecordStrip,#taskCenterModal) .generation-placeholder-icon.is-active::before,
  html body.workspace-readable :is(#designRecordStrip,#taskCenterModal) .generation-placeholder-icon.is-active::after {
    content: none !important;
    display: none !important;
    animation: none !important;
  }
  html[data-preview-theme="dark"] body.workspace-readable :is(#designRecordStrip,#taskCenterModal) .generation-placeholder-icon.is-active {
    background: #000 !important;
  }
}

/* The iframe keeps the approved 376 px canvas intact while the card scales it. */
.cr-generation-orbs-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 376px;
  height: 376px;
  max-width: none;
  border: 0;
  transform: translate(-50%, -50%) scale(var(--cr-orb-scale, 0));
  pointer-events: none;
  visibility: hidden;
}
[data-generation-orbs-ready] > .cr-generation-orbs-frame { visibility: visible; }
.mobile-creator-progress > .cr-mobile-orbs-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.mobile-creator-progress:not(.error):has(> .cr-mobile-orbs-stage[data-generation-orbs-ready]) {
  gap: 0;
}
.mobile-creator-progress:not(.error) > .cr-mobile-orbs-stage[data-generation-orbs-ready] {
  position: relative;
  inset: auto;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
}

.cr-generation-orbs-document {
  margin: 0;
  min-width: 376px;
  min-height: 100svh;
  display: grid;
  place-items: center;
  background: #fff;
}
.cr-generation-orbs-document > canvas {
  display: block;
  width: 376px;
  height: 376px;
  color: #17140f;
}

/* The finished image replaces the text-only loading state as soon as it can paint. */
html body.workspace-readable #resultsView.batch-generating #resultGrid .result-card.progressive-new-result {
  animation: none !important;
}
