/* ==================== 渲染初始化 ==================== */
/* 确保 body 在加载时可见，避免 CEP/UXP 环境下样式延迟导致白屏 */
/* 注意：此规则必须保持高优先级 */
body {
    visibility: visible !important;
    opacity: 1 !important;
    background: #000000 !important;
    display: block !important;
}

/* 初始隐藏（避免 FOUC），由 JS 在初始化完成后显示 */
body.render-ready {
    visibility: visible !important;
    opacity: 1 !important;
}

/* ==================== CSS 变量（必须放在最前面！） ==================== */
:root {
    /* 主色调 - 纯黑色主题 */
    --primary-50: #ffffff;
    --primary-100: #f8f9fa;
    --primary-200: #e9ecef;
    --primary-300: #dee2e6;
    --primary-400: #ced4da;
    --primary-500: #adb5bd;
    --primary-600: #6c757d;
    --primary-700: #495057;
    --primary-800: #1a1a1a;
    --primary-900: #000000;

    /* 强调色 - 现代绿 */
    --accent-50: #f0fdf4;
    --accent-100: #dcfce7;
    --accent-200: #bbf7d0;
    --accent-300: #86efac;
    --accent-400: #4ade80;
    --accent-500: #22c55e;
    --accent-600: #16a34a;
    --accent-700: #15803d;
    --accent-800: #166534;
    --accent-900: #14532d;

    /* 功能色 */
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;

    /* 间距系统 */
    --space-1: 4px;
    --space-2: 6px;
    --space-3: 8px;
    --space-4: 12px;
    --space-5: 16px;
    --space-6: 20px;

    /* 字体系统 */
    --font-xs: 11px;
    --font-sm: 12px;
    --font-base: 13px;
    --font-lg: 14px;
    --font-xl: 16px;
    --font-2xl: 18px;

    /* 圆角 */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;

    /* 阴影 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.7);
}

/* ==================== 预设菜单样式 ==================== */
.preset-menu .subgroup-title {
    padding: 6px 12px 6px 20px;
    font-weight: 600;
    color: #93c5fd !important; /* 次级标题用蓝色提高层级对比 */
    background: #0b1220 !important;
    border-bottom: 1px solid #1f2a44 !important;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* 浅色主题下，“生成数量”标签文字加深，增强对比度 */
body.theme-light .batch-size-label {
    color: #4b5563 !important;
}

/* 标题栏按钮组容器 - 四个按钮均匀分布 */
.header-btn-group {
    display: flex;
    gap: 3px;
    margin-left: auto;
    align-items: center;
    flex-shrink: 0;
}

.section-theme-btn {
    padding: 0 4px;
    min-width: 24px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid #4b5563;
    background: #020617;
    color: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.section-theme-btn:hover {
    background: #111827;
    color: #f9fafb;
    border-color: #a3e635;
    box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.6);
}
.preset-menu .subgroup-title:hover { background: #0a0f1d !important; }
.preset-menu .subgroup-title::after {
    content: '▾';
    font-size: 11px;
    color: #93c5fd !important;
    transition: transform 0.15s ease;
}
.preset-menu .subgroup-title.collapsed::after { transform: rotate(-90deg); }
/* UXP/CEP 环境下 appearance:none 会导致 select 选项文字无法正确渲染而"乱码"，仅保留背景/边框样式 */
.dark-select,
.dark-select option,
.dark-select optgroup {
    background: #020617 !important;
    color: #e5e7eb !important;
    border: 1px solid #374151 !important;
}

.dark-select:focus {
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15) !important;
    border-color: #4ade80 !important;
    background: #1f1f1f !important;
    color: #e5e7eb !important;
}

/* 种子输入框样式 */
#bananaPage .dark-input,
#ecommercePanel .dark-input {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background: #1f1f1f !important;
    color: #e5e7eb !important;
    border: 1px solid #333 !important;
    border-radius: var(--radius-sm) !important;
    padding: var(--space-2) var(--space-3) !important;
    font-size: var(--font-sm) !important;
    transition: all 0.2s ease !important;
    width: calc(100% - 10px) !important;
    margin-left: 10px !important;
    min-height: 32px !important;
    box-sizing: border-box !important;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif !important;
}

#bananaPage .dark-input:focus,
#ecommercePanel .dark-input:focus {
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15) !important;
    border-color: #4ade80 !important;
    background: #1f1f1f !important;
    color: #e5e7eb !important;
}

#bananaPage .dark-input::placeholder,
#ecommercePanel .dark-input::placeholder {
    color: #6b7280 !important;
    opacity: 1 !important;
}

/* 种子容器和输入框 - 紧凑样式 */
.seed-container {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0; /* 移除上边距 */
    margin-left: 20px; /* 增加左边距，与开关保持距离 */
    flex-shrink: 0; /* 防止收缩 */
    flex-wrap: nowrap; /* 不允许换行 */
}

.seed-input {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background: #1f1f1f !important;
    color: #e5e7eb !important;
    border: 1px solid #333 !important;
    border-radius: var(--radius-sm) !important;
    padding: 4px 6px !important;
    font-size: 11px !important;
    transition: all 0.2s ease !important;
    width: 80px !important;
    height: 24px !important;
    box-sizing: border-box !important;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif !important;
    margin: 0 !important;
    flex-shrink: 0 !important; /* 防止被压缩 */
}

.seed-input:focus {
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15) !important;
    border-color: #4ade80 !important;
    background: #1f1f1f !important;
    color: #e5e7eb !important;
}

.seed-input::placeholder {
    color: #6b7280 !important;
    opacity: 1 !important;
    font-size: 10px !important;
}

/* 种子标签样式 */
.seed-label {
    color: var(--primary-200);
    font-size: var(--font-sm);
    font-weight: normal;
    user-select: none;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-smooth: always;
    white-space: nowrap;
}

/* 缩放到画布按钮样式 - 开关样式 */
.stretch-button-container {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex: 1;
    margin: 0;
    margin-left: 20px; /* 与随机种左对齐 */
}

.manual-stretch-btn {
    flex-shrink: 0;
    padding: 4px 10px;
    background: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.5);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-smooth: always;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    height: 26px;
    min-height: 26px;
    margin-top: 1px;
    align-self: center;
}

.manual-stretch-btn:hover:not(:disabled) {
    background: rgba(59, 130, 246, 0.45);
    border-color: rgba(59, 130, 246, 0.8);
    color: #bfdbfe;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

.manual-stretch-btn:active:not(:disabled) {
    background: rgba(59, 130, 246, 0.6);
    transform: translateY(0);
}

.manual-stretch-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--primary-700);
}

body.theme-light .manual-stretch-btn {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
    border-color: rgba(59, 130, 246, 0.4);
}

body.theme-light .manual-stretch-btn:hover:not(:disabled) {
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.7);
    color: #1d4ed8;
}

/* 下拉展开列表在某些宿主是系统控件，尽量覆盖 */
select.dark-select::-ms-expand { display: none; }
select.dark-select option { background: #1f1f1f !important; color: #e5e7eb !important; }
select.dark-select option:checked { background: #272727 !important; color: #ffffff !important; }
.results.compact {
    margin-top: 8px;
}
.results.compact #textOutput {
    padding: 8px 10px;
    background: #2d3032;
    color: #e5e7eb;
    border-radius: 6px;
    border: 1px solid #444;
    min-height: 24px;
}
/* 放大“描述提示词 *”输入框高度 */
#bananaPage .form-group sp-textarea#prompt {
    min-height: 160px !important;
    height: 160px !important;
    width: 100% !important;
    margin-left: 0 !important;
    line-height: 1.4;
}

/* 兼容主题/其他覆盖规则 */
:root #bananaPage .form-group sp-textarea#prompt {
    min-height: 160px !important;
    height: 160px !important;
    width: 100% !important;
    margin-left: 0 !important;
}
/* 全局字体统一 - 确保所有文字使用一致字体 */
* {
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif !important;
    text-rendering: optimizeLegibility !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    font-smooth: always !important;
}

/* 取消所有圆角设计 - 移除半弧形 */
* {
    border-radius: 0;
}

/* 保持开关的圆角设计 */
.switch,
.slider,
.slider:before {
    border-radius: 24px !important;
}

/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    /* 强制可见，避免 CEP 白屏 */
    visibility: visible !important;
    opacity: 1 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: #000000 !important;
    color: #ffffff !important;  /* var(--primary-50) */
    overflow-x: hidden;
    line-height: 1.6;
    font-size: 12px;  /* var(--font-sm) */
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: transparent;
    position: relative;
}

.header {
    background: #111111 !important;
    color: #ffffff !important;  /* var(--primary-50) */
    padding: 12px 16px;  /* var(--space-4) var(--space-5) */
    text-align: center;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid #495057;  /* var(--primary-700) */
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(34, 197, 94, 0.1) 50%, transparent 70%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.header h1 {
    font-size: 16px;  /* var(--font-xl) */
    margin-bottom: 4px;  /* var(--space-1) */
    font-weight: 700;
    position: relative;
    z-index: 1;
    background: linear-gradient(135deg, #ffffff 0%, #86efac 100%);  /* var(--primary-50) var(--accent-300) */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    font-size: var(--font-xs);
    opacity: 0.9;
    position: relative;
    z-index: 1;
    color: var(--primary-300);
}

.main-content {
    flex: 1;
    padding: 12px;
    padding-inline: 12px;
    padding-bottom: 40px;
    overflow-y: auto;
    /* 为纵向滚动条预留稳定槽位，避免内容相对视窗“偏右”、左右留白不对称的错觉（Chromium/UXP） */
    scrollbar-gutter: stable;
    background: #000000 !important;
    border-radius: 0; /* 取消圆角设计 */
    margin-top: -2px;
    position: relative;
    z-index: 1;
    box-sizing: border-box;
}

.top-account-summary-bar {
    display: block;
    margin: 0 0 12px 0;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.28);
    background:
        linear-gradient(135deg, rgba(17, 24, 39, 0.96) 0%, rgba(15, 23, 42, 0.96) 55%, rgba(12, 74, 110, 0.82) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 8px 20px rgba(2, 6, 23, 0.28);
}

.app-container.api-config-open #topAccountSummaryBar {
    display: none !important;
}

.top-account-summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
}

.top-account-summary-main {
    min-width: 0;
    flex: 1 1 auto;
}

.top-account-summary-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: #93c5fd;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.top-account-summary-name {
    font-size: 16px;
    font-weight: 700;
    color: #f8fafc;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-account-summary-balance {
    flex: 0 0 auto;
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 4px;
    min-width: 0;
}

.top-account-summary-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    margin-left: 4px;
    color: #93c5fd;
    font-size: 12px;
    line-height: 1;
    transition: transform 0.18s ease;
}

.top-account-summary-bar.is-expanded .top-account-summary-chevron {
    transform: rotate(180deg);
}

.top-account-summary-balance-label {
    font-size: 11px;
    color: #cbd5e1;
}

.top-account-summary-balance-amount {
    font-size: 18px;
    font-weight: 800;
    color: #4ade80;
    line-height: 1;
}

.top-account-summary-balance-unit {
    font-size: 11px;
    color: #cbd5e1;
}

.top-account-summary-refresh-btn {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    margin-left: 6px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.55);
    color: #e2e8f0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.top-account-summary-refresh-btn:hover {
    transform: rotate(20deg);
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(96, 165, 250, 0.8);
}

.top-account-summary-refresh-btn:disabled {
    opacity: 0.6;
    cursor: default;
    transform: none;
}

.top-account-summary-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    display: flex;
    flex-direction: column;
    transition: max-height 0.22s ease, opacity 0.18s ease, margin-top 0.18s ease;
    margin-top: 0;
}

.top-account-summary-bar.is-expanded .top-account-summary-content {
    max-height: 140px;
    opacity: 1;
    margin-top: 12px;
}

.top-account-summary-actions {
    display: flex;
    gap: 8px;
}

.top-account-summary-toggle-row {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.top-account-summary-toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 40px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.42);
    border: 1px solid rgba(96, 165, 250, 0.24);
}

.top-account-summary-toggle-label input[type="checkbox"] {
    order: 2;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    accent-color: #22c55e;
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.35);
}

.top-account-summary-toggle-label .toggle-text {
    order: 1;
    flex: 1 1 auto;
    color: #eaf2ff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.top-account-summary-toggle-label:hover {
    background: rgba(30, 41, 59, 0.7);
    border-color: rgba(96, 165, 250, 0.55);
}

.top-account-summary-toggle-label:hover .toggle-text {
    color: #ffffff;
}

.top-account-summary-action-btn {
    flex: 1 1 0;
    min-width: 0;
    min-height: 34px;
    padding: 0 12px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.top-account-summary-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.26);
}

.top-account-summary-action-btn.secondary {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.95) 0%, rgba(2, 132, 199, 0.95) 100%);
}

body.theme-light .top-account-summary-bar {
    border-color: rgba(59, 130, 246, 0.2);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 250, 252, 0.98) 55%, rgba(224, 242, 254, 0.95) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), 0 8px 18px rgba(148, 163, 184, 0.16);
}

body.theme-light .top-account-summary-title {
    color: #2563eb;
}

body.theme-light .top-account-summary-name {
    color: #0f172a;
}

body.theme-light .top-account-summary-balance-label,
body.theme-light .top-account-summary-balance-unit {
    color: #475569;
}

body.theme-light .top-account-summary-refresh-btn {
    background: rgba(255, 255, 255, 0.88);
    color: #334155;
    border-color: rgba(148, 163, 184, 0.45);
}

body.theme-light .top-account-summary-chevron {
    color: #2563eb;
}

body.theme-light .top-account-summary-toggle-label {
    background: rgba(255, 255, 255, 0.86);
    border-color: rgba(59, 130, 246, 0.2);
}

body.theme-light .top-account-summary-toggle-label .toggle-text {
    color: #1e3a8a;
}

.tabs {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 12px 16px 10px;
    background: linear-gradient(180deg, rgba(10, 14, 24, 0.98) 0%, rgba(6, 10, 18, 0.92) 100%);
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
    position: relative;
    z-index: 20;
}

.tabs::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: min(420px, calc(100% - 32px));
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.25), rgba(34, 197, 94, 0.25), transparent);
}

.tab-button {
    min-width: 108px;
    height: 34px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid rgba(71, 85, 105, 0.7);
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.92) 0%, rgba(2, 6, 23, 0.96) 100%);
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.tab-button:hover {
    color: #f8fafc;
    border-color: rgba(129, 140, 248, 0.65);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
    transform: translateY(-1px);
}

.tab-button.active {
    color: #f8fafc;
    border-color: rgba(129, 140, 248, 0.92);
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.88) 0%, rgba(37, 99, 235, 0.88) 52%, rgba(34, 197, 94, 0.78) 100%);
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

@media (max-width: 420px) {
    .tabs {
        gap: 8px;
        padding: 10px 10px 8px;
    }

    .tab-button {
        min-width: 0;
        flex: 1;
        padding: 0 10px;
        font-size: 11px;
    }
}

.layout-two-columns {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-top: 8px;
}

.column-left,
.column-right {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.column-left {
    flex: 3;
}

.column-right {
    flex: 2;
    border-left: 1px solid var(--primary-700);
    padding-left: 8px;
}

/* 配置区域 - 纯黑色主题 */
#bananaPage .config-section {
    background: #020617 !important;
    border: 1px solid #1f2937;
    border-radius: var(--radius-lg) !important;
    padding: 0; /* 内边距由子元素控制 */
    margin-bottom: 10px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7);
}

