/* 1.0.335 — sequential mobile AI-by-prompt form without DOM mutation. */
@media (max-width: 768px) {
  #fotor-root .agent-popup:not(.text-image-popup) > .ai-agent {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
  }

  /* Keep the mobile title, while exposing the native action to flex ordering. */
  #fotor-root .agent-popup:not(.text-image-popup) .ai-agent__header {
    display: contents !important;
  }

  #fotor-root .agent-popup:not(.text-image-popup) .ai-agent__title {
    order: -30 !important;
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 0 12px !important;
    padding: 2px 42px 0 0 !important;
    box-sizing: border-box !important;
  }

  #fotor-root .agent-popup:not(.text-image-popup) .ai-agent__help {
    position: absolute !important;
    top: 14px !important;
    right: 14px !important;
    z-index: 4 !important;
    width: 32px !important;
    height: 32px !important;
    margin: 0 !important;
  }

  #fotor-root .agent-popup:not(.text-image-popup) .sg-agent-mode-tabs {
    order: -20 !important;
    position: static !important;
    z-index: auto !important;
    width: 100% !important;
    margin: 0 0 10px !important;
  }

  #fotor-root .agent-popup:not(.text-image-popup) .sg-agent-adult-consent {
    order: -19 !important;
    width: 100% !important;
    margin: 0 0 10px !important;
    box-sizing: border-box !important;
  }

  #fotor-root .agent-popup:not(.text-image-popup) .ai-agent__demo-note {
    order: -10 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 0 11px !important;
    box-sizing: border-box !important;
    color: rgba(160,173,190,.76) !important;
    font-size: 10.5px !important;
    line-height: 1.35 !important;
  }

  #fotor-root .agent-popup:not(.text-image-popup) .ai-agent__block {
    order: 0 !important;
    flex: 0 0 auto !important;
  }

  #fotor-root .agent-popup:not(.text-image-popup) .ai-agent__modes {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 7px !important;
  }

  /* 316 stores the disabled reason on the native header. Show it immediately
     before the real React action after display:contents exposes both items. */
  #fotor-root .agent-popup:not(.text-image-popup)
  .ai-agent__header.sg-action-has-reason::before {
    order: 98 !important;
    position: static !important;
    inset: auto !important;
    display: block !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 10px 0 -5px !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: rgba(189,201,216,.82) !important;
    box-shadow: none !important;
    font-size: 10.5px !important;
    font-weight: 650 !important;
    line-height: 1.3 !important;
    text-align: left !important;
    white-space: normal !important;
    pointer-events: none !important;
  }

  #fotor-root .agent-popup:not(.text-image-popup) .ai-agent__run {
    order: 99 !important;
    position: sticky !important;
    bottom: 0 !important;
    z-index: 10 !important;
    flex: 0 0 46px !important;
    width: 100% !important;
    min-height: 46px !important;
    margin: 12px 0 0 !important;
    border-radius: 12px !important;
    box-shadow: 0 -10px 22px rgba(11,15,20,.78) !important;
  }
}

@media (max-width: 370px) {
  #fotor-root .agent-popup:not(.text-image-popup) .ai-agent__help {
    right: 12px !important;
  }
}
