/* Add Image Overlay — mobile editor (max-width 1199px). Desktop inline controller unchanged at 1200px+. */

@media (max-width: 1199px) {
  html body.flux-tool-image-tools main[data-tool="add-image-overlay"]:not(.generic-studio-page) .aio-settings-header,
  html body.flux-tool-image-tools main[data-tool="add-image-overlay"]:not(.generic-studio-page) .docstream-primary-options,
  html body.flux-tool-image-tools main[data-tool="add-image-overlay"]:not(.generic-studio-page) .docstream-utility-options,
  html body.flux-tool-image-tools main[data-tool="add-image-overlay"]:not(.generic-studio-page) .sticky-mobile-action,
  html body.flux-tool-image-tools main[data-tool="add-image-overlay"]:not(.generic-studio-page) #utilityOutput,
  html body.flux-tool-image-tools main[data-tool="add-image-overlay"]:not(.generic-studio-page) .upload-trust-text {
    display: none !important;
  }
}

@media (max-width: 1199px) {
  html body.flux-tool-image-tools main[data-tool="add-image-overlay"]:not(.generic-studio-page) .aio-settings-header,
  html body.flux-tool-image-tools main[data-tool="add-image-overlay"]:not(.generic-studio-page) .docstream-primary-options,
  html body.flux-tool-image-tools main[data-tool="add-image-overlay"]:not(.generic-studio-page) .docstream-utility-options,
  html body.flux-tool-image-tools main[data-tool="add-image-overlay"]:not(.generic-studio-page) .sticky-mobile-action,
  html body.flux-tool-image-tools main[data-tool="add-image-overlay"]:not(.generic-studio-page) #utilityOutput,
  html body.flux-tool-image-tools main[data-tool="add-image-overlay"]:not(.generic-studio-page) .upload-trust-text {
    display: none !important;
  }
}