/* API 配置作为弹窗显示时的专用样式 */
.api-config-modal {
    position: fixed;
    top: 12px;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 94%;
    max-width: 420px;
    z-index: 10000;
    max-height: calc(100vh - 24px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 弹窗标题栏始终在内容区之上，避免与下方展开块（如版本选择）产生叠层混淆 */
.api-config-modal .config-header {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
}

.api-config-modal #configContent {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.api-config-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 9999;
}

.api-config-modal-hidden {
    display: none !important;
}

.simple-history-modal {
    top: 12px;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 92%;
    max-width: 420px;
    max-height: calc(100vh - 24px);
    z-index: 25001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.simple-history-body {
    flex: 1 1 auto;
    max-height: calc(100vh - 96px);
    min-height: 0;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
}

.simple-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.simple-history-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.simple-history-refresh,
.simple-history-more {
    min-width: 72px;
    white-space: nowrap;
}

.simple-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.simple-history-empty {
    padding: 20px 12px;
    color: var(--uxp-host-text-color-secondary, #999);
    font-size: 13px;
    text-align: center;
}

.simple-history-item {
    padding: 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.simple-history-item-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.simple-history-item-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--uxp-host-text-color, #f3f3f3);
}

.simple-history-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    color: var(--uxp-host-text-color-secondary, #999);
    font-size: 11px;
}

.simple-history-item-content {
    color: var(--uxp-host-text-color, #ddd);
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.simple-history-item-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
}

.simple-history-footer {
    display: flex;
    justify-content: center;
    padding-top: 12px;
}

.simple-history-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.5;
}

.simple-history-badge.info {
    background: rgba(59, 130, 246, 0.14);
    color: #93c5fd;
}

.simple-history-badge.warning {
    background: rgba(245, 158, 11, 0.14);
    color: #fcd34d;
}

.simple-history-badge.critical {
    background: rgba(239, 68, 68, 0.14);
    color: #fca5a5;
}

.simple-history-badge.unread {
    background: rgba(34, 197, 94, 0.14);
    color: #86efac;
}

.simple-history-badge.pending {
    background: rgba(245, 158, 11, 0.14);
    color: #fcd34d;
}

.simple-history-badge.paid {
    background: rgba(34, 197, 94, 0.14);
    color: #86efac;
}

.simple-history-badge.closed,
.simple-history-badge.failed {
    background: rgba(239, 68, 68, 0.14);
    color: #fca5a5;
}

#announcementCenterOverlay,
#paymentHistoryOverlay,
#commissionLogsOverlay {
    z-index: 25000;
}

body.simple-history-modal-open {
    overflow: hidden !important;
}

body.simple-history-modal-open #mainTabs,
body.simple-history-modal-open #bananaPage > :not(#announcementCenterOverlay):not(#announcementCenterModal):not(#paymentHistoryOverlay):not(#paymentHistoryModal):not(#commissionLogsOverlay):not(#commissionLogsModal) {
    visibility: hidden !important;
    pointer-events: none !important;
}

body.simple-history-modal-open #announcementCenterOverlay,
body.simple-history-modal-open #announcementCenterModal,
body.simple-history-modal-open #paymentHistoryOverlay,
body.simple-history-modal-open #paymentHistoryModal,
body.simple-history-modal-open #commissionLogsOverlay,
body.simple-history-modal-open #commissionLogsModal {
    visibility: visible !important;
    pointer-events: auto !important;
}

/* 首次使用免责声明弹窗 */
.disclaimer-overlay {
    position: fixed;
    inset: 0;
    background: #020617; /* 使用不透明深色，避免下方提示词输入框透出 */
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.disclaimer-modal {
    width: 90%;
    max-width: 420px;
    max-height: 80vh;
    background: #020617;
    border-radius: var(--radius-md);
    border: 1px solid #4b5563;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.disclaimer-title {
    font-size: 14px;
    font-weight: 600;
    color: #e5e7eb;
}

.disclaimer-scroll {
    flex: 1;
    padding: 8px;
    background: #020617;
    border-radius: 4px;
    border: 1px solid #374151;
    max-height: 52vh;
    overflow-y: auto;
    font-size: 11px;
    line-height: 1.5;
    color: #e5e7eb;
}

.disclaimer-scroll h3 {
    margin-top: 8px;
    margin-bottom: 4px;
    font-size: 12px;
    color: #e5e7eb;
}

.disclaimer-scroll p {
    margin: 0 0 4px 0;
}

.disclaimer-actions {
    display: flex;
    justify-content: flex-end;
}

.disclaimer-agree-btn {
    padding: 6px 16px;
    border-radius: 999px;
    border: 1px solid #16a34a;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #f9fafb;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.disclaimer-agree-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.disclaimer-agree-btn:not(:disabled):hover {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

body.theme-light .disclaimer-modal {
    background: #f9fafb;
    border-color: #d1d5db;
}

body.theme-light .disclaimer-title {
    color: #111827;
}

body.theme-light .disclaimer-scroll {
    background: #ffffff;
    border-color: #e5e7eb;
    color: #111827;
}

body.theme-light .disclaimer-scroll h3 {
    color: #111827;
}

/* 登录遮罩由上方 #loginOverlay / .login-overlay 统一定义 */

.login-modal-hidden {
    display: none !important;
    visibility: hidden !important;
}

/* 登录弹窗容器 */
.login-modal {
    width: 90%;
    max-width: 380px;
    max-height: 80vh;
    background: #0f172a;
    border-radius: var(--radius-md);
    border: 1px solid #334155;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 登录弹窗标题栏 */
.login-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

/* 登录弹窗标题 */
.login-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #f1f5f9;
    margin: 0;
}

/* 关闭按钮 */
.login-close-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 20px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
}

.login-close-btn:hover {
    background: #1e293b;
    color: #f1f5f9;
}

/* 登录表单 */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-form-hidden {
    display: none !important;
}

/* 登录字段 */
.login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-field label {
    font-size: 13px;
    font-weight: 500;
    color: #cbd5e1;
}

/* 登录错误 */
.login-error {
    font-size: 12px;
    color: #ef4444;
    min-height: 18px;
    text-align: center;
}

/* 登录提交按钮 */
.login-submit-btn {
    padding: 12px;
    border-radius: 6px;
    border: none;
    background: #3b82f6;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.login-submit-btn:hover {
    background: #2563eb;
}

/* 登录切换链接 */
.login-switch {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #94a3b8;
}

.login-switch button {
    background: none;
    border: none;
    color: #3b82f6;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
}

.login-switch button:hover {
    text-decoration: underline;
}

.login-admin-note {
    margin-top: 2px;
    font-size: 12px;
    line-height: 1.5;
    color: #94a3b8;
    text-align: center;
}

.login-remember-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #cbd5e1;
    cursor: pointer;
    user-select: none;
}

.login-remember-row input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin: 0;
}

.login-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-form-group label {
    font-size: 13px;
    font-weight: 500;
    color: #cbd5e1;
}

.login-form-group input {
    padding: 10px 12px;
    border-radius: 6px;
    border: 2px solid #f59e0b !important;
    background: #1e293b !important;
    background-color: #1e293b !important;
    color: #ffffff !important;
    font-size: 14px;
    transition: all 0.2s ease;
    caret-color: #ffffff !important;
    opacity: 1 !important;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}

.login-form-group input:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.login-form-group input::placeholder {
    color: #94a3b8 !important;
}

.login-error {
    font-size: 12px;
    color: #ef4444;
    min-height: 18px;
    text-align: center;
}

.login-submit-btn {
    padding: 12px;
    border-radius: 6px;
    border: none;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    margin-top: 4px;
}

.login-submit-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.login-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.login-switch-mode {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #94a3b8;
}

.login-switch-btn {
    background: none;
    border: none;
    color: #3b82f6;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    transition: color 0.18s ease;
}

.login-switch-btn:hover {
    color: #60a5fa;
    text-decoration: underline;
}

/* 浅色主题 */
body.theme-light .login-modal {
    background: #ffffff;
    border-color: #e2e8f0;
}

body.theme-light .login-title {
    color: #1e293b;
}

body.theme-light .login-close-btn {
    color: #64748b;
}

body.theme-light .login-close-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
}

body.theme-light .login-form-group label {
    color: #475569;
}

body.theme-light .login-form-group input {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
}

body.theme-light .login-form-group input:focus {
    border-color: #3b82f6;
}

body.theme-light .login-form-group input::placeholder {
    color: #94a3b8;
}

body.theme-light .login-switch-mode {
    color: #64748b;
}

body.theme-light .login-switch-btn {
    color: #2563eb;
}

body.theme-light .login-switch-btn:hover {
    color: #3b82f6;
}

/* 用户信息显示区域 */
.user-info-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #1e293b;
    border-radius: 6px;
    border: 1px solid #334155;
    margin-top: 8px;
}

.user-info-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: #f1f5f9;
}

.user-role {
    font-size: 11px;
    color: #94a3b8;
}

.user-logout-btn {
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid #475569;
    background: transparent;
    color: #94a3b8;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.user-logout-btn:hover {
    background: #334155;
    color: #f1f5f9;
    border-color: #64748b;
}

/* 浅色主题下的用户信息 */
body.theme-light .user-info-section {
    background: #f8fafc;
    border-color: #e2e8f0;
}

body.theme-light .user-avatar {
    background: linear-gradient(135deg, #3b82f6 0%, #a78bfa 100%);
}

body.theme-light .user-name {
    color: #1e293b;
}

body.theme-light .user-role {
    color: #64748b;
}

.user-invitation-section {
    margin: 2px 0 4px;
    padding: 10px 12px;
    min-height: 0 !important;
    height: auto !important;
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.18);
}

.user-invitation-header {
    margin-bottom: 8px;
}

.user-invitation-title {
    font-size: 12px;
    font-weight: 700;
    color: #93c5fd;
}

.user-invitation-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.user-invitation-row.compact {
    margin-top: 8px;
}

.user-invitation-text-group {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.user-invitation-label {
    font-size: 11px;
    color: #94a3b8;
}

.user-invitation-value {
    font-size: 13px;
    font-weight: 600;
    color: #f1f5f9;
    word-break: break-all;
}

.user-invitation-copy-btn {
    flex: 0 0 auto;
    min-width: 68px;
    justify-content: center;
}

body.theme-light .user-invitation-section {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.18);
}

body.theme-light .user-invitation-title {
    color: #2563eb;
}

body.theme-light .user-invitation-label {
    color: #64748b;
}

body.theme-light .user-invitation-value {
    color: #1e293b;
}

body.theme-light .user-logout-btn {
    border-color: #cbd5e1;
    color: #64748b;
}

body.theme-light .user-logout-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* 登录触发按钮 */
.login-trigger-btn {
    width: 100%;
    padding: 10px 16px;
    border-radius: 6px;
    border: 1px solid #3b82f6;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
}

.login-trigger-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

body.theme-light .login-trigger-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

body.theme-light .login-trigger-btn:hover {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* 配置标题栏 */
.config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 6px; /* 进一步减少内边距 */
    background: #333333;
    cursor: default;
    user-select: none;
    transition: background-color 0.2s ease;
    min-height: 16px; /* 进一步减少最小高度 */
}

.config-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.config-header:hover {
    background: #3a3a3a;
}

.config-header h3 {
    margin: 0;
    color: var(--primary-50);
    font-size: 10px; /* 进一步减小字体 */
    font-weight: 600;
    line-height: 1; /* 最紧凑的行高 */
}

.config-header .expand-btn {
    background: transparent;
    border: none;
    color: var(--primary-300);
    font-size: 8px; /* 进一步减小箭头大小 */
    cursor: pointer;
    transition: transform 0.2s ease;
    padding: 0; /* 移除内边距 */
    width: 12px; /* 进一步减小宽度 */
    height: 12px; /* 进一步减小高度 */
    display: flex;
    align-items: center;
    justify-content: center;
}

.api-config-close-btn {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 1px solid #22c55e;
    background: #020617;
    color: #22c55e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: all 0.18s ease;
}

.api-config-close-btn:hover {
    background: #22c55e;
    color: #020617;
    border-color: #22c55e;
}

.config-header .expand-btn:hover {
    color: var(--primary-50);
}

.config-header .expand-btn.collapsed {
    transform: rotate(-90deg);
}

/* 配置内容区域 */
.config-content {
    padding: 12px; /* 适中的内边距 */
    transition: all 0.15s ease; /* 进一步加快动画 */
    overflow: hidden;
}

.simple-history-modal .config-content.simple-history-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

.config-content.collapsed {
    max-height: 0;
    padding: 0; /* 完全移除折叠时的内边距 */
    opacity: 0;
    margin: 0; /* 移除边距 */
    border: none; /* 移除边框 */
}

/* 折叠时隐藏所有子元素 */
.config-content.collapsed * {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

/* 折叠状态指示器 */
.config-collapse-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 0;
    margin-top: 4px;
    border-top: 1px solid var(--primary-700);
    font-size: var(--font-xs);
    color: var(--primary-400);
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.config-collapse-indicator:hover {
    opacity: 1;
}

.collapse-icon {
    font-size: 10px;
    color: var(--accent-400);
    transition: transform 0.2s ease;
}

.collapse-text {
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-smooth: always;
}

/* 取消悬停效果 */
/* .config-section:hover {
    border-color: var(--accent-500);
} */

/* API输入组样式 - 现代化设计 */
#bananaPage .api-input-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    align-items: stretch;
}

#bananaPage .api-input-actions {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    justify-content: flex-end;
}

#bananaPage .api-input-group input {
    flex: 1;
    margin-bottom: 0;
    background: #020617 !important;
    border: 1px solid #374151 !important;
    border-radius: var(--radius-sm) !important;
    padding: var(--space-2) var(--space-3) !important;
    font-size: var(--font-sm) !important;
    color: #e5e7eb !important;
    transition: all 0.2s ease !important;
    height: 32px !important;
}

#bananaPage .api-input-group input:focus {
    border-color: var(--accent-500) !important;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1) !important;
    outline: none !important;
}

#bananaPage .api-input-group .toggle-btn,
#bananaPage .api-input-group .save-btn {
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-xs);
    white-space: nowrap;
    border-radius: var(--radius-sm);
    font-weight: normal;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    height: 32px;
    min-width: 60px;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-smooth: always;
}

#bananaPage .config-section.collapsed {
    padding: 2px 6px;
}

.config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.config-header h3 {
    margin: 0;
    color: #475569;
    font-size: 1rem;
}

.config-collapsed {
    animation: fadeIn 0.3s ease;
}

.config-expanded {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.config-summary {
    display: flex;
    gap: 15px;
    font-size: 0.8rem;
    color: #475569;
}

.config-summary div {
    display: flex;
    align-items: center;
    gap: 5px;
}

.config-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

#bananaPage .toggle-btn, #bananaPage .save-btn, #bananaPage .expand-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

#bananaPage .toggle-btn {
    background: var(--primary-700);
    color: var(--primary-50);
    border: 1px solid var(--primary-600);
}

#bananaPage .toggle-btn:hover {
    background: var(--primary-600);
    border-color: var(--primary-500);
}

#bananaPage .save-btn {
    background: var(--accent-500);
    color: var(--primary-50);
    border: 1px solid var(--accent-400);
}

#bananaPage .save-btn:hover {
    background: var(--accent-600);
    border-color: var(--accent-300);
}

#bananaPage .expand-btn {
    background: #f59e0b;
    color: white;
    padding: 4px 8px;
    font-size: 0.7rem;
}

#bananaPage .expand-btn:hover {
    background: #d97706;
}

#bananaPage .config-status {
    display: none;
    margin-top: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
}

#bananaPage .config-status.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

#bananaPage .config-status.error {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* API额度进度条样式 */
.quota-progress-section {
    margin-top: 4px;
    padding: 4px 0 0;
    border-radius: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    transition: all 0.2s ease;
}

.quota-bar-and-percentage {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
    width: calc(100% - 10px);
    margin-left: 10px; /* 与上方下拉框左边缘对齐 */
}

/* 复制微信号按钮 */
.wechat-copy-btn {
    margin-top: 6px;
    margin-left: 10px;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid #4b5563;
    background: #020617;
    color: #e5e7eb;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.wechat-copy-btn:hover {
    border-color: #22c55e;
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.4);
}

body.theme-light .wechat-copy-btn {
    background: #f9fafb !important;
    color: #111827 !important;
    border-color: #cbd5e1 !important;
}

