/* ========================================================== */
/* 全局美化滚动条 */
/* ========================================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ========================================================== */
/* 端与层级选择器样式 (紧凑化) */
/* ========================================================== */
.step-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: #fff;
    width: 18px;
    height: 18px;
    text-align: center;
    border-radius: 50%;
    font-size: 11px;
    margin-right: 8px;
    font-weight: 600;
    flex-shrink: 0;
}

.sidebar-section.terminal-section {
    margin-bottom: 12px;
}

.sidebar-section.terminal-section .section-title {
    margin-bottom: 6px;
}

.terminal-picker {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.terminal-trigger {
    width: 100%;
    min-width: 0;
    min-height: 34px;
    padding: 0 11px 0 12px;
    border: 1px solid #d9e3f0;
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, #fbfdff 0%, #f4f8fd 100%);
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.terminal-trigger:hover {
    background: #ffffff;
    border-color: #cdd6e3;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.terminal-picker.open .terminal-trigger {
    border-color: #cfd8e5;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.04);
}

.terminal-trigger svg {
    flex-shrink: 0;
    color: var(--text-sub);
    transition: transform 0.15s ease, color 0.15s ease;
}

.terminal-picker.open .terminal-trigger svg {
    transform: rotate(180deg);
    color: var(--text-sub);
}

.terminal-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    background: #ffffff;
    border: 1px solid #d9e3f0;
    border-radius: var(--radius-md);
    padding: 6px;
    box-shadow: var(--shadow-sm);
}

.terminal-picker:not(.open) .terminal-tabs {
    display: none;
}

.terminal-btn {
    padding: 6px 0;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    color: var(--text-sub);
    text-align: center;
    transition: all 0.15s ease;
    line-height: 1.1;
}

.terminal-btn:hover {
    color: var(--text-main);
    background: rgba(15, 23, 42, 0.04);
}

.terminal-btn.active {
    background: #eef3f8;
    border-color: #d8e2ee;
    color: var(--text-main);
    font-weight: 600;
    box-shadow: none;
}

.developing-prompt {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px dashed #cbd5e1;
    margin-top: 10px;
}

/* ========================================================== */
/* 字体与变量 */
/* ========================================================== */
@font-face {
    font-family: 'PingFangSC-Medium';
    src: url('https://cdn.jsdelivr.net/gh/shenweiyan/PingFangSC-Fonts/PingFang%20Medium.ttf') format('truetype');
    font-weight: normal;
    font-display: swap;
}

@font-face {
    font-family: 'FZLanTingHeiS-R';
    src: url('https://cdn.jsdelivr.net/gh/ww7627502-ctrl/baidudu@main/FZLanTingHeiS-R-GB.ttf') format('truetype');
    font-weight: normal;
    font-display: swap;
}

@font-face {
    font-family: 'FZLanTingHeiS-H';
    src: url('https://cdn.jsdelivr.net/gh/ww7627502-ctrl/baidudu@main/FZLanTingHeiS-H-GB.ttf') format('truetype');
    font-weight: normal;
    font-display: swap;
}

@font-face {
    font-family: 'FZLanTingHeiS-DB';
    src: url('https://cdn.jsdelivr.net/gh/ww7627502-ctrl/baidudu@main/FZLanTingHeiS-DB-GB.ttf') format('truetype');
    font-weight: normal;
    font-display: swap;
}

@font-face {
    font-family: 'FZLTHK';
    src: url('https://cdn.jsdelivr.net/gh/ww7627502-ctrl/baidudu@main/FZLTHK.TTF') format('truetype');
    font-weight: normal;
    font-display: swap;
}

@font-face {
    font-family: 'FZHanZhenGuangBiaoS-GB';
    src: url('https://cdn.jsdelivr.net/gh/ww7627502-ctrl/baidudu@main/FZHanZhenGuangBiaoS-GB.ttf') format('truetype');
    font-weight: normal;
    font-display: swap;
}

@font-face {
    font-family: 'FZHanYunHeiS-M';
    src: url('https://cdn.jsdelivr.net/gh/ww7627502-ctrl/baidudu@main/FZHanYHJW-M.TTF') format('truetype');
    font-weight: normal;
    font-display: swap;
}

@font-face {
    font-family: 'FZHanYunHeiS-L';
    src: url('https://cdn.jsdelivr.net/gh/ww7627502-ctrl/baidudu@main/FZHanYHJW-L.TTF') format('truetype');
    font-weight: normal;
    font-display: swap;
}

@font-face {
    font-family: 'FZHZGBJW';
    src: url('https://cdn.jsdelivr.net/gh/ww7627502-ctrl/baidudu@main/FZHZGBJW.TTF') format('truetype');
    font-weight: normal;
    font-display: swap;
}

:root {
    /* 主色与状态色 */
    --primary-color: #2563EB;
    --primary-hover: #1D4ED8;
    --primary-soft: #EFF4FF;
    --accent-ai: #6D28D9;

    /* 中性色阶（AI 工具风：冷静、克制） */
    --bg-color: #F4F6FA;
    --surface: #FFFFFF;
    --surface-muted: #F7F9FC;
    --text-main: #1F2733;
    --text-sub: #5B6675;
    --text-faint: #94A0B0;
    --border-color: #E6EAF0;
    --border-strong: #D5DBE4;

    /* 间距节奏 */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;

    /* 圆角与阴影 */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-pill: 999px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-md: 0 4px 16px rgba(16, 24, 40, 0.06);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.10);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* 核心布局修复：严格锁定全局高度 */
body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 头部 */
.app-header {
    height: 60px;
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
    z-index: 10;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-brand::before {
    content: "";
    width: 6px;
    height: 30px;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--primary-color), var(--accent-ai));
}

