/* AvaClik Looks: mirror the native Body desktop panel + Effects mobile strip. */
#fotor-root .left-rail .rail-btn[data-section="ai-looks"] { order: 55 !important; }
#fotor-root .left-rail .rail-btn[data-section="ai-looks"] .rail-ico { display:grid;place-items:center; }
#fotor-root .left-rail .rail-btn[data-section="ai-looks"].active { border-color:rgba(234,151,192,.95)!important;background:rgba(87,39,76,.38)!important;color:#ffe2f0!important; }
body.sg-looks-active #fotor-root .left-rail .rail-btn[data-section="effects"].active:not([data-section="ai-looks"]) { box-shadow:none!important; border-color:transparent!important; background:transparent!important; }
body.sg-looks-active #fotor-root .left-panel { visibility:hidden!important;pointer-events:none!important; }
body.sg-looks-active #fotor-root .mtool-top-controls { visibility:hidden!important;pointer-events:none!important; }
body.sg-looks-active > .sg-mobile-preset-active-label { opacity:0!important;visibility:hidden!important; }
body.sg-looks-active > .ava-mobile-hold-preview:not(.sg-looks-hold-preview) { display:none!important; }

.sg-looks-desktop-pane { position:fixed!important;z-index:1800;display:flex;flex-direction:column;box-sizing:border-box;min-height:0;overflow:hidden;background:#141114;color:#eee;border:1px solid rgba(255,255,255,.07);border-radius:13px 13px 0 0;box-shadow:0 8px 32px rgba(0,0,0,.22); }
.sg-looks-desktop-pane .left-panel-header { flex:0 0 auto;display:flex;align-items:center;justify-content:space-between;min-height:62px;padding:9px 13px;border-bottom:1px solid rgba(255,255,255,.09); }
.sg-looks-desktop-pane .left-panel-title { flex:1;min-width:0; }
.sg-looks-desktop-pane .lp-title-row { display:flex;align-items:center;gap:9px; }
.sg-looks-desktop-pane .lp-back,.sg-looks-desktop-pane .lp-close { flex:0 0 auto;display:grid;place-items:center;cursor:pointer;width:31px;height:31px;border-radius:9px;border:1px solid rgba(255,255,255,.12);background:#221f26;color:#ddd;font-size:17px; }
.sg-looks-desktop-pane .lp-title { font-size:22px;font-weight:750;line-height:1.18;color:#f6f2f6; }
.sg-looks-desktop-pane .lp-subtitle { margin-top:3px;font-size:11px;color:#afa5b2; }
.sg-looks-desktop-pane .left-panel-body { flex:1;min-height:0;overflow:hidden;padding:0!important; }
.sg-looks-desktop-pane .ai-hair-page { display:flex;flex-direction:column;height:100%;min-height:0; }
.sg-looks-desktop-pane .ai-hair-scroll { flex:1;min-height:0;overflow:auto;padding:14px 12px 10px!important; }
.sg-looks-desktop-pane .sg-looks-desktop-grid { display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:9px!important; }
.sg-looks-desktop-pane .sg-looks-tile { min-width:0;padding:0!important;border:1px solid rgba(255,255,255,.12);border-radius:8px;overflow:hidden;display:flex;flex-direction:column;background:#19171d;color:#f8f4f7;text-align:center;cursor:pointer; }
.sg-looks-desktop-pane .sg-looks-tile.active { border-color:#df89b3!important;box-shadow:0 0 0 1px rgba(223,137,179,.25); }
.sg-looks-desktop-pane .sg-looks-tile .ai-hair-thumb { width:100%;aspect-ratio:3/4;border:0;border-radius:0;overflow:hidden;background:#111; }
.sg-looks-desktop-pane .sg-looks-tile .ai-hair-thumb img { display:block;width:100%;height:100%;object-fit:cover; }
.sg-looks-desktop-pane .sg-looks-tile .ai-hair-title { display:grid;place-items:center;min-height:27px;padding:5px 3px;font-size:10px;font-weight:750;line-height:1.15;text-align:center;overflow-wrap:anywhere; }
.sg-looks-desktop-pane .ai-hair-footer { flex:0 0 auto;display:flex;align-items:center;gap:8px;justify-content:space-between;padding:10px 12px;border-top:1px solid rgba(255,255,255,.1);background:#18121a; }
.sg-looks-desktop-pane .sg-looks-format { flex:0 0 80px;max-width:25%;height:36px;border:1px solid rgba(255,255,255,.16);border-radius:8px;background:#1b1820;color:#f6e9f0;font-size:12px; }
.sg-looks-desktop-pane .sg-looks-desktop-apply { flex:1;min-width:0;height:36px;padding:5px 12px;border:1px solid rgba(230,150,190,.3);border-radius:9px;background:linear-gradient(120deg,#a83f7c,#e28bb6);color:white;font-weight:750;font-size:12px;cursor:pointer; }
.sg-looks-desktop-pane .sg-looks-desktop-apply:disabled { opacity:.45;cursor:not-allowed;background:#6e4f60; }

.sg-looks-mobile-pane,.sg-looks-mobile-controls,.sg-looks-mobile-selection { display:none; }
@media (max-width:768px) {
  #fotor-root .editor-shell.is-mobile .left-rail .rail-list { display:grid!important;grid-template-columns:repeat(6,minmax(0,1fr))!important;gap:3px!important; }
  #fotor-root .editor-shell.is-mobile .left-rail .rail-btn { min-width:0!important; }
  #fotor-root .editor-shell.is-mobile .left-rail .rail-btn .rail-label { font-size:clamp(6.8px,2.12vw,8.5px)!important;white-space:nowrap; }
  #fotor-root .editor-shell.is-mobile .left-rail .rail-btn .rail-ico { font-size:clamp(12px,3.8vw,16px)!important; }
  #fotor-root .editor-shell.is-mobile .left-rail .rail-btn[data-section="agent"] { order:10!important; }
  #fotor-root .editor-shell.is-mobile .left-rail .rail-btn[data-section="popular"] { order:20!important; }
  #fotor-root .editor-shell.is-mobile .left-rail .rail-btn[data-section="effects"] { order:50!important; }
  #fotor-root .editor-shell.is-mobile .left-rail .rail-btn[data-section="ai-looks"] { order:55!important; }
  #fotor-root .editor-shell.is-mobile .left-rail .rail-btn[data-section="ai-text-image"] { order:60!important; }
  #fotor-root .editor-shell.is-mobile .left-rail .rail-btn[data-section="adult"] { order:80!important; }
  .sg-looks-desktop-pane { display:none!important; }
  body.sg-looks-active .sg-looks-mobile-pane { position:fixed!important;z-index:1810;display:block;overflow:hidden;box-sizing:border-box;border:1px solid rgba(236,156,194,.16);border-radius:12px;background:#170f18;color:#fff;box-shadow:0 8px 18px rgba(0,0,0,.44); }
  .sg-looks-mobile-pane .mobile-tool-page { display:flex;flex-direction:column;height:100%;min-height:0;padding:1px;overflow:hidden; }
  .sg-looks-mobile-pane .mobile-tool-content { display:flex;flex:1;min-height:0;overflow:hidden;padding:0; }
  .sg-looks-mobile-pane .mobile-preset-strip { display:flex;width:100%;height:100%;gap:5px;overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x mandatory;-webkit-overflow-scrolling:touch;padding:2px;box-sizing:border-box;scrollbar-width:none; }
  .sg-looks-mobile-pane .mobile-preset-strip::-webkit-scrollbar { display:none; }
  .sg-looks-mobile-pane .mobile-preset-card { position:relative;flex:0 0 78px;scroll-snap-align:start;height:100%;min-width:0;padding:1px;border:1px solid rgba(255,255,255,.16);border-radius:10px;background:#211821;overflow:hidden;cursor:pointer;color:#fff;touch-action:pan-x; }
  .sg-looks-mobile-pane .mobile-preset-card.active { border-color:#ed8ab8;box-shadow:0 0 0 1px #b55489; }
  .sg-looks-mobile-pane .mobile-preset-thumb { position:absolute;inset:1px;border-radius:8px;overflow:hidden; }
  .sg-looks-mobile-pane .mobile-preset-thumb img { display:block;width:100%;height:100%;object-fit:cover; }
  .sg-looks-mobile-pane .mobile-preset-name { position:absolute;z-index:2;inset:auto 2px 2px;display:block;border:1px solid rgba(255,255,255,.1);border-radius:4px;background:rgba(7,7,11,.8);color:#fff;padding:2px 1px;font-size:8px;font-weight:750;text-align:center;line-height:9px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden; }
  body.sg-looks-active .sg-looks-mobile-controls { position:fixed!important;z-index:1812;display:flex;align-items:center;justify-content:space-between;gap:4px;box-sizing:border-box;background:transparent;color:#fff;pointer-events:none; }
  .sg-looks-mobile-controls .mtool-top-group { display:flex;align-items:center;gap:4px;min-width:0;pointer-events:auto; }
  .sg-looks-mobile-controls .mtool-top-btn--back { display:grid;place-items:center;width:29px;height:29px;border-radius:9px;border:1px solid rgba(255,255,255,.25);background:#36203b;color:#f6c9e2;font-size:18px;cursor:pointer; }
  .sg-looks-mobile-controls .sg-looks-mobile-preview-action,
  .sg-looks-mobile-controls .sg-looks-mobile-format-action,
  .sg-looks-mobile-controls .sg-looks-mobile-collapse { display:grid;place-items:center;width:25px;height:29px;min-width:25px;padding:0;border:1px solid rgba(255,255,255,.22);border-radius:8px;background:#2c1e31;color:#f3e5ee;font-size:13px;font-weight:800;cursor:pointer; }
  .sg-looks-mobile-controls .sg-looks-mobile-format-action { width:34px;min-width:34px;font-size:8px; }
  body.sg-looks-active .sg-looks-mobile-pane.is-collapsed .mobile-preset-strip { display:none; }
  .sg-looks-mobile-controls .sg-looks-mobile-controls__title { flex:1;min-width:0;color:#d9d0d9;text-align:center;font-size:8px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
  .sg-looks-mobile-controls .mtool-top-btn--apply { display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;min-width:102px;max-width:45vw;height:30px;padding:0 7px;border:1px solid #ba77a0;border-radius:9px;color:#fff;background:linear-gradient(120deg,#943c78,#d36a9f);font-size:9px;font-weight:750;white-space:nowrap;cursor:pointer; }
  .sg-looks-mobile-controls .mtool-top-btn--apply:disabled { background:#60445a;opacity:.60;color:#d7c3d1;cursor:not-allowed; }
  body.sg-looks-active .sg-looks-mobile-selection:not([hidden]) { position:fixed!important;z-index:1813;display:flex;align-items:center;justify-content:center;max-width:54vw;min-width:92px;height:26px;padding:0 10px;border:1px solid rgba(229,147,189,.35);border-radius:999px;transform:translateX(-50%);background:rgba(18,11,20,.94);color:#fff;font-size:10px;font-weight:800;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;pointer-events:none;box-shadow:0 8px 20px rgba(0,0,0,.3); }
  .sg-looks-hold-preview { z-index:2147482000!important; }
}

@media (max-width:370px){.sg-looks-mobile-controls .sg-looks-mobile-controls__title{display:none}.sg-looks-mobile-controls .mtool-top-btn--apply{min-width:108px}}

/* v0.5.30: The footer belongs to the visible panel, not its scrolling gallery. */
@media (min-width: 769px) {
  .sg-looks-desktop-pane { max-height: calc(100dvh - 12px); }
  .sg-looks-desktop-pane > .left-panel-body { display:flex!important; flex:1 1 auto!important; min-height:0!important; overflow:hidden!important; }
  .sg-looks-desktop-pane .ai-hair-page { flex:1 1 auto!important; height:auto!important; min-height:0!important; overflow:hidden!important; }
  .sg-looks-desktop-pane .ai-hair-scroll { flex:1 1 auto!important; height:0!important; min-height:0!important; overflow-y:auto!important; overscroll-behavior:contain; }
  .sg-looks-desktop-pane .ai-hair-footer { position:relative!important; flex:0 0 auto!important; min-height:58px!important; padding:10px 12px!important; z-index:1; }
}

/* v0.5.30: Exactly six original mobile tools, including Create.  The native
   theme's :has(.avaclik-tryon-rail) five-column rule must not win specificity. */
@media (max-width: 768px) {
  #fotor-root .editor-shell.is-mobile .left-rail .rail-list:has(> [data-section="ai-looks"]),
  #fotor-root .editor-shell.is-mobile .left-rail .rail-list:has(> .avaclik-tryon-rail):has(> [data-section="ai-looks"]),
  html[data-ava-editor-theme] #fotor-root .editor-shell.is-mobile .left-rail .rail-list:has(> [data-section="ai-looks"]) {
    display:grid!important;
    grid-template-columns:repeat(6,minmax(0,1fr))!important;
    column-gap:2px!important;
    width:100%!important;
    padding-right:2px!important;
    padding-left:2px!important;
    box-sizing:border-box!important;
    overflow:visible!important;
  }
  #fotor-root .editor-shell.is-mobile .left-rail .rail-list:has(> [data-section="ai-looks"]) > .rail-btn {
    box-sizing:border-box!important;
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
    margin:0!important;
    padding:4px 1px!important;
    gap:1px!important;
    overflow:hidden!important;
  }
  #fotor-root .editor-shell.is-mobile .left-rail .rail-list:has(> [data-section="ai-looks"]) > .rail-btn .rail-ico { 
    display:grid!important;
    place-items:center!important;
    width:100%!important;
    height:20px!important;
    min-height:0!important;
  }
  #fotor-root .editor-shell.is-mobile .left-rail .rail-list:has(> [data-section="ai-looks"]) > .rail-btn .rail-ico svg {
    display:block!important;
    width:17px!important;
    height:17px!important;
    max-width:100%!important;
  }
  #fotor-root .editor-shell.is-mobile .left-rail .rail-list:has(> [data-section="ai-looks"]) > .rail-btn .rail-label {
    display:block!important;
    max-width:100%!important;
    width:100%!important;
    min-width:0!important;
    padding:0!important;
    font-size:clamp(6.7px,1.85vw,8px)!important;
    line-height:1.13!important;
    font-weight:650!important;
    letter-spacing:-.14px!important;
    text-align:center!important;
    white-space:normal!important;
    overflow-wrap:anywhere!important;
  }
  /* Keep the native floating history and fit controls available while Looks is open. */
}

/* v0.5.31: isolate Looks. Native Effects (and whatever tool the React bundle
   previously had selected) remains in memory but must not look selected while
   the independent Looks view is open. No synthetic Effects clicks. */
html body.sg-looks-active #fotor-root .editor-shell.is-mobile .left-rail .rail-btn.active:not([data-section="ai-looks"]),
html body.sg-looks-active #fotor-root .editor-shell.is-mobile .left-rail .rail-btn.sg299-tools-active:not([data-section="ai-looks"]),
html body.sg-looks-active #fotor-root .editor-shell.is-mobile .left-rail .rail-btn[aria-current="page"]:not([data-section="ai-looks"]) {
  background:#2a1828!important;
  border-color:#673a56!important;
  box-shadow:none!important;
  outline:none!important;
  color:#dfb9d0!important;
}
html body.sg-looks-active #fotor-root .editor-shell.is-mobile .left-rail .rail-btn.active:not([data-section="ai-looks"]) :is(.rail-label,.rail-ico),
html body.sg-looks-active #fotor-root .editor-shell.is-mobile .left-rail .rail-btn.sg299-tools-active:not([data-section="ai-looks"]) :is(.rail-label,.rail-ico) {
  color:#dfb9d0!important;
}
html body.sg-looks-active #fotor-root .editor-shell.is-mobile .left-rail .rail-btn[data-section="ai-looks"].active {
  background:#3b1c33!important;
  border-color:#db70ac!important;
  box-shadow:inset 2px 0 0 #e779b1!important;
  color:#f9c1e0!important;
}
html body.sg-looks-active #fotor-root .editor-shell:not(.is-mobile) .left-rail .rail-btn.active:not([data-section="ai-looks"]),
html body.sg-looks-active #fotor-root .editor-shell:not(.is-mobile) .left-rail .rail-btn.sg299-tools-active:not([data-section="ai-looks"]) {
  background:transparent!important;
  border-color:transparent!important;
  box-shadow:none!important;
}
/* Stock desktop rail CSS hides native label text (font-size:0) and supplies
   only known tools through ::after. Our own label needs the same treatment. */
@media (min-width:769px) {
  #fotor-root .editor-shell:not(.is-mobile) .left-rail .rail-btn[data-section="ai-looks"] .rail-label::after {
    content:attr(data-looks-label)!important;
    display:block!important;
    font-size:8.5px!important;
    line-height:1.1!important;
    font-weight:650!important;
    white-space:nowrap!important;
  }
}
html body.sg-looks-active #fotor-root .editor-shell:not(.is-mobile) .left-rail .rail-btn.active:not([data-section="ai-looks"]) :is(.rail-ico,.rail-label),
html body.sg-looks-active #fotor-root .editor-shell:not(.is-mobile) .left-rail .rail-btn.sg299-tools-active:not([data-section="ai-looks"]) :is(.rail-ico,.rail-label) {
  color:var(--ava-muted,#aaa2a4)!important;
}


/* v0.5.32: the upstream safe-restoration layer mounts a second collapsible
   toolbar button directly under <body>. It remains visible because it is
   outside #fotor-root, even when the native editor toolbar is suppressed.
   Looks supplies its own Back + Collapse controls, so keep exactly those.
   Scope strictly to the Looks tab and restore native controls immediately
   after leaving it.  Override editor-mobile-panel-toggle-fix-322.css !important. */
@media (max-width: 768px) {
  html body.sg-looks-active > button.sg316-mobile-panel-toggle,
  html body.sg-looks-active > button.sg316-mobile-panel-toggle:not([hidden]),
  html body.sg-looks-active > button.sg-mobile-panel-toggle {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
  /* The original panel's Back/Collapse buttons must not overlap the
     Looks toolbar even when re-rendered by React. */
  html body.sg-looks-active #fotor-root .editor-shell.is-mobile .mtool-top-controls .mtool-top-btn--back,
  html body.sg-looks-active #fotor-root .editor-shell.is-mobile .sg-mobile-panel-toggle {
    display: none !important;
    pointer-events: none !important;
  }
}


/* v0.5.33: Preview opened via the toolbar must dismiss on tapping the
   dimmed region; the shared mobile hold-preview sheet sets pointer-events:none. */
.sg-looks-hold-preview.ava-mobile-hold-preview {
  pointer-events: auto !important;
}
.sg-looks-hold-preview > .ava-mobile-hold-preview__box {
  pointer-events: auto;
}

/* v0.5.33: Desktop Looks titles are always up to two readable lines, centered
   within the card. Keep this scoped to Looks rather than native hair/body. */
@media (min-width: 769px) {
  .sg-looks-desktop-pane .sg-looks-desktop-grid > .sg-looks-tile > .ai-hair-title {
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-height: 36px !important;
    padding: 4px 5px !important;
    white-space: normal !important;
    overflow: hidden !important;
    line-height: 1.2 !important;
    text-align: center !important;
  }
  .sg-looks-desktop-pane .sg-looks-desktop-grid > .sg-looks-tile .sg-looks-title-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    max-width: 100%;
    overflow: hidden;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: normal;
    text-overflow: ellipsis;
    font: inherit;
    line-height: 1.25;
    text-align: center;
  }
}

/* v0.5.48 — shared tabbed Looks modes; presets retain their original layout. */
.sg-looks-mode-tabs { display:grid;grid-template-columns:1fr 1fr;gap:5px;padding:8px 10px;background:#171119;border-bottom:1px solid rgba(255,255,255,.08); }
.sg-looks-mode-tab { min-height:34px;min-width:0;padding:5px 8px;border:1px solid rgba(255,255,255,.13);border-radius:9px;background:#261b29;color:#d0bbca;font-size:12px;font-weight:750;cursor:pointer; }
.sg-looks-mode-tab.active { background:linear-gradient(120deg,#703158,#a74b82);border-color:#dc91b4;color:#fff; }
.sg-looks-custom-view { display:none;box-sizing:border-box;min-width:0;padding:14px 13px;color:#f4edf3; }
.sg-looks-desktop-pane.is-custom .sg-looks-desktop-grid { display:none!important; }
.sg-looks-desktop-pane.is-custom .sg-looks-custom-view { display:flex;flex-direction:column;gap:12px; }
.sg-looks-custom-hint { font-size:12px;line-height:1.5;opacity:.75; }
.sg-looks-custom-upload { display:flex;align-items:center;justify-content:center;gap:12px;min-height:114px;padding:13px;border:1px dashed rgba(236,145,184,.6);border-radius:15px;background:linear-gradient(125deg,rgba(116,42,85,.22),rgba(255,255,255,.025));color:#fff;cursor:pointer;text-align:center; }
.sg-looks-custom-file { position:absolute;width:1px;height:1px;opacity:0;pointer-events:none; }
.sg-looks-custom-preview { width:68px;height:89px;flex:0 0 auto;object-fit:cover;border:1px solid rgba(255,255,255,.17);border-radius:10px;background:rgba(255,255,255,.07); }
.sg-looks-custom-preview:not([src]) { display:none; }
.sg-looks-custom-upload-caption { font-size:13px;line-height:1.35;font-weight:750; }
.sg-looks-custom-clear { align-self:flex-start;border:0;background:none;color:#edabd0;text-decoration:underline;font-size:11px;cursor:pointer; }
.sg-looks-custom-notes-label { display:flex;flex-direction:column;gap:8px;font-size:12px;font-weight:700; }
.sg-looks-custom-notes { box-sizing:border-box;width:100%;min-height:72px;max-height:150px;padding:10px;border:1px solid rgba(255,255,255,.16);border-radius:11px;background:#231b25;color:#fff;font:inherit;font-size:12px;resize:vertical;outline:none; }
.sg-looks-custom-notes:focus { border-color:#dc8db9; }
.sg-looks-desktop-pane.is-custom .sg-looks-custom-view { max-width:100%; }
@media (max-width:768px) {
  .sg-looks-mobile-pane .sg-looks-mode-tabs { gap:6px;padding:4px 5px;border-radius:10px 10px 0 0; }
  .sg-looks-mobile-pane .sg-looks-mode-tab { min-height:26px;padding:3px;font-size:10px; }
  body.sg-looks-active .sg-looks-mobile-pane.is-custom .mobile-preset-strip { display:none!important; }
  .sg-looks-mobile-pane.is-custom .sg-looks-custom-view { display:flex;flex-direction:column;gap:5px;width:100%;overflow-y:auto;min-height:0;padding:5px 9px; }
  .sg-looks-mobile-pane.is-custom .sg-looks-custom-hint { font-size:10px;line-height:1.25; }
  .sg-looks-mobile-pane.is-custom .sg-looks-custom-upload { min-height:57px;padding:5px;gap:9px;border-radius:10px; }
  .sg-looks-mobile-pane.is-custom .sg-looks-custom-preview { width:39px;height:49px;border-radius:6px; }
  .sg-looks-mobile-pane.is-custom .sg-looks-custom-upload-caption { font-size:10px; }
  .sg-looks-mobile-pane.is-custom .sg-looks-custom-clear { font-size:9px; }
  .sg-looks-mobile-pane.is-custom .sg-looks-custom-notes-label { gap:3px;font-size:10px; }
  .sg-looks-mobile-pane.is-custom .sg-looks-custom-notes { min-height:40px;max-height:58px;padding:5px 7px;font-size:11px;resize:none; }
  .sg-looks-mobile-pane.is-custom .mobile-tool-page { height:calc(100% - 35px); }
  .sg-looks-mobile-pane.is-custom .mobile-tool-content { display:block;overflow-y:auto; }
  .sg-looks-mobile-controls.is-custom .sg-looks-mobile-preview-action,
  .sg-looks-mobile-controls.is-custom .sg-looks-mobile-collapse { display:none; }
}

/* v0.5.49: Looks is a standalone panel, not a second layer of native Tools.
   The React-safe search (312) is portaled under <body> with a higher z-index
   than Looks, so hiding the React panel alone never hid its search input. */
body.sg-looks-active > .sg312-tool-search-portal,
body.sg-looks-active > .sg312-tool-search-portal.is-visible {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
/* For installations where the old inline search (296) is still enqueued. */
body.sg-looks-active #fotor-root .sg296-tool-search {
  display: none !important;
}
/* No ghost catalog behind the custom reference editor. Keep the native panel
   mounted so React state, tool switching, and geometry remain unchanged. */
body.sg-looks-active #fotor-root .editor-shell .left-panel {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
body.sg-looks-active > .sg-looks-desktop-pane {
  background: #141114 !important;
  isolation: isolate;
}
body.sg-looks-active > .sg-looks-desktop-pane :is(.left-panel-body, .ai-hair-page, .ai-hair-scroll, .sg-looks-custom-view) {
  background: #141114 !important;
}
body.sg-looks-active > .sg-looks-desktop-pane.is-custom .sg-looks-desktop-grid {
  display: none !important;
}

/* v0.5.70: Full-height mobile Looks previews.
   The mode tabs are a sibling of .mobile-tool-page, so the old 100%-height
   page overflowed below the pane and clipped the bottom of each preset tile.
   Reserve one row for tabs and let the picture strip take the remaining area.
   Scope to ready-made presets: the custom-reference form keeps its own layout. */
@media (max-width: 768px) {
  body.sg-looks-active .sg-looks-mobile-pane:not(.is-custom) {
    display: flex !important;
    flex-direction: column !important;
  }
  .sg-looks-mobile-pane:not(.is-custom) > .sg-looks-mode-tabs {
    flex: 0 0 auto !important;
  }
  .sg-looks-mobile-pane:not(.is-custom) > .mobile-tool-page {
    flex: 1 1 0 !important;
    height: auto !important;
    min-height: 0 !important;
  }
  .sg-looks-mobile-pane:not(.is-custom) .mobile-tool-content {
    min-height: 0 !important;
  }
}

/* v0.5.98: only the mobile helper opened by Looks, never the native
   Agent when selected directly, Create, authentication or payment dialogs. */
body.sg-looks-agent-bridge #fotor-root .agent-popup-overlay:not(.text-image-popup-overlay),
body.sg-looks-active #fotor-root .editor-shell.is-mobile .agent-popup-overlay:not(.text-image-popup-overlay) {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}


/* v0.5.100: isolate visible UI from the native panel's transient layout.
   Native controls remain in React; only intermediate catalog painting is suppressed. */
html body.sg-looks-active #fotor-root .editor-shell > .left-panel,
html body.sg-looks-active #fotor-root .editor-shell > .mtool-top-controls {
  transition: none !important;
  animation: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
html body.sg-looks-active #fotor-root .editor-shell > .left-panel :is(.lp-catalog, .lp-catalog-grid, .mobile-catalog-strip) {
  display: none !important;
  animation: none !important;
  transition: none !important;
}
@media (max-width: 768px) {
  /* The original mobile panel is fixed-position. It must not paint behind the
     independent Looks view; the workspace/history and actual dialogs stay visible. */
  html body.sg-looks-active #fotor-root .editor-shell.is-mobile > .left-panel {
    display: none !important;
  }
  html body.sg-looks-active #fotor-root .editor-shell.is-mobile {
    --m-panel-h: 78px !important;
  }
}
@media (min-width: 769px) {
  /* Match native panel-system widths when React has temporarily removed its panel. */
  html body.sg-looks-active #fotor-root .editor-shell:not(.is-mobile) {
    --ava-looks-slot-width: clamp(360px, 21vw, 380px);
  }
  html[data-ava-editor-theme] body.sg-looks-active #fotor-root .editor-shell:not(.is-mobile) {
    --ava-looks-slot-width: clamp(370px, 38vw, 440px);
  }
  html body.sg-looks-active #fotor-root .editor-shell:not(.is-mobile):not(:has(> .left-panel)) > .workspace {
    margin-left: calc(var(--ava-looks-slot-width) + 10px) !important;
  }
}
@media (min-width: 769px) and (max-width: 1100px) {
  html:not([data-ava-editor-theme]) body.sg-looks-active #fotor-root .editor-shell:not(.is-mobile) {
    --ava-looks-slot-width: 350px;
  }
}

/* v0.5.104: prevent native mobile image callouts in the preset gallery.
   Keep pan-x on the existing card and its scroll strip. */
@media (max-width:768px) {
  .sg-looks-mobile-pane .sg-looks-mobile-preset,
  .sg-looks-mobile-pane .sg-looks-mobile-preset *,
  .sg-looks-hold-preview,
  .sg-looks-hold-preview * {
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
  }
  .sg-looks-mobile-pane .sg-looks-mobile-preset .mobile-preset-thumb,
  .sg-looks-mobile-pane .sg-looks-mobile-preset .mobile-preset-thumb img,
  .sg-looks-mobile-pane .sg-looks-mobile-preset .mobile-preset-name,
  .sg-looks-hold-preview .ava-mobile-hold-preview__box img {
    pointer-events: none !important;
    -webkit-user-drag: none;
  }
  /* Hold preview should not intercept the finger's release; the explicit
     preview button still opens the existing tap-to-dismiss modal. */
  .sg-looks-hold-preview.sg-looks-gesture-preview,
  .sg-looks-hold-preview.sg-looks-gesture-preview * {
    pointer-events: none !important;
  }
}