.quota-progress-bar {
    flex: 1;
    height: 16px; /* 更粗一点，接近下拉框的视觉高度 */
    background: #111827;
    border-radius: 0;
    overflow: hidden;
}

.quota-percentage {
    color: var(--accent-400);
    font-size: var(--font-xs);
    font-weight: 500;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
    background: transparent;
    padding: 0;
    border-radius: 0;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: none;
}

.quota-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e 0%, #4ade80 100%);
    border-radius: 0;
    transition: width 0.25s ease-out;
    width: 0%;
    box-shadow: none;
}

/* 根据额度百分比改变颜色 */
.quota-progress-fill.high {
    background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
}

.quota-progress-fill.medium {
    background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
}

.quota-progress-fill.low {
    background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

.quota-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-xs);
    color: var(--primary-300);
    margin-top: 1px;
    width: calc(100% - 10px);
    margin-left: 10px; /* 让下方“已用 / 总额”也与下拉框对齐 */
}

.quota-used,
.quota-total {
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}

/* 进度条动画效果 */
.quota-progress-fill {
    position: relative;
    overflow: hidden;
}

/* Mac系统进度条特殊处理 */
@supports (-webkit-appearance: none) {
    .quota-progress-fill {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        will-change: width;
    }
}

.quota-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* 上传区域 - 纯黑色主题 */
.upload-section {
    margin-bottom: 10px;
    padding: 10px;
    padding-inline: 10px; /* 与滚动区配合，左右内边距严格对称 */
    border: 1px solid #1f2937;
    background: radial-gradient(circle at top left, #020617 0, #020617 40%, #020617 100%) !important;
    border-radius: var(--radius-lg) !important;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.75);
}

/* 在 API 配置弹窗打开时，直接对需要隐藏的具体元素执行 display:none
   不使用 visibility:hidden/pointer-events:none，因为它们无法被子元素覆盖，
   会导致配置面板（嵌套在 main-content 内部）也被一起禁用 */
.app-container.api-config-open .upload-section,
.app-container.api-config-open .input-settings-section,
.app-container.api-config-open .tabs,
.app-container.api-config-open #prompt,
.app-container.api-config-open .preview-prompt,
.app-container.api-config-open #results {
    display: none !important;
}

/* API 配置弹窗自身和遮罩层不受影响，正常显示 */
.app-container.api-config-open #configSection,
.app-container.api-config-open #apiConfigOverlay {
    display: block !important;
}

.app-container.api-config-open #configSection.api-config-modal {
    display: flex !important;
}

.upload-section.task-manager-hidden,
.input-settings-section.task-manager-hidden {
    display: none;
}

/* 显示免责声明时，隐藏主界面内容，避免视觉重叠 */
.app-container.disclaimer-active .main-content {
    visibility: hidden;
}

/* 显示登录弹窗时：与配置弹窗一致，直接隐藏主内容（display:none），避免提示词框露出 */
.app-container.login-active .main-content {
    display: none !important;
}
/* 登录时同时隐藏上传区/参数区（与配置弹窗用同一套 class，见 openApiConfigPanel） */
.app-container.login-active .upload-section,
.app-container.login-active .input-settings-section {
    display: none !important;
}
/* 登录时隐藏顶部标签栏，避免任何主界面元素露出 */
.app-container.login-active .tabs {
    display: none !important;
}
/* 无论 DOM 结构如何，登录时强制隐藏提示词输入框，防止重叠到登录界面上 */
.app-container.login-active #prompt,
.app-container.login-active .preview-prompt {
    display: none !important;
    visibility: hidden !important;
}

/* 登录输入框 - UXP 兼容 */
.simple-input {
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    border: 2px solid #f59e0b;
    border-radius: 6px;
    font-size: 14px;
    color: #000 !important;
    background: #fff !important;
    outline: none;
    box-sizing: border-box;
    -webkit-text-fill-color: #000 !important;
}
.simple-input::placeholder {
    color: #666 !important;
    -webkit-text-fill-color: #666 !important;
}
.simple-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.simple-password {
    -webkit-text-security: disc;
}

/* 登录层：与免责声明弹窗一致，全屏不透明 + 最高 z-index，独立堆叠层防止被主界面遮挡 */
#loginOverlay,
.login-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: #020617 !important;
    z-index: 2147483647 !important;
    /* 默认隐藏，显示/隐藏由 JS 控制（避免与登录成功后主界面叠加） */
    display: none;
    align-items: center !important;
    justify-content: center !important;
    pointer-events: auto !important;
}
/* 登录弹窗内容：确保在遮罩之上、可点击 */
#loginOverlay .login-modal {
    position: relative !important;
    z-index: 2147483647 !important;
    pointer-events: auto !important;
}
#loginOverlay .login-form,
#loginOverlay .login-switch,
#loginOverlay .login-switch button,
#loginOverlay .login-close-btn,
#loginOverlay .login-submit-btn {
    pointer-events: auto !important;
}

/* 取消悬停效果 */
/* .upload-section:hover {
    border-color: var(--accent-500);
} */

.upload-section h3,
.input-settings-section h3,
.results h3 {
    margin-bottom: var(--space-2);
    color: #9ca3af;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

/* Banana 顶部标题移除，只保留操作按钮行 */
.upload-section h3 {
    justify-content: stretch;
    display: none;
}

.upload-section h3 > span,
.upload-section h3::before {
    display: none;
}

.upload-section h3 > span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1 1 auto;
}

.upload-section h3::before,
.input-settings-section h3::before,
.results h3::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(180deg, #4ade80, #16a34a);
}

/* 标题右侧的小设置按钮（API 配置入口） */
.section-settings-btn {
    padding: 0 8px;
    min-width: 0;
    height: 22px;
    border-radius: 4px;
    border: 1px solid #4b5563;
    background: #020617;
    color: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1;
    flex: 1 1 0;
}

.header-btn-group {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    flex-wrap: nowrap;
    margin-left: 0;
    flex: 1 1 100%;
    max-width: none;
    width: 100%;
    justify-content: stretch;
}

.banana-top-actions {
    margin: 0 0 6px 0;
}

.section-theme-btn {
    flex: 1 1 0;
    min-width: 0;
    height: 24px;
    font-size: 9px;
}

#openApiConfig,
#taskManagerBtn {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
}

.header-btn-group > button {
    flex: 1 1 0;
    min-width: 0;
}

#taskManagerBtn #taskManagerCount {
    font-size: 0.9em;
    margin-left: 2px;
}

.section-settings-btn:hover {
    background: #111827;
    color: #f9fafb;
    border-color: #a3e635;
    box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.6);
}

.upload-area {
    text-align: center;
    padding: 8px;
}

.upload-btn {
    display: inline-block;
    padding: var(--space-2) var(--space-4);
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
    color: var(--primary-50);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--font-sm);
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.upload-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
}

.upload-btn:hover::before {
    left: 100%;
}

.upload-info {
    margin-top: 8px;
    font-size: 0.75rem;
    color: #64748b;
}


.image-preview-item {
    position: relative;
    background: var(--primary-50);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid var(--primary-300);
}

.image-preview-item:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-400);
}

.image-preview-item img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    display: block;
}

.image-remove-btn {
    position: absolute;
    top: var(--space-1);
    right: var(--space-1);
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, var(--error) 0%, #dc2626 100%);
    color: var(--primary-50);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.image-remove-btn:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: scale(1.15);
    box-shadow: var(--shadow-md);
}

/* 表单样式 - 精致紧凑设计 */
#bananaPage .form-group {
    margin-bottom: 8px; /* 减小间距 */
}

#bananaPage .form-group label {
    display: block;
    margin-bottom: var(--space-1);
    font-weight: normal;
    color: var(--primary-200);
    font-size: var(--font-sm);
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-smooth: always;
}

#bananaPage .form-group input,
#bananaPage .form-group textarea,
#bananaPage .form-group sp-textarea,
#bananaPage .form-group select {
    width: calc(100% - 10px) !important; /* 与预设下拉框保持一致 */
    margin-left: 10px !important; /* 与预设下拉框保持一致 */
    padding: var(--space-2) var(--space-3) !important;
    border: 1px solid #374151 !important;
    border-radius: var(--radius-sm) !important;
    font-size: var(--font-sm) !important;
    transition: all 0.2s ease !important;
    background: #020617 !important;
    color: #e5e7eb !important;
    font-weight: normal !important;
    display: block !important;
    min-height: 32px !important;
    height: auto !important;
    box-sizing: border-box !important;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif !important;
    text-rendering: optimizeLegibility !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    font-smooth: always !important;
}

#bananaPage .form-group input:focus,
#bananaPage .form-group textarea:focus,
#bananaPage .form-group select:focus {
    outline: none !important;
    border-color: var(--accent-500) !important;
    background: #020617 !important;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25) !important;
    width: calc(100% - 10px) !important; /* 保持宽度一致 */
    margin-left: 10px !important; /* 保持左边距一致 */
}

/* 自定义下拉（预设） */
#promptPreset {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    position: absolute !important;
    pointer-events: none !important;
}

.preset-dropdown { position: relative; width: calc(100% - 10px); margin-left: 10px; }
.preset-trigger {
    width: 100%;
    min-height: 32px;
    padding: 6px;
    border: 1px solid #374151 !important;
    border-radius: var(--radius-sm) !important;
    background: #020617 !important;
    color: #e5e7eb !important;
    box-sizing: border-box;
    font-size: var(--font-sm) !important;
    line-height: 1.4;
    cursor: pointer;
    transition: all 0.2s ease !important;
    box-shadow: inset 3px 0 0 rgba(34, 197, 94, 0.8), 0 0 0 1px rgba(15, 23, 42, 0.85);
}
.preset-trigger:focus { 
    outline: none !important; 
    border-color: var(--accent-500) !important; 
    background: #020617 !important; 
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25) !important; 
}
.preset-menu {
    position: fixed; /* 脱离父级裁剪 */
    top: 0; left: 0;
    min-width: 240px;
    max-height: 280px;
    overflow-y: auto;
    background: #1f1f1f !important;
    border: 1px solid #333 !important;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.45) !important;
    z-index: 9999;
    overscroll-behavior: contain; /* 防止滚轮穿透到面板 */
    color: #e5e7eb !important;
}

/* 打开下拉时为容器增加底部占位，避免与下方重叠 */
.preset-dropdown.open { margin-bottom: 300px; }

/* 下拉展开时锁定面板滚动（UXP宿主会强推滚动到容器，这里强制关闭） */
html.no-scroll, body.no-scroll { overflow: hidden !important; overscroll-behavior: contain; }
.main-content.no-scroll { overflow: hidden !important; }
.preset-menu .group-title {
    padding: 8px 12px;
    font-weight: 700;
    color: #a7f3d0 !important; /* 更显眼的绿色 */
    background: #1f2937 !important; /* 更深背景形成对比 */
    border-bottom: 1px solid #334155 !important;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.preset-menu .group-title:hover { background: #0f172a !important; }
.preset-menu .group-title::after {
    content: '▾';
    font-size: 12px;
    color: #a7f3d0 !important;
    transition: transform 0.15s ease;
}
.preset-menu .group-title.collapsed { opacity: 0.95; }
.preset-menu .group-title.collapsed::after { transform: rotate(-90deg); }
.preset-menu .menu-item { transition: height 0.15s ease, opacity 0.15s ease; }
.preset-menu .menu-item {
    padding: 8px 12px;
    color: #e5e7eb !important;
    background: #1f1f1f !important;
    border-bottom: 1px solid #2a2a2a !important;
    font-size: 0.85rem;
    cursor: pointer;
}
.preset-menu .menu-item:hover { background: #2a2a2a !important; }

#bananaPage .form-group input:focus,
#bananaPage .form-group textarea:focus,
#bananaPage .form-group select:focus {
    outline: none;
    border-color: var(--accent-500);
    background: #020617;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}

#bananaPage .form-group sp-textarea {
    resize: vertical;
    min-height: 200px;
}

/* 单独放大提示词输入框高度 */
#prompt {
    min-height: 160px;
    height: 160px;
    max-height: 500px;
    margin-left: 0 !important;
    width: 100% !important;
}

#prompt.wukong-prompt-preset-locked {
    opacity: 0.72;
    cursor: not-allowed;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

/* 输入和设置区域 - 统一卡片样式 */
.input-settings-section {
    background: #020617 !important;
    border: 1px solid #1f2937;
    border-radius: var(--radius-lg) !important;
    padding: 10px; /* 统一内边距 */
    margin-bottom: 10px; /* 统一间距 */
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.75);
}

.input-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.input-settings-toggle-btn {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid #4b5563;
    background: #020617;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    cursor: pointer;
    padding: 0;
    transition: all 0.18s ease;
}

.input-settings-toggle-btn:hover {
    background: #111827;
    color: #f9fafb;
    border-color: #a3e635;
}

.input-settings-content {
    margin-top: 4px;
}

.input-settings-content.collapsed {
    display: none;
}

/* 取消悬停效果 */
/* .input-settings-section:hover {
    border-color: var(--accent-500);
} */

/* 快捷操作开关 - 纯黑色主题 */
.quick-actions {
    display: flex;
    flex-direction: column; /* 改回纵向排列 */
    gap: 6px; /* 行间距 */
    margin: 0; /* 基础外边距 */
    background: transparent; /* 透明背景，使用父容器背景 */
    border: none; /* 移除边框，使用父容器边框 */
    border-radius: 0; /* 移除圆角 */
    padding: 0; /* 移除内边距，使用父容器内边距 */
    position: relative;
    overflow: visible; /* 改为可见，避免内容被裁剪 */
    min-width: 0; /* 防止flex子项溢出 */
}

/* 每一行的布局 */
.action-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    width: 100%;
    flex-wrap: wrap; /* 允许换行，防止元素重叠 */
}
/* 在输入设置卡片内，开关组与"选择张数"左/右边缘对齐 */
.input-settings-section .quick-actions { 
    width: 100% !important; 
    margin-left: 0 !important; 
    justify-content: flex-start !important; /* 左对齐，防止元素分散 */
}

.switch-container {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex: 0 0 auto; /* 改为不伸缩，保持内容宽度 */
    min-width: 0;
    flex-wrap: nowrap; /* 不允许换行 */
    overflow: visible;
}

.switch-label {
    color: var(--primary-200);
    font-size: var(--font-sm);
    font-weight: normal;
    user-select: none;
    flex: 0 0 auto; /* 改为不拉伸 */
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-smooth: always;
    white-space: nowrap;
    overflow: visible;
    text-overflow: unset;
    line-height: 1.4;
    letter-spacing: normal;
    word-spacing: normal;
}

/* 预设选择器样式 */
#bananaPage .form-group select optgroup {
    font-weight: 600;
    color: #cbd5e1 !important;
    background-color: #262626 !important;
    padding: 5px 0;
}

#bananaPage .form-group select option {
    padding: 8px 12px;
    color: #e5e7eb !important;
    background-color: #1f1f1f !important;
}

#bananaPage .form-group select option:hover {
    background-color: #272727 !important;
}

/* 开关样式 - 暗黑科幻风 */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #020617; /* 关闭时深黑轨道 */
    border-radius: 999px;
    border: 1px solid #374151;
    transition: all 0.2s ease;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.9);
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: #e5e7eb; /* 关闭时浅灰滑块 */
    border-radius: 999px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
    transition: all 0.2s ease;
}

input:checked + .slider {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-color: #4ade80;
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.6), 0 0 14px rgba(34, 197, 94, 0.5);
}

input:checked + .slider:before {
    transform: translateX(20px);
    background: #ecfdf5;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.7);
}

.slider:hover {
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.9), 0 0 10px rgba(148, 163, 184, 0.4);
}