.header-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.header-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.2px;
    color: var(--text-main);
}

.header-subtitle {
    font-size: 12px;
    color: var(--text-sub);
    margin-top: 1px;
}

.header-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-radius: var(--radius-pill);
    padding: 9px 18px;
}

.btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.18s ease;
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.primary-btn:hover {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow-md);
}

.secondary-btn {
    background-color: var(--surface-muted);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.secondary-btn:hover {
    background-color: #EDF1F6;
    border-color: var(--border-strong);
}

/* ========================================================== */
/* 三栏布局核心 */
/* ========================================================== */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    width: 100%;
}

/* 基础侧边栏 */
.sidebar {
    width: 340px;
    min-width: 340px;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    flex-shrink: 0;
    padding: 20px 16px;
}

.left-sidebar {
    border-right: 1px solid var(--border-color);
    width: 300px;
    min-width: 300px;
    overflow: hidden !important;
    padding-bottom: 0;
    z-index: 5;
}

.right-sidebar {
    border-left: 1px solid var(--border-color);
    box-shadow: -1px 0 0 rgba(16, 24, 40, 0.02);
    z-index: 5;
    background: var(--bg-color);
    overflow: hidden;
    scrollbar-gutter: stable;
}

#dynamicControlsArea {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

#manualControlsWrapper {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid rgba(17, 24, 39, 0.08);
}

/* 整体自适应：窗口变窄时左右侧栏一起收窄，中间画板不被挤到无法完整显示 */
@media (max-width: 1440px) {
    .sidebar { width: 300px; min-width: 300px; padding: 18px 14px; }
    .left-sidebar { width: 264px; min-width: 264px; }
}
@media (max-width: 1200px) {
    .sidebar { width: 260px; min-width: 260px; padding: 16px 12px; }
    .left-sidebar { width: 232px; min-width: 232px; }
}
@media (max-width: 1000px) {
    .sidebar { width: 220px; min-width: 220px; }
    .left-sidebar { width: 200px; min-width: 200px; }
}

#wangpanWorkspace {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

/* ========================================================== */
/* 右侧面板卡片分组样式 */
/* ========================================================== */
.panel-group {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.panel-group-header {
    background: var(--surface-muted);
    padding: 12px 16px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-group-header::before {
    content: "";
    width: 4px;
    height: 14px;
    border-radius: 2px;
    background: var(--primary-color);
    flex-shrink: 0;
}

.panel-group-body {
    padding: 16px;
}

.panel-group-body .sidebar-section:last-child {
    margin-bottom: 0;
}

/* 侧边栏内部元素 */
.sidebar-section {
    margin-bottom: 20px;
}

.section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-sub);
    margin-bottom: 10px;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
}

/* 带步骤编号的导航标题：作为主流程步骤，需更醒目 */
.section-title:has(.step-label) {
    font-size: 13px;
    color: var(--text-main);
    margin-bottom: 12px;
}

