/* Route-scoped result sizing for virtual try-on. The upstream image owns its ratio. */
body[data-shopao-ai-operation="virtual_try_on"] .shopao-generation-card:not(.is-pending):not(.is-failed) {
  height: auto;
  min-height: 0;
  max-height: none;
  aspect-ratio: auto;
}

body[data-shopao-ai-operation="virtual_try_on"] .shopao-generation-card:not(.is-pending):not(.is-failed) img {
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
}

/* The native editor keeps a desktop width while restoring a mobile result.
   Both native and fixed footers must fit beside the native 160px sidebar. */
@media (max-width: 600px) {
  body[data-shopao-ai-operation="virtual_try_on"] .task-panel-footer:not(.shopao-screen-safe-footer) {
    max-width: max(0px, calc(100vw - 160px)) !important;
  }

  body[data-shopao-ai-operation="virtual_try_on"] .task-panel-footer.shopao-screen-safe-footer {
    max-width: calc(100vw - max(0px, var(--shopao-footer-left, 0px))) !important;
  }

  body[data-shopao-ai-operation="virtual_try_on"] .task-panel-footer .task-editor-panel-footer {
    display: flex;
    gap: 8px;
    padding: 12px 8px;
  }

  body[data-shopao-ai-operation="virtual_try_on"] .task-panel-footer .text-guide {
    flex: 1 1 0;
    min-width: 0;
    font-size: 11px;
    line-height: 16px;
    overflow-wrap: anywhere;
  }

  body[data-shopao-ai-operation="virtual_try_on"] .task-panel-footer .animation-container {
    flex: 1 1 0;
    min-width: 0;
  }

  body[data-shopao-ai-operation="virtual_try_on"] .task-panel-footer #create-new-task-btn {
    width: 100% !important;
    min-width: 0;
  }
}