.generate-btn {
    width: 100%;
    padding: 8px 12px;  /* var(--space-3) var(--space-4) */
    background: #22c55e;  /* var(--accent-500) */
    color: #ffffff;  /* var(--primary-50) */
    border: 1px solid #4ade80;  /* var(--accent-400) */
    border-radius: 4px;  /* var(--radius-sm) */
    font-size: 13px;  /* var(--font-base) */
    font-weight: normal;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;  /* var(--space-3) */
    height: 36px;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-smooth: always;
}

.generate-btn:hover:not(:disabled) {
    background: #16a34a;  /* var(--accent-600) */
    border-color: #86efac;  /* var(--accent-300) */
}

.generate-btn:active:not(:disabled) {
    background: #15803d;  /* var(--accent-700) */
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #495057 !important;  /* var(--primary-700) */
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 30px;
    color: #666;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #64748b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 中断按钮 */
.cancel-btn {
    margin-top: 15px;
    padding: 8px 20px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.cancel-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

.cancel-btn:active {
    transform: translateY(0);
}

/* 结果区域 - 纯黑色主题 */
.results {
    margin-top: var(--space-5);
    padding: var(--space-4);
    border: 1px solid var(--primary-700);
    background: #111111;
    border-radius: var(--radius-sm);
    position: relative;
    overflow: hidden;
}

.results h3 {
    margin-bottom: var(--space-4);
    color: var(--primary-50);
    font-size: var(--font-lg);
    font-weight: 700;
}

.image-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 15px;
}

.image-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.image-item:hover {
    transform: translateY(-3px);
}

.image-item img {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: contain;
    display: block;
    background: #f8f9fa;
}

.image-info {
    padding: 10px;
    font-size: 0.8rem;
    color: #666;
    border-top: 1px solid #e1e5e9;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.image-title {
    font-weight: 600;
    color: #374151;
}

.image-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.action-btn {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.download-btn {
    background: #16a34a;
    color: white;
}

.download-btn:hover {
    background: #15803d;
}

.send-to-ps-btn {
    background: #0ea5e9;
    color: white;
}

.send-to-ps-btn:hover {
    background: #0284c7;
}

.text-output {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #64748b;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    color: #1e293b;
    white-space: pre-wrap;
}

.error {
    background: #fee;
    border-left-color: #f56565;
    color: #c53030;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.empty-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.empty-state h3 {
    color: #475569;
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.empty-state p {
    font-size: 0.9rem;
    line-height: 1.4;
}

/* 响应式设计 */
@media (max-width: 400px) {
    .main-content {
        padding: 15px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .config-summary {
        flex-direction: column;
        gap: 8px;
    }
}

/*（旧版强制灰色主题已移除，改用统一深灰主题，详见文件后面的 body/.config-section/.upload-section 规则）*/

/* 上传按钮容器 - 现代化设计 */
#bananaPage .upload-buttons-container {
    display: flex;
    gap: 2px; /* 再缩小按钮之间的间距，避免整体太宽 */
    width: 100%;
    margin: 6px 0 8px 0; /* 减小间距 */
    flex-wrap: nowrap; /* 一排展示 */
    justify-content: space-between; /* 平均分布 */
    align-items: stretch;
}

#bananaPage .upload-button {
    flex: 1 1 0%; /* 平均分配宽度，允许根据容器宽度自适应 */
    min-width: 0; /* 允许根据空间缩放，但配合 overflow: visible 仍能完整显示文字 */
    padding: 8px 16px; /* 再略微放大按钮，给文字更多空间 */
    background: radial-gradient(circle at top, #111827 0, #020617 45%, #020617 100%);
    border: 1px solid #4b5563;
    border-radius: 999px;
    color: #e5e7eb;
    font-size: 11px; /* 字号保持，但因为按钮更大更容易容纳文字 */
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    min-height: 34px;
    height: 34px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-smooth: always;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.9), 0 0 0 1px rgba(15, 23, 42, 0.7);
    line-height: 1.1;
    display: flex;
    align-items: center;
    justify-content: center;
    word-break: normal;
}

/* 让“开始生成”按钮独占一行且填满红框宽度 */
#bananaPage .upload-buttons-container:first-of-type .upload-button#generateBtn {
    flex: 1 1 100%;
    height: 80px; /* 增加高度，仅影响“开始生成” */
    font-size: 16px;
}

/* 主界面按钮列布局 + 统一矩形风格 */
#bananaPage .upload-buttons-column {
    flex-direction: column !important;
    gap: 6px !important;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important; /* 避免继承 space-between 在列方向产生怪异对齐 */
    align-items: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* 列布局下按钮占满上传区内宽，避免视觉“靠右” */
#bananaPage .upload-section .upload-buttons-column .upload-button {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    align-self: stretch !important;
    box-sizing: border-box !important;
}

/* 统一去掉胶囊圆角，整齐矩形 */
#bananaPage .upload-buttons-column .upload-button {
    border-radius: 6px !important;
}

/* "开始生成" 正常高度，"电商详情页" 作为次要按钮略矮 */
#bananaPage .upload-buttons-column .upload-button#generateBtn {
    flex: 0 0 80px;
    border-radius: 8px 8px 4px 4px !important;
}

#bananaPage .upload-buttons-column .ec-detail-inline-row {
    display: flex;
    gap: 6px;
    width: 100%;
    flex: 0 0 42px;
}

#bananaPage .upload-buttons-column .ec-detail-inline-row .upload-button {
    flex: 1 1 0%;
    min-width: 0;
    height: 42px;
    margin-top: 0 !important;
}

#bananaPage .upload-buttons-column .ec-detail-inline-row #openEcommerceBtn {
    border-radius: 4px 4px 4px 8px !important;
}

#bananaPage .upload-buttons-column .ec-detail-inline-row #openInteriorDesignBtn {
    border-radius: 4px 4px 8px 4px !important;
}

/* 常用功能（可折叠勾选，介于「开始生成」与「电商详情」之间） */
.quick-functions-box {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(55, 65, 81, 0.95);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.55);
    padding: 6px 8px 8px;
    flex: 0 0 auto;
}

.quick-functions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.quick-functions-title {
    font-size: 12px;
    font-weight: 600;
    color: #cbd5e1;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}

.quick-functions-collapse-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.quick-functions-collapse-btn:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.06);
}

.quick-functions-content {
    margin-top: 6px;
    max-height: 220px;
    overflow-y: auto;
}

.quick-functions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
}

.wukong-quick-fn-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
    color: #e2e8f0;
    user-select: none;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}

.wukong-quick-fn-checkbox {
    width: 14px;
    height: 14px;
    accent-color: #10b981;
    cursor: pointer;
    flex-shrink: 0;
}

.wukong-quick-fn-text {
    line-height: 1.25;
}

/* 分类 tab：两行，每行 flex，3+2 均分 */
.quick-functions-tabs {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 4px;
    width: 100%;
    box-sizing: border-box;
}

.quick-functions-tabs .qf-tab-row {
    display: flex;
    gap: 3px;
    width: 100%;
    box-sizing: border-box;
}

.quick-functions-tabs .qf-tab-btn {
    flex: 1 1 0%;
    box-sizing: border-box;
    background: transparent;
    border: 1px solid rgba(100, 116, 139, 0.5);
    border-radius: 3px;
    color: #94a3b8;
    font-size: 10px;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
    padding: 1px 4px;
    height: 18px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-width: 0;
}

.qf-tab-btn:hover {
    border-color: #10b981;
    color: #10b981;
}

.qf-tab-btn.qf-tab-active {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
}

body.theme-light .qf-tab-btn {
    border-color: rgba(148, 163, 184, 0.5);
    color: #64748b;
}

body.theme-light .qf-tab-btn:hover {
    border-color: #10b981;
    color: #10b981;
}

body.theme-light .qf-tab-btn.qf-tab-active {
    background: #10b981;
    color: #fff;
}

body.theme-light .quick-functions-box {
    background: rgba(248, 250, 252, 0.95);
    border-color: rgba(148, 163, 184, 0.55);
}

body.theme-light .quick-functions-title {
    color: #334155;
}

body.theme-light .quick-functions-collapse-btn {
    color: #64748b;
}

body.theme-light .quick-functions-collapse-btn:hover {
    color: #0f172a;
    background: rgba(15, 23, 42, 0.06);
}

body.theme-light .wukong-quick-fn-label {
    color: #1e293b;
}

/* 电商详情页按钮：次要风格（非主色，描边感） */
.ec-detail-inline-btn {
    background: rgba(5, 150, 105, 0.12) !important;
    border: 1px solid rgba(16, 185, 129, 0.4) !important;
    color: #6ee7b7 !important;
}

.ec-detail-inline-btn:hover {
    background: rgba(5, 150, 105, 0.22) !important;
    border-color: rgba(16, 185, 129, 0.65) !important;
}

/* 电商面板底部按钮改为垂直排列，开始生成高度减半 */
.ec-button-row-col {
    flex-direction: column !important;
    gap: 6px !important;
}

.ec-button-row-col .ec-btn-primary {
    flex: 0 0 36px !important;
    padding: 4px 12px !important;
    font-size: 12px !important;
    border-radius: 6px !important;
}

.ec-button-row-col .ec-btn-secondary {
    flex: 0 0 36px !important;
    padding: 4px 12px !important;
    font-size: 12px !important;
    border-radius: 6px !important;
}

#openEcommerceBtn.active,
#openInteriorDesignBtn.active {
    background: rgba(4, 120, 87, 0.3) !important;
}

/* 深色主题下“开始生成”按钮禁用态（灰色） */
#bananaPage .upload-button#generateBtn:disabled {
    background: #4b5563;
    border-color: #4b5563;
    color: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
}

#bananaPage .upload-button:hover {
    background: radial-gradient(circle at top, #1f2937 0, #020617 50%, #020617 100%);
    border-color: #6b7280;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.9), 0 6px 14px rgba(0, 0, 0, 0.7);
}

#bananaPage .upload-button:active {
    background: #020617;
    transform: translateY(1px);
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.9), 0 2px 4px rgba(0, 0, 0, 0.6);
}

/* 多预览框容器 - 现代化卡片区域 */
.multi-preview-container {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 8px;
    margin-top: 10px;
    padding: 6px;
    border-radius: var(--radius-md);
    background: #020617;
    border: 1px solid #1f2937;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.8);
    min-height: 140px; /* 防止高度被压成0，保证卡片区域始终可见 */
}

/* 预览下方的提示词输入框，让宽度与预览组对齐 */
.preview-prompt {
    padding: 0; /* 与“开始生成”按钮左右边缘对齐（使用父容器的内边距） */
    margin-top: 8px;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}
.upload-section .preview-prompt sp-textarea#prompt {
    width: 100% !important;
    margin-left: 0 !important;
    box-sizing: border-box;
    min-height: 160px;
    height: 160px;
    max-height: none;
    overflow-y: auto;
    line-height: 1.4;
}

/* 生成张数按钮组 - 横向排列 */
.batch-size-toggle {
    margin-top: 4px;
    padding: 0;
    display: flex;
    flex-direction: column; /* 上下两行：标签在上，按钮在下 */
    align-items: stretch; /* 与下方全宽按钮、提示词同宽 */
    gap: 2px;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.batch-size-label {
    font-size: 11px;
    color: #9ca3af;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.batch-size-buttons {
    display: flex;
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
    align-items: center;
}

.batch-size-btn {
    min-width: 26px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #4b5563;
    background: #020617;
    color: #e5e7eb;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
}

/* 自定义张数输入区：标签 + 输入框 靠右对齐 */
.batch-size-custom {
    display: flex;
    align-items: center;
    margin-left: auto; /* 将自定义输入推到行右侧 */
    gap: 0;
}

.batch-size-custom-label {
    font-size: 11px;
    color: #9ca3af;
}

/* 自定义张数输入框样式 */
.batch-size-input {
    width: 52px;
    padding: 2px 4px;
    border-radius: 4px;
    border: 1px solid #4b5563;
    background: #020617;
    color: #e5e7eb;
    font-size: 11px;
    text-align: center;
    outline: none;
}

.batch-size-input::-webkit-outer-spin-button,
.batch-size-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.batch-size-input[type=number] {
    appearance: textfield;
    -moz-appearance: textfield;
}

.batch-size-btn:hover {
    border-color: #a3e635;
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.4);
}

.batch-size-btn.active {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-color: #16a34a;
    color: #f9fafb;
}

/* 让"选择预设模版"和"选择照片张数"与上方提示词输入框左右对齐 */
/* 让下方控件与上方提示词输入框同宽、同左/右边缘（不再撑满卡片） */
.input-settings-section .form-group .preset-dropdown,
.input-settings-section .form-group select#batchSize,
.input-settings-section .form-group select#fanxingModel {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
}
.input-settings-section .form-group .preset-trigger { width: 100% !important; }

/* 服务器2的分辨率和画幅比例选择器对齐 */
.input-settings-section #imageSizeContainer {
    margin-bottom: 8px !important;
    margin-top: 4px !important; /* 缩小与上方的间距 */
    padding: 0 !important;
}

.input-settings-section #imageSizeContainer > div {
    display: flex !important;
    gap: 8px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.input-settings-section #imageSizeContainer select#imageSize {
    flex: 1 !important;
    width: 0 !important; /* flex布局下设为0让flex: 1生效 */
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
}

.input-settings-section #imageSizeContainer select#bananaAspectRatio {
    flex: 1 !important;
    width: 0 !important; /* flex布局下设为0让flex: 1生效 */
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
}

.input-settings-section #imageSizeContainer.gpt-image2-aspect-only select#imageSize {
    display: none !important;
}

.input-settings-section #imageSizeContainer.gpt-image2-aspect-only select#bananaAspectRatio {
    flex: 1 1 100% !important;
    width: 100% !important;
}

.preview-slot {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: relative;
    padding: 8px 8px 6px;
    border-radius: var(--radius-md);
    background: #020617;
    border: 1px solid #1f2937;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.7);
    transition: all 0.25s ease-out;
    min-height: 130px; /* 略微压低整体卡片高度 */
    flex: 1 1 0;
    min-width: 0;
}

/* 隐藏选区预览 */
.preview-slot[data-slot="selection"] {
    display: none !important;
}


.slot-label {
    font-size: 11px;
    color: #9ca3af;
    margin-bottom: 6px;
    text-align: left;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.slot-status {
    margin-top: 4px;
    font-size: 11px;
    color: #6b7280;
    text-align: left;
}

/* 槽位选择状态 - 卡片高亮 */
.preview-slot.selected {
    transform: translateY(-2px) scale(1.03);
    border-color: var(--accent-400);
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.7), 0 16px 32px rgba(34, 197, 94, 0.2);
}

.preview-slot.selected .slot-label {
    color: #4ade80;
}

/* 图像预览容器 - 现代化设计 */
.preview-container {
    width: 100%;
    height: 120px; /* 提高预览高度 */
    border-radius: 6px;
    overflow: hidden;
    margin: 0;
}

.image-drop-zone {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--primary-500); /* 增加边框宽度和对比度 */
    border-radius: 4px;
    overflow: hidden;
    background: #2a2a2a; /* 使用更亮的背景色 */
    /* 添加棋盘格背景来显示透明信息 */
    background-image: 
        linear-gradient(45deg, var(--primary-600) 25%, transparent 25%), 
        linear-gradient(-45deg, var(--primary-600) 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, var(--primary-600) 75%), 
        linear-gradient(-45deg, transparent 75%, var(--primary-600) 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
    transition: all 0.2s ease;
}

.clickable-drop-zone {
    cursor: pointer;
}

.clickable-drop-zone:hover {
    border-color: var(--accent-400);
}

.image-preview {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 1; /* 预览在下，删除按钮在上 */
    opacity: 1; /* 默认可见，避免缩略图完全透明 */
    transition: opacity 0.3s ease;
}

.image-preview.visible {
    opacity: 1; /* 保持兼容，未来如需再次做淡入动画可用 */
}

.drop-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff; /* 改为白色，确保可见 */
    font-size: 12px;
    pointer-events: none;
    z-index: 2;
    transition: opacity 0.3s ease;
    text-align: center;
    font-weight: normal;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-smooth: always;
}