.bu-selector {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
}

.bu-selector-row2 {
    margin-top: 8px;
}

.bu-selector-row2 .bu-btn {
    grid-column: 1;
}

.bu-btn {
    min-width: 0;
    width: 100%;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: transform 0.2s;
    line-height: 0;
    overflow: hidden;
    border-radius: 6px;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.bu-btn:focus,
.bu-btn:focus-visible,
.bu-btn:active {
    outline: none;
}

.bu-btn img {
    width: 100%;
    height: 100%;
    aspect-ratio: 3418 / 1844;
    object-fit: cover;
    display: block;
    border-radius: inherit;
    transition: all 0.3s;
    filter: url(#lightBlueTint);
}

/* 第二排未选中：黑色部分换成 #B6E7DC */
.bu-selector-row2 .bu-btn img {
    filter: url(#mintTint);
}

.bu-btn:hover {
    transform: translateY(-2px);
}

.bu-btn.active img {
    filter: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.upload-drop-zone {
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 10px;
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--surface-muted);
    transition: all 0.18s ease;
    min-height: 80px;
}

/* 主图替换：底部独立放图面板，靠最右侧、纵向拉满与左侧输入栏等高 */
.base-pic-panel {
    width: 210px;
    flex-shrink: 0;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    box-shadow: var(--shadow-sm);
}

.base-pic-panel-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    padding-left: 8px;
    border-left: 3px solid var(--primary-color);
    line-height: 1.2;
}

.base-pic-drop {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    cursor: pointer;
    padding: 10px;
    transition: all 0.18s ease;
}

.base-pic-drop:hover {
    border-color: var(--primary-color);
    background: var(--primary-soft);
}

.base-pic-drop.drag-over {
    border-color: var(--primary-color);
    background: var(--primary-soft);
}

.base-pic-preview {
    max-width: 100%;
    max-height: 84px;
    border-radius: 6px;
    object-fit: contain;
    display: block;
}

.base-pic-hint {
    font-size: 11px;
    color: var(--text-sub);
    text-align: center;
    line-height: 1.3;
}

.upload-drop-zone:hover {
    border-color: var(--primary-color);
    background: var(--primary-soft);
}

.upload-drop-zone.drag-over {
    border-color: var(--primary-color);
    background: var(--primary-soft);
}

.upload-preview-img {
    max-width: 100%;
    max-height: 60px;
    border-radius: 4px;
    margin-bottom: 6px;
}

.upload-text {
    font-size: 11px;
    color: var(--text-faint);
}

.color-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 12px;
}

.color-selector label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    color: var(--text-sub);
    transition: all 0.15s ease;
}

.color-selector label:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.color-selector label:has(input:checked) {
    border-color: var(--primary-color);
    background: var(--primary-soft);
    color: var(--primary-color);
    font-weight: 600;
}

.input-group {
    margin-bottom: 12px;
}

.input-group span {
    display: block;
    font-size: 12px;
    color: var(--text-sub);
    margin-bottom: 5px;
}

.input-group input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-main);
    background: var(--surface);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ========================================================== */
/* 画板预览区 (Figma 无限画板支持) */
/* ========================================================== */
.center-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    position: relative;
}

.center-workspace {
    flex: 1;
    min-height: 0;
    background: #EAEDF2;
    background-image: radial-gradient(rgba(16, 24, 40, 0.05) 1px, transparent 1px);
    background-size: 22px 22px;
    position: relative;
    overflow: hidden;
    /* 关闭原生的滚动条，由 JS 接管拖拽 */
    cursor: default;
}

.center-workspace.ai-result-workspace {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    scrollbar-gutter: stable;
}

#canvasContainer {
    width: 100%;
    height: 100%;
    transform-origin: 0 0;
    will-change: transform;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

#canvasContainer.ai-result-preview-mode {
    width: max-content;
    min-width: 100%;
    height: 100%;
    transform: none !important;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 48px;
    padding: 32px 48px 40px;
}

#canvasContainer.ai-result-preview-mode .view-section.active {
    display: block;
    flex: 0 0 auto;
    width: auto !important;
    max-width: none;
    max-height: calc(100vh - 220px);
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-snap-align: start;
    padding-bottom: 24px;
}

