/* [2026-03-28] 目的：滿版設計工作台 shell（抽屜、AI 區、RWD）；編輯畫布基底樣式由 cDLoading 補載之 ContentStyle1／SimpleEditor1 與列表一致，勿在此複製 .guide／.design 全套 */
/* [2026-03-23] 目的：將 productlist.txt 內嵌樣式搬至外部 CSS，避免模板夾帶 style */
/* 滿版視窗：固定一屏，不讓整頁上下滑動 */
.design-overlay { position: fixed; inset: 0; z-index: 9999; background: #fff; display: none; flex-direction: column; overflow: hidden; height: 100vh; max-height: 100vh; }
.design-overlay.is-open { display: flex; }
.design-overlay__bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid #e5e7eb; flex-shrink: 0; }
.design-overlay__title { font-weight: 600; font-size: 1.125rem; }
.design-overlay__close { cursor: pointer; padding: 8px 16px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; }
.design-overlay__close:hover { background: #f3f4f6; }
.design-overlay__body { flex: 1; min-height: 0; overflow: hidden; padding: 12px 16px; display: flex; flex-direction: column; }
body.overlay-open { overflow: hidden; }

/* [2026-03-26] 目的：畫布工具列僅手機版顯示（桌機維持原本右欄縮放/清除） */
.design-canvas-toolbar { display: none; }

/* [2026-03-26] 目的：手機抽屜 tab 僅手機顯示，避免桌機右下角多出四顆按鈕 */
.design-drawer__tabs { display: none; }

/* [2026-04-04] 目的：桌機右欄 .meta 已顯示目前商品；抽屜頂「目前選擇」列僅手機用，預設隱藏避免與 .function-panel__col--cta 重複 */
.design-drawer__status { display: none; }

/* 新排版：左＝僅編輯畫布（衣服完整呈現），右＝功能區＋AI 生成區（右欄放大） */
.design-overlay .editor-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(280px, 42%) minmax(360px, 58%); gap: 0; overflow: hidden; }
.design-overlay .editor-canvas { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #f0f2f5; }
.design-overlay .stage--full { flex: 1; min-height: 0; display: flex; padding: 16px; align-items: center; justify-content: center; }
.design-overlay .stage--full .stage__canvas { width: 100%; max-width: 100%; height: 100%; min-height: 200px; max-height: 85vh; position: relative; background: #fff; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,.08); overflow: hidden; aspect-ratio: auto; }
/* [2026-03-23] 目的：編輯區底圖固定以 cover 呈現，與印刷範圍座標換算一致 */
/* [2026-03-28] 目的：底圖填滿 stage__canvas 並置下層；#guide 疊於 tee 上（tee 之 filter 會建立 stacking context，需明示 z-index 避免印刷區被畫在底圖「底下」） */
.design-overlay .stage--full .stage__canvas #teeImg {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    position: absolute !important;
    inset: 0 !important;
    z-index: 0;
}
/* [2026-03-28] 目的：ContentStyle1 已有 .guide 邊框與定位；此處僅保險 position＋疊在 tee 上，避免 left/top 被當 static */
.design-overlay .stage--full .stage__canvas #guide {
    position: absolute !important;
    z-index: 1;
}

/* [2026-03-28] 目的：在 .guide 內讓設計圖疊在 BGCanvas 之上（SimpleEditor1 的 .BGCanvas 僅部分定位） */
.design-overlay .stage--full .stage__canvas #designImg.design,
.design-overlay .stage--full .stage__canvas img.design {
    z-index: 2;
}

.design-overlay .stage--full .stage__canvas .guide .BGCanvas {
    z-index: 0;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    box-sizing: border-box;
}
.design-overlay .editor-right { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 0 16px 16px; overflow: auto; border-left: 1px solid #e5e7eb; background: #fff; }
.design-overlay .function-panel { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(0, 1fr); gap: 12px; align-items: stretch; background: #f8f9fa; border-radius: 12px; flex-shrink: 0; }
.design-overlay .function-panel__col { min-width: 0; background: #ffffff; border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,.03); padding: 8px 10px; display: flex; flex-direction: column; justify-content: center; }
.design-overlay .function-panel__col--main { justify-content: flex-start; padding: 8px 12px 10px; }
.design-overlay .function-panel__main-grid { display: flex; flex-direction: column; gap: 6px; padding-top: 0; }
.design-overlay .function-panel__row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.design-overlay .function-panel__label { font-size: 14px; color: #6b7280; min-width: 4.5em; }
.design-overlay .seg.seg--frontback { display: flex; gap: 6px; }
.design-overlay .seg__btn { padding: 6px 12px; border-radius: 8px; border: 1px solid #d1d5db; background: #fff; cursor: pointer; font-size: 14px; }
.design-overlay .seg__btn.is-active { background: #1f6feb; color: #fff; border-color: #1f6feb; }
.design-overlay .workbench__color-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.design-overlay .workbench__color-row .sw { box-sizing: border-box; width: 28px; height: 28px; border-radius: 6px; border: 2px solid #d1d5db; cursor: pointer; flex-shrink: 0; background: var(--c, #fff); overflow: hidden; padding: 0; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; }
/* [2026-03-28] 目的：工作台色票改為圓點（與列表 DispalyMode 5 一致），勿呈現方塊小衣服圖 */
.design-overlay .workbench__color-row .sw.sw--workbench-dot { border-radius: 50%; background-color: var(--c, #e5e7eb); background-size: cover; background-position: center; background-repeat: no-repeat; }
.design-overlay .workbench__color-row .sw.sw--workbench-dot-text { font-size: 11px; font-weight: 600; color: #374151; background: #f3f4f6; }
.design-overlay .workbench__color-row .sw.sw--workbench-dot-empty { background: #e5e7eb; background-image: none !important; }
.design-overlay .workbench__color-row .sw img { width: 100%; height: 100%; object-fit: cover; display: block; }
.design-overlay .workbench__color-row .sw:hover { border-color: #1f6feb; }
.design-overlay .workbench__color-row .sw.is-active { border-color: #1f6feb; box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1f6feb; }
/* [2026-03-28] 目的：一頁式商品照模式依 data-spec-detail-id 隱藏非當前細項之色票 */
.design-overlay #workbenchColorRow .sw.workbench-sw--filtered-out { display: none !important; }
/* [2026-03-28] 目的：多色時預設只顯示目前選中色票；點目前色票展開（見 4.js capture） */
.design-overlay #workbenchColorRow.workbench--color-collapse:not(.is-expanded) .sw:not(.is-active) { display: none !important; }
.design-overlay .function-panel__inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.design-overlay .function-panel .btn { padding: 6px 12px; font-size: 14px; }
.design-overlay .function-panel__row--ai { align-items: flex-start; transition: opacity .15s ease; }
.design-overlay .function-panel__row--ai.is-collapsed { opacity: 0; pointer-events: none; }
.design-overlay .function-panel__ai { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.design-overlay .zoom-inline { margin-left: 32px; }
/* [2026-04-02] 目的：置中鈕在縮放右側；無「2.視角」列或手機「設計圖」分頁（縮放列隱藏）時改顯示列 3 備用鈕 */
#design-overlay #btnCenterDesignHFallback { display: none !important; }
@media (min-width: 960px) {
    #design-overlay #moduleRowView.is-hidden ~ #rowDesignInput #btnCenterDesignHFallback { display: inline-flex !important; align-items: center; }
}
@media (max-width: 959px) {
    #design-overlay .design-drawer.is-expanded[data-active-tab="design"] #rowDesignInput #btnCenterDesignHFallback {
        display: inline-flex !important;
        align-items: center;
    }
}
.design-overlay .zoom-label { font-size: 12px; color: #6b7280; }
.design-overlay .design-mode-btn.is-active { background: #1f6feb; color: #fff; border-color: #1f6feb; }
.design-overlay .function-panel__ai-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.design-overlay .function-panel__ai .ai-prompt { width: 100%; min-height: 52px; resize: vertical; font-size: 13px; padding: 6px 8px; border-radius: 6px; border: 1px solid #d1d5db; box-sizing: border-box; }
.design-overlay .ai-ref-row { display: flex; gap: 8px; align-items: flex-start; }
.design-overlay .ai-ref-thumb { width: 64px; height: 64px; border-radius: 8px; border: 1px dashed #d1d5db; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #f9fafb; flex-shrink: 0; }
.design-overlay .ai-ref-thumb__placeholder { font-size: 10px; color: #9ca3af; text-align: center; line-height: 1.4; }
.design-overlay .ai-ref-thumb__img { max-width: 100%; max-height: 100%; object-fit: cover; }
.design-overlay .ai-ref-thumb__img.is-hidden { display: none; }
.design-overlay .function-panel input[type="range"] { width: 90px; }
.design-overlay .function-panel .zoom__value { font-size: 14px; }
.design-overlay .function-panel__col--cta { display: flex; flex-direction: column; gap: 8px; align-items: stretch; padding: 10px 12px; justify-content: flex-start; }
.design-overlay .function-panel__col--cta .meta--compact .meta__label { font-size: 12px; color: #6b7280; }
.design-overlay .function-panel__col--cta .meta--compact .meta__value { font-size: 13px; font-weight: 600; }
.design-overlay .function-panel__col--cta .meta--compact .meta__hint { font-size: 12px; color: #9ca3af; }
.design-overlay .function-panel .btn--cta { padding: 8px 18px; font-size: 16px; border-radius: 999px; }
.design-overlay .cta__hint { font-size: 14px; color: #6b7280; text-align: right; }
.design-overlay .step-label { font-size: 15px; color: #6b7280; font-weight: 600; margin-bottom: 6px; }
.design-overlay .step-label--cta { text-align: right; }
.design-overlay .preview--compact { flex-shrink: 0; display: flex; flex-direction: column; }
.design-overlay .preview--compact .preview__head { padding: 10px 0 6px; flex-shrink: 0; }
.design-overlay .preview--compact .preview__head .kicker { font-size: 15px; font-weight: 600; color: #4b5563; text-align: center; padding-left: 8px; }
.design-overlay .preview--compact .preview__head .title { font-size: 17px; font-weight: 700; }
.design-overlay .preview-thumbs { display: flex; gap: 10px; flex-shrink: 0; }
.design-overlay .preview-thumbs .slot { flex: 1; min-width: 0; aspect-ratio: 3/4; background: #f3f4f6; border-radius: 8px; overflow: hidden; display: flex; align-items: center; justify-content: center; position: relative; }
.design-overlay .preview-thumbs .slot__media { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 10px; }
.design-overlay .preview-thumbs .slot img.AIPhoto { max-width: 100%; max-height: 100%; object-fit: cover; display: block; cursor: zoom-in; border-radius: 6px; }
.design-overlay .preview-thumbs .slot.has-image .slot__state { display: none; }
.design-overlay .preview-thumbs .slot .is-hidden { display: none !important; }
.design-overlay .preview-thumbs .AIPhotoStatus { font-size: 14px; color: #374151; background: rgba(255,255,255,.9); border: 1px solid #e5e7eb; padding: 6px 10px; border-radius: 999px; }
.design-overlay .preview-thumbs .slot__state { text-align: center; padding: 8px; font-size: 13px; color: #6b7280; }
.design-overlay .preview-thumbs .slot__controls { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; flex-direction: column; gap: 8px; align-items: stretch; padding: 8px; border-radius: 10px; background: rgba(255,255,255,.92); border: 1px solid rgba(229,231,235,.9); box-shadow: 0 6px 18px rgba(0,0,0,.08); backdrop-filter: blur(6px); }
.design-overlay .preview-thumbs .slot__prompt { width: 100%; resize: none; border-radius: 8px; border: 1px solid #e5e7eb; background: #fff; padding: 8px 10px; font-size: 13px; line-height: 1.35; height: 52px; }
.design-overlay .preview-thumbs .slot__prompt::placeholder { color: #9ca3af; }
.design-overlay .preview-thumbs .slot__controls > .slot__row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.design-overlay .preview-thumbs .slot__select { flex: 1; min-width: 0; height: 34px; border-radius: 8px; border: 1px solid #e5e7eb; background: #fff; padding: 0 10px; font-size: 14px; }
.design-overlay .preview-thumbs .slot__select--mode { flex: 0 0 140px; }
.design-overlay .preview-thumbs .slot__btn { flex-shrink: 0; height: 34px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
.design-overlay .preview-thumbs .slot__composed-wrap { margin-top: 6px; }
.design-overlay .preview-thumbs .slot__composed-link { font-size: 12px; color: #1f6feb; text-decoration: underline; word-break: break-all; }
.design-overlay .preview-thumbs .slot__composed-link:hover { color: #1557c7; }
.design-overlay .preview-thumbs .slot__composed-link.is-hidden { display: none; }
.design-overlay .preview--compact .preview__bar { padding: 10px 0 0; border-top: 1px solid #e5e7eb; flex-shrink: 0; }
.design-overlay .preview--compact .preview__bar .btn { font-size: 14px; padding: 8px 14px; margin-right: 8px; }
.design-overlay .preview--compact .preview__bar .status { font-size: 14px; color: #6b7280; }

/* [2026-03-28] 目的：預設隱藏一頁式專用「上傳商品照」；一般列表編輯流程不變 */
.design-overlay .preview-thumbs .slot__sale-upload { display: none; }
.design-overlay .preview-thumbs .slot__sale-upload-label { margin: 0; cursor: pointer; }
.design-overlay .preview-thumbs .slot__sale-upload-btn { display: inline-block; font-size: 12px; padding: 6px 10px; }
.design-overlay[data-sale-spec-photo-mode="1"] .preview-thumbs .slot__sale-upload { display: block; margin-bottom: 6px; }
.design-overlay[data-sale-spec-photo-mode="1"] #btnOnePageCreate,
.design-overlay[data-sale-spec-photo-mode="1"] #btnOverlayPurchase { display: none !important; }
/* [2026-03-28] 目的：一頁式商品照模式隱藏長文案，僅保留「完成」按鈕 */
.design-overlay[data-sale-spec-photo-mode="1"] .gen-status-lead { display: none !important; }
.design-overlay[data-sale-spec-photo-mode="1"] #genStatus { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
/* [2026-03-28] 目的：雙 #ID 隱藏規則特異性過高會壓過 .design-overlay[attr] 顯示規則，改為 :not([data-sale-spec-photo-mode]) */
#design-overlay:not([data-sale-spec-photo-mode="1"]) #btnSaleSpecPhotoDone { display: none !important; }
#design-overlay[data-sale-spec-photo-mode="1"] #btnSaleSpecPhotoDone {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    min-width: 140px;
    max-width: 100%;
    margin-right: 0;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
}
.design-overlay label.file { position: relative; display: inline-block; cursor: pointer; vertical-align: middle; }
.design-overlay label.file input[type="file"],
.design-overlay .slot__sale-upload-label input[type="file"] {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
}

/* [2026-03-26] 目的：手機版設計視窗（進入編輯）採上畫布＋下抽屜；外層不捲動，抽屜內捲動 */
@media (max-width: 959px) {
    :root {
        --az-drawer-tabs-h: 52px;
        --az-drawer-min-h: clamp(96px, 18vh, 120px);
        --az-drawer-max-h: 90vh;
    }
    .design-overlay__body { padding: 0; }
    .design-overlay .editor-layout {
        display: flex;
        flex-direction: column;
    }
    .design-overlay .editor-canvas {
        flex: 1 1 auto;
        min-height: 0;
        /* 抽屜是 fixed 疊上來：預留底部空間避免畫布被遮住 */
        padding-bottom: calc(var(--az-drawer-min-h) + var(--az-drawer-tabs-h));
    }
    /* 畫布工具列（縮放/清除）固定在抽屜上方 */
    .design-canvas-toolbar {
        display: block;
        flex: 0 0 auto;
        margin: 0 10px 10px;
        padding: 10px 12px;
        border-radius: 14px;
        background: rgba(255,255,255,.96);
        border: 1px solid rgba(15, 23, 42, .10);
        box-shadow: 0 10px 22px rgba(15, 23, 42, .10);
        backdrop-filter: blur(8px);
    }
    .design-canvas-toolbar__row { display: flex; align-items: center; gap: 10px; }
    .design-canvas-toolbar__row + .design-canvas-toolbar__row { margin-top: 10px; }
    .design-canvas-toolbar__label { font-size: 12px; color: #6b7280; font-weight: 700; }
    .design-canvas-toolbar__range { flex: 1 1 auto; min-width: 0; }
    .design-canvas-toolbar__range input[type="range"] { width: 100% !important; }
    .design-canvas-toolbar__value { font-size: 12px; color: #111; font-weight: 800; white-space: nowrap; }
    .design-canvas-toolbar__row--actions { justify-content: flex-end; }

    /* 手機：整件衣服要完整顯示，避免 cover 裁切 */
    .design-overlay .stage--full { padding: 10px; }
    .design-overlay .stage--full .stage__canvas {
        max-height: calc(100vh - 56px - var(--az-drawer-min-h) - var(--az-drawer-tabs-h));
        border-radius: 14px;
        /* [2026-03-26] 目的：手機版編輯畫布更聚焦（外框/陰影略增強） */
        border: 1px solid rgba(15, 23, 42, .10);
        box-shadow: 0 10px 26px rgba(15, 23, 42, .14);
    }
    .design-overlay .stage--full .stage__canvas #teeImg { object-fit: contain !important; }

    /* 抽屜骨架：桌機仍用 editor-right 右欄；手機把它變成底部抽屜 */
    .design-overlay [data-design-drawer-root] {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 10010;
        border-left: 0;
        background: transparent;
        padding: 0;
        overflow: visible;
    }
    .design-drawer {
        width: 100%;
        background: #fff;
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
        box-shadow: 0 -10px 30px rgba(0,0,0,.15);
        display: flex;
        flex-direction: column;
        overflow: hidden;
        height: var(--az-drawer-min-h);
        max-height: var(--az-drawer-max-h);
    }
    .design-drawer.is-expanded {
        /* 展開時：高度以內容為主，但最多到上限；內容過長在抽屜內捲 */
        height: auto;
    }
    /* [2026-03-26] 目的：AI商品照(tab=ai) 展開時直接到最高，讓預覽區盡量拉高 */
    .design-drawer.is-expanded[data-active-tab="ai"] {
        height: var(--az-drawer-max-h);
    }
    .design-drawer__handle {
        padding: 10px 0 6px;
        display: flex;
        justify-content: center;
        align-items: center;
        flex: 0 0 auto;
    }
    .design-drawer__grab {
        width: 44px;
        height: 5px;
        border-radius: 999px;
        background: rgba(0,0,0,.18);
    }
    .design-drawer__status {
        display: flex;
        gap: 6px;
        align-items: center;
        padding: 10px 14px 10px;
        font-size: 12px;
        color: #6b7280;
        flex: 0 0 auto;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        /* [2026-03-26] 目的：狀態列保持中性，不使用反藍（反藍只用於 tab active） */
        background: transparent;
        border-top: 0;
        border-bottom: 0;
        position: relative;
    }
    .design-drawer__status-value {
        color: #111;
        font-weight: 700;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .design-drawer__content {
        flex: 1 1 auto;
        min-height: 0;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0 12px calc(var(--az-drawer-tabs-h) + 12px); /* 留給底部 tab */
    }
    .design-drawer.is-expanded .design-drawer__content {
        max-height: calc(var(--az-drawer-max-h) - var(--az-drawer-tabs-h) - 70px); /* handle+status 預留 */
    }
    /* 半開時不要露出任何內容（避免像你圖中「選擇顏色」雜亂露出） */
    .design-drawer:not(.is-expanded) .design-drawer__content {
        display: none;
    }
    .design-drawer__tabs {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: var(--az-drawer-tabs-h);
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        border-top: 1px solid #e5e7eb;
        background: rgba(255,255,255,.98);
        backdrop-filter: blur(8px);
    }
    .design-drawer__tab {
        appearance: none;
        border: 0;
        background: transparent;
        border-left: 1px solid rgba(229,231,235,.9);
        font-size: 12px;
        font-weight: 700;
        color: #6b7280;
        padding: 8px 4px;
        white-space: nowrap;
    }
    .design-drawer__tab:first-child { border-left: 0; }
    .design-drawer__tab.is-active {
        color: #111;
        /* [2026-03-26] 目的：手機版 tab active 更清楚（更明顯的底色/描邊） */
        background: rgba(31,111,235,.14);
        /* active 指示線放下方（更符合 bottom tab 習慣） */
        box-shadow: inset 0 -2px 0 rgba(31,111,235,.55);
    }
    /* 抽屜未展開時，不顯示 active 藍底（避免看起來像已點開某分頁） */
    .design-drawer:not(.is-expanded) .design-drawer__tab.is-active {
        color: #6b7280;
        background: transparent;
        box-shadow: none;
    }

    /* 手機：把原本右欄的 padding/邊線移除，交給抽屜控制 */
    .design-overlay .editor-right { border-left: 0; padding: 0; }

    /* [2026-03-26] 目的：第一階段先完成「款式規格」抽屜：只顯示顏色/視角，其它內容先隱藏 */
    .design-drawer.is-expanded[data-active-tab="spec"] #rowDesignInput,
    .design-drawer.is-expanded[data-active-tab="spec"] #rowAI,
    .design-drawer.is-expanded[data-active-tab="spec"] #rowAiSceneHint,
    .design-drawer.is-expanded[data-active-tab="spec"] .preview--compact,
    .design-drawer.is-expanded[data-active-tab="spec"] .function-panel__col--cta {
        display: none !important;
    }

    /* 款式規格：內容滿寬，不要縮在左上角 */
    .design-drawer.is-expanded[data-active-tab="spec"] .function-panel {
        display: block !important;
        width: 100% !important;
        background: transparent;
        border-radius: 0;
        box-shadow: none;
    }
    .design-drawer.is-expanded[data-active-tab="spec"] .function-panel__col--main {
        width: 100% !important;
        border-radius: 14px;
        padding: 12px 12px 14px;
    }
    /* 抽屜內不要再顯示原本的縮放 inline（已移到畫布工具列） */
    .design-drawer .zoom-inline { display: none !important; }

    /* [2026-03-26] 目的：設計圖 tab：只顯示上傳/AI 設計與 prompt（保留同份內容，先做排版切分） */
    .design-drawer.is-expanded[data-active-tab="design"] #rowSpecColor,
    .design-drawer.is-expanded[data-active-tab="design"] #moduleRowView,
    .design-drawer.is-expanded[data-active-tab="design"] #rowAiSceneHint,
    .design-drawer.is-expanded[data-active-tab="design"] .preview--compact,
    .design-drawer.is-expanded[data-active-tab="design"] .function-panel__col--cta {
        display: none !important;
    }
    .design-drawer.is-expanded[data-active-tab="design"] .function-panel {
        display: block !important;
        width: 100% !important;
        background: transparent;
        border-radius: 0;
        box-shadow: none;
    }
    .design-drawer.is-expanded[data-active-tab="design"] .function-panel__col--main {
        width: 100% !important;
        border-radius: 14px;
        padding: 12px 12px 14px;
    }
    .design-drawer.is-expanded[data-active-tab="design"] .function-panel__row { margin-bottom: 8px; }
    /* 設計圖：AI 文生圖/圖生圖的提示詞區要滿寬且更高 */
    .design-drawer.is-expanded[data-active-tab="design"] #rowDesignInput .function-panel__label,
    .design-drawer.is-expanded[data-active-tab="design"] #rowAI .function-panel__label { display: none !important; }
    .design-drawer.is-expanded[data-active-tab="design"] #rowDesignInput,
    .design-drawer.is-expanded[data-active-tab="design"] #rowAI {
        align-items: stretch;
    }
    .design-drawer.is-expanded[data-active-tab="design"] .ai-ref-row {
        flex-direction: column;
        align-items: stretch;
    }
    .design-drawer.is-expanded[data-active-tab="design"] .ai-ref-thumb {
        width: 100%;
        height: 88px;
    }
    .design-drawer.is-expanded[data-active-tab="design"] .function-panel__ai .ai-prompt {
        width: 100%;
        min-height: 110px;
        resize: none;
    }
    /* 清除已移到畫布工具列：抽屜內不再顯示 */
    .design-drawer.is-expanded[data-active-tab="design"] #btnClear { display: none !important; }

    /* [2026-03-26] 目的：AI生成 tab：三張卡為主（水平滑動），先隱藏功能面板 */
    .design-drawer.is-expanded[data-active-tab="ai"] .function-panel { display: none !important; }
    .design-drawer.is-expanded[data-active-tab="ai"] .preview--compact { display: flex !important; }
    .design-drawer.is-expanded[data-active-tab="ai"] .preview--compact .preview__head { display: none !important; }
    .design-drawer.is-expanded[data-active-tab="ai"] .preview--compact .preview__bar { display: none !important; }
    .design-drawer.is-expanded[data-active-tab="ai"] .preview-thumbs {
        display: grid !important;
        grid-auto-flow: column;
        /* 一次滑動一張：滿寬卡片 */
        grid-auto-columns: 100%;
        gap: 12px;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px;
    }
    .design-drawer.is-expanded[data-active-tab="ai"] .preview-thumbs .slot {
        scroll-snap-align: start;
        /* [2026-03-26] 目的：手機 AI生成卡：控制區必須在抽屜內，不能壓到下方 tab */
        aspect-ratio: auto;
        border-radius: 14px;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    .design-drawer.is-expanded[data-active-tab="ai"] .preview-thumbs .slot__media {
        position: relative !important;
        inset: auto !important;
        z-index: 0;
        flex: 1 1 auto;
        min-height: 280px;
        padding: 12px;
    }
    .design-drawer.is-expanded[data-active-tab="ai"] .preview-thumbs .slot__controls {
        position: relative !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        z-index: 1;
        margin: 0 12px 12px;
        padding: 10px;
        border-radius: 14px;
        background: rgba(255,255,255,.98);
        border: 1px solid rgba(229,231,235,.95);
        box-shadow: 0 10px 20px rgba(0,0,0,.08);
        backdrop-filter: blur(8px);
    }
    .design-drawer.is-expanded[data-active-tab="ai"] .preview-thumbs .slot__prompt {
        height: 92px;
    }

    /* [2026-03-26] 目的：完成 tab：只顯示行動按鈕（建立一頁式/購買），先不顯示三張卡 */
    .design-drawer.is-expanded[data-active-tab="done"] .function-panel { display: none !important; }
    .design-drawer.is-expanded[data-active-tab="done"] .preview--compact { display: flex !important; }
    .design-drawer.is-expanded[data-active-tab="done"] .preview--compact .preview__head { display: none !important; }
    .design-drawer.is-expanded[data-active-tab="done"] .preview-thumbs { display: none !important; }
    .design-drawer.is-expanded[data-active-tab="done"] .preview--compact .preview__bar {
        display: block !important;
        border-top: 0;
        padding: 12px 0 0;
    }
    .design-drawer.is-expanded[data-active-tab="done"] .preview--compact .preview__bar .status {
        display: flex;
        flex-direction: column;
        gap: 10px;
        font-size: 13px;
        color: #374151;
    }
    .design-drawer.is-expanded[data-active-tab="done"] .preview--compact .preview__bar .btn {
        width: 100%;
        margin-right: 0;
    }
}
.ai-photo-modal { position: fixed; inset: 0; z-index: 10050; display: none; }
.ai-photo-modal.is-open { display: block; }
.ai-photo-modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.ai-photo-modal__panel { position: absolute; inset: 40px 40px 40px 40px; background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; }
.ai-photo-modal__img { max-width: 100%; max-height: 100%; object-fit: contain; background: #111827; }
.ai-photo-modal__close { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 999px; border: 1px solid #e5e7eb; background: rgba(255,255,255,.95); cursor: pointer; font-size: 16px; line-height: 32px; }
.ai-photo-modal__close:hover { background: #f3f4f6; }
@media (max-width: 900px) { .ai-photo-modal__panel { inset: 16px; } }

/* [2026-03-24] 目的：AI 情境照生成時啟用全版遮罩，鎖住所有操作以避免重複觸發 */
.ai-global-mask { position: fixed; inset: 0; z-index: 200000; background: rgba(17,17,17,.35); backdrop-filter: blur(1.5px); display: flex; align-items: center; justify-content: center; padding: 20px; }
.ai-global-mask.is-hidden { display: none !important; }
.ai-global-mask__panel { min-width: 260px; max-width: 92vw; background: #fff; border: 1px solid #e6e3da; border-radius: 14px; box-shadow: 0 16px 40px rgba(0,0,0,.2); padding: 16px 18px; text-align: center; }
.ai-global-mask__spinner { width: 28px; height: 28px; margin: 0 auto 10px; border: 3px solid #e9e7df; border-top-color: #1f6feb; border-radius: 50%; animation: ai-spin .9s linear infinite; }
.ai-global-mask__title { font-weight: 700; font-size: 16px; margin-bottom: 4px; color: #111; }
.ai-global-mask__desc { font-size: 13px; color: #4e4e4e; }
@keyframes ai-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@media (max-width: 900px) { .design-overlay .editor-layout { grid-template-columns: 1fr 320px; } }