.drop-text.hidden {
    opacity: 0;
}

.upload-status {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 3;
}

.upload-status.visible {
    opacity: 1;
}

.loading-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    z-index: 4;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 5px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 🚀 选区生成中的动画效果 */
.image-drop-zone.generating {
    border: 2px solid var(--accent-400) !important;
    background: rgba(34, 197, 94, 0.1) !important;
    animation: pulse-glow 2s ease-in-out infinite;
}

.image-drop-zone.generating .drop-text {
    color: var(--accent-400) !important;
    font-weight: normal !important;
    animation: text-pulse 1.5s ease-in-out infinite;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif !important;
    text-rendering: optimizeLegibility !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    font-smooth: always !important;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(34, 197, 94, 0.3);
        border-color: var(--accent-400) !important;
    }
    50% {
        box-shadow: 0 0 20px rgba(34, 197, 94, 0.6);
        border-color: var(--accent-500) !important;
    }
}

@keyframes text-pulse {
    0%, 100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.7;
        transform: translate(-50%, -50%) scale(1.05);
    }
}

.remove-image-btn {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 16px;
    height: 16px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50% !important;
    cursor: pointer;
    font-size: 12px;
    line-height: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10; /* 提高删除按钮层级，避免被图片覆盖 */
    transition: background-color 0.2s, transform 0.1s ease;
    position: absolute;
}

/* 使用两根白色细线绘制“×”，避免字体渲染差异 */
.remove-image-btn::before,
.remove-image-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 2px;
    background: #ffffff;
    transform-origin: center;
    pointer-events: none;
}

.remove-image-btn::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.remove-image-btn::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.remove-image-btn:hover {
    background: rgba(239, 68, 68, 1);
}

.upload-btn {
    position: absolute;
    top: 5px;
    left: 5px;
    padding: 5px 10px;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    z-index: 2;
    transition: background-color 0.2s;
}

/* 默认隐藏“选区预览”整个槽位，彻底不占空间 */
.preview-slot[data-slot="selection"] {
    display: none;
}

.upload-btn:hover {
    background: #357abd;
}

/* 强制深灰色主题覆盖 - 更舒适的深色 */
body {
    visibility: visible !important;
    opacity: 1 !important;
    background: #1a1a1a !important;
}

.main-content {
    background: #1a1a1a !important;
    scrollbar-gutter: stable;
}

#bananaPage .config-section {
    background: #2a2a2a !important;
}

.upload-section {
    background: #2a2a2a !important;
}

.quick-actions {
    background: #2a2a2a !important;
}

.results {
    background: #2a2a2a !important;
}

.image-preview-grid {
    background: #2a2a2a !important;
}

.image-drop-zone {
    background: #2a2a2a !important;
}

/* 尝试覆盖Photoshop系统UI */
html {
    background: #1a1a1a !important;
}

/* 覆盖可能的系统标题栏 */
[data-uxp-panel] {
    background: #1a1a1a !important;
}

/* 覆盖面板容器 */
.uxp-panel {
    background: #1a1a1a !important;
}

/* 覆盖可能的系统UI元素 */
.uxp-panel-header,
.uxp-panel-title,
.uxp-panel-toolbar {
    background: #2a2a2a !important;
    color: #ffffff !important;
}

/* 覆盖底部状态栏 */
.uxp-panel-footer,
.uxp-panel-status {
    background: #2a2a2a !important;
    color: #ffffff !important;
}

/* ==================== Temperature 滑块样式 ==================== */

/* Temperature 容器 */
.temperature-container {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: 0;
    width: 100%;
}

/* Temperature 标签 */
.temperature-label {
    color: var(--primary-200);
    font-size: var(--font-sm);
    font-weight: normal;
    user-select: none;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
    white-space: nowrap;
}

/* Temperature 值显示 */
#temperatureValue {
    color: #4ade80;
    font-weight: 600;
    min-width: 25px;
    display: inline-block;
    text-align: center;
}

/* Temperature 滑块 */
.temperature-slider {
    flex: 1;
    min-width: 150px;
    height: 6px;
    background: linear-gradient(to right, #6366f1, #8b5cf6, #ec4899);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.temperature-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #4ade80;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 4px rgba(74, 222, 128, 0.5);
    transition: all 0.2s ease;
}

.temperature-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.8);
}

.temperature-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #4ade80;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 4px rgba(74, 222, 128, 0.5);
    transition: all 0.2s ease;
}

.temperature-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.8);
}

/* ==================== 自动扩大画布开关样式 ==================== */

/* 主页：提示词下方「AI 优化」条 — 与生成数量区对齐、留白充足 */
.ai-prompt-optimize-bar {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin-top: 10px;
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(55, 65, 81, 0.85);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.72) 0%, rgba(15, 23, 42, 0.45) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.ai-prompt-optimize-bar.preset-disabled {
    opacity: 0.6;
}

.ai-prompt-optimize-bar.preset-disabled .ai-prompt-optimize-title {
    color: #9ca3af;
}

.ai-prompt-optimize-inner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    min-width: 0;
}

/* 与全局 .switch 一致，此处仅保证垂直居中标题区 */
.ai-prompt-optimize-switch {
    flex-shrink: 0;
    margin-top: 2px;
}

.ai-prompt-optimize-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.ai-prompt-optimize-title {
    font-size: 13px;
    font-weight: 500;
    color: #e5e7eb;
    letter-spacing: 0.02em;
    line-height: 1.35;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}

.ai-prompt-optimize-hint {
    font-size: 11px;
    line-height: 1.45;
    color: #6b7280;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}

.ai-prompt-optimize-modes-wrap {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(55, 65, 81, 0.65);
}

.ai-prompt-optimize-mode-label {
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9ca3af;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}

.ai-prompt-optimize-mode-select {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 36px;
    margin: 0 !important;
    box-sizing: border-box !important;
}

body.theme-light .ai-prompt-optimize-bar {
    border-color: rgba(209, 213, 219, 1);
    background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

body.theme-light .ai-prompt-optimize-title {
    color: #111827;
}

body.theme-light .ai-prompt-optimize-hint {
    color: #6b7280;
}

body.theme-light .ai-prompt-optimize-modes-wrap {
    border-top-color: rgba(203, 213, 225, 0.95);
}

body.theme-light .ai-prompt-optimize-mode-label {
    color: #64748b;
}

body.theme-light .ai-prompt-optimize-mode-select {
    background: #f9fafb !important;
    color: #334155 !important;
    border-color: rgba(203, 213, 225, 0.95) !important;
}

.auto-expand-toggle {
    display: flex;
    align-items: center;
    margin-left: var(--space-3);
    flex-shrink: 0;
    white-space: nowrap;
}

#bananaPage .toggle-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    user-select: none;
}

#bananaPage .toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #4ade80;
}

.toggle-text {
    color: var(--primary-200);
    font-size: var(--font-sm);
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
    white-space: nowrap;
}

#bananaPage .toggle-label:hover .toggle-text {
    color: #4ade80;
}

/* ==================== 高清放大功能样式 ==================== */

/* 高清放大区域使用与配置区域相同的样式 */
#upscaleSection {
    background: #2a2a2a !important;
    border: 1px solid var(--primary-700);
    border-radius: var(--radius-sm);
    padding: 0; /* 移除内边距，由子元素控制 */
    margin-bottom: 8px;
    margin-top: 8px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

/* 高清放大区域折叠样式 */
#upscaleSection.collapsed {
    padding: 2px 6px;
}

#upscaleHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 6px;
    cursor: pointer;
    user-select: none;
    background: #333333;
    border: none;
    color: var(--primary-50);
    font-size: 10px;
    font-weight: 600;
    transition: all 0.2s ease;
    min-height: 16px;
}

#upscaleHeader:hover {
    background: #3a3a3a;
}

#upscaleContent {
    padding: 12px;
    transition: all 0.3s ease;
    overflow: hidden;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}

#upscaleContent.collapsed {
    max-height: 0;
    padding: 0;
    opacity: 0;
    margin: 0;
}

#upscaleToggle {
    background: transparent;
    border: none;
    color: var(--primary-300);
    font-size: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
    padding: 0;
    width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#upscaleToggle:hover {
    color: var(--primary-50);
}

#upscaleToggle.collapsed {
    transform: rotate(-90deg);
}

.upscale-header {
    margin-bottom: 8px;
}

.upscale-header h3 {
    margin: 0;
    color: var(--primary-50);
    font-size: var(--font-sm);
    font-weight: 600;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}

.upscale-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin: 0;
    padding: 0;
}

.upscale-slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.upscale-label {
    color: var(--primary-200);
    font-size: var(--font-sm);
    font-weight: normal;
    user-select: none;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
    white-space: nowrap;
    min-width: 110px;
}

.upscale-value {
    color: #4ade80;
    font-weight: 600;
    min-width: 25px;
    display: inline-block;
    text-align: center;
}

.upscale-slider {
    flex: 1;
    min-width: 150px;
    height: 6px;
    background: linear-gradient(to right, #4ade80, #22c55e, #16a34a);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upscale-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #4ade80;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 4px rgba(74, 222, 128, 0.5);
    transition: all 0.2s ease;
}

.upscale-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.8);
}

.upscale-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #4ade80;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 4px rgba(74, 222, 128, 0.5);
    transition: all 0.2s ease;
}

.upscale-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.8);
}

.upscale-buttons-container {
    display: flex;
    gap: 8px;
    width: 100%;
    align-items: stretch;
}

.upscale-button {
    flex: 1;
    min-width: 0;
    padding: 6px 8px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: var(--primary-50);
    border: 1px solid #16a34a;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 48px;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-smooth: always;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin: 0;
}

.upscale-cancel-button {
    flex: 0 0 auto;
    min-width: 80px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: var(--primary-50);
    border: 1px solid #dc2626;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 48px;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-smooth: always;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin: 0;
}

.upscale-cancel-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    border-color: #b91c1c;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

.upscale-cancel-button:active:not(:disabled) {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
    transform: translateY(0);
}

.upscale-cancel-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--primary-700);
}

.upscale-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    border-color: #15803d;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(34, 197, 94, 0.3);
}

.upscale-button:active:not(:disabled) {
    background: linear-gradient(135deg, #15803d 0%, #14532d 100%);
    transform: translateY(0);
}

.upscale-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--primary-700);
}

.upscale-status {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: var(--font-sm);
    text-align: center;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}

.upscale-status.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.upscale-status.error {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.upscale-status.processing {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* 浅色主题覆盖样式 */
body.theme-light {
    background: #b8c1cc !important; /* 再稍微压暗一点整体背景灰度 */
    color: #111827 !important;
}

body.theme-light #bananaPage .config-section,
body.theme-light .upload-section,
body.theme-light .input-settings-section,
body.theme-light .results {
    background: #e5e7eb !important; /* 卡片本身也稍微压暗 */
    border-color: #cbd5e1 !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.16);
}

body.theme-light .upload-section h3,
body.theme-light .input-settings-section h3,
body.theme-light .results h3 {
    color: #374151 !important; /* 覆盖 gemini-styles 中 .upload-section h3 的白色 */
}

body.theme-light .upload-section h3::before,
body.theme-light .input-settings-section h3::before,
body.theme-light .results h3::before {
    background: linear-gradient(180deg, #3b82f6, #22c55e);
}

body.theme-light #bananaPage .form-group input,
body.theme-light #bananaPage .form-group textarea,
body.theme-light #bananaPage .form-group select {
    background: #f9fafb !important; /* 不用纯白，大面积区域更柔和 */
    color: #111827 !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 0 0 1px rgba(209, 213, 219, 0.9) !important;
}

body.theme-light #bananaPage .form-group input:focus,
body.theme-light #bananaPage .form-group textarea:focus,
body.theme-light #bananaPage .form-group select:focus {
    background: #ffffff !important;
    border-color: #22c55e !important;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.35) !important;
}

body.theme-light .preset-trigger {
    background: #f9fafb !important;
    color: #111827 !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 0 0 1px rgba(209, 213, 219, 0.9) !important;
}

body.theme-light .preset-menu {
    background: #ffffff !important;
    border-color: #e5e7eb !important;
}

/* 浅色主题下：统一覆盖所有 dark-select 下拉框的外层样式（标题栏） */
body.theme-light .main-content select.dark-select {
    background: #f9fafb !important;
    color: #111827 !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 0 0 1px rgba(209, 213, 219, 0.9) !important;
}

body.theme-light .main-content select.dark-select:focus {
    background: #ffffff !important;
    border-color: #22c55e !important;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3) !important;
}

/* 浅色主题下，服务器2分辨率/画幅比例选择器改为浅灰风格 */
body.theme-light .input-settings-section #imageSizeContainer select#imageSize,
body.theme-light .input-settings-section #imageSizeContainer select#bananaAspectRatio {
    background: #f9fafb !important;
    color: #111827 !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 0 0 1px rgba(209, 213, 219, 0.9) !important;
}

body.theme-light .input-settings-section #imageSizeContainer select#imageSize:focus,
body.theme-light .input-settings-section #imageSizeContainer select#bananaAspectRatio:focus {
    background: #ffffff !important;
    border-color: #22c55e !important;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3) !important;
}

body.theme-light .quota-progress-bar {
    background: #e5e7eb;
}

body.theme-light .quota-details {
    color: #4b5563;
}

body.theme-light .upload-section,
body.theme-light .input-settings-section {
    background: radial-gradient(circle at top left, #ffffff 0, #f9fafb 40%, #f3f4f6 100%) !important;
}

/* 进一步柔化浅色主题，避免过于刺眼的纯白 */
body.theme-light {
    background: #a7b4c7 !important;
    color: #111827 !important;
}

body.theme-light .main-content {
    background: #a7b4c7 !important; /* 与 body 保持一致的中灰 */
    color: #111827 !important; /* 覆盖 gemini 中 .main-content 的白字 */
}

body.theme-light #bananaPage .config-section,
body.theme-light .upload-section,
body.theme-light .input-settings-section,
body.theme-light .results {
    background: #d7dde5 !important; /* 再灰一点，但仍略浅于整体背景 */
    border-color: #cbd5e1 !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
    color: #111827 !important; /* 覆盖 gemini 中这些区域的白色文字 */
}

/* 浅色主题下，所有表单标签文字改为深灰，避免白字 */
body.theme-light #bananaPage .form-group label {
    color: #374151 !important;
}

/* 浅色主题下的上传/操作按钮统一样式 */
body.theme-light #bananaPage .upload-button {
    background: linear-gradient(135deg, #ffffff 0%, #e5e7eb 100%) !important;
    color: #111827 !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

body.theme-light #bananaPage .upload-button:hover {
    background: linear-gradient(135deg, #e5e7eb 0%, #d4d4d8 100%) !important;
    border-color: #9ca3af !important;
    box-shadow: 0 2px 6px rgba(148, 163, 184, 0.35);
}

/* 浅色主题下的“开始生成”按钮维持主色绿色，但适配浅色风格 */
body.theme-light #bananaPage .upload-button#generateBtn {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
    color: #f9fafb !important;
    border-color: #16a34a !important;
    box-shadow: 0 4px 10px rgba(34, 197, 94, 0.4);
}

body.theme-light #bananaPage .upload-button#generateBtn:disabled {
    background: #d1d5db !important;
    color: #6b7280 !important;
    border-color: #9ca3af !important;
    box-shadow: none !important;
    cursor: not-allowed;
}

/* 浅色主题下的批量生成按钮组样式 */
body.theme-light .batch-size-btn {
    background: #e5e7eb !important;
    color: #111827 !important;
    border-color: #cbd5e1 !important;
}

body.theme-light .batch-size-btn:hover {
    border-color: #22c55e !important;
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.4);
}

body.theme-light .batch-size-btn.active {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
    border-color: #16a34a !important;
    color: #f9fafb !important;
    box-shadow: 0 3px 8px rgba(34, 197, 94, 0.4) !important;
}