#canvasContainer.ai-result-preview-mode .preview-grid.flex-center {
    flex-wrap: nowrap;
    justify-content: flex-start;
    width: auto;
    gap: 32px;
}

#canvasContainer.ai-result-preview-mode .members-channel-grid,
#canvasContainer.ai-result-preview-mode .tier-based-rewards-grid {
    display: flex !important;
    flex-wrap: nowrap;
    justify-content: flex-start;
    width: auto;
}

#canvasContainer.ai-result-preview-mode .members-channel-grid .preview-card,
#canvasContainer.ai-result-preview-mode .tier-based-rewards-grid .preview-card {
    width: auto;
    min-width: 0;
}

#canvasContainer.ai-result-preview-mode .phone-canvas {
    max-height: 56vh;
}


@keyframes aiGlow {
    0% {
        box-shadow: 0 0 5px rgba(100, 26, 255, 0.2);
    }

    50% {
        box-shadow: 0 0 15px rgba(100, 26, 255, 0.6);
    }

    100% {
        box-shadow: 0 0 5px rgba(100, 26, 255, 0.2);
    }
}

.ai-btn-active {
    animation: aiGlow 1.5s infinite;
}

.preview-grid.flex-center {
    display: flex;
    flex-wrap: wrap;
    gap: 60px;
    justify-content: center;
    width: 100%;
}

.preview-card.transparent-card {
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

.members-channel-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: 28px;
    width: 100%;
    overflow: visible;
    padding: 0 12px 12px;
    box-sizing: border-box;
}

.members-channel-grid .preview-card {
    width: 100%;
    min-width: 0;
}

.members-channel-grid .phone-canvas {
    width: 100%;
    max-width: 100%;
    max-height: none;
}

.tier-based-rewards-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: 28px;
    width: 100%;
    overflow: visible;
    padding: 0 12px 12px;
    box-sizing: border-box;
}

.tier-based-rewards-grid .preview-card {
    width: 100%;
    min-width: 0;
}

.tier-based-rewards-grid .phone-canvas {
    width: 100%;
    max-width: 100%;
    max-height: none;
}

.text-center {
    text-align: center !important;
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-sub);
    margin-bottom: 12px;
}

.phone-canvas {
    max-height: 56vh;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    margin: 0 auto;
    display: block;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.zoomable-canvas {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.zoomable-canvas:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
}

.ai-result-preview-mode .view-section.active {
    cursor: pointer;
}

.ai-result-preview-mode .view-section.ai-preview-selected .phone-canvas,
.ai-result-preview-mode .phone-canvas.ai-preview-selected {
    outline: 3px solid var(--primary-color);
    outline-offset: 8px;
    box-shadow: 0 18px 48px rgba(37, 99, 235, 0.22);
}

/* 动态显示控制 */
.control-group {
    display: none;
}

.control-group.active {
    display: block;
}

.view-section {
    display: none;
    width: 100%;
}

.view-section.active {
    display: block;
    animation: fadeIn 0.3s;
}

.view-section.prompt-view.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================================== */
/* 弹窗样式 */
/* ========================================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.65);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.detail-modal-panel {
    background: #fff;
    border-radius: 12px;
    width: 800px;
    max-width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% {
        transform: scale(0.95);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.detail-modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fdfdfd;
}

.detail-modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.close-detail-modal {
    font-size: 28px;
    cursor: pointer;
    color: #999;
    line-height: 1;
    transition: color 0.2s;
}

.close-detail-modal:hover {
    color: #333;
}

.detail-modal-body {
    padding: 32px 24px;
    overflow-y: auto;
    scrollbar-gutter: stable;
    background: #f7f8fc;
    display: flex;
    flex-direction: column;
    gap: 32px;
    align-items: center;
}

.detail-modal-body.dark-floor {
    background: #130129;
}

.detail-modal-body img {
    max-width: 100%;
    max-height: 70vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.banner-label {
    font-size: 14px;
    color: #333333;
    font-weight: bold;
    margin-bottom: 12px;
    text-align: center;
}

.detail-modal-body.dark-floor .banner-label {
    color: rgba(255, 255, 255, 0.9);
}

/* 导出弹窗 */
.export-modal-panel {
    background: #fff;
    width: 500px;
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    margin: auto;
}

.export-modal-header {
    background: #f8fafc;
    padding: 14px 20px;
    font-weight: bold;
    font-size: 15px;
    border-bottom: 1px solid var(--border-color);
}

.export-modal-body {
    padding: 20px;
    max-height: 55vh;
    overflow-y: auto;
    scrollbar-gutter: stable;
}

.export-group {
    margin-bottom: 24px;
}

.export-group-title {
    font-size: 13px;
    font-weight: bold;
    color: #222;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #f1f5f9;
    border-left: 3px solid var(--primary-color);
    border-radius: 0 4px 4px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.export-badge {
    font-size: 12px;
}

.export-badge.ss {
    color: #E63F00;
}

.export-badge.s {
    color: #F59A23;
}

.export-group label {
    display: block;
    margin-bottom: 10px;
    padding-left: 8px;
    font-size: 13px;
    cursor: pointer;
    color: #444;
}

.export-group label:hover {
    color: var(--primary-color);
}

.export-modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 颜色选择器与滑块 */
.color-picker-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #444;
}

.color-picker-wrap input[type="color"] {
    width: 26px;
    height: 26px;
    border: 1px solid #cbd5e1;
    padding: 0;
    cursor: pointer;
    border-radius: 4px;
    background: transparent;
}

.color-picker-wrap input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 1px;
}

