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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    background: #f5f7fa;
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body.modal-no-scroll {
    overflow: hidden;
}

.container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: white;
    box-shadow: none;
    border-radius: 0;
}

/* 控制面板头部样式 */
.control-header {
    background: white;
    color: #333;
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 12px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.control-header h1 {
    font-size: 1.2rem;
    margin-bottom: 4px;
    font-weight: 600;
    color: #1f2937;
}

.control-header p {
    font-size: 0.8rem;
    color: #6b7280;
    margin: 0;
}

.title-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.control-settings-btn {
    border: none;
    background: transparent;
    color: #6b7280;
    padding: 6px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.control-settings-btn:hover {
    background: rgba(11, 83, 69, 0.08);
    color: #0b5345;
}

.control-settings-btn svg {
    display: block;
}

/* ============================================
   新版统一控制面板样式 - 紧凑设计
   ============================================ */

.control-panel-unified {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: white;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

/* 紧凑标题栏 */
.control-header-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: linear-gradient(135deg, #0B5345 0%, #16A085 100%);
    color: white;
    flex-shrink: 0;
}

.control-header-compact .control-settings-btn {
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 6px;
}

.control-header-compact .control-settings-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.title-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.title-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.title-inline h1 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.title-desc {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.75);
    margin: 0;
    line-height: 1.3;
}

.title-badge {
    font-size: 0.6rem;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-weight: 500;
    white-space: nowrap;
}

/* 可滚动内容区 */
.control-content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 计费模式切换区 */
.billing-mode-section {
    margin-bottom: 12px;
}

.billing-mode-toggle {
    display: flex;
    background: #f1f3f5;
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.billing-mode-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #6b7280;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.billing-mode-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    color: #374151;
}

.billing-mode-btn.active {
    background: white;
    color: #0B5345;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.billing-mode-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.billing-mode-icon svg {
    width: 14px;
    height: 14px;
}

.billing-mode-btn.active .billing-mode-icon svg {
    stroke: #0B5345;
}

.billing-mode-text {
    white-space: nowrap;
}

/* 参数分区 */
.param-section {
    background: #f8f9fb;
    border-radius: 8px;
    border: 1px solid #e8ebef;
    overflow: hidden;
}

.param-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: white;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.param-section-header:hover {
    background: #f8f9fb;
}

.param-section-header.no-collapse {
    cursor: default;
}

.param-section-header.no-collapse:hover {
    background: white;
}

.param-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
}

.param-section-title svg {
    color: #0B5345;
    flex-shrink: 0;
}

.collapse-icon {
    font-size: 0.75rem;
    color: #9ca3af;
    transition: transform 0.2s ease;
}

.param-section.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.param-section.collapsed .param-section-body {
    display: none;
}

.param-section-body {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid #e8ebef;
}

/* 统一参数配置区 */
.param-unified-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.param-unified-body {
    flex: 1;
    overflow-y: auto;
    gap: 10px;
}

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

.param-group + .param-group {
    padding-top: 8px;
    border-top: 1px dashed #e5e7eb;
}

.prompt-group {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.prompt-group textarea {
    flex: 1;
    min-height: 60px;
    resize: none;
}

/* 参数行布局 */
.param-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.param-label {
    font-size: 0.8rem;
    color: #6b7280;
    min-width: 36px;
    flex-shrink: 0;
}

.param-value {
    font-size: 0.8rem;
    color: #374151;
    background: #f3f4f6;
    padding: 4px 10px;
    border-radius: 4px;
    flex: 1;
}

.param-label-small {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 4px;
}

/* 参数网格 - 动态列布局 */
.param-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.param-cell {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 70px;
}

/* 参数单元格的显示/隐藏控制 - 兼容原有JS逻辑 */
.param-cell.aspect-ratio-selection,
.param-cell.image-size-selection,
.param-cell.image-count-selection {
    flex: 1;
    min-width: 70px;
}

/* 紧凑型下拉框 */
.select-wrapper.compact {
    flex: 1;
}

.select-wrapper.mini {
    width: 100%;
    border-radius: 6px;
}

.select-wrapper.compact .custom-select,
.select-wrapper.mini .custom-select {
    padding: 7px 28px 7px 10px;
    font-size: 0.85rem;
}

.compact-input {
    padding: 6px 10px !important;
    font-size: 0.85rem !important;
    margin-top: 6px;
}

/* 提示词区域特殊样式 */
.prompt-section .param-section-body {
    gap: 8px;
}

.prompt-section textarea,
.prompt-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    background: white;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    line-height: 1.5;
}

.prompt-section textarea:focus,
.prompt-group textarea:focus {
    outline: none;
    border-color: #0B5345;
    box-shadow: 0 0 0 2px rgba(11, 83, 69, 0.1);
}

.prompt-section textarea::placeholder,
.prompt-group textarea::placeholder {
    color: #9ca3af;
}

/* 紧凑型翻译按钮 */
.tiny-btn.compact {
    padding: 4px 10px;
    font-size: 0.75rem;
}

/* 紧凑型上传按钮 */
.upload-inline-btn.compact {
    padding: 5px 10px;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.upload-inline-btn.compact svg {
    flex-shrink: 0;
}

/* 底部固定操作区 */
.control-footer {
    padding: 12px 14px;
    background: white;
    border-top: 1px solid #e8ebef;
    flex-shrink: 0;
}

.control-footer .generate-btn {
    padding: 10px 20px;
    font-size: 0.95rem;
    border-radius: 8px;
}

/* 主体内容 */
main {
    flex: 1;
    display: flex;
    overflow: hidden;
    padding: 0;
}

/* 网格布局 */
.main-grid {
    display: grid;
    grid-template-columns: 330px 1fr 330px;
    gap: 0;
    height: 100%;
    width: 100%;
}

/* 控制面板 */
.control-panel {
    background: #f8f9fb;
    border-radius: 0;
    padding: 12px;
    box-shadow: none;
    border-right: 1px solid #e5e7eb;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* 结果面板 */
.result-panel {
    background: #f8f9fb;
    border-radius: 0;
    padding: 16px;
    box-shadow: none;
    border-right: 1px solid #e5e7eb;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* 图库面板 */
.gallery-panel {
    background: #f8f9fb;
    border-radius: 0;
    padding: 16px;
    box-shadow: none;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.gallery-panel::-webkit-scrollbar {
    display: none;
}

/* 生成记录区块 - 约占 1/2 */
.gallery-records-section {
    flex: 1 1 50%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 绘图信息区块 - 约占 1/2 */
.drawing-info-section {
    flex: 1 1 50%;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* 图库面板内的section需要占满剩余高度 */
.gallery-panel .section-compact {
    display: flex;
    flex-direction: column;
}

.gallery-panel .section-compact .image-gallery {
    flex: 1;
}

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

.gallery-header h3 {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 问号气泡提示 */
.help-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: help;
    color: #9ca3af;
    transition: color 0.2s ease;
}

.help-tooltip:hover {
    color: #0B5345;
}

.help-tooltip svg {
    width: 14px;
    height: 14px;
}

.tooltip-content {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    transform: none;
    background: #1f2937;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 200px;
    text-align: left;
    line-height: 1.4;
}

.tooltip-content::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 12px;
    border: 6px solid transparent;
    border-bottom-color: #1f2937;
}

.help-tooltip:hover .tooltip-content {
    opacity: 1;
    visibility: visible;
}

.gallery-actions {
    display: flex;
    gap: 8px;
}

.gallery-btn {
    border: 1px solid #d1d5db;
    background: #f8fafc;
    color: #374151;
    padding: 4px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.gallery-btn:hover {
    background: #e5f2ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.gallery-btn.danger {
    border-color: #fecaca;
    background: #fff5f5;
    color: #b91c1c;
}

.gallery-btn.danger:hover {
    background: #fee2e2;
    border-color: #f87171;
    color: #b91c1c;
}

.gallery-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* 紧凑章节样式 */
.section-compact {
    margin-bottom: 0;
    background: white;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #e5e7eb;
}

.section-compact h3 {
    font-size: 0.95rem;
    margin-bottom: 12px;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.control-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 16px;
    flex: 1;
    min-height: 0;
}

.control-section .control-group:first-of-type {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
}

.control-section .control-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.control-section .control-group+.control-group {
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}

.control-group.control-actions {
    gap: 16px;
}

.control-group.control-actions .generate-btn {
    width: 100%;
}

/* 输入行布局 */
.input-row {
    display: flex;
    gap: 10px;
}

.input-compact {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #fafbfc;
}

.input-compact:focus {
    outline: none;
    border-color: #0B5345;
    background: white;
    box-shadow: 0 0 0 3px rgba(11, 83, 69, 0.1);
}

/* 表单组件 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #fafbfc;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-divider {
    margin: 20px 0 12px;
    font-weight: 700;
    color: #0B5345;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.modal-body>.form-divider:first-child {
    margin-top: 0;
}

.form-hint {
    display: block;
    margin-top: 6px;
    color: #6b7280;
    font-size: 0.75rem;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 8px 0 16px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #0B5345;
    cursor: pointer;
    user-select: none;
}

.checkbox-label span {
    font-size: 0.95rem;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
    accent-color: #0B5345;
}

/* 紧凑表单组件 */
.section-compact textarea {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #fafbfc;
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

.section-compact textarea:focus {
    outline: none;
    border-color: #0B5345;
    background: white;
    box-shadow: 0 0 0 3px rgba(11, 83, 69, 0.1);
}

/* 提示词提示 */
.prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.tiny-btn {
    border: none;
    background: linear-gradient(45deg, #0B5345, #16A085);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tiny-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(11, 83, 69, 0.25);
}

.tiny-btn .btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

.prompt-flash {
    animation: promptFlash 0.5s ease;
}

@keyframes promptFlash {
    0% {
        box-shadow: 0 0 0 0 rgba(11, 83, 69, 0.35);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(11, 83, 69, 0);
    }
}

/* 注释信息 */
.notice-info {
    padding: 12px 16px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #856404;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.notice-info:hover {
    border-color: #f8d775;
    box-shadow: 0 4px 12px rgba(250, 204, 21, 0.15);
}

.notice-info:focus-visible {
    outline: 2px solid #facc15;
    outline-offset: 2px;
}

.notice-info p {
    margin: 0;
    font-weight: 500;
}

.notice-info .notice-text {
    line-height: 1.5;
    max-height: calc(1.5em * 3);
    overflow: hidden;
    position: relative;
}

.notice-info .notice-text::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1.5em;
    background: linear-gradient(180deg, rgba(255, 243, 205, 0) 0%, rgba(255, 243, 205, 1) 100%);
    pointer-events: none;
}

.notice-info .notice-more {
    font-weight: 600;
    font-size: 0.8rem;
    color: #b7791f;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.notice-info .notice-more::after {
    content: '›';
    font-family: Arial, sans-serif;
}

.gallery-notice {
    margin-top: 12px;
}

.gallery-notice .notice-text {
    max-height: none;
}

.gallery-notice .notice-text::after {
    display: none;
}

/* 用时显示 */
.time-info {
    margin: 0;
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(11, 83, 69, 0.08) 0%, rgba(22, 160, 133, 0.12) 100%);
    border: 1px solid rgba(11, 83, 69, 0.15);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #0B5345;
    text-align: left;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.time-info svg {
    flex-shrink: 0;
    opacity: 0.8;
}

/* 生成记录 */
.image-gallery {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.image-gallery::-webkit-scrollbar {
    display: none;
}

.gallery-placeholder {
    text-align: center;
    color: #9ca3af;
    font-size: 0.85rem;
    padding: 20px;
}

.gallery-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.gallery-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
    flex-shrink: 0;
    width: 100%;
    aspect-ratio: 4 / 1;
    min-height: 50px;
}

.gallery-item-visual {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 6px;
}

.gallery-item.selectable {
    border-style: dashed;
}

.gallery-item.selected {
    border-color: #0B5345;
    box-shadow: 0 4px 12px rgba(11, 83, 69, 0.25);
}

.gallery-item.pending {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.08), rgba(15, 23, 42, 0.05));
    border-style: dashed;
}

.gallery-item.failed {
    border-color: rgba(239, 68, 68, 0.85);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(239, 68, 68, 0.04));
}

.gallery-item:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15); /* 增加阴影范围 */
    border-color: #0B5345;
    z-index: 10; /* 确保hover时在最上层，不会被其他卡片遮挡 */
}

.gallery-select-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: #0B5345;
    transition: all 0.2s ease;
}

.gallery-item.selected .gallery-select-indicator {
    background: #0B5345;
    border-color: #0B5345;
    color: #fff;
}

.gallery-count-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    pointer-events: none;
}

.gallery-item.pending .gallery-count-badge {
    background: rgba(13, 148, 136, 0.75);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-item.is-video img {
    filter: brightness(0.9);
}

.gallery-video-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 6px 18px rgba(15, 23, 42, 0.55);
    pointer-events: none;
}

.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    letter-spacing: 2px;
    backdrop-filter: blur(2px);
    pointer-events: none;
}