/* 浅色主题下的自定义张数输入框样式 */
body.theme-light .batch-size-input {
    background: #f9fafb !important;
    color: #111827 !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 0 0 1px rgba(209, 213, 219, 0.9) !important;
}

body.theme-light .batch-size-custom-label {
    color: #6b7280 !important;
}

/* 浅色主题下的标题右侧小按钮（主题切换 / 配置） */
body.theme-light .section-theme-btn,
body.theme-light .section-settings-btn {
    background: #e5e7eb !important;
    color: #111827 !important;
    border-color: #cbd5e1 !important;
}

body.theme-light .section-theme-btn:hover,
body.theme-light .section-settings-btn:hover {
    background: #d4d4d8 !important;
    color: #111827 !important;
    border-color: #9ca3af !important;
    box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.5);
}

/* 浅色主题下的预览区域整体协调处理 */
body.theme-light .multi-preview-container {
    background: #e5e7eb !important;  /* 与整体卡片保持一致的浅灰 */
    border-color: #cbd5e1 !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18) !important;
}

body.theme-light .preview-slot {
    background: #f9fafb !important;  /* 浅灰卡片，避免整块太压抑 */
    border-color: #d1d5db !important;
    box-shadow: 0 3px 8px rgba(15, 23, 42, 0.15) !important;
}

body.theme-light .slot-label {
    color: #4b5563 !important;
}

body.theme-light .slot-status {
    color: #6b7280 !important;
}

body.theme-light .image-drop-zone {
    background: #020617 !important;   /* 去掉强棋盘格，改为纯深色底 */
    border-color: #111827 !important;
    background-image: none !important;
}

body.theme-light .drop-text {
    color: #9ca3af !important;
}

/* 浅色主题下的预览卡选中状态 - 绿色描边更清晰 */
body.theme-light .preview-slot.selected {
    border-color: #22c55e !important;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.7) !important;
}

body.theme-light .preview-slot.selected .slot-label {
    color: #16a34a !important;
}

/* 浅色主题下的结果区域和文本输出 */
body.theme-light .results {
    background: #e5e7eb !important;
    border-color: #cbd5e1 !important;
}

body.theme-light .results.compact #textOutput {
    background: #f9fafb !important;
    color: #111827 !important;
    border-color: #cbd5e1 !important;
}

/* 浅色主题下的加载状态和中断按钮 */
body.theme-light .loading {
    background: #e5e7eb !important;
    color: #374151 !important;
}

body.theme-light .cancel-btn {
    background: #ef4444 !important;
    border-color: #dc2626 !important;
    color: #f9fafb !important;
}

body.theme-light .cancel-btn:hover {
    background: #dc2626 !important;
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.35) !important;
}

/* 浅色主题下 API 输入区按钮（显示 / 保存） */
body.theme-light #bananaPage .api-input-group .toggle-btn {
    background: #e5e7eb !important;
    color: #111827 !important;
    border: 1px solid #cbd5e1 !important;
}

body.theme-light #bananaPage .api-input-group .toggle-btn:hover {
    background: #d4d4d8 !important;
    border-color: #9ca3af !important;
}

body.theme-light #bananaPage .api-input-group .save-btn {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
    color: #f9fafb !important;
    border: 1px solid #16a34a !important;
}

body.theme-light #bananaPage .api-input-group .save-btn:hover {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%) !important;
    border-color: #15803d !important;
}

/* 浅色主题下全局 toggle/save 按钮（如果有其他地方使用） */
body.theme-light #bananaPage .toggle-btn:not(.api-input-group .toggle-btn),
body.theme-light #bananaPage .expand-btn {
    background: #e5e7eb !important;
    color: #111827 !important;
    border: 1px solid #cbd5e1 !important;
}

body.theme-light #bananaPage .save-btn:not(.api-input-group .save-btn) {
    background: #22c55e !important;
    color: #f9fafb !important;
    border: 1px solid #16a34a !important;
}

/* 浅色主题下 quick-actions 背景统一为透明，由父卡片控制 */
body.theme-light .quick-actions {
    background: transparent !important;
}

/* 浅色主题下 dark-select 选项的下拉背景也改成浅色 */
body.theme-light select.dark-select option {
    background: #f9fafb !important;
    color: #111827 !important;
}

body.theme-light select.dark-select option:checked {
    background: #e5e7eb !important;
    color: #111827 !important;
}

/* 浅色主题下的开关/提示标签文本颜色加深，避免发白 */
body.theme-light .switch-label,
body.theme-light .seed-label,
body.theme-light .temperature-label {
    color: #374151 !important;
}

/* 浅色主题下的种子输入框样式 */
body.theme-light .seed-input {
    background: #f9fafb !important;
    color: #111827 !important;
    border-color: #cbd5e1 !important;
}

body.theme-light .seed-input:focus {
    background: #ffffff !important;
    border-color: #22c55e !important;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3) !important;
}

/* ==================== 任务管理面板样式 ==================== */
.task-manager-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #0f172a;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.task-manager-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid #1e293b;
    flex-shrink: 0;
}

.task-manager-header h3 {
    margin: 0;
    font-size: 14px;
    color: #e2e8f0;
}

.task-manager-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    min-width: 0;
    flex: 1 1 auto;
}

.task-manager-query-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 3px 10px;
    font-size: 11px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1;
}

.task-manager-query-btn:hover {
    background: #1d4ed8;
}

.task-manager-query-btn:disabled {
    background: #475569;
    cursor: not-allowed;
}

.task-manager-clear-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 3px 10px;
    font-size: 11px;
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1;
}

.task-manager-clear-btn:hover {
    background: #b91c1c;
}

.task-manager-close-btn {
    flex: 0 0 30px;
    padding: 2px 8px;
    font-size: 16px;
    background: transparent;
    color: #94a3b8;
    border: 1px solid #334155;
    border-radius: 4px;
    cursor: pointer;
    line-height: 1;
}

body.vi-vn-locale .upload-buttons-container {
    gap: 1px;
}

body.vi-vn-locale .upload-button,
body.vi-vn-locale .section-settings-btn,
body.vi-vn-locale .task-manager-query-btn,
body.vi-vn-locale .task-manager-clear-btn {
    letter-spacing: -0.01em;
}

body.vi-vn-locale .header-btn-group {
    gap: 3px;
}


.task-manager-close-btn:hover {
    color: #e2e8f0;
    border-color: #64748b;
}

.task-manager-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.task-manager-empty {
    text-align: center;
    color: #64748b;
    padding: 40px 0;
    font-size: 13px;
}

.task-manager-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 单条任务记录 */
.task-manager-item {
    background: #1e293b;
    border-radius: 8px;
    padding: 10px;
    border: 1px solid #334155;
}

.task-manager-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.task-manager-item-time {
    font-size: 11px;
    color: #64748b;
}

.task-manager-item-info {
    font-size: 11px;
    color: #94a3b8;
}

.task-manager-item-prompt {
    font-size: 11px;
    color: #cbd5e1;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* 缩略图网格 */
.task-manager-thumbs {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.task-manager-thumb-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.task-manager-thumb {
    position: relative;
    flex: 0 0 72px;
    width: 72px;
    height: 72px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.task-manager-thumb:hover {
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35);
}

.task-manager-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.task-manager-thumb-actions {
    flex: 1 1 auto;
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 8px;
    min-width: 0;
}

.task-manager-thumb-action-btn {
    flex: 1 1 0;
    min-width: 0;
    min-height: 32px;
    padding: 0 10px;
    background: rgba(59, 130, 246, 0.9);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    transition: background 0.15s, transform 0.15s;
}

.task-manager-thumb-action-btn:hover {
    background: rgba(59, 130, 246, 1);
    transform: translateY(-1px);
}

.task-manager-thumb-action-btn.new-doc {
    background: rgba(34, 197, 94, 0.85);
}

.task-manager-thumb-action-btn.new-doc:hover {
    background: rgba(34, 197, 94, 1);
}

/* 已导入标记 */
.task-manager-thumb.imported {
    border-color: #22c55e;
}

.task-manager-thumb.imported::after {
    content: '✓';
    position: absolute;
    top: 2px;
    right: 4px;
    color: #22c55e;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 0 0 3px rgba(0,0,0,0.8);
}

/* 任务进度条（生成中状态） */
.task-manager-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.task-manager-progress-bar {
    flex: 1;
    height: 18px;
    background: #2a2a2a;
    border-radius: 9px;
    overflow: hidden;
    position: relative;
}

.task-manager-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    transition: width 0.3s ease;
    border-radius: 9px;
}

.task-manager-progress-text {
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
    min-width: 70px;
}

.task-generating {
    border-color: #3b82f6;
}

.task-failed {
    border-color: #ef4444;
    opacity: 0.7;
}

/* 浅色主题适配 */
body.theme-light .task-manager-panel {
    background: #f8fafc;
}

body.theme-light .task-manager-header {
    border-bottom-color: #e2e8f0;
}

body.theme-light .task-manager-header h3 {
    color: #1e293b;
}

body.theme-light .task-manager-query-btn {
    background: #3b82f6;
}

body.theme-light .task-manager-query-btn:hover {
    background: #2563eb;
}

body.theme-light .task-manager-close-btn {
    color: #64748b;
    border-color: #cbd5e1;
}

body.theme-light .task-manager-item {
    background: #ffffff;
    border-color: #e2e8f0;
}

body.theme-light .task-manager-item-prompt {
    color: #374151;
}

body.theme-light .task-manager-empty {
    color: #94a3b8;
}

/* =============================================
   充值系统样式
   ============================================= */

/* 余额显示区 */
.user-balance-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.balance-info {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.balance-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.payment-history-entry {
    margin: 2px 0 4px;
    display: block;
    width: 100%;
    min-height: 0 !important;
    height: auto !important;
}

.payment-history-entry-btn {
    display: flex !important;
    align-items: center;
    width: 100%;
    justify-content: center;
    padding: 8px 12px;
    min-height: 36px !important;
    height: 36px !important;
    background: linear-gradient(135deg, #375dfb, #1d4ed8);
    color: #fff;
}

.network-test-entry {
    margin: 2px 0 4px;
    display: block;
    width: 100%;
    min-height: 0 !important;
    height: auto !important;
}

.network-test-entry-btn {
    display: flex !important;
    align-items: center;
    width: 100%;
    justify-content: center;
    padding: 8px 12px;
    min-height: 36px !important;
    height: 36px !important;
    background: linear-gradient(135deg, #0f766e, #0f9f87);
    color: #fff;
}

.network-test-result {
    margin-top: 6px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(96, 165, 250, 0.18);
}

.network-test-result-title {
    font-size: 12px;
    color: var(--uxp-host-text-color-secondary, #94a3b8);
    margin-bottom: 6px;
}

.network-test-summary {
    font-size: 13px;
    font-weight: 600;
    color: #e5e7eb;
    margin-bottom: 8px;
}

.network-test-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.network-test-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.network-test-label {
    font-size: 11px;
    color: var(--uxp-host-text-color-secondary, #94a3b8);
}

.network-test-value {
    font-size: 14px;
    font-weight: 700;
    color: #f8fafc;
}

.network-test-meta {
    margin-top: 8px;
    font-size: 11px;
    color: var(--uxp-host-text-color-secondary, #94a3b8);
}

.commission-center-card {
    margin: 2px 0 4px;
    padding: 10px 12px;
    min-height: 0 !important;
    height: auto !important;
    border-radius: 8px;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.18);
}

.commission-center-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.commission-center-title {
    font-size: 13px;
    font-weight: 700;
    color: #d1fae5;
}

.commission-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.commission-summary-item {
    padding: 8px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.commission-summary-label {
    font-size: 11px;
    color: var(--uxp-host-text-color-secondary, #94a3b8);
    margin-bottom: 4px;
}

.commission-summary-value {
    font-size: 14px;
    font-weight: 700;
    color: #f8fafc;
}

.commission-transfer-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.commission-transfer-input {
    flex: 1 1 auto;
    min-width: 0;
}

.commission-transfer-btn {
    flex: 0 0 auto;
    min-width: 96px;
    justify-content: center;
}

.commission-transfer-available {
    margin-top: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #bbf7d0;
}

.commission-transfer-hint {
    margin-top: 6px;
    font-size: 11px;
    color: var(--uxp-host-text-color-secondary, #94a3b8);
    line-height: 1.5;
}

.commission-history-entry {
    margin-top: 8px;
    margin-bottom: 0;
}

#configContent > #userInvitationSection + #paymentHistoryEntry,
#configContent > #paymentHistoryEntry + #commissionCenterCard,
#configContent > #commissionCenterCard + #networkTestEntry {
    margin-top: 2px !important;
}

.balance-label {
    font-size: 11px;
    color: var(--uxp-host-text-color-secondary, #999);
}

.balance-amount {
    font-size: 16px;
    font-weight: 700;
    color: #4ade80;
}

.balance-unit {
    font-size: 11px;
    color: var(--uxp-host-text-color-secondary, #999);
}

.recharge-trigger-btn {
    padding: 4px 12px;
    font-size: 12px;
    background: linear-gradient(135deg, #1473e6, #0d5dbf);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: opacity 0.2s;
}

.recharge-trigger-btn:hover {
    opacity: 0.85;
}

/* 余额区域的手动刷新按钮（小图标按钮） */
.balance-refresh-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    font-size: 14px;
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.balance-refresh-btn:hover {
    background: rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

.balance-refresh-btn:active {
    opacity: 0.7;
}

/* 充值弹窗打开时：主界面提示词/上传区不浮到弹窗上，并隐藏避免透出 */
body.recharge-modal-open .upload-section,
body.recharge-modal-open .input-settings-section {
    z-index: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
body.recharge-modal-open #prompt {
    z-index: 0 !important;
    visibility: hidden !important;
}

/* 充值弹窗遮罩：必须高于 API 配置弹窗(z-index:10000)，避免被遮挡 */
.recharge-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 25000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 弹窗主体 */
.recharge-modal {
    background: #2a2a2a;
    border-radius: 12px;
    width: 320px;
    max-width: 95vw;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.recharge-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.recharge-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.recharge-close-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.2s, background 0.2s;
}

.recharge-close-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.recharge-modal-body {
    padding: 16px 20px 20px;
}

/* 步骤容器 */
.recharge-step {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.recharge-hint {
    font-size: 13px;
    color: #bbb;
    margin: 0 0 12px;
}

/* 金额选择按钮组 */
.recharge-amounts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.amount-btn {
    padding: 10px 0;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.amount-btn:hover {
    background: rgba(20, 115, 230, 0.25);
    border-color: #1473e6;
    color: #fff;
}

.amount-btn.selected {
    background: #1473e6;
    border-color: #1473e6;
    color: #fff;
}

/* 自定义金额 */
.recharge-custom-label {
    font-size: 12px;
    color: #999;
    display: block;
    margin-bottom: 6px;
}

.recharge-custom-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.recharge-custom-input {
    flex: 1;
    padding: 8px 10px !important;
    font-size: 14px !important;
    border-radius: 6px !important;
    background: rgba(255,255,255,0.15) !important;
    border: 1px solid rgba(255,255,255,0.3) !important;
    color: #00ff88 !important;
    -webkit-text-fill-color: #00ff88 !important;
}
.recharge-custom-input::placeholder {
    color: rgba(255,255,255,0.5) !important;
    -webkit-text-fill-color: rgba(255,255,255,0.5) !important;
}

.recharge-confirm-btn {
    padding: 8px 18px;
    background: linear-gradient(135deg, #1473e6, #0d5dbf);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.recharge-confirm-btn:hover {
    opacity: 0.88;
}

.recharge-confirm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.recharge-error {
    color: #f87171;
    font-size: 12px;
    margin-top: 8px;
    padding: 6px 10px;
    background: rgba(248, 113, 113, 0.1);
    border-radius: 4px;
    border: 1px solid rgba(248, 113, 113, 0.2);
}

/* 二维码区域：防止被 flex 压缩导致底部裁切 */
.qr-section {
    text-align: center;
    padding: 4px 0;
    flex-shrink: 0;
}

.qr-amount-text {
    font-size: 14px;
    color: #ccc;
    margin: 0 0 12px;
}

.qr-amount-text strong {
    color: #4ade80;
    font-size: 18px;
}

/* 二维码容器：增大尺寸以提高扫码成功率 */
.qrcode-container {
    width: 300px;
    height: 300px;
    min-width: 300px;
    min-height: 300px;
    margin: 0 auto 12px;
    background: #fff;
    border-radius: 8px;
    padding: 12px;
    box-sizing: border-box;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.qrcode-container svg,
.qrcode-container canvas,
.qrcode-container img {
    max-width: 100% !important;
    max-height: 100% !important;
}

/* 表格二维码：增大到 280x280 像素 */
.qrcode-container table {
    width: 280px !important;
    height: 280px !important;
    min-width: 280px !important;
    min-height: 280px !important;
    max-width: 280px !important;
    max-height: 280px !important;
    flex-shrink: 0;
    border-spacing: 0 !important;
    border-collapse: collapse;
}

.qr-fallback-hint {
    font-size: 12px;
    color: #999;
    margin: 0 0 8px;
    text-align: center;
}
.qr-fallback-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px !important;
    font-size: 11px !important;
    color: #333 !important;
    -webkit-text-fill-color: #333 !important;
    background: #fff !important;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.qr-tip {
    font-size: 12px;
    color: #999;
    margin: 0 0 12px;
}

/* 状态栏 */
.recharge-status-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 14px;
}

.status-text {
    font-size: 13px;
    font-weight: 500;
}

.status-waiting { color: #facc15; }
.status-success { color: #4ade80; }
.status-failed  { color: #f87171; }
.status-paying  { color: #60a5fa; }

/* 转圈动画 */
.status-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: #60a5fa;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.status-spinner.hidden {
    display: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.recharge-cancel-btn {
    display: block;
    width: 100%;
    padding: 9px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #bbb;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.recharge-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* 支付结果 */
.recharge-result {
    text-align: center;
    padding: 16px 0 20px;
}

.result-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 12px;
    background: #166534;
    color: #4ade80;
}

.result-icon.fail {
    background: #7f1d1d;
    color: #f87171;
}

.result-text {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 6px;
}

.result-balance {
    font-size: 13px;
    color: #999;
    margin: 0 0 8px;
}

.result-tip {
    font-size: 12px;
    color: #f59e0b;
    margin: 0 0 12px;
}

.recharge-refresh-btn {
    background: #3b82f6;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    margin-bottom: 12px;
    transition: background 0.2s;
}

.recharge-refresh-btn:hover {
    background: #2563eb;
}


/* ============================================
   电商详情页弹窗（#ecommercePanel）— 紧凑、独立层级
   ============================================ */

/* 电商遮罩：与主界面同级挂在 body 下，必须高于 .preset-menu(9999)、.task-manager-panel(9998)、充值相关层 */
.ec-portal-overlay {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.72) !important;
    z-index: 28000 !important;
    pointer-events: auto !important;
}

/* 打开电商弹窗时，强制隐藏主界面所有元素（参考登录弹窗策略，彻底防止下层控件透上来） */
body.ec-modal-active .main-content,
body.ec-modal-active .upload-section,
body.ec-modal-active .input-settings-section,
body.ec-modal-active .tabs,
body.ec-modal-active #prompt,
body.ec-modal-active .preview-prompt {
    display: none !important;
    visibility: hidden !important;
}

/* RH 设置打开时，采用与电商弹窗一致的纯黑背景策略，彻底隐藏主界面内容 */
.app-container.rh-settings-open .main-content,
.app-container.rh-settings-open .upload-section,
.app-container.rh-settings-open .input-settings-section,
.app-container.rh-settings-open .tabs,
.app-container.rh-settings-open #prompt,
.app-container.rh-settings-open .preview-prompt,
.app-container.rh-settings-open #results {
    display: none !important;
    visibility: hidden !important;
}

#rhSettingsOverlay {
    display: none;
}

#rhSettingsModal {
    display: none;
}

body.rh-settings-open #rhSettingsOverlay {
    display: block !important;
    visibility: visible !important;
}

body.rh-settings-open #rhSettingsModal {
    display: flex !important;
    visibility: visible !important;
}

#ecommercePanel.ec-modal-root {
    z-index: 28001 !important;
    width: min(94vw, 400px);
    max-width: 400px;
    max-height: min(90vh, 560px);
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border: 1px solid #1e293b;
    border-radius: 10px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04);
    background: #0b1220;
}

/* 不与全局 .config-header 共用，避免 10px 标题 */
#ecommercePanel .ec-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    padding: 5px 7px 5px 9px !important;
    margin: 0 !important;
    background: linear-gradient(180deg, #111827 0%, #0b1220 100%);
    border-bottom: 1px solid #1e293b;
}

#ecommercePanel .ec-modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

#ecommercePanel .ec-modal-badge {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #a7f3d0;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.35);
    padding: 2px 6px;
    border-radius: 4px;
}

#ecommercePanel .ec-modal-title {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #f1f5f9;
    line-height: 1.25;
    letter-spacing: 0.01em;
}

#ecommercePanel .ec-modal-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #94a3b8;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

#ecommercePanel .ec-modal-close:hover {
    background: #1e293b;
    color: #f1f5f9;
    border-color: #475569;
}

/* 头部按钮组容器 */
#ecommercePanel .ec-modal-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* 头部通用按钮样式（关闭按钮 + 语言切换） */
#ecommercePanel .ec-header-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

#ecommercePanel .ec-header-btn:hover {
    background: #1e293b;
    color: #f1f5f9;
    border-color: #475569;
}

/* 可滚动内容区：紧凑内边距 */
#ecommercePanel .ec-modal-body {
    padding: 3px 5px 5px !important;
    overflow-x: hidden;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* 确保第一个子元素没有额外间距 */
#ecommercePanel .ec-modal-body > *:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

#ecommercePanel .ec-interior-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 表单：gap 由父 .ec-modal-body 统一控制 */
/* 表单行：flex 自由分配列宽（2列自动50%，3列自动33%） */
#ecommercePanel .ec-form-row {
    display: flex;
    gap: 8px;
    margin: 0 !important;
    padding: 0 !important;
    align-items: stretch;
}

#ecommercePanel .ec-form-row .ec-form-group {
    flex: 1 1 0;
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
}

#ecommercePanel .ec-form-row .ec-form-group-full {
    margin-bottom: 0;
}

/* 独占整行：品牌色、产品描述（避免在窄弹窗里像半宽） */
#ecommercePanel .ec-form-row-fullwidth {
    flex-wrap: wrap !important;
    width: 100% !important;
}

#ecommercePanel .ec-form-row-fullwidth .ec-form-group-full {
    flex: 1 1 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
}

#ecommercePanel .ec-product-prompt-wrap .dark-textarea,
#ecommercePanel textarea#ecProductPrompt {
    width: 100% !important;
    min-height: 88px !important;
    max-height: 240px !important;
    box-sizing: border-box !important;
}