.color-picker-wrap input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}

input[type=range]:focus {
    outline: none;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: #cbd5e1;
    border-radius: 2px;
}

input[type=range]::-webkit-slider-thumb {
    height: 14px;
    width: 14px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid var(--primary-color);
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

input[type=range]:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* ================= 像素级还原 Figma 侧边栏质感 ================= */
.resource-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 8px;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    scrollbar-gutter: stable;
    flex: 1;
    min-height: 0;
    padding-bottom: 20px;
    margin-left: -16px;
    margin-right: -16px;
}

.resource-list::-webkit-scrollbar {
    width: 10px;
}

.resource-list::-webkit-scrollbar-track {
    background: transparent;
}

.resource-list::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 5px;
    border: 3px solid #fff;
}

.resource-list:hover::-webkit-scrollbar-thumb {
    background: #D9D9D9;
}

.resource-directory {
    padding: 10px 0 6px;
    border-bottom: 1px solid rgba(37, 138, 255, 0.08);
}

.resource-directory:last-child {
    border-bottom: 0;
}

.resource-directory-title {
    padding: 8px 16px 10px 26px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0;
}

.resource-directory-items {
    display: flex;
    flex-direction: column;
}

.resource-item {
    display: flex;
    align-items: center;
    min-height: 34px;
    padding: 6px 16px 6px 38px;
    cursor: pointer;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    color: var(--text-sub);
    user-select: none;
    transition: background-color 0.15s ease, color 0.15s ease;
    width: 100%;
    box-sizing: border-box;
    border-left: 2px solid transparent;
}

.resource-item:hover {
    background-color: var(--surface-muted);
    color: var(--text-main);
}

.resource-item.active {
    background-color: var(--primary-soft);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.resource-item.placeholder {
    opacity: 0.92;
}

.resource-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    color: rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
}

.resource-item.active .resource-item-icon {
    color: var(--primary-color);
}

.resource-item-text {
    flex: 1;
    white-space: nowrap;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
    line-height: 22px;
}

.resource-item-text::-webkit-scrollbar {
    display: none;
}

/* 覆盖 Pickr 插件样式 */
.pcr-button {
    width: 26px !important;
    height: 26px !important;
    border-radius: 4px !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: none !important;
}

.input-group .pcr-button {
    width: 100% !important;
    height: 28px !important;
}

.pcr-app[data-theme="nano"] {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
    border-radius: 12px !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
}

/* ========================================================== */
/* 引导式三步流程：① AI 自动 → ② 手动微调(折叠) → ③ 导出 */
/* ========================================================== */

/* 步骤编号徽标 */
.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    background: var(--primary-color);
    color: #fff;
    flex-shrink: 0;
}

.step-num.ai {
    background: var(--accent-ai);
}

.step-num.light {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    margin-right: 6px;
}

/* ① AI 面板引导文案 */
.ai-guide-hint {
    font-size: 12px;
    color: #6B5DB8;
    line-height: 1.5;
    margin-bottom: 12px;
}

/* ② 手动微调折叠头 */
.manual-accordion-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    margin-bottom: 14px;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
    transition: all 0.18s ease;
}