.gallery-item-overlay.is-failed {
    background: rgba(239, 68, 68, 0.55);
}

.gallery-item-pending {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    padding: 12px;
    background: linear-gradient(135deg, rgba(11, 83, 69, 0.85), rgba(13, 148, 136, 0.75));
    position: relative;
}

.gallery-item-pending .pending-text {
    display: inline-block;
}

.gallery-item-pending .pending-text::after {
    content: '...';
    display: inline-block;
    width: 20px;
    text-align: left;
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: '';
    }
    40% {
        content: '.';
    }
    60% {
        content: '..';
    }
    80%, 100% {
        content: '...';
    }
}

.gallery-item-pending .pending-time {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    font-size: 13px;
    padding: 8px;
    text-align: center;
    font-weight: 500;
}

.gallery-item-pending.failed {
    color: rgba(239, 68, 68, 0.85);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(239, 68, 68, 0.04));
}

.gallery-item .gallery-time {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    font-size: 13px;
    padding: 8px 8px;
    text-align: center;
    font-weight: 500;
}

/* 设置齿轮按钮 */
.settings-gear {
    position: absolute;
    bottom: 20px;
    left: 20px;
}

/* API设置弹窗样式 */
.settings-input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 500;
    color: #1e293b;
    letter-spacing: -0.01em;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-input:hover {
    border-color: #cbd5e1;
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.settings-input:focus {
    outline: none;
    border-color: #0B5345;
    box-shadow: 0 0 0 3px rgba(11, 83, 69, 0.12), 0 2px 4px rgba(0, 0, 0, 0.06);
    background: linear-gradient(180deg, #ffffff 0%, #f0fdf9 100%);
}

.settings-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.gallery-item.pending .gallery-time {
    background: rgba(13, 148, 136, 0.18);
    color: #0b5345;
    font-weight: 600;
}

.gallery-item.failed .gallery-time {
    background: rgba(239, 68, 68, 0.25);
    color: #b91c1c;
    font-weight: 600;
}

.settings-input:focus {
    outline: none;
    border-color: #0B5345;
    box-shadow: 0 0 0 3px rgba(11, 83, 69, 0.1);
}

.settings-input:disabled {
    background: #f5f6f8;
    color: #94a3b8;
    cursor: not-allowed;
}

.select-wrapper {
    position: relative;
    display: inline-flex;
    align-items: stretch;
    width: 100%;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.select-wrapper:hover {
    border-color: #cbd5e1;
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.select-wrapper:hover .select-arrow {
    color: #475569;
}

.custom-endpoint-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

.custom-endpoint-wrapper label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #0f172a;
}

.custom-model-type-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.custom-model-type-wrapper label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #0f172a;
}

.select-wrapper:focus-within {
    border-color: #0B5345;
    box-shadow: 0 0 0 3px rgba(11, 83, 69, 0.12), 0 2px 4px rgba(0, 0, 0, 0.06);
    background: linear-gradient(180deg, #ffffff 0%, #f0fdf9 100%);
}

.select-wrapper:focus-within .select-arrow {
    color: #0B5345;
    transform: translateY(-50%) rotate(180deg);
}

.custom-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    flex: 1 1 auto;
    width: 100%;
    padding: 10px 36px 10px 12px;
    font-size: 0.92rem;
    font-weight: 500;
    color: #1e293b;
    background: transparent;
    border: none;
    border-radius: 0;
    cursor: pointer;
    letter-spacing: -0.01em;
}

.custom-select:focus {
    outline: none;
    box-shadow: none;
}

.select-arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.select-arrow svg {
    display: block;
}

.custom-select option {
    padding: 10px 14px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #334155;
    background: #ffffff;
}

.custom-select option:hover,
.custom-select option:focus,
.custom-select option:checked {
    background: linear-gradient(90deg, rgba(11, 83, 69, 0.12), rgba(11, 83, 69, 0.04));
    color: #0B5345;
}

.custom-select option:checked {
    font-weight: 600;
}

.custom-select option[disabled] {
    color: #94a3b8;
    background: #eef2f7;
}

.aspect-ratio-selection {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.aspect-ratio-selection label {
    font-size: 0.85rem;
    color: #6b7280;
}

.image-size-selection {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.image-size-selection label {
    font-size: 0.85rem;
    color: #6b7280;
}

.image-count-selection {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.image-count-selection label {
    font-size: 0.85rem;
    color: #6b7280;
}

.video-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.video-option {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.video-option label {
    font-size: 0.85rem;
    color: #6b7280;
}

.selection-hint {
    display: block;
    font-size: 0.78rem;
    color: #9ca3af;
    line-height: 1.4;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    justify-content: flex-end;
}

.primary-btn {
    padding: 10px 20px;
    background: linear-gradient(45deg, #0B5345, #16A085);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(11, 83, 69, 0.3);
}

.secondary-btn {
    padding: 10px 20px;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    background: #e5e7eb;
}

/* 立即获取按钮样式 */
.get-api-key-btn {
    margin-top: 8px;
    padding: 6px 12px;
    background: #f3f4f6;
    color: #0B5345;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.get-api-key-btn:hover {
    background: #0B5345;
    color: white;
    border-color: #0B5345;
    transform: translateY(-1px);
}

/* 模式选择按钮 */
.mode-buttons {
    display: flex;
    gap: 10px;
}

.mode-btn {
    flex: 1;
    padding: 10px 16px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mode-btn:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.mode-btn.active {
    background: linear-gradient(45deg, #0B5345, #16A085);
    color: white;
    border-color: #0B5345;
}

/* 文件上传区域 */
.upload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.upload-area {
    border: 1px dashed #cbd5f5;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    background: #f8fafc;
    transition: all 0.2s ease;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #0B5345;
    background: rgba(11, 83, 69, 0.05);
}

.upload-chip {
    background: #0B5345;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
}

.upload-hint {
    font-size: 0.75rem;
    color: #6b7280;
}

/* 上传图片计数 */
.upload-count {
    font-size: 0.9rem;
    color: #0B5345;
    font-weight: normal;
}

.upload-inline .upload-count {
    margin-left: auto;
    font-size: 0.8rem;
    color: #4b5563;
}

.upload-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.upload-inline-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #0B5345;
    background: transparent;
    color: #0B5345;
    font-size: 0.85rem;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.upload-inline-btn:hover,
.upload-inline-btn:focus {
    background: #0B5345;
    color: #fff;
}

.upload-inline.dragover {
    background: rgba(11, 83, 69, 0.06);
    border-radius: 6px;
    outline: 1px dashed #0B5345;
    outline-offset: 2px;
}

/* 已上传图片列表 */
.uploaded-images {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.uploaded-image {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    width: 88px;
    height: 66px;
    flex: 0 0 auto;
}

.uploaded-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.uploaded-image .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    transition: all 0.3s ease;
}

.uploaded-image .remove-btn:hover {
    background: rgba(255, 0, 0, 1);
    transform: scale(1.1);
}

.uploaded-images-inline {
    margin-top: 8px;
    gap: 8px;
}

.uploaded-images-inline .uploaded-image {
    width: 64px;
    height: 48px;
}

.uploaded-images-inline .uploaded-image .remove-btn {
    width: 18px;
    height: 18px;
}

/* 生成按钮 */
.generate-btn {
    width: 100%;
    padding: 8px 32px;
    background: linear-gradient(45deg, #0B5345, #16A085);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(11, 83, 69, 0.3);
}

.generate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* 加载动画 */
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* 结果区域 */
.result-panel {
    gap: 16px;
}

.result-container {
    position: relative;
    background: linear-gradient(150deg, rgba(255, 255, 255, 0.96), rgba(239, 246, 255, 0.98));
    border-radius: 10px;
    padding: 28px 32px 32px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: 0;
    border: 1px solid rgba(148, 163, 184, 0.28);
    box-shadow: 0 40px 70px -40px rgba(15, 23, 42, 0.35);
    overflow: visible;
}

.result-header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.result-title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.result-title .time-info {
    padding: 5px 10px;
    font-size: 0.75rem;
}

.result-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
    white-space: nowrap;
}

.result-stage {
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 16px;
    background: rgba(15, 23, 42, 0.03);
    border-radius: 8px;
    width: 100%;
    text-align: left;
    overflow: visible;
}

.result-placeholder {
    color: #64748b;
    font-size: 0.95rem;
    text-align: center;
    width: 100%;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-placeholder-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.placeholder-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.placeholder-canvas {
    width: 100px;
    height: 100px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(11, 83, 69, 0.08) 0%, rgba(22, 160, 133, 0.12) 100%);
    border: 2px dashed rgba(11, 83, 69, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0B5345;
    opacity: 0.7;
}

.placeholder-dots {
    display: flex;
    align-items: center;
    gap: 6px;
}

.placeholder-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(11, 83, 69, 0.3);
}

.placeholder-dots span:nth-child(2) {
    width: 8px;
    height: 8px;
    background: rgba(11, 83, 69, 0.5);
}

.placeholder-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.placeholder-title {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    margin: 0;
}

.placeholder-desc {
    font-size: 0.85rem;
    color: #9ca3af;
    margin: 0;
}

.result-stage .result-content {
    width: 100%;
}

.result-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 28px;
    align-items: stretch;
}

.result-progress {
    position: relative;
    z-index: 1;
    display: none;
    flex-direction: column;
    gap: 16px;
    padding-top: 20px;
    margin-top: 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.4);
}

.result-progress.is-visible {
    display: flex;
}

.result-selection-bar {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    border-radius: 6px;
    background: rgba(13, 148, 136, 0.08);
    border: 1px solid rgba(13, 148, 136, 0.18);
}

.result-select-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #0b5345;
    cursor: pointer;
    user-select: none;
}

.result-select-all input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.result-selection-count {
    font-size: 0.9rem;
    color: rgba(15, 23, 42, 0.68);
}

/* 主结果顶部展示已移除，保留栅格展示 */

.result-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.result-grid-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #f4f6fb;
    border: none;
    box-shadow: 0 18px 32px -30px rgba(15, 23, 42, 0.4);
    aspect-ratio: 4 / 3;
    display: flex;
}

.result-grid-item::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 0 solid transparent;
    box-shadow: none;
    pointer-events: none;
    transition: border 0.18s ease, box-shadow 0.2s ease;
}

.result-grid-preview {
    flex: 1;
    border: none;
    padding: 0;
    margin: 0;
    background: #090b17;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    overflow: hidden;
    position: relative;
}

.result-grid-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.25s ease;
    background: transparent;
}

.result-card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    perspective: 1600px;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.result-card[data-status="failed"] {
    border-color: rgba(239, 68, 68, 0.65);
    background: rgba(254, 242, 242, 0.9);
}

.result-card.is-error .result-card-stream {
    display: flex !important;
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.result-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
}

.result-card.is-flipped .result-card-inner {
    transform: rotateY(180deg);
}

.result-card-face {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    backface-visibility: hidden;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.result-card-front {
    background: #f5f6fa;
}

.result-card-back {
    background: #f8fafc;
    transform: rotateY(180deg);
    padding: 16px;
    overflow-y: auto;
    gap: 12px;
    align-items: flex-start;
}

.result-card-stream {
    flex: 1;
    padding: 18px;
    overflow-y: auto;
    font-size: 0.78rem;
    line-height: 1.6;
    color: #0f172a;
    background: rgba(15, 23, 42, 0.05);
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.result-card-stream-line {
    white-space: pre-wrap;
    word-break: break-word;
    text-align: left;
}

.result-card-stream-message {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(15, 23, 42, 0.86);
    letter-spacing: 0.02em;
}

.result-card-stream-message .dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.55);
    animation: result-card-dot 1.2s infinite ease-in-out;
    transform-origin: center;
}

.result-card-stream-message .dot:nth-of-type(2) {
    animation-delay: 0.15s;
}

.result-card-stream-message .dot:nth-of-type(3) {
    animation-delay: 0.3s;
}

@keyframes result-card-dot {
    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.35;
    }

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

@media (prefers-reduced-motion: reduce) {
    .result-card-stream-message .dot {
        animation: none;
        opacity: 0.65;
    }
}

.result-card.is-streaming .result-card-stream {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    padding: 22px;
    border: none;
    background: rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(4px);
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.22);
}

.result-card.is-streaming .result-card-stream-line {
    font-size: 0.9rem;
    color: rgba(15, 23, 42, 0.86);
}

.result-card.is-streaming .result-grid-preview {
    opacity: 0;
    pointer-events: none;
}

.result-card:not(.is-streaming) .result-card-stream {
    display: none;
}

.result-card.is-ready .result-grid-preview {
    opacity: 1;
}

.result-card.is-video .result-grid-preview {
    cursor: pointer !important;
}

.result-card.is-video .result-grid-preview img {
    filter: brightness(0.88);
    cursor: pointer;
}

.result-card.is-video .result-grid-preview::after {
    content: '\25B6';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 44px;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 6px 18px rgba(15, 23, 42, 0.55);
    pointer-events: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.result-card.is-video .result-grid-preview:hover::after {
    transform: scale(1.06);
}


.result-card-toggle {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    background: rgba(15, 23, 42, 0.7);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.result-card-toggle:hover {
    background: rgba(15, 23, 42, 0.85);
    transform: translateY(-1px);
}

.result-card-toggle:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    transform: none;
}

.result-grid-item:not(.is-ready) .result-card-toggle {
    display: none;
}

.result-grid-item:not(.is-ready) .result-grid-select {
    display: none;
}

.result-card.is-streaming .result-card-toggle {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.result-card-text {
    font-size: 0.82rem;
    line-height: 1.6;
    color: #0f172a;
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}

.result-card-text p {
    margin: 0;
    text-align: left;
}

.result-card-text a {
    color: #0b5345;
    word-break: break-word;
}

.result-card-code {
    background: #0f172a;
    color: #e2e8f0;
    padding: 12px 14px;
    border-radius: 8px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: 0.82rem;
    overflow-x: auto;
}

.result-card-empty {
    color: #94a3b8;
    text-align: center;
    font-size: 0.85rem;
    padding: 24px 12px;
}

.result-grid-preview img:hover,
.result-grid-preview img:focus-visible {
    transform: scale(1.02);
}

.result-card.is-video .result-grid-preview img:hover,
.result-card.is-video .result-grid-preview img:focus-visible {
    transform: scale(1);
}

.result-grid-preview:focus-visible {
    outline: 3px solid rgba(13, 148, 136, 0.9);
    outline-offset: 6px;
}

.result-grid-select {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.6);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
    opacity: 0.2;
}

.result-grid-select:hover {
    background: rgba(15, 23, 42, 0.75);
    transform: translateY(-1px);
    opacity: 1;
}

.result-grid-checkbox {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid rgba(255, 255, 255, 0.75);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: white;
    font-size: 14px;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.result-grid-checkbox:checked {
    background: #16a085;
    border-color: #16a085;
}

.result-grid-checkbox:checked::after {
    content: '✓';
    line-height: 1;
}

.result-grid-item.selected {
    box-shadow: 0 26px 52px -26px rgba(22, 160, 133, 0.55);
}

.result-grid-item.is-ready .result-grid-select {
    opacity: 1;
}

.result-grid-item.selected::after {
    border-width: 2px;
    border-color: rgba(22, 160, 133, 0.8);
    box-shadow: 0 0 0 2px rgba(22, 160, 133, 0.45) inset;
}


.result-content img:focus-visible {
    outline: 3px solid rgba(13, 148, 136, 0.9);
    outline-offset: 4px;
}

.result-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.result-action-btn {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid rgba(15, 118, 110, 0.18);
    background: #f8fafc;
    color: #0f766e;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.result-action-btn.primary {
    background: linear-gradient(45deg, #0B5345, #16A085);
    color: #f8fafc;
    border-color: transparent;
    box-shadow: 0 8px 16px -14px rgba(13, 148, 136, 0.65);
}

.result-action-btn:hover {
    transform: translateY(-1px);
}

.result-action-btn:not(.primary):hover {
    background: rgba(13, 148, 136, 0.08);
    color: #0b5345;
}

.result-actions .result-selection-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #0f4c45;
    white-space: nowrap;
}

.result-actions .result-selection-bar .result-select-all {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.result-actions .result-selection-bar input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.result-text {
    position: relative;
    z-index: 1;
    padding: 18px 20px;
    background: rgba(15, 23, 42, 0.04);
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    backdrop-filter: blur(4px);
    color: #1e293b;
    line-height: 1.7;
    flex: 0 0 auto;
    max-height: clamp(160px, 32vh, 320px);
    overflow-y: auto;
    min-height: 0;
}

.result-text h4 {
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: #0f172a;
}

.result-text p {
    color: inherit;
}

.generation-hint {
    position: relative;
    z-index: 1;
    padding: 18px 20px;
    background: rgba(13, 148, 136, 0.08);
    border: 1px solid rgba(13, 148, 136, 0.24);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 14px;
    color: #0f766e;
    backdrop-filter: blur(3px);
    flex: 0 0 auto;
    max-height: clamp(160px, 32vh, 320px);
    overflow-y: auto;
    min-height: 0;
    font-size: 0.85rem;
}

.generation-hint>div:not(.hint-spinner) {
    flex: 1;
    min-width: 0;
}

.generation-hint .hint-sub {
    font-size: 0.75rem;
    color: #0d9488;
    margin: 4px 0 0;
    overflow-x: auto;
    padding-bottom: 4px;
}

.generation-hint .result-card-code {
    margin: 6px 0 0;
    max-width: 100%;
    box-sizing: border-box;
}

.hint-spinner {
    width: 22px;
    height: 22px;
    border: 2px solid rgba(13, 148, 136, 0.16);
    border-top: 2px solid #0d9488;
    border-radius: 999px;
    animation: spin 0.9s linear infinite;
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    padding: 24px 16px;
    overflow-y: auto;
}

.image-preview-modal {
    --preview-margin: clamp(32px, 6vh, 88px);
    --preview-gutter: clamp(18px, 3vw, 36px);
    padding: var(--preview-margin);
    overflow: hidden;
}


.modal-content {
    background: white;
    border-radius: 10px;
    width: min(520px, 100%);
    max-width: calc(100vw - 32px);
    max-height: min(90vh, 680px);
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    animation: modalShow 0.3s ease;
    display: flex;
    flex-direction: column;
}

@keyframes modalShow {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.close {
    font-size: 24px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #333;
}

.modal-body {
    padding: 25px;
    flex: 1 1 auto;
    overflow-y: auto;
}

.modal-body p {
    margin: 0;
    color: #555;
    line-height: 1.6;
}

.image-preview-content {
    width: min(100%, calc(100vw - (2 * var(--preview-margin))));
    max-height: max(0px, calc(100vh - (2 * var(--preview-margin))));
    padding: var(--preview-gutter);
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    color: #f8fafc;
    box-sizing: border-box;
    position: relative;
    overflow: visible;
    animation: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--preview-gutter);
}


.image-preview-body {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 0;
}

.image-preview-frame {
    width: 100%;
    max-width: max(0px, calc(100vw - (2 * var(--preview-margin)) - (2 * var(--preview-gutter))));
    max-height: max(0px, calc(100vh - (2 * var(--preview-margin)) - (2 * var(--preview-gutter))));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(12px, 2vw, 24px);
    background: rgba(15, 23, 42, 0.65);
    border-radius: 10px;
    box-shadow: 0 35px 60px rgba(15, 23, 42, 0.55);
    overflow: hidden;
}

.image-preview-frame img,
.image-preview-frame video {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 8px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.45);
}

.image-preview-frame video {
    background: #000;
}

.image-preview-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: none;
    background: rgba(15, 23, 42, 0.4);
    color: #f8fafc;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    z-index: 10;
}

.image-preview-nav:hover {
    background: rgba(248, 250, 252, 0.25);
    transform: translateY(-50%) scale(1.05);
}

.image-preview-nav:disabled,
.image-preview-nav[aria-disabled="true"] {
    background: rgba(15, 23, 42, 0.25);
    color: rgba(248, 250, 252, 0.45);
    cursor: default;
}

.image-preview-nav-prev {
    left: calc(var(--preview-gutter) / 2);
}

.image-preview-nav-next {
    right: calc(var(--preview-gutter) / 2);
}

.image-preview-nav.is-hidden {
    display: none;
}

.is-hidden {
    display: none !important;
}

.image-preview-indicator {
    display: none;
    margin-top: -8px;
    gap: 10px;
    align-items: center;
    justify-content: center;
    color: rgba(248, 250, 252, 0.65);
    font-size: 0.85rem;
    letter-spacing: 0.2em;
}

.preview-indicator-dot {
    font-size: 0.7rem;
    color: inherit;
    opacity: 0.45;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.preview-indicator-dot.is-active {
    opacity: 1;
    transform: scale(1.2);
}







.image-preview-close {
    position: absolute;
    top: calc(var(--preview-gutter) / 2);
    right: calc(var(--preview-gutter) / 2);
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: none;
    background: rgba(15, 23, 42, 0.4);
    color: #f8fafc;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.image-preview-close:hover {
    background: rgba(248, 250, 252, 0.25);
    transform: scale(1.05);
}

.notice-modal-content {
    max-width: 520px;
}

.notice-modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 0.95rem;
    color: #555;
}

.notice-modal-body p {
    margin: 0;
}

/* ============================================
   API设置弹窗专用样式
   ============================================ */

.settings-modal-content {
    width: min(440px, 100%);
    max-height: min(90vh, 700px);
}

.settings-modal-header {
    background: linear-gradient(135deg, #0B5345 0%, #16A085 100%);
    padding: 16px 20px;
    border-bottom: none;
    flex-shrink: 0;
}

.settings-modal-header h3 {
    color: white;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-modal-header h3 svg {
    flex-shrink: 0;
}

.settings-modal-header .close {
    color: rgba(255, 255, 255, 0.8);
}

.settings-modal-header .close:hover {
    color: white;
}

.settings-modal-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.settings-section {
    background: #f8f9fb;
    border-radius: 10px;
    border: 1px solid #e8ebef;
    overflow: hidden;
    flex-shrink: 0;
}

.settings-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: white;
    border-bottom: 1px solid #e8ebef;
}

.settings-section-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0B5345;
}

.settings-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
    flex: 1;
}

.settings-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    color: #6b7280;
}

.settings-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #0B5345;
    cursor: pointer;
}