#ecommercePanel .ec-modal-body > .ec-form-group.ec-form-group-full {
    margin: 0;
}

#ecommercePanel .ec-form-group label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: #64748b;
    margin: 0 0 1px !important;
    padding: 0 !important;
    letter-spacing: 0.02em;
    line-height: 1.2;
    min-height: 14px;
    overflow: hidden;
    word-break: break-all;
}

#ecommercePanel .dark-input,
#ecommercePanel .dark-select,
#ecommercePanel .dark-textarea {
    width: 100% !important;
    padding: 4px 7px !important;
    min-height: 26px !important;
    margin: 0 !important;
    background: #020617 !important;
    border: 1px solid #273549 !important;
    border-radius: 5px !important;
    color: #e2e8f0 !important;
    font-size: 11px !important;
    line-height: 1.3 !important;
    box-sizing: border-box !important;
}

#ecommercePanel .dark-input:focus,
#ecommercePanel .dark-select:focus,
#ecommercePanel .dark-textarea:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.18);
}

#ecommercePanel .dark-textarea {
    resize: vertical;
    min-height: 48px;
    max-height: 120px;
    line-height: 1.4;
}

#ecommercePanel .ec-hint {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    padding: 5px 7px;
    margin: 0;
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.12);
    border-radius: 6px;
    font-size: 10px;
    line-height: 1.4;
    color: #7dd3fc;
}

/* ============================================
   电商面板：参考图区块（独立卡片、清晰层级）
   ============================================ */

/* 参考图整块：卡片式、统一间距 */
#ecommercePanel .ec-ref-section {
    margin: 6px 0 14px 0;
    padding: 14px 12px;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 0;
    /* 确保内部内容区与按钮组宽度完全对齐 */
    box-sizing: border-box;
}

/* 按钮和槽位都在同一个宽度基准上 */
#ecommercePanel .ec-ref-section .ec-ref-actions,
#ecommercePanel .ec-ref-section .ec-ref-slots {
    width: 100%;
    box-sizing: border-box;
}

/* 标题：与下方内容留出呼吸感 */
#ecommercePanel .ec-ref-heading {
    margin: 0 0 10px 0;
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    letter-spacing: 0.02em;
    line-height: 1.3;
}

/* 三个操作按钮：等分、统一间距 */
#ecommercePanel .ec-ref-actions {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

#ecommercePanel .ec-ref-section .ec-upload-button {
    flex: 1 1 0%;
    min-width: 0;
    padding: 8px 10px;
    font-size: 11px;
    min-height: 32px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid #334155;
    border-radius: 6px;
    color: #e2e8f0;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#ecommercePanel .ec-ref-section .ec-upload-button:hover {
    background: rgba(51, 65, 85, 0.9);
    border-color: #475569;
    color: #f1f5f9;
}

#ecommercePanel .ec-ref-section .ec-upload-button:active {
    background: rgba(15, 23, 42, 0.95);
    transform: translateY(1px);
}

body.theme-light #ecommercePanel .ec-ref-section .ec-upload-button {
    background: rgba(241, 245, 249, 0.9);
    color: #1e293b;
    border-color: #cbd5e1;
}

body.theme-light #ecommercePanel .ec-ref-section .ec-upload-button:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

body.theme-light #ecommercePanel .ec-ref-section {
    background: rgba(248, 250, 252, 0.9);
    border-color: rgba(203, 213, 225, 0.8);
}

body.theme-light #ecommercePanel .ec-ref-heading {
    color: #475569;
}

body.theme-light #ecommercePanel .ec-ref-section .ec-ref-slot {
    background: rgba(241, 245, 249, 0.9);
    border-color: #cbd5e1;
}

body.theme-light #ecommercePanel .ec-ref-section .ec-ref-slot:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

body.theme-light #ecommercePanel .ec-ref-section .ec-ref-placeholder span {
    color: #94a3b8;
}

body.theme-light #ecommercePanel .ec-ref-section .ec-ref-hint {
    color: #64748b;
}

/* 三个预览槽：与按钮组左对齐、总宽一致（gap=6px 与按钮一致，flex=1 等宽） */
#ecommercePanel .ec-ref-section .ec-ref-slots {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 10px;
    width: 100%;
    box-sizing: border-box;
}

#ecommercePanel .ec-ref-section .ec-ref-slot {
    flex: 1 1 0%;
    min-width: 0;
    height: 72px;
    position: relative;
    border: 1.5px dashed #475569;
    border-radius: 8px;
    background: rgba(2, 6, 23, 0.6);
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    /* label 默认行为 */
    user-select: none;
}

/* 文件输入框：隐藏但可点击（与 label 联动） */
#ecommercePanel .ec-ref-section .ec-ref-file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 3;
    /* 移除默认样式 */
    padding: 0;
    margin: 0;
    font-size: 0;
    filter: none;
}

#ecommercePanel .ec-ref-section .ec-ref-slot:hover {
    border-color: #64748b;
    background: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 1px rgba(100, 116, 139, 0.3);
}

/* 槽位被选中时的视觉高亮（与主界面 .preview-slot.selected 一致） */
#ecommercePanel .ec-ref-section .ec-ref-slot.selected {
    border-color: #22c55e !important;
    border-style: solid !important;
    background: rgba(34, 197, 94, 0.12) !important;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.5), 0 4px 16px rgba(34, 197, 94, 0.2) !important;
    transform: scale(1.05);
}

body.theme-light #ecommercePanel .ec-ref-section .ec-ref-slot.selected {
    border-color: #16a34a !important;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.7), 0 4px 16px rgba(34, 197, 94, 0.15) !important;
}

#ecommercePanel .ec-ref-section .ec-ref-slot.has-image {
    border-style: solid;
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.06);
    /* 保持 cursor: pointer，让有图的槽仍可点击替换 */
}

/* 预览图 / 占位符 / 删除按钮都透传点击到父级槽位 */
#ecommercePanel .ec-ref-section .ec-ref-preview,
#ecommercePanel .ec-ref-section .ec-ref-placeholder,
#ecommercePanel .ec-ref-section .ec-ref-placeholder span {
    pointer-events: none;
    user-select: none;
}

#ecommercePanel .ec-ref-section .ec-ref-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
    border-radius: 6px;
}

#ecommercePanel .ec-ref-section .ec-ref-slot.has-image .ec-ref-preview {
    display: block;
}

#ecommercePanel .ec-ref-section .ec-ref-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

#ecommercePanel .ec-ref-section .ec-ref-slot.has-image .ec-ref-placeholder {
    display: none;
}

#ecommercePanel .ec-ref-section .ec-ref-placeholder span {
    font-size: 20px;
    color: #475569;
    font-weight: 300;
    line-height: 1;
    user-select: none;
}

#ecommercePanel .ec-ref-section .ec-ref-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    background: rgba(0, 0, 0, 0.75);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 4;
    transition: background 0.15s;
}

#ecommercePanel .ec-ref-section .ec-ref-remove:hover {
    background: #ef4444;
}

#ecommercePanel .ec-ref-section .ec-ref-slot:not(.has-image) .ec-ref-remove {
    display: none !important;
}

/* 说明文案：与槽位留出间距、可读性更好 */
#ecommercePanel .ec-ref-section .ec-ref-hint {
    margin: 0;
    font-size: 10px;
    color: #64748b;
    line-height: 1.4;
}

/* 兼容：其他位置若仍用 .ec-upload-buttons-container 的样式保留 */
#ecommercePanel .ec-upload-buttons-container {
    display: flex;
    gap: 6px;
}

#ecommercePanel .ec-upload-button {
    flex: 1 1 0%;
    padding: 6px 8px;
    font-size: 11px;
    min-height: 28px;
    background: radial-gradient(circle at top, #111827 0, #020617 45%, #020617 100%);
    border: 1px solid #4b5563;
    border-radius: 4px;
    color: #e5e7eb;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#ecommercePanel .ec-upload-button:hover {
    background: radial-gradient(circle at top, #1f2937 0, #020617 50%, #020617 100%);
    border-color: #6b7280;
}

#ecommercePanel .ec-upload-button:active {
    background: #020617;
    transform: translateY(1px);
}

body.theme-light #ecommercePanel .ec-upload-button {
    background: linear-gradient(135deg, #ffffff 0%, #e5e7eb 100%);
    color: #111827;
    border-color: #cbd5e1;
}

body.theme-light #ecommercePanel .ec-upload-button:hover {
    background: linear-gradient(135deg, #e5e7eb 0%, #d4d4d8 100%);
    border-color: #9ca3af;
}

#ecommercePanel .ec-progress-area {
    margin: 0 !important;
}

/* 错误提示容器 */
#ecommercePanel .ec-error-container {
    padding: 20px;
    text-align: center;
}

#ecommercePanel .ec-error-icon {
    width: 48px;
    height: 48px;
    line-height: 48px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    font-size: 24px;
    margin: 0 auto 12px;
}

#ecommercePanel .ec-error-title {
    font-size: 14px;
    font-weight: 600;
    color: #f87171;
    margin-bottom: 8px;
}