.manual-accordion-header:hover {
    border-color: var(--border-strong);
    background: var(--surface-muted);
}

.manual-accordion-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.opt-tag {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-faint);
    background: var(--surface-muted);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1px 8px;
}

.manual-accordion-caret {
    color: var(--text-faint);
    font-size: 12px;
    transition: transform 0.2s ease;
}

.manual-accordion-header.open .manual-accordion-caret {
    transform: rotate(180deg);
}

/* 折叠态：隐藏手动参数区（子元素自身 display 逻辑不受影响） */
.manual-collapsed {
    display: none;
}

.manual-intro-hint {
    font-size: 12px;
    color: var(--text-sub);
    line-height: 1.6;
    background: var(--surface-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-bottom: 14px;
}

.right-action-section {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(17, 24, 39, 0.08);
}

.right-action-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.right-action-section-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
}

.right-action-section-title::before {
    content: "";
    width: 4px;
    height: 14px;
    border-radius: 999px;
    background: var(--primary-color);
}

.smart-action-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 12px;
    background: linear-gradient(180deg, #fbfdff 0%, #f7faff 100%);
    border: 1px solid rgba(37, 138, 255, 0.16);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.smart-action-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

.smart-action-head-text {
    min-width: 0;
    flex: 1;
}

.smart-action-label {
    font-size: 11px;
    color: var(--text-faint);
    margin-bottom: 2px;
}

.smart-action-title {
    font-size: 13px;
    line-height: 1.3;
    font-weight: 600;
    color: var(--text-main);
    word-break: break-word;
}

.smart-action-ops {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.smart-action-toggle,
.smart-action-export {
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    padding: 7px 10px;
    cursor: pointer;
}

.smart-action-toggle {
    background: var(--surface-muted);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.smart-action-export {
    background: var(--primary-color);
    color: #fff;
}

.smart-action-body {
    display: none;
}

.smart-action-panel.open .smart-action-body {
    display: block;
}

.smart-action-grid {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.smart-action-btn {
    min-height: 32px;
    padding: 0 14px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: var(--surface-muted);
    color: var(--text-main);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.smart-action-btn:hover,
.smart-action-btn.active {
    background: #fff;
    border-color: #cdd6e3;
    transform: translateY(-1px);
}

.smart-action-btn.active {
    color: var(--primary-color);
    border-color: rgba(37, 138, 255, 0.28);
    box-shadow: 0 0 0 3px rgba(37, 138, 255, 0.06);
}

.smart-action-detail {
    display: none;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    max-height: 180px;
    overflow: auto;
}

.smart-action-detail.active {
    display: block;
}

.smart-action-placeholder,
.smart-action-empty {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-sub);
    background: var(--surface-muted);
    border: 1px dashed var(--border-color);
    border-radius: 7px;
    padding: 10px;
}

.bottom-manual-controls {
    display: none;
    margin: 12px 0 0;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(37, 138, 255, 0.14);
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(16, 24, 40, 0.08);
    max-height: min(58vh, 420px);
    overflow-y: auto;
    width: 100%;
    box-sizing: border-box;
}

.bottom-manual-controls.open {
    display: block;
}

.bottom-manual-controls .manual-intro-hint {
    display: none;
}

.smart-text-editor {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.smart-text-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.smart-text-tab {
    flex-shrink: 0;
    min-height: 30px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text-sub);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.smart-text-tab.active {
    background: rgba(37, 138, 255, 0.1);
    color: var(--primary-color);
    border-color: rgba(37, 138, 255, 0.22);
}

.smart-text-editor-title {
    font-size: 12px;
    color: var(--text-sub);
    margin-bottom: 2px;
}

.smart-text-section {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.smart-text-section-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.smart-text-section-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(37, 138, 255, 0.08);
    color: var(--primary-color);
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.smart-text-section-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
}

.smart-text-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.smart-text-row label {
    font-size: 12px;
    color: var(--text-sub);
    font-weight: 600;
}

.smart-text-input {
    width: 100%;
    min-height: 34px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: #fff;
    color: var(--text-main);
    font-size: 13px;
    padding: 7px 9px;
    outline: none;
}

.smart-text-input:focus {
    border-color: rgba(37, 138, 255, 0.45);
    box-shadow: 0 0 0 3px rgba(37, 138, 255, 0.08);
}

.smart-text-meta {
    align-self: flex-end;
    font-size: 11px;
    color: var(--text-faint);
}

.smart-focus {
    outline: 2px solid rgba(37, 138, 255, 0.45);
    outline-offset: 4px;
}

/* 素材库（右侧面板，占位脚手架） */
.material-lib {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 12px 14px;
    margin-bottom: 10px;
    min-height: 0;
}

.material-lib.drag-over {
    border-color: rgba(37, 138, 255, 0.38);
    box-shadow: 0 0 0 3px rgba(37, 138, 255, 0.08), var(--shadow-sm);
}

.material-lib-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.material-lib-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
}

.material-lib-tag {
    font-size: 11px;
    color: var(--text-faint);
    background: var(--surface-muted);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1px 8px;
}

.material-lib-hint {
    font-size: 12px;
    color: var(--text-sub);
    line-height: 1.5;
    margin-bottom: 12px;
}

.material-lib-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.material-lib-btn {
    flex: 1;
    min-height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(37, 138, 255, 0.22);
    background: rgba(37, 138, 255, 0.08);
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.material-lib-btn.secondary {
    background: var(--surface-muted);
    color: var(--text-main);
    border-color: var(--border-color);
}

.material-lib-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 120px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 2px;
}

.material-category {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.material-category-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
}

.material-category-count {
    color: var(--text-faint);
    font-weight: 500;
}

.material-category-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.material-item {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    padding: 5px;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
    text-align: left;
}

.material-item:hover {
    border-color: rgba(37, 138, 255, 0.35);
    box-shadow: 0 6px 16px rgba(16, 24, 40, 0.08);
    transform: translateY(-1px);
}

.material-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 1.2;
    border-radius: 6px;
    object-fit: contain;
    background: linear-gradient(45deg, #f8fafc 25%, transparent 25%), linear-gradient(-45deg, #f8fafc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f8fafc 75%), linear-gradient(-45deg, transparent 75%, #f8fafc 75%);
    background-size: 12px 12px;
    background-position: 0 0, 0 6px, 6px -6px, -6px 0;
}

.material-thumb.is-pending {
    min-height: 48px;
}

.material-name {
    margin-top: 5px;
    font-size: 11px;
    line-height: 1.3;
    color: var(--text-sub);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.material-empty {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 170px;
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--surface-muted);
    color: var(--text-faint);
    font-size: 12px;
    padding: 16px;
}

/* ========================================================== */
/* AI 生成输入栏（底部独立模块，与画布上下分区，互不遮挡） */
/* ========================================================== */
.ai-dock-bar {
    flex-shrink: 0;
    background: var(--surface);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 20px rgba(35, 36, 48, 0.05);
    padding: 14px 24px;
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 16px;
    z-index: 20;
}

.ai-dock {
    width: 100%;
    max-width: 760px;
    background: transparent;
    padding: 0;
}

.ai-dock-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.ai-dock-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-ai);
    flex-shrink: 0;
}

.ai-dock-hint {
    font-size: 12px;
    color: var(--text-sub);
    flex: 1;
    min-width: 120px;
}

.ai-dock-model {
    margin-left: auto;
    max-width: 190px;
    padding: 5px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-sub);
    background: var(--surface-muted);
    cursor: pointer;
}

.ai-dock-input {
    position: relative;
    width: 100%;
    border: 1px solid #D9D5F5;
    border-radius: var(--radius-md);
    background: #fff;
    margin-bottom: 10px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ai-dock-input:focus-within {
    border-color: var(--accent-ai);
    box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.12);
}

.ai-dock-input textarea {
    width: 100%;
    height: 64px;
    padding: 12px 130px 12px 14px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    resize: none;
    font-family: inherit;
    line-height: 1.5;
    color: var(--text-main);
    outline: none;
    background: transparent;
}

.ai-dock-gen {
    width: 100%;
    background: linear-gradient(90deg, #2563EB, #6D28D9);
    border: none;
    font-weight: 600;
    font-size: 14px;
    padding: 11px 0;
    box-shadow: 0 6px 16px rgba(109, 40, 217, 0.28);
    transition: all 0.2s ease;
}

.ai-dock-gen:hover {
    box-shadow: 0 8px 22px rgba(109, 40, 217, 0.36);
}