.settings-toggle-label {
    user-select: none;
}

.settings-section-body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-row label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #475569;
}

.settings-row .settings-input {
    padding: 10px 14px;
}

.settings-input-group {
    display: flex;
    gap: 8px;
}

.settings-input-group .settings-input {
    flex: 1;
}

.settings-link-btn {
    padding: 9px 14px;
    background: transparent;
    color: #0B5345;
    border: 1px solid #0B5345;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.settings-link-btn:hover {
    background: #0B5345;
    color: white;
}

.settings-hint {
    margin: 0;
    font-size: 0.75rem;
    color: #9ca3af;
    line-height: 1.4;
}

.settings-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 16px;
    background: #f8f9fb;
    border-top: 1px solid #e8ebef;
    flex-shrink: 0;
}

.settings-btn-primary {
    padding: 9px 20px;
    background: linear-gradient(135deg, #0B5345 0%, #16A085 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(11, 83, 69, 0.3);
}

.settings-btn-secondary {
    padding: 9px 20px;
    background: white;
    color: #6b7280;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-btn-secondary:hover {
    background: #f3f4f6;
    color: #374151;
}

/* 翻译设置禁用状态 */
.settings-section-body.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* 移动端适配 */
@media (max-width: 480px) {
    .settings-modal-content {
        max-height: 90vh;
    }

    .settings-modal-header {
        padding: 14px 16px;
    }

    .settings-modal-header h3 {
        font-size: 0.95rem;
    }

    .settings-modal-body {
        padding: 12px;
        gap: 10px;
    }

    .settings-section-header {
        padding: 10px 12px;
    }

    .settings-section-body {
        padding: 10px 12px;
    }

    .settings-row .settings-input {
        padding: 8px 10px;
        font-size: 0.85rem;
    }

    .settings-modal-footer {
        padding: 12px;
    }

    .settings-btn-primary,
    .settings-btn-secondary {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}

/* ============================================
   Toast 气泡提示样式
   ============================================ */

.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    pointer-events: auto;
    animation: toastSlideIn 0.3s ease;
    max-width: 400px;
}

.toast.toast-success {
    background: linear-gradient(135deg, #0B5345 0%, #16A085 100%);
    color: white;
}

.toast.toast-error {
    background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
    color: white;
}

.toast.toast-info {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
}

.toast.toast-warning {
    background: linear-gradient(135deg, #d35400 0%, #f39c12 100%);
    color: white;
}

.toast-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    line-height: 1.4;
}

.toast.toast-exit {
    animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* 移动端 Toast 适配 */
@media (max-width: 480px) {
    .toast-container {
        top: 10px;
        left: 10px;
        right: 10px;
        transform: none;
    }

    .toast {
        padding: 10px 16px;
        font-size: 0.85rem;
        max-width: 100%;
        width: 100%;
    }
}

/* 响应式设计 */

/* 平板端 (769px - 1024px) */
@media (max-width: 1024px) {
    .main-grid {
        grid-template-columns: 280px 1fr 220px;
    }

    .control-panel,
    .result-panel,
    .gallery-panel {
        padding: 10px;
    }

    .result-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .control-header-compact {
        padding: 10px 12px;
    }

    .title-inline h1 {
        font-size: 0.95rem;
    }

    .title-desc {
        font-size: 0.65rem;
    }
}

/* 小平板/大手机 (481px - 768px) */
@media (max-width: 768px) {
    body {
        overflow: auto;
    }

    .container {
        height: auto;
        min-height: 100vh;
    }

    main {
        padding: 0;
    }

    .main-grid {
        grid-template-columns: 1fr;
        height: auto;
        min-height: auto;
        grid-template-areas:
            "control"
            "result"
            "gallery";
        gap: 0;
    }

    .control-panel {
        grid-area: control;
        order: 1;
        max-height: none;
        overflow: visible;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        padding: 0;
        background: transparent;
    }

    .control-panel-unified {
        border-radius: 0;
        border-left: none;
        border-right: none;
        max-height: none;
    }

    .control-content-scroll {
        max-height: none;
        overflow: visible;
        padding: 12px;
    }

    .control-header-compact {
        border-radius: 0;
    }

    .result-panel {
        grid-area: result;
        order: 2;
        max-height: none;
        overflow: visible;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        padding: 12px;
    }

    .gallery-panel {
        grid-area: gallery;
        order: 3;
        max-height: none;
        overflow: visible;
        padding: 12px;
    }

    .image-gallery {
        max-height: 280px;
        overflow-y: auto;
    }

    .result-container {
        padding: 16px;
        min-height: 200px;
        border-radius: 12px;
    }

    .result-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .result-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* 移动端参数布局优化 */
    .param-section {
        border-radius: 8px;
    }

    .param-grid {
        gap: 8px;
    }

    .param-cell {
        min-width: 80px;
    }

    .select-wrapper.mini .custom-select {
        padding: 6px 26px 6px 10px;
        font-size: 0.85rem;
    }

    .prompt-section textarea,
    .prompt-group textarea {
        min-height: 70px;
    }

    .control-footer {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

/* 手机端 (max-width: 480px) */
@media (max-width: 480px) {
    body {
        padding: 0;
    }

    .modal {
        padding: 12px 8px;
    }

    .main-grid {
        gap: 0;
    }

    .control-content-scroll {
        padding: 10px;
        gap: 6px;
    }

    .control-header-compact {
        padding: 12px;
    }

    .title-inline h1 {
        font-size: 0.9rem;
    }

    .title-desc {
        font-size: 0.65rem;
    }

    .title-badge {
        font-size: 0.55rem;
        padding: 2px 5px;
    }

    .control-settings-btn {
        padding: 5px;
    }

    .control-settings-btn svg {
        width: 16px;
        height: 16px;
    }

    .param-section {
        border-radius: 6px;
    }

    .param-section-header {
        padding: 10px 12px;
    }

    .param-section-title {
        font-size: 0.8rem;
        gap: 6px;
    }

    .param-section-title svg {
        width: 12px;
        height: 12px;
    }

    .param-section-body {
        padding: 10px 12px;
    }

    .param-grid {
        gap: 6px;
    }

    .param-cell {
        min-width: 70px;
    }

    .param-label-small {
        font-size: 0.7rem;
        margin-bottom: 3px;
    }

    .select-wrapper.mini .custom-select {
        padding: 5px 22px 5px 8px;
        font-size: 0.8rem;
    }

    .select-wrapper.mini .select-arrow {
        right: 6px;
    }

    .select-wrapper.mini .select-arrow svg {
        width: 9px;
        height: 9px;
    }

    .prompt-section textarea,
    .prompt-group textarea {
        min-height: 60px;
        font-size: 0.85rem;
        padding: 10px;
    }

    .upload-inline-btn.compact {
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    .upload-inline-btn.compact svg {
        width: 12px;
        height: 12px;
    }

    .upload-count {
        font-size: 0.75rem;
    }

    .uploaded-images-inline .uploaded-image {
        width: 50px;
        height: 38px;
    }

    .control-footer {
        padding: 10px 12px;
    }

    .control-footer .generate-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
        border-radius: 8px;
    }

    .result-panel {
        padding: 10px;
    }

    .result-container {
        padding: 14px;
        border-radius: 10px;
    }

    .result-header h3 {
        font-size: 0.9rem;
    }

    .result-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .result-action-btn {
        padding: 5px 10px;
        font-size: 0.75rem;
    }

    .gallery-panel {
        padding: 10px;
    }

    .gallery-header h3 {
        font-size: 0.9rem;
    }

    .gallery-btn {
        padding: 4px 10px;
        font-size: 0.75rem;
    }

    .image-gallery {
        max-height: 240px;
    }

    .gallery-notice {
        padding: 10px 12px;
        font-size: 0.8rem;
    }

    .modal-content {
        width: 100%;
        max-height: calc(100vh - 24px);
        border-radius: 12px;
    }

    .modal-header,
    .modal-body {
        padding: 14px;
    }

    .modal-header h3 {
        font-size: 1rem;
    }
}

/* 超小屏幕 (max-width: 360px) */
@media (max-width: 360px) {
    .title-inline h1 {
        font-size: 0.85rem;
    }

    .title-desc {
        font-size: 0.6rem;
    }

    .title-badge {
        font-size: 0.5rem;
        padding: 1px 4px;
    }

    .param-section-title {
        font-size: 0.75rem;
    }

    .param-cell {
        min-width: 60px;
    }

    .param-label-small {
        font-size: 0.65rem;
    }

    .select-wrapper.mini .custom-select {
        padding: 4px 18px 4px 6px;
        font-size: 0.75rem;
    }

    .control-footer .generate-btn {
        padding: 9px 14px;
        font-size: 0.85rem;
    }

    .result-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
}

@media (max-height: 640px) {
    .modal {
        align-items: flex-start;
        padding-top: 32px;
        padding-bottom: 32px;
    }
}

/* ============================================
   绘图信息面板样式
   ============================================ */

.drawing-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.drawing-info-header h3 {
    font-size: 0.95rem;
    color: #374151;
    font-weight: 500;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.drawing-info-content {
    flex: 1;
    overflow-y: auto;
    font-size: 0.85rem;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.drawing-info-content::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

.drawing-info-placeholder {
    text-align: center;
    color: #9ca3af;
    font-size: 0.85rem;
    padding: 24px 16px;
}

/* 信息行样式 */
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #f3f4f6;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: #6b7280;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.info-value {
    color: #374151;
    font-weight: 500;
    text-align: right;
    word-break: break-all;
}

.info-model {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 计费模式标签 */
.billing-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.billing-ppu {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.billing-ubp {
    background: rgba(59, 130, 246, 0.15);
    color: #2563eb;
}

/* 绘图信息顶部气泡标签 */
.info-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.info-meta-row-split {
    justify-content: space-between;
    align-items: center;
}

.info-meta-left,
.info-meta-right {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.info-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    background: #f3f4f6;
    color: #4b5563;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.info-tag-model {
    flex: 1;
    max-width: 100%;
}

.info-tag-time {
    flex: 1;
    max-width: 100%;
    font-family: 'Consolas', 'Monaco', monospace;
}

.info-tag.billing-ppu {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
}

.info-tag.billing-ubp {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

/* 信息分组 */
.info-group {
    margin-top: 12px;
}

.info-group-title {
    font-size: 0.75rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

/* 提示词展示 */
.info-prompt {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 0.8rem;
    color: #4b5563;
    line-height: 1.5;
    max-height: 80px;
    overflow-y: auto;
    word-break: break-word;
}

/* 参考图展示 */
.info-references {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.info-ref-thumb {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.info-ref-thumb:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.info-ref-count {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #6b7280;
}

/* ============================================
   绘图信息面板响应式
   ============================================ */

/* 平板端 (769px - 1024px) */
@media (max-width: 1024px) {
    .drawing-info-section {
        flex: 1 1 50%;
        min-height: 0;
    }

    .info-prompt {
        max-height: 60px;
    }
}

/* 小平板/大手机 (481px - 768px) */
@media (max-width: 768px) {
    .gallery-panel {
        gap: 10px;
    }

    .gallery-records-section {
        flex: 1 1 50%;
        min-height: 0;
    }

    .drawing-info-section {
        flex: 1 1 50%;
        min-height: 0;
    }

    .info-row {
        padding: 5px 0;
    }

    .info-group {
        margin-top: 10px;
        padding-top: 10px;
    }

    .info-params {
        gap: 6px;
    }

    .info-param {
        padding: 3px 8px;
        font-size: 0.75rem;
    }
}

/* 手机端 (max-width: 480px) */
@media (max-width: 480px) {
    .drawing-info-section {
        flex: 1 1 50%;
        min-height: 0;
    }

    .drawing-info-header h3 {
        font-size: 0.9rem;
    }

    .info-label,
    .info-value {
        font-size: 0.75rem;
    }

    .info-prompt {
        max-height: 50px;
        padding: 8px 10px;
    }

    .info-ref-thumb,
    .info-ref-count {
        width: 40px;
        height: 40px;
    }
}

/* ============================================
   高度响应式设计 - 小高度屏幕优化
   ============================================ */

/* 中等高度屏幕 (800px 以下) */
@media (max-height: 800px) {
    .control-panel {
        padding: 8px;
    }

    .control-header-compact {
        padding: 10px 12px;
    }

    .title-inline h1 {
        font-size: 0.95rem;
    }

    .title-desc {
        font-size: 0.65rem;
    }

    .control-content-scroll {
        padding: 8px;
        gap: 6px;
    }

    .billing-mode-section {
        margin-bottom: 8px;
    }

    .billing-mode-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .param-section-header {
        padding: 8px 10px;
    }

    .param-section-title {
        font-size: 0.8rem;
    }

    .param-section-body {
        padding: 8px 10px;
        gap: 6px;
    }

    .param-label-small {
        font-size: 0.7rem;
        margin-bottom: 2px;
    }

    .select-wrapper.mini .custom-select {
        padding: 5px 26px 5px 8px;
        font-size: 0.8rem;
    }

    .prompt-group textarea {
        min-height: 60px;
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    .param-group + .param-group {
        padding-top: 6px;
    }

    .param-unified-body {
        gap: 8px;
    }

    .control-footer {
        padding: 10px 12px;
    }

    .control-footer .generate-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
}

/* 小高度屏幕 (700px 以下) */
@media (max-height: 700px) {
    .control-panel {
        padding: 6px;
    }

    .control-header-compact {
        padding: 8px 10px;
    }

    .title-inline h1 {
        font-size: 0.9rem;
    }

    .title-desc {
        font-size: 0.6rem;
        line-height: 1.2;
    }

    .title-badge {
        font-size: 0.55rem;
        padding: 2px 4px;
    }

    .control-content-scroll {
        padding: 6px;
        gap: 5px;
    }

    .billing-mode-section {
        margin-bottom: 6px;
    }

    .billing-mode-toggle {
        padding: 3px;
        gap: 3px;
    }

    .billing-mode-btn {
        padding: 5px 8px;
        font-size: 0.75rem;
        gap: 4px;
    }

    .billing-mode-icon svg {
        width: 12px;
        height: 12px;
    }

    .param-section {
        border-radius: 6px;
    }

    .param-section-header {
        padding: 6px 8px;
    }

    .param-section-title {
        font-size: 0.75rem;
        gap: 6px;
    }

    .param-section-title svg {
        width: 12px;
        height: 12px;
    }

    .collapse-icon {
        font-size: 0.65rem;
    }

    .param-section-body {
        padding: 6px 8px;
        gap: 5px;
    }

    .param-grid {
        gap: 5px;
    }

    .param-cell {
        min-width: 65px;
    }

    .param-label-small {
        font-size: 0.65rem;
        margin-bottom: 2px;
    }

    .select-wrapper.mini {
        border-width: 1.5px;
    }

    .select-wrapper.mini .custom-select {
        padding: 4px 22px 4px 6px;
        font-size: 0.75rem;
    }

    .select-wrapper.mini .select-arrow {
        right: 6px;
    }

    .select-wrapper.mini .select-arrow svg {
        width: 8px;
        height: 8px;
    }

    .prompt-group textarea {
        min-height: 50px;
        padding: 6px 8px;
        font-size: 0.75rem;
    }

    .param-group + .param-group {
        padding-top: 5px;
    }

    .param-unified-body {
        gap: 6px;
    }

    .upload-inline-btn.compact {
        padding: 4px 8px;
        font-size: 0.7rem;
    }

    .upload-inline-btn.compact svg {
        width: 11px;
        height: 11px;
    }

    .uploaded-images-inline .uploaded-image {
        width: 42px;
        height: 32px;
    }

    .control-footer {
        padding: 8px 10px;
    }

    .control-footer .generate-btn {
        padding: 7px 14px;
        font-size: 0.85rem;
        border-radius: 6px;
    }
}

/* 极小高度屏幕 (600px 以下) */
@media (max-height: 600px) {
    .control-panel {
        padding: 4px;
    }

    .control-header-compact {
        padding: 6px 8px;
    }

    .title-inline h1 {
        font-size: 0.85rem;
    }

    .title-desc {
        display: none;
    }

    .control-content-scroll {
        padding: 5px;
        gap: 4px;
    }

    .billing-mode-section {
        margin-bottom: 4px;
    }

    .billing-mode-btn {
        padding: 4px 6px;
        font-size: 0.7rem;
    }

    .param-section-header {
        padding: 5px 6px;
    }

    .param-section-title {
        font-size: 0.7rem;
        gap: 5px;
    }

    .param-section-body {
        padding: 5px 6px;
        gap: 4px;
    }

    .param-grid {
        gap: 4px;
    }

    .param-label-small {
        font-size: 0.6rem;
    }

    .select-wrapper.mini .custom-select {
        padding: 3px 20px 3px 5px;
        font-size: 0.7rem;
    }

    .prompt-group textarea {
        min-height: 40px;
        padding: 5px 6px;
        font-size: 0.7rem;
    }

    .param-group + .param-group {
        padding-top: 4px;
    }

    .param-unified-body {
        gap: 5px;
    }

    .control-footer {
        padding: 6px 8px;
    }

    .control-footer .generate-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

/* 高度和宽度组合响应式 - 小屏幕笔记本 */
@media (max-height: 750px) and (max-width: 1400px) {
    .main-grid {
        grid-template-columns: 300px 1fr 300px;
    }
}

@media (max-height: 650px) and (max-width: 1400px) {
    .main-grid {
        grid-template-columns: 280px 1fr 280px;
    }
}

/* 默认折叠部分区域以节省空间 - 通过 JS 控制更佳 */
@media (max-height: 650px) {
    /* 视频参数区域默认更紧凑 */
    .video-params-section .param-section-body {
        padding: 4px 6px;
    }
}

/* ============================================
   右侧面板高度响应式优化
   ============================================ */

/* 中等高度屏幕 (800px 以下) - 右侧面板 */
@media (max-height: 800px) {
    .result-panel,
    .gallery-panel {
        padding: 12px;
    }

    .gallery-panel {
        gap: 10px;
    }

    .result-container {
        padding: 12px;
    }

    .result-grid {
        gap: 12px;
    }

    .gallery-records-section {
        flex: 1 1 50%;
        min-height: 0;
    }

    .gallery-records-section,
    .drawing-info-section {
        min-height: 0;
    }

    .drawing-info-section {
        flex: 1 1 50%;
    }

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

    .gallery-header h3 {
        font-size: 0.9rem;
    }

    .panel-header h2 {
        font-size: 0.95rem;
    }

    .image-gallery {
        gap: 8px;
    }

    .gallery-item {
        aspect-ratio: 4 / 1;
    }
}

/* 小高度屏幕 (700px 以下) - 右侧面板 */
@media (max-height: 700px) {
    .result-panel,
    .gallery-panel {
        padding: 10px;
    }

    .gallery-panel {
        gap: 8px;
    }

    .result-container {
        padding: 10px;
    }

    .result-grid {
        gap: 10px;
    }

    .gallery-records-section {
        flex: 1 1 50%;
        min-height: 0;
    }

    .drawing-info-section {
        flex: 1 1 50%;
        min-height: 0;
    }

    .gallery-header {
        margin-bottom: 6px;
    }

    .gallery-header h3 {
        font-size: 0.85rem;
    }

    .gallery-btn {
        padding: 3px 8px;
        font-size: 0.75rem;
    }

    .drawing-info-header h3 {
        font-size: 0.85rem;
    }

    .info-content {
        padding: 8px;
    }

    .info-row {
        padding: 4px 0;
    }

    .info-label,
    .info-value {
        font-size: 0.75rem;
    }

    .info-prompt {
        max-height: 45px;
        padding: 6px 8px;
        font-size: 0.75rem;
    }

    .panel-header h2 {
        font-size: 0.9rem;
    }

    .gallery-item {
        aspect-ratio: 4 / 1;
    }

    .info-params {
        gap: 4px;
    }

    .info-param {
        padding: 2px 6px;
        font-size: 0.7rem;
    }
}

/* 极小高度屏幕 (600px 以下) - 右侧面板 */
@media (max-height: 600px) {
    .result-panel,
    .gallery-panel {
        padding: 8px;
    }

    .gallery-panel {
        gap: 6px;
    }

    .result-container {
        padding: 8px;
        min-height: 150px;
    }

    .result-grid {
        gap: 8px;
    }

    .gallery-records-section {
        flex: 1 1 50%;
        min-height: 0;
    }

    .drawing-info-section {
        flex: 1 1 50%;
        min-height: 0;
    }

    .gallery-header {
        margin-bottom: 4px;
    }

    .gallery-header h3 {
        font-size: 0.8rem;
    }

    .gallery-btn {
        padding: 2px 6px;
        font-size: 0.7rem;
    }

    .drawing-info-header {
        padding: 6px 10px;
    }

    .drawing-info-header h3 {
        font-size: 0.8rem;
    }

    .info-content {
        padding: 6px;
    }

    .info-prompt {
        max-height: 35px;
        padding: 5px 6px;
        font-size: 0.7rem;
    }

    .panel-header {
        padding-bottom: 8px;
        margin-bottom: 8px;
    }

    .panel-header h2 {
        font-size: 0.85rem;
    }

    .gallery-item {
        aspect-ratio: 4 / 1;
    }

    .info-ref-thumb,
    .info-ref-count {
        width: 35px;
        height: 35px;
    }
}

/* ============================================
   自定义下拉菜单组件
   ============================================ */

/* 自定义下拉容器 */
.custom-dropdown {
    position: relative;
    width: 100%;
}

/* 下拉触发器（显示选中值的区域） */
.custom-dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 12px;
    padding-right: 36px;
    font-size: 0.92rem;
    font-weight: 500;
    color: #1e293b;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    user-select: none;
    letter-spacing: -0.01em;
}

.custom-dropdown-trigger:hover {
    border-color: #cbd5e1;
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.custom-dropdown.open .custom-dropdown-trigger {
    border-color: #0B5345;
    box-shadow: 0 0 0 3px rgba(11, 83, 69, 0.12), 0 2px 4px rgba(0, 0, 0, 0.06);
    background: linear-gradient(180deg, #ffffff 0%, #f0fdf9 100%);
}

/* 下拉箭头 */
.custom-dropdown-arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.custom-dropdown-trigger:hover .custom-dropdown-arrow {
    color: #475569;
}

.custom-dropdown.open .custom-dropdown-arrow {
    color: #0B5345;
    transform: translateY(-50%) rotate(180deg);
}

/* 下拉选项列表容器 */
.custom-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.15),
                0 4px 12px -2px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.98);
    transform-origin: top center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.custom-dropdown.open .custom-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* 下拉菜单滚动条美化 */
.custom-dropdown-menu::-webkit-scrollbar {
    width: 6px;
}

.custom-dropdown-menu::-webkit-scrollbar-track {
    background: transparent;
    margin: 6px 0;
}

.custom-dropdown-menu::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.custom-dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 选项样式 */
.custom-dropdown-option {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    border-bottom: 1px solid #f1f5f9;
}

.custom-dropdown-option:last-child {
    border-bottom: none;
}

.custom-dropdown-option:hover {
    background: linear-gradient(90deg, rgba(11, 83, 69, 0.08), rgba(11, 83, 69, 0.02));
    color: #0B5345;
}

.custom-dropdown-option.selected {
    background: linear-gradient(90deg, rgba(11, 83, 69, 0.12), rgba(11, 83, 69, 0.04));
    color: #0B5345;
    font-weight: 600;
}

.custom-dropdown-option.selected::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #0B5345;
    border-radius: 0 2px 2px 0;
}

/* 选项选中图标 */
.custom-dropdown-option .check-icon {
    margin-left: auto;
    opacity: 0;
    color: #0B5345;
    transition: opacity 0.15s ease;
}

.custom-dropdown-option.selected .check-icon {
    opacity: 1;
}

/* 禁用选项 */
.custom-dropdown-option.disabled {
    color: #94a3b8;
    cursor: not-allowed;
    background: #f8fafc;
}

.custom-dropdown-option.disabled:hover {
    background: #f8fafc;
    color: #94a3b8;
}

/* 紧凑版本 */
.custom-dropdown.compact .custom-dropdown-trigger {
    padding: 7px 10px;
    padding-right: 28px;
    font-size: 0.85rem;
}

.custom-dropdown.compact .custom-dropdown-arrow {
    right: 8px;
}

.custom-dropdown.compact .custom-dropdown-arrow svg {
    width: 9px;
    height: 9px;
}

.custom-dropdown.compact .custom-dropdown-menu {
    max-height: 220px;
}

.custom-dropdown.compact .custom-dropdown-option {
    padding: 8px 12px;
    font-size: 0.85rem;
}

/* mini版本 */
.custom-dropdown.mini .custom-dropdown-trigger {
    padding: 7px 10px;
    padding-right: 28px;
    font-size: 0.85rem;
    border-radius: 6px;
}

.custom-dropdown.mini .custom-dropdown-arrow {
    right: 8px;
}

.custom-dropdown.mini .custom-dropdown-arrow svg {
    width: 9px;
    height: 9px;
}

.custom-dropdown.mini .custom-dropdown-menu {
    max-height: 200px;
    border-radius: 8px;
}

.custom-dropdown.mini .custom-dropdown-option {
    padding: 8px 12px;
    font-size: 0.85rem;
}

/* 响应式调整 */
@media (max-width: 480px) {
    .custom-dropdown-trigger {
        padding: 8px 10px;
        padding-right: 30px;
        font-size: 0.85rem;
    }

    .custom-dropdown-option {
        padding: 9px 12px;
        font-size: 0.85rem;
    }

    .custom-dropdown.mini .custom-dropdown-trigger,
    .custom-dropdown.compact .custom-dropdown-trigger {
        padding: 6px 8px;
        padding-right: 24px;
        font-size: 0.8rem;
    }

    .custom-dropdown.mini .custom-dropdown-option,
    .custom-dropdown.compact .custom-dropdown-option {
        padding: 7px 10px;
        font-size: 0.8rem;
    }
}

/* ===== 右侧任务列表样式 ===== */
.gallery-item.active-task {
    border: 2px solid #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.task-progress-info {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(59, 130, 246, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    z-index: 2;
}

.task-cancel-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: rgba(220, 38, 38, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 0;
    font-weight: bold;
    transition: all 0.2s;
    z-index: 3;
    padding: 0;
}

.task-cancel-btn:hover {
    background: rgba(220, 38, 38, 1);
    transform: scale(1.1);
}