#ecommercePanel .ec-error-message {
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.5;
    margin-bottom: 16px;
    padding: 10px;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 6px;
    word-break: break-all;
}

#ecommercePanel .ec-error-btn {
    padding: 8px 24px;
    background: #3b82f6;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

#ecommercePanel .ec-error-btn:hover {
    background: #2563eb;
}

#ecommercePanel .ec-step-list {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 10px;
    padding: 6px 10px;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 6px;
}

#ecommercePanel .ec-step-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    transition: all 0.3s ease;
}

#ecommercePanel .ec-step-icon {
    font-size: 12px;
    width: 16px;
    text-align: center;
}

#ecommercePanel .ec-step-name {
    white-space: nowrap;
}

#ecommercePanel .ec-step-pending {
    color: #64748b;
}

#ecommercePanel .ec-step-active {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.15);
}

#ecommercePanel .ec-step-active .ec-step-icon {
    animation: ec-spin 1s linear infinite;
}

#ecommercePanel .ec-step-done {
    color: #10b981;
}

#ecommercePanel .ec-step-line {
    width: 20px;
    height: 1px;
    background: #334155;
}

#ecommercePanel .ec-progress-bar-container {
    height: 4px;
    background: #1e293b;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 3px;
}

#ecommercePanel .ec-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #34d399);
    border-radius: 2px;
    transition: width 0.25s ease;
    width: 0%;
}

#ecommercePanel .ec-progress-text {
    font-size: 10px;
    color: #64748b;
    text-align: center;
}

#ecommercePanel .ec-progress-detail {
    font-size: 9px;
    color: #475569;
    text-align: center;
    margin-top: 2px;
}

@keyframes ec-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

#ecommercePanel .ec-result-area {
    margin: 0 !important;
}

#ecommercePanel .ec-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 8px;
    background: rgba(6, 78, 59, 0.45);
    border: 1px solid rgba(52, 211, 153, 0.2);
    border-radius: 6px 6px 0 0;
    font-size: 10px;
    font-weight: 600;
    color: #6ee7b7;
}

#ecommercePanel .ec-result-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
    padding: 6px;
    background: #020617;
    border: 1px solid #1e293b;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 180px;
    overflow-y: auto;
}

#ecommercePanel .ec-result-item {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    background: #0f172a;
}

#ecommercePanel .ec-result-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    border-radius: 4px;
}

#ecommercePanel .ec-button-row {
    display: flex;
    gap: 8px;
    justify-content: stretch;
    margin-top: 2px !important;
    padding-top: 4px !important;
    border-top: 1px solid #1e293b;
}

#ecommercePanel .ec-btn {
    flex: 1;
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s, opacity 0.12s;
    border: none;
}

#ecommercePanel .ec-btn-primary {
    background: linear-gradient(180deg, #10b981 0%, #059669 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

#ecommercePanel .ec-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

#ecommercePanel .ec-btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

#ecommercePanel .ec-btn-secondary {
    background: #1e293b;
    color: #94a3b8;
    border: 1px solid #334155;
}

#ecommercePanel .ec-btn-apply {
    position: absolute;
    bottom: 4px;
    right: 4px;
    padding: 3px 7px;
    background: rgba(37, 99, 235, 0.9);
    color: #fff;
    border: none;
    font-size: 10px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
}

#ecommercePanel .ec-result-item:hover .ec-btn-apply {
    opacity: 1;
}

#openEcommerceBtn.active,
#openInteriorDesignBtn.active {
    background: linear-gradient(135deg, #047857 0%, #059669 100%) !important;
}

/* ============================================
   复刻模式 + 宫格模式横向排列容器
   ============================================ */

#ecommercePanel .ec-mode-row {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #1e293b;
}

/* 整体区块 - 恢复适应 flex 子项 */
#ecommercePanel .ec-clone-section {
    flex: 1;
    padding: 10px 12px;
    border-top: none;
    border-bottom: none;
    border-left: none;
    border-right: 1px solid #1e293b;
    background: #0d1526;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#ecommercePanel .ec-clone-section:first-child {
    border-left: 1px solid #1e293b;
}

/* 宫格模式开关 - 适应 flex 子项 */
#ecommercePanel .ec-mode-toggle-row {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: none;
    background: transparent;
}

/* ============================================
   宫格模式开关 + 生成数量/宫格类型切换
   ============================================ */

#ecommercePanel .ec-mode-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    border-bottom: 1px solid #1e293b;
}

#ecommercePanel .ec-mode-toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #e2e8f0;
}

#ecommercePanel .ec-mode-icon { font-size: 14px; }

/* 宫格模式激活：隐藏生成数量整个组，显示宫格类型整个组 */
#ecommercePanel.ec-grid-mode-active #ecImageCountGroup {
    display: none !important;
}

/* 默认隐藏宫格类型整个组（block 布局） */
#ecommercePanel #ecGridTypeGroup {
    display: none;
}

/* 宫格模式激活时显示宫格类型组（保持 block 布局） */
#ecommercePanel.ec-grid-mode-active #ecGridTypeGroup {
    display: block !important;
}

/* 宫格预览气泡容器：内联显示，让 tooltip 相对于它定位 */
#ecommercePanel #ecGridPreviewWrap {
    display: inline-block;
    position: relative;
}

/* 宫格预览气泡：显示在选择框上方 */
#ecommercePanel .ec-grid-preview-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    top: auto;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background: #0d1526;
    border: 1px solid #1e3a5f;
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    white-space: normal;
    max-width: min(260px, 92vw);
    box-sizing: border-box;
}

#ecommercePanel .ec-grid-preview-tooltip.visible {
    opacity: 1;
    pointer-events: auto;
}

#ecommercePanel .ec-grid-preview-tooltip .gpt-title {
    font-size: 11px;
    color: #64748b;
    margin-bottom: 10px;
    text-align: center;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

#ecommercePanel .ec-grid-preview-tooltip .gpt-canvas-info {
    font-size: 11px;
    color: #94a3b8;
    text-align: center;
    margin-bottom: 10px;
}

#ecommercePanel .ec-grid-preview-tooltip .gpt-canvas-info span {
    color: #38bdf8;
    font-weight: 600;
}

/* 预览画布：固定宽高，tile 大小由 JS 内联 px 决定（避免 fr 单位在超窄容器里塌成 0） */
#ecommercePanel .ec-grid-preview-canvas {
    display: block;
    box-sizing: border-box;
    background: #1a2a3a;
    border-radius: 6px;
    overflow: hidden;
    margin: 0 auto 6px auto;
    line-height: 0; /* 消除行内块之间的空隙 */
}

/* 清除 CSS 默认的 grid/flex 干扰 */
#ecommercePanel .ec-grid-preview-canvas.landscape,
#ecommercePanel .ec-grid-preview-canvas.portrait,
#ecommercePanel .ec-grid-preview-canvas.square {
    width: auto;
    height: auto;
}

/* 单个 tile：display:inline-block 配合 line-height:0 父容器，确保块之间无间隙 */
#ecommercePanel .ec-grid-preview-tile {
    display: inline-block;
    box-sizing: border-box;
    background: #2a3f5f;
    border: 1px solid #1e3a5f;
    border-radius: 2px;
    font-size: 0;   /* 让文字容器不占额外高度 */
    vertical-align: top;
    flex-shrink: 0;
    transition: background 0.15s;
    /* 宽高由 JS 内联 px 决定 */
}

#ecommercePanel .ec-grid-preview-tile .tile-num {
    display: block;
    color: #38bdf8;
    font-size: 7px;
    font-weight: 700;
    opacity: 0.85;
    line-height: 1;
    text-align: center;
    padding: 0;
}

/* 预览说明文字 */
#ecommercePanel .ec-grid-preview-tooltip .gpt-desc {
    font-size: 10px;
    color: #64748b;
    text-align: center;
    margin-top: 6px;
}

#ecommercePanel .ec-grid-preview-tooltip .gpt-desc .gpt-arr-row,
#ecommercePanel .ec-grid-preview-tooltip .gpt-desc .gpt-arr-col {
    display: inline-block;
    margin: 0 2px;
    vertical-align: middle;
}

#ecommercePanel .ec-grid-preview-tooltip .gpt-desc .arr-icon {
    font-size: 14px;
    color: #38bdf8;
}

/* ============================================
   复刻模式区块
   ============================================ */

/* 整体区块 - 已被上方 .ec-mode-row .ec-clone-section 覆盖 */
#ecommercePanel .ec-clone-section {
    /* 原有样式已由父容器 .ec-mode-row 统一处理 */
}

/* 开关行 */
#ecommercePanel .ec-clone-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#ecommercePanel .ec-clone-toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #e2e8f0;
}

#ecommercePanel .ec-clone-icon { font-size: 14px; }

/* Toggle Switch */
#ecommercePanel .toggle-switch {
    position: relative;
    width: 36px;
    height: 20px;
    display: inline-block;
    flex-shrink: 0;
}

#ecommercePanel .toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

#ecommercePanel .toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #334155;
    border-radius: 20px;
    transition: background 0.3s;
}

#ecommercePanel .toggle-slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

#ecommercePanel .toggle-switch input:checked + .toggle-slider {
    background: #10b981;
}

#ecommercePanel .toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(16px);
}

/* 复刻模式体内容（仅保留上传槽位，极简布局） */
#ecommercePanel .ec-clone-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* 复刻参考图槽位 */
#ecommercePanel .ec-clone-slot {
    position: relative;
    border: 1.5px dashed #334155;
    border-radius: 8px;
    height: 80px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#ecommercePanel .ec-clone-slot:hover {
    border-color: #10b981;
}

#ecommercePanel .ec-clone-slot.selected {
    border-color: #10b981;
    border-style: solid;
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.3);
}

#ecommercePanel .ec-clone-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #0b1220;
}

#ecommercePanel .ec-clone-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    font-size: 20px;
}

#ecommercePanel .ec-clone-placeholder[style*="display: none"] {
    display: none;
}

#ecommercePanel .ec-clone-slot.has-image .ec-clone-placeholder {
    display: none;
}

#ecommercePanel .ec-clone-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: background 0.15s;
}

#ecommercePanel .ec-clone-remove:hover {
    background: rgba(220, 38, 38, 0.9);
}

/* ============================================
   复刻模式区块
   ============================================ */

/* 拆解预览 */
#ecommercePanel .ec-clone-analysis-result {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#ecommercePanel .ec-clone-analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: #10b981;
    font-weight: 600;
}

#ecommercePanel .ec-clone-tiles-preview {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}

#ecommercePanel .ec-clone-tiles-preview::-webkit-scrollbar {
    height: 4px;
}
#ecommercePanel .ec-clone-tiles-preview::-webkit-scrollbar-track {
    background: transparent;
}
#ecommercePanel .ec-clone-tiles-preview::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 2px;
}

#ecommercePanel .ec-clone-tile-thumb {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 6px;
    border: 1px solid #1e293b;
    overflow: hidden;
    background: #0b1220;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

#ecommercePanel .ec-clone-tile-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 开启复刻模式后，参考图区块标题变化 */
#ecommercePanel .ec-ref-heading-clone {
    color: #10b981 !important;
}
/* 插件在线更新 */
.plugin-update-container {
    margin-top: 16px;
}

/* 第一行：标签 + 按钮 */
.plugin-update-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.plugin-update-label {
    font-size: 12px;
    color: #666;
}

/* 更新按钮 */
.plugin-update-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.plugin-update-btn:hover {
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.5);
}

.plugin-update-btn:active {
    transform: translateY(1px);
}

.plugin-update-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.plugin-update-icon {
    font-size: 14px;
    display: inline-block;
    transition: transform 0.3s ease;
}

.plugin-update-btn:not(:disabled):hover .plugin-update-icon {
    transform: rotate(180deg);
}

/* 更新状态提示 */
.plugin-update-status {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.5;
    color: #e2e8f0;
}

.plugin-update-status.loading {
    background: rgba(96, 165, 250, 0.15);
    border: 1px solid rgba(96, 165, 250, 0.3);
    color: #93c5fd;
}

.plugin-update-status.success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #86efac;
}

.plugin-update-status.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* 版本选择器（正常流，在按钮下方展开） */
.plugin-version-selector {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(320px, calc(100vw - 48px));
    max-height: min(420px, calc(100vh - 48px));
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    overflow: hidden;
    z-index: 25050;
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
}

.plugin-update-selector-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.52);
    z-index: 25040;
}

#configSection.plugin-update-selector-open #configContent > :not(.plugin-update-container) {
    visibility: hidden;
    pointer-events: none;
}

#configSection.plugin-update-selector-open .plugin-update-header,
#configSection.plugin-update-selector-open #plugin-update-status {
    visibility: hidden;
    pointer-events: none;
}

.version-selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(245, 158, 11, 0.2);
    background: rgba(245, 158, 11, 0.08);
    border-radius: 8px 8px 0 0;
}

.version-selector-title {
    font-size: 13px;
    font-weight: 600;
    color: #f59e0b;
}

.version-selector-close {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.version-selector-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.plugin-version-list {
    padding: 4px 0;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

/* 版本列表项 */
.version-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.version-item:last-child {
    border-bottom: none;
}

.version-item:hover {
    background: rgba(245, 158, 11, 0.1);
}

.version-item.latest {
    background: rgba(34, 197, 94, 0.12);
    border-left: 3px solid #4ade80;
}

.version-item.current {
    background: rgba(96, 165, 250, 0.1);
    border-left: 3px solid #60a5fa;
    cursor: default;
}

.version-item.current:hover {
    background: rgba(96, 165, 250, 0.1);
}

.version-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.version-number {
    font-weight: 600;
    font-size: 14px;
    color: #f1f5f9;
}

.version-date {
    font-size: 11px;
    color: #64748b;
}

.version-description {
    font-size: 11px;
    color: #94a3b8;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.version-badge {
    flex-shrink: 0;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    margin-left: 8px;
}

.version-badge.latest {
    background: #4ade80;
    color: #052e16;
}

.version-badge.current {
    background: #60a5fa;
    color: #1e3a8a;
}

.version-badge.older {
    background: #4b5563;
    color: #d1d5db;
}

.version-action {
    flex-shrink: 0;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
    margin-left: 6px;
    font-weight: 500;
}

.version-item.current .version-action {
    background: rgba(96, 165, 250, 0.2);
    color: #60a5fa;
    border-color: rgba(96, 165, 250, 0.3);
    cursor: default;
}

/* 滚动条 */
.plugin-version-selector::-webkit-scrollbar {
    width: 6px;
}

.plugin-version-selector::-webkit-scrollbar-track {
    background: transparent;
}

.plugin-version-selector::-webkit-scrollbar-thumb {
    background: rgba(245, 158, 11, 0.3);
    border-radius: 3px;
}

/* 浅色主题 */
body.theme-light .plugin-update-btn {
    color: #d97706;
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.4);
}

body.theme-light .plugin-update-btn:hover {
    background: rgba(245, 158, 11, 0.2);
}

body.theme-light .plugin-version-selector {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(245, 158, 11, 0.4);
}

body.theme-light .version-selector-header {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
}

body.theme-light .version-selector-title {
    color: #b45309;
}

body.theme-light .version-number {
    color: #1e293b;
}

body.theme-light .version-description {
    color: #64748b;
}

body.theme-light .version-item:hover {
    background: rgba(245, 158, 11, 0.08);
}

body.theme-light .version-item.latest {
    background: rgba(34, 197, 94, 0.1);
    border-left-color: #16a34a;
}

body.theme-light .version-badge.latest {
    background: #16a34a;
    color: white;
}

body.theme-light .version-item.current {
    background: rgba(59, 130, 246, 0.08);
    border-left-color: #2563eb;
}

body.theme-light .version-badge.current {
    background: #2563eb;
    color: white;
}

body.theme-light .version-item {
    border-bottom-color: rgba(0, 0, 0, 0.05);
}