@media (max-width: 1199px) {
  html body.add-image-overlay-mobile-editor-active.compress-100kb-ready {
    overflow: hidden !important;
    height: 100dvh !important;
  }

  html body.add-image-overlay-mobile-editor-active.compress-100kb-ready .site-header,
  html body.add-image-overlay-mobile-editor-active.compress-100kb-ready .site-footer,
  html body.add-image-overlay-mobile-editor-active.compress-100kb-ready main[data-tool="add-image-overlay"] > .breadcrumb,
  html body.add-image-overlay-mobile-editor-active.compress-100kb-ready main[data-tool="add-image-overlay"] > .tool-page-hero,
  html body.add-image-overlay-mobile-editor-active.compress-100kb-ready main[data-tool="add-image-overlay"] .tool-workspace-note,
  html body.add-image-overlay-mobile-editor-active.compress-100kb-ready main[data-tool="add-image-overlay"] .tool-content-stack,
  html body.add-image-overlay-mobile-editor-active.compress-100kb-ready main[data-tool="add-image-overlay"] .docstream-image-utility-form,
  html body.add-image-overlay-mobile-editor-active.compress-100kb-ready main[data-tool="add-image-overlay"] .sticky-mobile-action,
  html body.add-image-overlay-mobile-editor-active.compress-100kb-ready main[data-tool="add-image-overlay"] #utilityOutput,
  html body.add-image-overlay-mobile-editor-active.compress-100kb-ready main[data-tool="add-image-overlay"] .aio-editor-toolbar {
    display: none !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] {
    position: fixed !important;
    inset: 0 !important;
    z-index: 9999 !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    background: #e8eef7 !important;
    overflow: hidden !important;
    color: #172033 !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor.is-hidden {
    display: none !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-header {
    display: grid !important;
    grid-template-columns: 40px minmax(0, 1fr) auto !important;
    grid-template-areas: "back history actions" !important;
    align-items: center !important;
    flex: 0 0 50px !important;
    min-height: 50px !important;
    padding: 0 10px !important;
    background: #1976d2 !important;
    z-index: 30 !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-back {
    grid-area: back !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    border: 0 !important;
    border-radius: 10px !important;
    background: rgba(255, 255, 255, 0.14) !important;
    color: #fff !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-history {
    grid-area: history !important;
    display: inline-flex !important;
    justify-self: center !important;
    gap: 22px !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-history-btn {
    width: 32px !important;
    height: 32px !important;
    border: 0 !important;
    background: transparent !important;
    color: #fff !important;
    opacity: 1 !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-history-btn:disabled {
    opacity: 0.42 !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-header-actions {
    grid-area: actions !important;
    display: flex !important;
    justify-content: flex-end !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-header-download {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 34px !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: #fff !important;
    color: #1565c0 !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-header-download.is-disabled {
    opacity: 0.5 !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-status {
    flex: 0 0 auto !important;
    padding: 6px 12px !important;
    text-align: center !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #334155 !important;
    opacity: 1 !important;
    background: rgba(255, 255, 255, 0.72) !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-main {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 8px 10px !important;
    overflow: hidden !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-preview-host {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-preview-shell {
    width: 100% !important;
    max-width: calc(100vw - 24px) !important;
    margin: 0 auto !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-preview-frame {
    border-radius: 16px !important;
    overflow: hidden !important;
    background: #fff !important;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14) !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-preview-frame img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-height: min(58vh, 620px) !important;
    object-fit: contain !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-preview-pills {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    padding: 10px 12px !important;
    background: #fff !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-preview-pill {
    display: inline-flex !important;
    align-items: center !important;
    min-height: 28px !important;
    padding: 0 10px !important;
    border-radius: 999px !important;
    border: 1px solid #dbeafe !important;
    background: #f8fbff !important;
    color: #334155 !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    opacity: 1 !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-preview-pill.is-ready {
    color: #166534 !important;
    border-color: #86efac !important;
    background: #f0fdf4 !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-preview-pill.is-dirty {
    color: #9a3412 !important;
    border-color: #fdba74 !important;
    background: #fff7ed !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-empty-editor {
    width: calc(100vw - 24px) !important;
    margin: 0 auto !important;
    padding: 22px 18px !important;
    border-radius: 18px !important;
    background: #fff !important;
    box-shadow: 0 10px 28px rgba(37, 99, 235, 0.08) !important;
    text-align: center !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-empty-editor strong {
    display: block !important;
    margin-bottom: 8px !important;
    color: #172033 !important;
    font-size: 16px !important;
    font-weight: 800 !important;
    opacity: 1 !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-empty-editor span {
    display: block !important;
    color: #334155 !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    opacity: 1 !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-toolbar {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    flex: 0 0 64px !important;
    min-height: 64px !important;
    gap: 0 !important;
    padding: 4px 6px !important;
    background: #fff !important;
    border-top: 1px solid #dbeafe !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-toolbar button {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    min-height: 52px !important;
    border: 0 !important;
    border-radius: 12px !important;
    background: transparent !important;
    color: #334155 !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    opacity: 1 !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-toolbar button.is-active {
    background: #eff6ff !important;
    color: #2563eb !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-primary {
    flex: 0 0 auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: calc(100% - 20px) !important;
    min-height: 48px !important;
    margin: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    border: 0 !important;
    border-radius: 14px !important;
    background: linear-gradient(135deg, #0ea5e9, #2563eb 58%, #4f46e5) !important;
    color: #fff !important;
    font-size: 15px !important;
    font-weight: 800 !important;
    opacity: 1 !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-primary:disabled {
    opacity: 0.55 !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-backdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 40 !important;
    background: rgba(15, 23, 42, 0.42) !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-bottom-sheet {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 50 !important;
    max-height: min(72vh, 560px) !important;
    display: flex !important;
    flex-direction: column !important;
    border-radius: 18px 18px 0 0 !important;
    background: #fff !important;
    box-shadow: 0 -18px 42px rgba(15, 23, 42, 0.18) !important;
    transform: translateY(100%) !important;
    transition: transform 0.24s ease !important;
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"].aio-mobile-sheet-open .aio-mobile-bottom-sheet {
    transform: translateY(0) !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-sheet-head {
    display: grid !important;
    grid-template-columns: 44px 1fr 44px !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 10px 12px !important;
    border-bottom: 1px solid #e2e8f0 !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-sheet-title {
    display: block !important;
    text-align: center !important;
    color: #172033 !important;
    font-size: 15px !important;
    font-weight: 800 !important;
    opacity: 1 !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-sheet-close,
  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-sheet-apply {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 40px !important;
    height: 40px !important;
    border: 0 !important;
    border-radius: 12px !important;
    background: #f8fafc !important;
    color: #334155 !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-sheet-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: auto !important;
    padding: 14px 14px 18px !important;
    -webkit-overflow-scrolling: touch !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-panel-lead {
    margin: 0 0 12px !important;
    color: #334155 !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    opacity: 1 !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-file-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: 100% !important;
    min-height: 48px !important;
    border: 1px solid #bfdbfe !important;
    border-radius: 14px !important;
    background: #eff6ff !important;
    color: #1d4ed8 !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    opacity: 1 !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-file-card {
    margin-top: 12px !important;
    padding: 12px !important;
    border: 1px solid #dbeafe !important;
    border-radius: 14px !important;
    background: #f8fbff !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-file-top {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-file-meta strong {
    display: block !important;
    color: #172033 !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    opacity: 1 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-file-meta small {
    display: block !important;
    margin-top: 2px !important;
    color: #334155 !important;
    font-size: 12px !important;
    opacity: 1 !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-file-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    margin-top: 10px !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-mini-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    min-height: 44px !important;
    border: 1px solid #dbeafe !important;
    border-radius: 12px !important;
    background: #fff !important;
    color: #334155 !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    opacity: 1 !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-help {
    margin: 12px 0 0 !important;
    color: #334155 !important;
    font-size: 13px !important;
    line-height: 1.45 !important;
    opacity: 1 !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-help.is-error {
    color: #b91c1c !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-range-row {
    display: grid !important;
    gap: 10px !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-range-label {
    color: #172033 !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    opacity: 1 !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-range-badge {
    justify-self: end !important;
    min-height: 28px !important;
    padding: 0 10px !important;
    border-radius: 999px !important;
    background: #eff6ff !important;
    color: #2563eb !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    opacity: 1 !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-range-row input[type="range"] {
    width: 100% !important;
    min-height: 44px !important;
    accent-color: #2563eb !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-range-hint {
    display: flex !important;
    justify-content: space-between !important;
    gap: 8px !important;
    color: #334155 !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    opacity: 1 !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-position-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-position-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 48px !important;
    border: 1px solid #dbeafe !important;
    border-radius: 12px !important;
    background: #fff !important;
    color: #334155 !important;
    opacity: 1 !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-position-btn.is-active {
    border-color: #2563eb !important;
    background: #eff6ff !important;
    color: #2563eb !important;
  }

  html body.add-image-overlay-mobile-editor-active .aio-mobile-editor[data-aio-portaled="true"] .aio-mobile-position-btn:disabled {
    opacity: 0.45 !important;
  }
}

@media (max-width: 760px) {
  html body.flux-tool-image-tools main[data-tool="add-image-overlay"]:not(.generic-studio-page) .docstream-image-utility-form.has-uploaded-file,
  html body.flux-tool-image-tools main[data-tool="add-image-overlay"]:not(.generic-studio-page) .sticky-mobile-action,
  html body.flux-tool-image-tools main[data-tool="add-image-overlay"]:not(.generic-studio-page) #utilityOutput {
    display: none !important;
  }
}
